The friendly Operating System for the Internet of Things
diskio.h File Reference

Detailed Description

Author
Oliver Hahm olive.nosp@m.r.ha.nosp@m.hm@in.nosp@m.ria..nosp@m.fr

Definition in file diskio.h.

#include <stdint.h>
+ Include dependency graph for diskio.h:

Go to the source code of this file.

Macros

Generic ioctl command (defined for FatFs)
#define CTRL_SYNC   0
 Flush disk cache (for write functions)
 
#define GET_SECTOR_COUNT   1
 Get media size (for only f_mkfs())
 
#define GET_SECTOR_SIZE   2
 Get sector size (for multiple sector size (_MAX_SS >= 1024))
 
#define GET_BLOCK_SIZE   3
 Get erase block size (for only f_mkfs())
 
#define CTRL_ERASE_SECTOR   4
 Force erased a block of sectors (for only _USE_ERASE)
 
Generic ioctl command
#define CTRL_POWER   5
 Get/Set power status.
 
#define CTRL_LOCK   6
 Lock/Unlock media removal.
 
#define CTRL_EJECT   7
 Eject media.
 
MMC/SDC specific ioctl command
#define MMC_GET_TYPE   10
 Get card type.
 
#define MMC_GET_CSD   11
 Get CSD.
 
#define MMC_GET_CID   12
 Get CID.
 
#define MMC_GET_OCR   13
 Get OCR.
 
#define MMC_GET_SDSTAT   14
 Get SD status.
 

Enumerations

enum  diskio_result_t {
  DISKIO_RES_OK = 0, DISKIO_RES_ERROR, DISKIO_RES_WRPRT, DISKIO_RES_NOTRDY,
  DISKIO_RES_PARERR
}
 Results of Disk Functions. More...
 
Disk Status Bits
enum  diskio_sta_t { DISKIO_STA_NOINIT = 0x01, DISKIO_STA_NODISK = 0x02, DISKIO_STA_PROTECT = 0x04 }
 

Functions

void copy_al2un (unsigned char *dst, const unsigned long *src, int count)
 Copy aligned to unaligned. More...
 
void copy_un2al (unsigned long *dst, const unsigned char *src, int count)
 Copy unaligned to aligned. More...
 
diskio_sta_t mci_initialize (void)
 Initialize media control interface (MCI) More...
 
diskio_sta_t mci_status (void)
 Get the status of the media control interface (MCI) More...
 
diskio_result_t mci_read (unsigned char *buff, unsigned long sector, unsigned char count)
 Read sectors over the media control interface (MCI) More...
 
diskio_result_t mci_write (const unsigned char *buff, unsigned long sector, unsigned char count)
 Write sectors over the media control interface (MCI) More...
 
diskio_result_t mci_ioctl (unsigned char ctrl, void *buff)
 IOCTL functions for the media control interface (MCI) More...
 

Function Documentation

diskio_sta_t mci_initialize ( void  )
Returns
0 on success
a diskio_sta_t value on error
diskio_result_t mci_ioctl ( unsigned char  ctrl,
void *  buff 
)
Parameters
[in]ctrlControl code
[in,out]buffBuffer to send/receive data block
Returns
DISKIO_RES_OK on success
any other diskio_result_t value on error
diskio_result_t mci_read ( unsigned char *  buff,
unsigned long  sector,
unsigned char  count 
)
Parameters
[out]buffPointer to the data buffer to store read data
[in]sectorStart sector number (LBA)
[in]countSector count (1..127)
Returns
DISKIO_RES_OK on success
any other diskio_result_t value on error
diskio_sta_t mci_status ( void  )
Returns
0 on success
a diskio_sta_t value on error
diskio_result_t mci_write ( const unsigned char *  buff,
unsigned long  sector,
unsigned char  count 
)
Parameters
[in]buffPointer to the data to be written
[in]sectorStart sector number (LBA)
[in]countSector count (1..127)
Returns
DISKIO_RES_OK on success
any other diskio_result_t value on error