Main Page | Modules | Namespace List | Data Structures | Directories | File List | Namespace Members | Data Fields | Globals

Storage Devices


Data Structures

struct  T_SD_SPEC
struct  T_SD_INSTANCE

Compact Flash (CF) and Integrated Drive Electronics (IDE) support

#define ERR_TIMEOUT   ERR_GENERIC + 10
 response timeout
#define ERR_CORRECTED   ERR_GENERIC + 20
#define ERR_WRITE_FAULT   ERR_GENERIC + 30
typedef unsigned long T_IDE_HANDLE
 handle for ide devices
T_IDE_HANDLE ide_open (T_ADDRESS pa_nSlotBaseAddress, unsigned short pa_nAddressShift, bool pa_bAsMaster, T_GPIO_MASK pa_gpioResetFlag, T_GPIO_MASK pa_gpioIntReq)
void ide_close (T_IDE_HANDLE pa_hIDE)
T_ERROR_CODE ide_readSingleBlock (T_IDE_HANDLE pa_hIDE, T_ADDRESS pa_nBlockAddr, unsigned char *pa_cData)
T_ERROR_CODE ide_readMultipleBlocks (T_IDE_HANDLE pa_hIDE, T_ADDRESS pa_nStartBlockAddr, unsigned long pa_nBlockCount, unsigned char *pa_cData)
T_ERROR_CODE ide_writeSingleBlock (T_IDE_HANDLE pa_hIDE, T_ADDRESS pa_nBlockAddr, unsigned char *pa_cData)
T_ERROR_CODE ide_writeMultipleBlocks (T_IDE_HANDLE pa_hIDE, T_ADDRESS pa_nStartBlockAddr, unsigned long pa_nBlockCount, unsigned char *pa_cData)

Secure Digital Card (SD)

#define SD_SPI_MODE   0
#define SD_1BIT_MODE   1
 Currently not supported.
#define SD_4BIT_MODE   2
 Currently not supported.
#define SD_RESPONSE_TIMEOUT   2500
#define SD_NR_OF_SETUP_ATTEMPS   3
#define SD_RESET_TIMEOUT   150
#define SD_EXCL_ACCESS_TIMOUT   2000
#define SD_GO_IDLE_STATE   ((BYTE)0)
#define SD_SEND_OP_COND   ((BYTE)1)
#define SD_ALL_SEND_CID   ((BYTE)2)
#define SD_SET_RELATIVE_ADDRESS   ((BYTE)3)
#define SD_SET_DSR   ((BYTE)4)
#define SD_SELECT_CARD   ((BYTE)7)
#define SD_SEND_CSD   ((BYTE)9)
#define SD_SEND_CID   ((BYTE)10)
#define SD_READ_DATA_UNTIL_STOP   ((BYTE)11)
#define SD_STOP_TRANSMISSION   ((BYTE)12)
#define SD_SEND_STATUS   ((BYTE)13)
#define SD_GO_INACTIVE_STATE   ((BYTE)15)
#define SD_SET_BLOCK_LEN   ((BYTE)16)
#define SD_READ_SINGLE_BLOCK   ((BYTE)17)
#define SD_WRITE_DATA_UNTIL_STOP   ((BYTE)20)
#define SD_WRITE_SINGLE_BLOCK   ((BYTE)24)
#define SD_PROGRAM_CSD   ((BYTE)27)
#define SD_TAG_SECTOR_START   ((BYTE)32)
#define SD_TAG_SECTOR_END   ((BYTE)33)
#define SD_UNTAG_SECTOR   ((BYTE)34)
#define SD_TAG_ERASE_GRP_START   ((BYTE)35)
#define SD_TAG_ERASE_GRP_END   ((BYTE)36)
#define SD_UNTAG_ERASE_GRP   ((BYTE)37)
#define SD_ERASE   ((BYTE)38)
#define SD_APP_CMD   ((BYTE)55)
#define SD_OCR_INIT   ((DWORD)0x80100000)
#define SD_BUSY_OCR   ((BYTE)0x80)
#define SD_STBY_STATE_MSK   ((DWORD)0x01D81E00)
#define SD_STBY_STATE   ((DWORD)0x00000600)
#define SD_DATA_STATE_MSK   ((DWORD)0xE0040E00)
#define SD_DATA_STATE   ((DWORD)0x00000A00)
#define SD_RCV_STATE_MSK   ((DWORD)0xE0020E00)
#define SD_RCV_STATE   ((DWORD)0x00000A00)
#define SD_TRAN_STATE_MSK   ((DWORD)0xE0020E00)
#define SD_TRAN_STATE   ((DWORD)0x00000800)
#define SD_CRC_ERROR   1
#define SD_ILLEGAL_COMMAND   3
#define SD_PARAMETER_ERROR   4
#define SD_ADDRESS_ERROR   5
#define SD_ERASE_SEQ_ERROR   6
#define SD_IDLE_STATE   7
#define SD_CARD_BUSY   8
#define SD_INVALID_RESPONSE   127
#define SD_NOT_USED   0xffff
#define SD_CD_PIN0   PF8
#define SD_CD_PIN1   SD_NOT_USED
#define SD_CD_PIN2   SD_NOT_USED
#define SD_CD_PIN3   SD_NOT_USED
#define SD_CD_PIN4   SD_NOT_USED
#define SD_CD_PIN5   SD_NOT_USED
#define SD_CD_PIN6   SD_NOT_USED
typedef unsigned long T_SD_HANDLE
 handle for sd slot
void sd_init (void)
void sd_cleanup (void)
T_SD_HANDLE sd_open (unsigned char pa_cSlot)
void sd_close (T_SD_HANDLE pa_hSDcard)
char sd_writeSingleBlock (T_SD_HANDLE pa_hSDcard, unsigned long pa_nBlockAddress, unsigned char *pa_cData)
char sd_readSingleBlock (T_SD_HANDLE pa_hSDcard, unsigned long pa_nBlockAddress, unsigned char *pa_cData)
char sd_readCardInfo (T_SD_HANDLE pa_hSDcard, unsigned char *cProductName, unsigned char *cManufactID, unsigned char *cApplicationID, unsigned char *cProductRev, unsigned long *nSerialNr, unsigned char *cManuMonth, unsigned short *nManuYear)

Detailed Description

contains storage device driver

Define Documentation

#define ERR_CORRECTED   ERR_GENERIC + 20
 

#define ERR_TIMEOUT   ERR_GENERIC + 10
 

response timeout

#define ERR_WRITE_FAULT   ERR_GENERIC + 30
 

#define SD_1BIT_MODE   1
 

Currently not supported.

#define SD_4BIT_MODE   2
 

Currently not supported.

#define SD_ADDRESS_ERROR   5
 

#define SD_ALL_SEND_CID   ((BYTE)2)
 

#define SD_APP_CMD   ((BYTE)55)
 

#define SD_BUSY_OCR   ((BYTE)0x80)
 

#define SD_CARD_BUSY   8
 

#define SD_CD_PIN0   PF8
 

#define SD_CD_PIN1   SD_NOT_USED
 

#define SD_CD_PIN2   SD_NOT_USED
 

#define SD_CD_PIN3   SD_NOT_USED
 

#define SD_CD_PIN4   SD_NOT_USED
 

#define SD_CD_PIN5   SD_NOT_USED
 

#define SD_CD_PIN6   SD_NOT_USED
 

#define SD_CRC_ERROR   1
 

#define SD_DATA_STATE   ((DWORD)0x00000A00)
 

#define SD_DATA_STATE_MSK   ((DWORD)0xE0040E00)
 

#define SD_ERASE   ((BYTE)38)
 

#define SD_ERASE_SEQ_ERROR   6
 

#define SD_EXCL_ACCESS_TIMOUT   2000
 

#define SD_GO_IDLE_STATE   ((BYTE)0)
 

#define SD_GO_INACTIVE_STATE   ((BYTE)15)
 

#define SD_IDLE_STATE   7
 

#define SD_ILLEGAL_COMMAND   3
 

#define SD_INVALID_RESPONSE   127
 

#define SD_NOT_USED   0xffff
 

#define SD_NR_OF_SETUP_ATTEMPS   3
 

#define SD_OCR_INIT   ((DWORD)0x80100000)
 

#define SD_PARAMETER_ERROR   4
 

#define SD_PROGRAM_CSD   ((BYTE)27)
 

#define SD_RCV_STATE   ((DWORD)0x00000A00)
 

#define SD_RCV_STATE_MSK   ((DWORD)0xE0020E00)
 

#define SD_READ_DATA_UNTIL_STOP   ((BYTE)11)
 

#define SD_READ_SINGLE_BLOCK   ((BYTE)17)
 

#define SD_RESET_TIMEOUT   150
 

#define SD_RESPONSE_TIMEOUT   2500
 

#define SD_SELECT_CARD   ((BYTE)7)
 

#define SD_SEND_CID   ((BYTE)10)
 

#define SD_SEND_CSD   ((BYTE)9)
 

#define SD_SEND_OP_COND   ((BYTE)1)
 

#define SD_SEND_STATUS   ((BYTE)13)
 

#define SD_SET_BLOCK_LEN   ((BYTE)16)
 

#define SD_SET_DSR   ((BYTE)4)
 

#define SD_SET_RELATIVE_ADDRESS   ((BYTE)3)
 

#define SD_SPI_MODE   0
 

#define SD_STBY_STATE   ((DWORD)0x00000600)
 

#define SD_STBY_STATE_MSK   ((DWORD)0x01D81E00)
 

#define SD_STOP_TRANSMISSION   ((BYTE)12)
 

#define SD_TAG_ERASE_GRP_END   ((BYTE)36)
 

#define SD_TAG_ERASE_GRP_START   ((BYTE)35)
 

#define SD_TAG_SECTOR_END   ((BYTE)33)
 

#define SD_TAG_SECTOR_START   ((BYTE)32)
 

#define SD_TRAN_STATE   ((DWORD)0x00000800)
 

#define SD_TRAN_STATE_MSK   ((DWORD)0xE0020E00)
 

#define SD_UNTAG_ERASE_GRP   ((BYTE)37)
 

#define SD_UNTAG_SECTOR   ((BYTE)34)
 

#define SD_WRITE_DATA_UNTIL_STOP   ((BYTE)20)
 

#define SD_WRITE_SINGLE_BLOCK   ((BYTE)24)
 


Typedef Documentation

typedef unsigned long T_IDE_HANDLE
 

handle for ide devices

typedef unsigned long T_SD_HANDLE
 

handle for sd slot


Function Documentation

void ide_close T_IDE_HANDLE  pa_hIDE  ) 
 

Parameters:
pa_hIDE handle for the ide device
closes ide device and frees resources.

T_IDE_HANDLE ide_open T_ADDRESS  pa_nSlotBaseAddress,
unsigned short  pa_nAddressShift,
bool  pa_bAsMaster,
T_GPIO_MASK  pa_gpioResetFlag,
T_GPIO_MASK  pa_gpioIntReq
 

Parameters:
pa_nSlotBaseAddress base address of IDE device
pa_nAddressShift depents on connected address signals
pa_bAsMaster true if device is master
pa_gpioResetFlag gpio pin connected to reset signal of device
pa_gpioIntReq gpio pin connected to irq signal of device
Returns:
handle for ide device
opens ide compatible device or cf card in true ide mode on selected base address.

See also:
ide_close

T_ERROR_CODE ide_readMultipleBlocks T_IDE_HANDLE  pa_hIDE,
T_ADDRESS  pa_nStartBlockAddr,
unsigned long  pa_nBlockCount,
unsigned char *  pa_cData
 

Parameters:
pa_hIDE handle to the ide device
pa_nStartBlockAddr blockaddress of the first block to read from
pa_nBlockCount number of consecutive blocks to read
pa_cData pointer to the buffer to read into
Returns:
on success ERR_NONE, otherwise appropriate error code
reads multiple consecutive blocks from the ide device.

T_ERROR_CODE ide_readSingleBlock T_IDE_HANDLE  pa_hIDE,
T_ADDRESS  pa_nBlockAddr,
unsigned char *  pa_cData
 

Parameters:
pa_hIDE handle to the ide device
pa_nBlockAddr blockaddress to read from
pa_cData pointer to the buffer to read into
Returns:
on success ERR_NONE, otherwise appropriate error code
reads a single block from the ide device.

T_ERROR_CODE ide_writeMultipleBlocks T_IDE_HANDLE  pa_hIDE,
T_ADDRESS  pa_nStartBlockAddr,
unsigned long  pa_nBlockCount,
unsigned char *  pa_cData
 

Parameters:
pa_hIDE handle of the ide device
pa_nStartBlockAddr blockaddress of the first block to write to
pa_nBlockCount number of consecutive blocks to write
pa_cData pointer to the data block
Returns:
on success ERR_NONE, otherwise error code
writes multiple consecutive blocks to the ide device.

T_ERROR_CODE ide_writeSingleBlock T_IDE_HANDLE  pa_hIDE,
T_ADDRESS  pa_nBlockAddr,
unsigned char *  pa_cData
 

Parameters:
pa_hIDE handle of the ide device
pa_nBlockAddr blockaddress to write to
pa_cData pointer to the data block
Returns:
on success ERR_NONE, otherwise error code
writes a single block to the ide device.

void sd_cleanup void   ) 
 

cleans up and frees resources allocated by sd_init.

See also:
sd_init

void sd_close T_SD_HANDLE  pa_hSDcard  ) 
 

Parameters:
pa_hSDcard handle for the opened sd slot
closes the sd slot and frees allocated resources.

See also:
sd_open

void sd_init void   ) 
 

initialized the sd card support, allocates some resources.

See also:
sd_cleanup

T_SD_HANDLE sd_open unsigned char  pa_cSlot  ) 
 

Parameters:
pa_cSlot slot to be opened
Returns:
handle for the opened slot
uses spi driver to communicate with the sd device.

Attention:
spi_setup has to be called before, to setup the correct spi configuration for the sd card
See also:
sd_close

spi_setup

char sd_readCardInfo T_SD_HANDLE  pa_hSDcard,
unsigned char *  cProductName,
unsigned char *  cManufactID,
unsigned char *  cApplicationID,
unsigned char *  cProductRev,
unsigned long *  nSerialNr,
unsigned char *  cManuMonth,
unsigned short *  nManuYear
 

Parameters:
pa_hSDcard handle to the sd slot
cProductName after call holds the sd card name
cManufactID after call holds the manufacturer id
cApplicationID after call holds the application id
cProductRev after call holds the product revision
nSerialNr after call holds the sd card serial number
cManuMonth after call holds the production month
nManuYear after call holds the production year
Returns:
0 on success, otherwise error code
reads sd card specific data.

char sd_readSingleBlock T_SD_HANDLE  pa_hSDcard,
unsigned long  pa_nBlockAddress,
unsigned char *  pa_cData
 

Parameters:
pa_hSDcard handle to the sd slot
pa_nBlockAddress blockaddress to read from
pa_cData pointer to the buffer to read into
Returns:
on success 0, otherwise error code
reads a single block from the sd card.

char sd_writeSingleBlock T_SD_HANDLE  pa_hSDcard,
unsigned long  pa_nBlockAddress,
unsigned char *  pa_cData
 

Parameters:
pa_hSDcard handle to the sd slot
pa_nBlockAddress blockaddress to write to
pa_cData pointer to the data block
Returns:
on success 0, otherwise error code
writes a single block on the sd card.


Generated on Thu Mar 2 16:11:32 2006 for VDK Blacksheep by  doxygen 1.4.1