source: UsbWattMeter/trunk/fatfs/diskio.h

Last change on this file was 167, checked in by coas-nagasima, 6 years ago

MIMEにSJISを設定

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-chdr; charset=SHIFT_JIS
File size: 2.9 KB
Line 
1/*-----------------------------------------------------------------------
2/ Low level disk interface modlue include file (C)ChaN, 2014
3/-----------------------------------------------------------------------*/
4
5#ifndef _DISKIO_DEFINED
6#define _DISKIO_DEFINED
7
8#ifdef __cplusplus
9extern "C" {
10#endif
11
12#define _USE_WRITE 1 /* 1: Enable disk_write function */
13#define _USE_IOCTL 1 /* 1: Enable disk_ioctl fucntion */
14
15#include "integer.h"
16
17
18/* Status of Disk Functions */
19typedef BYTE DSTATUS;
20
21/* Results of Disk Functions */
22typedef enum {
23 RES_OK = 0, /* 0: Successful */
24 RES_ERROR, /* 1: R/W Error */
25 RES_WRPRT, /* 2: Write Protected */
26 RES_NOTRDY, /* 3: Not Ready */
27 RES_PARERR /* 4: Invalid Parameter */
28} DRESULT;
29
30
31/*---------------------------------------*/
32/* Prototypes for disk control functions */
33
34
35DSTATUS disk_initialize (BYTE pdrv);
36DSTATUS disk_status (BYTE pdrv);
37DRESULT disk_read (BYTE pdrv, BYTE* buff, DWORD sector, UINT count);
38#if _USE_WRITE
39DRESULT disk_write (BYTE pdrv, const BYTE* buff, DWORD sector, UINT count);
40#endif
41#if _USE_IOCTL
42DRESULT disk_ioctl (BYTE pdrv, BYTE cmd, void* buff);
43#endif
44
45
46/* Disk Status Bits (DSTATUS) */
47#define STA_NOINIT 0x01 /* Drive not initialized */
48#define STA_NODISK 0x02 /* No medium in the drive */
49#define STA_PROTECT 0x04 /* Write protected */
50
51
52/* Command code for disk_ioctrl fucntion */
53
54/* Generic command (Used by FatFs) */
55#define CTRL_SYNC 0 /* Complete pending write process (needed at _FS_READONLY == 0) */
56#define GET_SECTOR_COUNT 1 /* Get media size (needed at _USE_MKFS == 1) */
57#define GET_SECTOR_SIZE 2 /* Get sector size (needed at _MAX_SS != _MIN_SS) */
58#define GET_BLOCK_SIZE 3 /* Get erase block size (needed at _USE_MKFS == 1) */
59#define CTRL_TRIM 4 /* Inform device that the data on the block of sectors is no longer used (needed at _USE_TRIM == 1) */
60
61/* Generic command (Not used by FatFs) */
62#define CTRL_FORMAT 5 /* Create physical format on the media */
63#define CTRL_POWER_IDLE 6 /* Put the device idle state */
64#define CTRL_POWER_OFF 7 /* Put the device off state */
65#define CTRL_LOCK 8 /* Lock media removal */
66#define CTRL_UNLOCK 9 /* Unlock media removal */
67#define CTRL_EJECT 10 /* Eject media */
68
69/* MMC/SDC specific command (Not used by FatFs) */
70#define MMC_GET_TYPE 50 /* Get card type */
71#define MMC_GET_CSD 51 /* Get CSD */
72#define MMC_GET_CID 52 /* Get CID */
73#define MMC_GET_OCR 53 /* Get OCR */
74#define MMC_GET_SDSTAT 54 /* Get SD status */
75
76/* ATA/CF specific command (Not used by FatFs) */
77#define ATA_GET_REV 60 /* Get F/W revision */
78#define ATA_GET_MODEL 61 /* Get model name */
79#define ATA_GET_SN 62 /* Get serial number */
80
81
82/* MMC card type flags (MMC_GET_TYPE) */
83#define CT_MMC 0x01 /* MMC ver 3 */
84#define CT_SD1 0x02 /* SD ver 1 */
85#define CT_SD2 0x04 /* SD ver 2 */
86#define CT_SDC (CT_SD1|CT_SD2) /* SD */
87#define CT_BLOCK 0x08 /* Block addressing */
88
89
90#ifdef __cplusplus
91}
92#endif
93
94#endif
Note: See TracBrowser for help on using the repository browser.