| | 1 | = GIET-VM / SDC Driver = |
| | 2 | |
| | 3 | [[PageOutline]] |
| | 4 | |
| | 5 | The [source:soft/giet_vm/giet_drivers/sdc_driver.c sdc_driver.c] and [source:soft/giet_vm/giet_drivers/sdc_driver.h sdc_driver.h] files define the SDC driver. |
| | 6 | |
| | 7 | This component is a single channel, block oriented, external mass storage peripheral, implemented on a SD card. |
| | 8 | |
| | 9 | The ''sdc_driver'' uses the lower level ''spi_driver'' to access the SD card. |
| | 10 | |
| | 11 | 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. |
| | 12 | |
| | 13 | 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. |
| | 14 | |
| | 15 | WARNING : The '''_sdc_write()''' function is not implemented yet |
| | 16 | |
| | 17 | |
| | 18 | |
| | 19 | === unsigned int '''_sdc_init'''() === |
| | 20 | This function initializes the SPI controller and call sdc_open to initialize the SD card. |
| | 21 | Returns 0 if success, >0 if failure |
| | 22 | |
| | 23 | === unsigned int '''_sdc_read'''( unsigned int mode, unsigned int lba, paddr_t buffer, unsigned int count ) === |
| | 24 | Transfer data from the SD card to a memory buffer. |
| | 25 | * mode : BOOT / KERNEL / USER (Not used in this implementation) |
| | 26 | * lba : first block index on the SD card |
| | 27 | * buffer : physical base address of the memory buffer |
| | 28 | * count : number of blocks to be transfered. |
| | 29 | Returns 0 if success, > 0 if error. |
| | 30 | |
| | 31 | === unsigned int '''_sdc_write'''( unsigned int mode, unsigned int lba, paddr_t buffer, unsigned int count ) === |
| | 32 | Transfer data from a memory buffer to the SD card. |
| | 33 | * mode : BOOT / KERNEL / USER (Not used in this implementation) |
| | 34 | * lba : first block index on the SD card. |
| | 35 | * buffer : physical base address of the memory buffer |
| | 36 | * count : number of blocks to be transfered. |
| | 37 | Returns 0 if success, > 0 if error. |
| | 38 | WARNING: The _sdc_write() is not implemented yet. |
| | 39 | |
| | 40 | === unsigned int '''_sdc_get_status'''() === |
| | 41 | This function should not be called for this implementation of the SDC driver (No DMA). |
| | 42 | |
| | 43 | === unsigned int '''_sdc_get_block_size'''() === |
| | 44 | Returns the block size (bytes). |
| | 45 | |
| | 46 | |
| | 47 | |
| | 48 | |