- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

Defines | Functions | Variables
csl_mmcsd_ataIf.c File Reference

Functional layer API source file for MMCSD ATA file system interface. More...

`#include "csl_mmcsd.h"`
`#include "csl_mmcsd_ataIf.h"`

## Defines
#define | ENABLE_CACHE 1
## Functions
AtaError | MMC_initState (AtaState *pDrive)
AtaError | MMC_readWriteControl (AtaSector phySector, void *pAtaMediaState, AtaUint16 *pWord, int last_sector)
AtaError | MMC_issueReadCommand (AtaSector phySector, void *pAtaMediaState, AtaUint16 sectorCount)
AtaError | MMC_readNextWord (void *pAtaMediaState, AtaUint16 *pWord)
AtaError | MMC_readNextWord1 (void *pAtaMediaState, AtaUint16 *pWord, AtaUint16 word_delta)
AtaError | MMC_readNextNWords (void *pAtaMediaState, AtaUint16 *pData, AtaUint16 words)
AtaError | MMC_writeSector (AtaSector phySector, void *pAtaMediaState, AtaUint16 *pWord, int byteSwap)
AtaError | MMC_readNSectors (void *pAtaMediaState, AtaUint16 *pReadBuf, AtaSector startSector, AtaUint16 sectorCount)
AtaError | MMC_writeNSectors (void *pAtaMediaState, AtaUint16 *pWriteBuf, AtaSector startSector, AtaUint16 sectorCount)
AtaError | MMC_read_CID (void *pAtaMediaState, unsigned int *pBuf)
AtaError | MMC_read_CSD (void *pAtaMediaState, unsigned int *pBuf)
AtaError | MMC_writeSectorFlush (void *pAtaMediaState)
int | MMC_commandReadyStatusCheck (void *pAtaMediaState)
AtaError | MMC_dataReadyStatusCheck (void *pAtaMediaState)
AtaError | MMC_busyStatusCheck (void *pAtaMediaState)
AtaUint16 | MMC_getSerialID (void *pAtaMediaState, AtaSerialID *pSerID)
AtaUint16 | MMC_file_system_format (void *pAtaMediaState)
AtaError | MMC_reset (void *pAtaMediaState)
AtaUint16 | MMC_get_time (void)
AtaUint16 | MMC_get_mod_time (void)
AtaUint16 | MMC_get_date (void)
AtaUint16 | MMC_get_mod_date (void)
AtaError | MMC_flushFat (void *pAtaMediaState)
static AtaError | getAtaErrorNo (CSL_Status result)
## Variables
Uint16 | gReadBuf [CSL_MMCSD_PAGE_SIZE/2] = {0xbb,}
Uint16 | gWordCount = 256
AtaSector | gNextPhySector = 0
Uint16 | gWriteBuf [2 *CSL_MMCSD_PAGE_SIZE]
AtaSector | cached_phySector0
AtaSector | cached_phySector1
AtaSector | cached_phySector2
AtaSector | cached_phySector3
AtaUint16 | nbuf_cached = 0

## Detailed Description

Functional layer API source file for MMCSD ATA file system interface.

Path: \(CSLPATH)\ src

## Function Documentation

static AtaError getAtaErrorNo | ( | CSL_Status | result | ) | `[static]`

===========================================================================
getAtaErrorNo

Description
This function checks the return value send by the MMCSD CSL module and returns the corresponding error value to the ATA File system. This function is called in case of any error occurred

Arguments

                result    Result returned by the CSL MMCSD module

Return Value AtaError

- ATA_ERROR_INVALID_PARAM - Returned for Invalid input parameters
- ATA_ERROR_TIMEOUT - Time out Error Occurred
- ATA_ERROR_UNSUPPORTED - MMC/SD hardware is not supported

Pre Condition
None

Post Condition
Returns ATA Error codes

Modifies
None

Example

                CSL_Status    result;
                AtaError      ataErr;

                result = MMC_init();

                ataErr = getAtaErrorNo(result);

===========================================================================

Referenced by MMC_issueReadCommand(), MMC_readNSectors(), MMC_writeNSectors(), and MMC_writeSector().

AtaError MMC_readWriteControl | ( | AtaSector | phySector,
|  | void * | pAtaMediaState,
|  | AtaUint16 * | pWord,
|  | int | last_sector
| ) |  |

===========================================================================
MMC_readWriteControl //KR041110

Description
This function is used to cache and write data to the media. This function can write 1 to 4 sectors each sector containing 512 bytes

Arguments

                phySector         Sector number from which data needs to be read
                pAtaMediaState    ATA media state structure
                pWord             Write data buffer
                last_sector       Flag to flush cache

Return Value AtaError

- ATA_ERROR_NONE - Returned for success
- ATA_ERROR_INVALID_PARAM - Returned for Invalid input parameters
- ATA_ERROR_TIMEOUT - Time out Error Occurred
- ATA_ERROR_UNSUPPORTED - MMC/SD hardware is not supported

Pre Condition
MMC_initState API should be called successfully.

Post Condition
Writes Data to MMC/SD card

Modifies
MMCSD Sector data

Example

     			#define CSL_MMCSD_BUF_SIZE (256u)

    			AtaMMCState    ataMediaState;
    			AtaState       ataState;
    			AtaState       *pAtaState;
    			AtaError       ataErr;
    			AtaSector      phySector;
    			AtaUint16      writeBuf[CSL_MMCSD_BUF_SIZE];

    			pAtaState = &ataState;

    			phySector = 0;
    			ataState->pAtaMediaState = &ataMediaState;

    			ataErr = MMC_initState(&ataState);

                ataErr = pAtaState->AtaWriteSector(phySector,
                                                   ataState->pAtaMediaState,
                                                   writeBuf, FALSE);

===========================================================================

References CSL_MMCSD_PAGE_SIZE, MMC_writeNSectors(), and MMC_writeSector().

Referenced by MMC_initState().