wiki:sdc_driver

Version 1 (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.

Th sdc_driver is one of the physical disk driver that can be called by the generic IOC driver, and 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_read() and _sdc_write() are blocking until the transfer is fully completed, and does not use any interrupt to signal completion.

WARNING : The _sdc_write() function is not implemented yet

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_read( unsigned int mode, unsigned int lba, paddr_t buffer, unsigned int count )

Transfer data from the SD card to a memory buffer.

  • mode : BOOT / KERNEL / USER (Not used in this implementation)
  • 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.

unsigned int _sdc_write( unsigned int mode, unsigned int lba, paddr_t buffer, unsigned int count )

Transfer data from a memory buffer to the SD card.

  • mode : BOOT / KERNEL / USER (Not used in this implementation)
  • 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. WARNING: The _sdc_write() is not implemented yet.

unsigned int _sdc_get_status()

This function should not be called for this implementation of the SDC driver (No DMA).

unsigned int _sdc_get_block_size()

Returns the block size (bytes).