Low level disk interface. More...

Detailed Description

Low level disk interface.

Files

file  diskio.h
 

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...
 
enum  diskio_sta_t { DISKIO_STA_NOINIT = 0x01 , DISKIO_STA_NODISK = 0x02 , DISKIO_STA_PROTECT = 0x04 }
 Disk Status Bits. More...
 

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...
 

Generic ioctl command (defined for FatFs)

#define CTRL_SYNC   0
 Flush disk cache (for write functions) More...
 
#define GET_SECTOR_COUNT   1
 Get media size (for only f_mkfs()) More...
 
#define GET_SECTOR_SIZE   2
 Get sector size (for multiple sector size (_MAX_SS >= 1024)) More...
 
#define GET_BLOCK_SIZE   3
 Get erase block size (for only f_mkfs()) More...
 
#define CTRL_ERASE_SECTOR   4
 Force erased a block of sectors (for only _USE_ERASE) More...
 

Generic ioctl command

#define CTRL_POWER   5
 Get/Set power status. More...
 
#define CTRL_LOCK   6
 Lock/Unlock media removal. More...
 
#define CTRL_EJECT   7
 Eject media. More...
 

MMC/SDC specific ioctl command

#define MMC_GET_TYPE   10
 Get card type. More...
 
#define MMC_GET_CSD   11
 Get CSD. More...
 
#define MMC_GET_CID   12
 Get CID. More...
 
#define MMC_GET_OCR   13
 Get OCR. More...
 
#define MMC_GET_SDSTAT   14
 Get SD status. More...
 

Macro Definition Documentation

◆ CTRL_EJECT

#define CTRL_EJECT   7

Eject media.

Definition at line 91 of file diskio.h.

◆ CTRL_ERASE_SECTOR

#define CTRL_ERASE_SECTOR   4

Force erased a block of sectors (for only _USE_ERASE)

Definition at line 82 of file diskio.h.

◆ CTRL_LOCK

#define CTRL_LOCK   6

Lock/Unlock media removal.

Definition at line 90 of file diskio.h.

◆ CTRL_POWER

#define CTRL_POWER   5

Get/Set power status.

Definition at line 89 of file diskio.h.

◆ CTRL_SYNC

#define CTRL_SYNC   0

Flush disk cache (for write functions)

Definition at line 78 of file diskio.h.

◆ GET_BLOCK_SIZE

#define GET_BLOCK_SIZE   3

Get erase block size (for only f_mkfs())

Definition at line 81 of file diskio.h.

◆ GET_SECTOR_COUNT

#define GET_SECTOR_COUNT   1

Get media size (for only f_mkfs())

Definition at line 79 of file diskio.h.

◆ GET_SECTOR_SIZE

#define GET_SECTOR_SIZE   2

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

Definition at line 80 of file diskio.h.

◆ MMC_GET_CID

#define MMC_GET_CID   12

Get CID.

Definition at line 100 of file diskio.h.

◆ MMC_GET_CSD

#define MMC_GET_CSD   11

Get CSD.

Definition at line 99 of file diskio.h.

◆ MMC_GET_OCR

#define MMC_GET_OCR   13

Get OCR.

Definition at line 101 of file diskio.h.

◆ MMC_GET_SDSTAT

#define MMC_GET_SDSTAT   14

Get SD status.

Definition at line 102 of file diskio.h.

◆ MMC_GET_TYPE

#define MMC_GET_TYPE   10

Get card type.

Definition at line 98 of file diskio.h.

Enumeration Type Documentation

◆ diskio_result_t

Results of Disk Functions.

Enumerator
DISKIO_RES_OK 

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

Definition at line 52 of file diskio.h.

◆ diskio_sta_t

Disk Status Bits.

Enumerator
DISKIO_STA_NOINIT 

Drive not initialized.

DISKIO_STA_NODISK 

No medium in the drive.

DISKIO_STA_PROTECT 

Write protected.

Definition at line 63 of file diskio.h.

Function Documentation

◆ copy_al2un()

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

Copy aligned to unaligned.

Parameters
[out]dstPointer to unaligned destination address
[in]srcPointer to aligned source address
[in]countNumber of bytes to copy

◆ copy_un2al()

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

Copy unaligned to aligned.

Parameters
[out]dstPointer to unaligned destination address
[in]srcPointer to aligned source address
[in]countNumber of bytes to copy