MAV'RIC
Macros | Typedefs | Enumerations | Functions
diskio.h File Reference
#include "integer.h"
#include "ff.h"
Include dependency graph for diskio.h:

Go to the source code of this file.

Macros

#define _USE_WRITE   1
 1: Enable disk_write function
 
#define _USE_IOCTL   1
 1: Enable disk_ioctl function
 
#define STA_NOINIT   0x01
 Drive not initialized.
 
#define STA_NODISK   0x02
 No medium in the drive.
 
#define STA_PROTECT   0x04
 Write protected. More...
 
#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) More...
 
#define CTRL_POWER   5
 Get/Set power status.
 
#define CTRL_LOCK   6
 Lock/Unlock media removal.
 
#define CTRL_EJECT   7
 Eject media.
 
#define CTRL_FORMAT   8
 Create physical format on the media. More...
 
#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. More...
 
#define ATA_GET_REV   20
 Get F/W revision.
 
#define ATA_GET_MODEL   21
 Get model name.
 
#define ATA_GET_SN   22
 Get serial number.
 

Typedefs

typedef BYTE DSTATUS
 Status of Disk Functions.
 

Enumerations

enum  DRESULT {
  RES_OK = 0, RES_ERROR, RES_WRPRT, RES_NOTRDY,
  RES_PARERR
}
 Results of Disk Functions. More...
 

Functions

DSTATUS disk_initialize (BYTE pdrv)
 Initialise the disk. More...
 
DSTATUS disk_status (BYTE pdrv)
 Get Disk Status. More...
 
DRESULT disk_read (BYTE pdrv, BYTE *buff, DWORD sector, UINT count)
 Read a sector from the device and write to buff. More...
 
DRESULT disk_write (BYTE pdrv, const BYTE *buff, DWORD sector, UINT count)
 Write the value of buff on the sector. More...
 
DRESULT disk_ioctl (BYTE pdrv, BYTE cmd, void *buff)
 Miscellaneous Functions, function to get information from the device. More...
 
DWORD get_fattime (void)
 The time to write the metadata of the files. More...
 

Detailed Description

Link the FatFs level with the low level command of the disk If a working storage control module is available, it should be attached to the FatFs via a glue function rather than modifying it. This is an example of glue functions to attach various exsisting storage control module to the FatFs module with a defined API.

Link the FatFs level with the low level command of the disk

Macro Definition Documentation

#define CTRL_ERASE_SECTOR   4

Force erased a block of sectors (for only _USE_ERASE)

Generic command (not used by FatFs)

#define CTRL_FORMAT   8

Create physical format on the media.

MMC/SDC specific ioctl command

#define MMC_GET_SDSTAT   14

Get SD status.

ATA/CF specific ioctl command

#define STA_PROTECT   0x04

Write protected.

Command code for disk_ioctrl fucntion Generic command (used by FatFs)

Enumeration Type Documentation

enum DRESULT

Results of Disk Functions.

Enumerator
RES_OK 

0: Successful

RES_ERROR 

1: R/W Error

RES_WRPRT 

2: Write Protected

RES_NOTRDY 

3: Not Ready

RES_PARERR 

4: Invalid Parameter

Function Documentation

DSTATUS disk_initialize ( BYTE  pdrv)

Initialise the disk.

Parameters
pdrvThe drive number (0..)
Returns
A DSTATUS value => STA_ #define

Here is the caller graph for this function:

DRESULT disk_ioctl ( BYTE  pdrv,
BYTE  cmd,
void *  buff 
)

Miscellaneous Functions, function to get information from the device.

Parameters
pdrvThe drive number (0..)
cmdThe command of the feature
buffThe pointer to the buffer on which the result will be written
Returns
The result of the get information process

Here is the caller graph for this function:

DRESULT disk_read ( BYTE  pdrv,
BYTE *  buff,
DWORD  sector,
UINT  count 
)

Read a sector from the device and write to buff.

Parameters
pdrvThe drive number (0..)
buffThe data buffer to store read data
sectorThe start sector address to be read (LBA)
countThe number of sectors to be read
Returns
The result of the read process, a DRESULT enum value

Here is the caller graph for this function:

DSTATUS disk_status ( BYTE  pdrv)

Get Disk Status.

Parameters
pdrvThe drive number (0..)
Returns
A DSTATUS value => STA_ #define
DRESULT disk_write ( BYTE  pdrv,
const BYTE *  buff,
DWORD  sector,
UINT  count 
)

Write the value of buff on the sector.

Parameters
pdrvThe drive number (0..)
buffThe pointer to the buffer to take the data to write from
sectorThe start sector on which it will be written (LBA)
countThe number of sectors on which it will be written
Returns
The result of the write process, a DRESULT enum value

Here is the caller graph for this function:

DWORD get_fattime ( void  )

The time to write the metadata of the files.

Returns
The time under a bit mask form