wiki:sdc_driver

Version 3 (modified by alain, 10 years ago) (diff)

--

GIET-VM / SDC Driver

The sdc_driver.c and sdc_driver.h files define the SDC driver.

This component is a single channel, block oriented, external mass storage peripheral, implemented on a SD card.

The SDC driver uses the lower level SPI driver to access the SD card.

It is called by the generic FAT handler when the USE_IOC_SPI flag is set in the hard_config.h file.

The SEG_IOC_BASE address must be defined in the hard_config.h file.

In this implementation, the SDC peripheral is acting as a target (no DMA capability) : the _sdc_access() function is blocking until the transfer is fully completed, and does not use any interrupt to signal completion, whatever the requested mode.

WARNING : Write transfers (from memory to SD card) are not supported yet.

Access functions

unsigned int _sdc_init()

This function initializes the SPI controller and call sdc_open to initialize the SD card. Returns 0 if success, >0 if failure

unsigned int _sdc_access( unsigned int use_irq , unsigned int to_mem , unsigned int lba, unsigned long long buffer, unsigned int count )

Transfer data from the SD card to a memory buffer.

  • use_irq : unused, access is always synchronous.
  • to_mem : must be non zero as write transfer are not supported yet.
  • lba : first block index on the SD card.
  • buffer : physical base address of the memory buffer
  • count : number of blocks to be transfered.

Returns 0 if success, > 0 if error.