annotate diskio.h @ 45:425af63d584d

merge
author Matt Johnston <matt@ucc.asn.au>
date Sat, 23 Jun 2012 23:37:36 +0800
parents 7da9a3f23592
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
1 /*-----------------------------------------------------------------------
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
2 / Low level disk interface modlue include file (C)ChaN, 2010
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
3 /-----------------------------------------------------------------------*/
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
4
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
5 #ifndef _DISKIO
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
6
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
7 #define _READONLY 0 /* 1: Remove write functions */
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
8 #define _USE_IOCTL 1 /* 1: Use disk_ioctl fucntion */
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
9
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
10 #include "integer.h"
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
11
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
12
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
13 /* Status of Disk Functions */
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
14 typedef BYTE DSTATUS;
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
15
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
16 /* Results of Disk Functions */
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
17 typedef enum {
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
18 RES_OK = 0, /* 0: Successful */
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
19 RES_ERROR, /* 1: R/W Error */
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
20 RES_WRPRT, /* 2: Write Protected */
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
21 RES_NOTRDY, /* 3: Not Ready */
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
22 RES_PARERR /* 4: Invalid Parameter */
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
23 } DRESULT;
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
24
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
25
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
26 /*---------------------------------------*/
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
27 /* Prototypes for disk control functions */
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
28
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
29 DSTATUS disk_initialize (BYTE);
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
30 DSTATUS disk_status (BYTE);
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
31 DRESULT disk_read (BYTE, BYTE*, DWORD, BYTE);
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
32 #if _READONLY == 0
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
33 DRESULT disk_write (BYTE, const BYTE*, DWORD, BYTE);
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
34 #endif
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
35 DRESULT disk_ioctl (BYTE, BYTE, void*);
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
36 void disk_timerproc (void);
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
37
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
38
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
39
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
40 /* Disk Status Bits (DSTATUS) */
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
41
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
42 #define STA_NOINIT 0x01 /* Drive not initialized */
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
43 #define STA_NODISK 0x02 /* No medium in the drive */
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
44 #define STA_PROTECT 0x04 /* Write protected */
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
45
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
46
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
47 /* Command code for disk_ioctrl fucntion */
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
48
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
49 /* Generic command (mandatory for FatFs) */
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
50 #define CTRL_SYNC 0 /* Flush disk cache (for write functions) */
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
51 #define GET_SECTOR_COUNT 1 /* Get media size (for only f_mkfs()) */
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
52 #define GET_SECTOR_SIZE 2 /* Get sector size (for multiple sector size (_MAX_SS >= 1024)) */
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
53 #define GET_BLOCK_SIZE 3 /* Get erase block size (for only f_mkfs()) */
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
54
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
55 /* Generic command */
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
56 #define CTRL_POWER 4 /* Get/Set power status */
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
57 #define CTRL_LOCK 5 /* Lock/Unlock media removal */
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
58 #define CTRL_EJECT 6 /* Eject media */
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
59
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
60 /* MMC/SDC command */
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
61 #define MMC_GET_TYPE 10 /* Get card type */
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
62 #define MMC_GET_CSD 11 /* Get CSD */
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
63 #define MMC_GET_CID 12 /* Get CID */
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
64 #define MMC_GET_OCR 13 /* Get OCR */
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
65 #define MMC_GET_SDSTAT 14 /* Get SD status */
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
66
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
67 /* ATA/CF command */
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
68 #define ATA_GET_REV 20 /* Get F/W revision */
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
69 #define ATA_GET_MODEL 21 /* Get model name */
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
70 #define ATA_GET_SN 22 /* Get serial number */
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
71
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
72
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
73 #define _DISKIO
7da9a3f23592 Import ds18x20 code
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
74 #endif