CMSIS2000  0.0.7
 Указатель Структуры данных Файлы Функции Переменные Определения типов Перечисления Элементы перечислений Макросы Группы Страницы
diskio.h
См. документацию.
1 /*-----------------------------------------------------------------------
2 / Low level disk interface modlue include file (C)ChaN, 2013
3 /-----------------------------------------------------------------------*/
4 
5 #ifndef _DISKIO_DEFINED
6 #define _DISKIO_DEFINED
7 
8 #ifdef __cplusplus
9 extern "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 */
19 typedef BYTE DSTATUS;
20 
21 /* Results of Disk Functions */
22 typedef 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 
35 DSTATUS disk_initialize (BYTE pdrv);
36 DSTATUS disk_status (BYTE pdrv);
37 DRESULT disk_read (BYTE pdrv, BYTE*buff, DWORD sector, BYTE count);
38 #if _READONLY == 0
39 DRESULT disk_write (BYTE pdrv, const BYTE* buff, DWORD sector, BYTE count);
40 #endif
41 DRESULT disk_ioctl (BYTE pdrv, BYTE cmd, void* buff);
42 
43 
44 /* Disk Status Bits (DSTATUS) */
45 #define STA_NOINIT 0x01 /* Drive not initialized */
46 #define STA_NODISK 0x02 /* No medium in the drive */
47 #define STA_PROTECT 0x04 /* Write protected */
48 
49 
50 /* Command code for disk_ioctrl fucntion */
51 
52 /* Generic command (used by FatFs) */
53 #define CTRL_SYNC 0 /* Flush disk cache (for write functions) */
54 #define GET_SECTOR_COUNT 1 /* Get media size (for only f_mkfs()) */
55 #define GET_SECTOR_SIZE 2 /* Get sector size (for multiple sector size (_MAX_SS >= 1024)) */
56 #define GET_BLOCK_SIZE 3 /* Get erase block size (for only f_mkfs()) */
57 #define CTRL_ERASE_SECTOR 4 /* Force erased a block of sectors (for only _USE_ERASE) */
58 
59 /* Generic command (not used by FatFs) */
60 #define CTRL_POWER 5 /* Get/Set power status */
61 #define CTRL_LOCK 6 /* Lock/Unlock media removal */
62 #define CTRL_EJECT 7 /* Eject media */
63 #define CTRL_FORMAT 8 /* Create physical format on the media */
64 
65 /* MMC/SDC specific ioctl command */
66 #define MMC_GET_TYPE 10 /* Get card type */
67 #define MMC_GET_CSD 11 /* Get CSD */
68 #define MMC_GET_CID 12 /* Get CID */
69 #define MMC_GET_OCR 13 /* Get OCR */
70 #define MMC_GET_SDSTAT 14 /* Get SD status */
71 
72 /* ATA/CF specific ioctl command */
73 #define ATA_GET_REV 20 /* Get F/W revision */
74 #define ATA_GET_MODEL 21 /* Get model name */
75 #define ATA_GET_SN 22 /* Get serial number */
76 
77 
78 /* MMC card type flags (MMC_GET_TYPE) */
79 #define CT_MMC 0x01 /* MMC ver 3 */
80 #define CT_SD1 0x02 /* SD ver 1 */
81 #define CT_SD2 0x04 /* SD ver 2 */
82 #define CT_SDC (CT_SD1|CT_SD2) /* SD */
83 #define CT_BLOCK 0x08 /* Block addressing */
84 
85 
86 #ifdef __cplusplus
87 }
88 #endif
89 
90 #endif