Merge branch 'release/0.1'
[clinton/Smoothieware.git] / src / libs / ChaNFS / CHAN_FS / diskio.h
CommitLineData
df27a6a3
MM
1/*-----------------------------------------------------------------------
2/ Low level disk interface modlue include file
3/-----------------------------------------------------------------------*/
d9ebc974 4\r
df27a6a3 5#ifndef _DISKIO
d9ebc974 6\r
df27a6a3
MM
7#define _READONLY 0 /* 1: Remove write functions */
8#define _USE_IOCTL 1 /* 1: Use disk_ioctl fucntion */
d9ebc974 9\r
df27a6a3 10#include "integer.h"
d9ebc974
AW
11\r
12\r
df27a6a3
MM
13/* Status of Disk Functions */
14typedef BYTE DSTATUS;
d9ebc974 15\r
df27a6a3
MM
16/* Results of Disk Functions */
17typedef enum {
18 RES_OK = 0, /* 0: Successful */
19 RES_ERROR, /* 1: R/W Error */
20 RES_WRPRT, /* 2: Write Protected */
21 RES_NOTRDY, /* 3: Not Ready */
22 RES_PARERR /* 4: Invalid Parameter */
23} DRESULT;
d9ebc974
AW
24\r
25\r
df27a6a3
MM
26/*---------------------------------------*/
27/* Prototypes for disk control functions */
d9ebc974 28\r
df27a6a3
MM
29int assign_drives (int, int);
30DSTATUS disk_initialize (BYTE);
31DSTATUS disk_status (BYTE);
32DRESULT disk_read (BYTE, BYTE*, DWORD, BYTE);
33#if _READONLY == 0
34DRESULT disk_write (BYTE, const BYTE*, DWORD, BYTE);
35#endif
36DRESULT disk_ioctl (BYTE, BYTE, void*);
37void disk_timerproc (void);
d9ebc974
AW
38\r
39\r
40\r
41\r
df27a6a3 42/* Disk Status Bits (DSTATUS) */
d9ebc974 43\r
df27a6a3
MM
44#define STA_NOINIT 0x01 /* Drive not initialized */
45#define STA_NODISK 0x02 /* No medium in the drive */
46#define STA_PROTECT 0x04 /* Write protected */
d9ebc974
AW
47\r
48\r
df27a6a3 49/* Command code for disk_ioctrl fucntion */
d9ebc974 50\r
df27a6a3
MM
51/* Generic command (defined for FatFs) */
52#define CTRL_SYNC 0 /* Flush disk cache (for write functions) */
53#define GET_SECTOR_COUNT 1 /* Get media size (for only f_mkfs()) */
54#define GET_SECTOR_SIZE 2 /* Get sector size (for multiple sector size (_MAX_SS >= 1024)) */
55#define GET_BLOCK_SIZE 3 /* Get erase block size (for only f_mkfs()) */
56#define CTRL_ERASE_SECTOR 4 /* Force erased a block of sectors (for only _USE_ERASE) */
d9ebc974 57\r
df27a6a3
MM
58/* Generic command */
59#define CTRL_POWER 5 /* Get/Set power status */
60#define CTRL_LOCK 6 /* Lock/Unlock media removal */
61#define CTRL_EJECT 7 /* Eject media */
d9ebc974 62\r
df27a6a3
MM
63/* MMC/SDC specific ioctl command */
64#define MMC_GET_TYPE 10 /* Get card type */
65#define MMC_GET_CSD 11 /* Get CSD */
66#define MMC_GET_CID 12 /* Get CID */
67#define MMC_GET_OCR 13 /* Get OCR */
68#define MMC_GET_SDSTAT 14 /* Get SD status */
d9ebc974 69\r
df27a6a3
MM
70/* ATA/CF specific ioctl command */
71#define ATA_GET_REV 20 /* Get F/W revision */
72#define ATA_GET_MODEL 21 /* Get model name */
73#define ATA_GET_SN 22 /* Get serial number */
d9ebc974 74\r
df27a6a3
MM
75/* NAND specific ioctl command */
76#define NAND_FORMAT 30 /* Create physical format */
d9ebc974
AW
77\r
78\r
df27a6a3
MM
79#define _DISKIO
80#endif