KallistiOS git master
Independent SDK for the Sega Dreamcast
|
Block-level access to an SD card attached to the SCIF port. More...
Go to the source code of this file.
Functions | |
uint8 | sd_crc7 (const uint8 *data, int size, uint8 crc) |
Calculate a SD/MMC-style CRC over a block of data. | |
int | sd_init (void) |
Initialize the SD card for use. | |
int | sd_shutdown (void) |
Shut down SD card support. | |
int | sd_read_blocks (uint32 block, size_t count, uint8 *buf) |
Read one or more blocks from the SD card. | |
int | sd_write_blocks (uint32 block, size_t count, const uint8 *buf) |
Write one or more blocks to the SD card. | |
uint64 | sd_get_size (void) |
Retrieve the size of the SD card. | |
int | sd_blockdev_for_partition (int partition, kos_blockdev_t *rv, uint8 *partition_type) |
Get a block device for a given partition on the SD card. | |
Block-level access to an SD card attached to the SCIF port.
This file contains the interface to working with the SD card reader that was designed by jj1odm. The SD card reader itself connects to the SCIF port and uses it basically as a simple SPI bus.
For reference, all I/O through this code should be done in the order of SD card blocks (which are 512 bytes a piece). Also, this should adequately support SD and SDHC cards (and possibly SDXC, but I don't have any of them to try out).
This code doesn't directly implement any filesystems on top of the SD card, but rather provides you with direct block-level access. This probably will not be useful to most people in its current form (without a filesystem), but this will provide you with all of the building blocks you should need to actually make it work for you.
Due to the patent-encumbered nature of certain parts of the FAT32 filesystem, that filesystem will likely never be supported in KOS proper (unless, of course, people are still using KOS after those patents expire). I'm not going to encourage anyone to violate Microsoft's patents on FAT32 and I'm not going to be the enabler for anyone to do so either. So, if you want FAT32, you're on your own.