diskio.h

CTRL_SYNC

Flush disk cache (for write functions)

1
0
GET_SECTOR_COUNT

Get media size (for only f_mkfs())

1
1
GET_SECTOR_SIZE

Get sector size (for multiple sector size (_MAX_SS >= 1024))

1
2
GET_BLOCK_SIZE

Get erase block size (for only f_mkfs())

1
3
CTRL_ERASE_SECTOR

Force erased a block of sectors (for only _USE_ERASE)

1
4
CTRL_POWER

Get/Set power status.

1
5
CTRL_LOCK

Lock/Unlock media removal.

1
6
CTRL_EJECT

Eject media.

1
7
MMC_GET_TYPE

Get card type.

1
10
MMC_GET_CSD

Get CSD.

1
11
MMC_GET_CID

Get CID.

1
12
MMC_GET_OCR

Get OCR.

1
13
MMC_GET_SDSTAT

Get SD status.

1
14
enum diskio_result_t
DISKIO_RES_OK = 0
0: Successful
DISKIO_RES_ERROR
1: R/W Error
DISKIO_RES_WRPRT
2: Write Protected
DISKIO_RES_NOTRDY
3: Not Ready
DISKIO_RES_PARERR
4: Invalid Parameter
enum diskio_sta_t
DISKIO_STA_NOINIT = 0x01
Drive not initialized.
DISKIO_STA_NODISK = 0x02
No medium in the drive.
DISKIO_STA_PROTECT = 0x04
Write protected.
void copy_al2un(unsigned char * dst, const unsigned long * src, int count)

Copy aligned to unaligned.

Parameters

dst:Pointer to unaligned destination address
src:Pointer to aligned source address
count:Number of bytes to copy

void copy_un2al(unsigned long * dst, const unsigned char * src, int count)

Copy unaligned to aligned.

Parameters

dst:Pointer to unaligned destination address
src:Pointer to aligned source address
count:Number of bytes to copy

diskio.h::diskio_sta_t mci_initialize(void)

Initialize media control interface (MCI)

Return values

diskio.h::diskio_sta_t mci_status(void)

Get the status of the media control interface (MCI)

Return values

diskio.h::diskio_result_t mci_read(unsigned char * buff, unsigned long sector, unsigned char count)

Read sectors over the media control interface (MCI)

Parameters

buff:Pointer to the data buffer to store read data
sector:Start sector number (LBA)
count:Sector count (1..127)

Return values

diskio.h::diskio_result_t mci_write(const unsigned char * buff, unsigned long sector, unsigned char count)

Write sectors over the media control interface (MCI)

Parameters

buff:Pointer to the data to be written
sector:Start sector number (LBA)
count:Sector count (1..127)

Return values

diskio.h::diskio_result_t mci_ioctl(unsigned char ctrl, void * buff)

IOCTL functions for the media control interface (MCI)

Parameters

ctrl:Control code
buff:Buffer to send/receive data block

Return values