]>
cloudbase.mooo.com Git - z180-stamp.git/blob - fatfs/src/diskio.c
1 /*-----------------------------------------------------------------------*/
2 /* Low level disk I/O module skeleton for FatFs (C)ChaN, 2013 */
3 /*-----------------------------------------------------------------------*/
4 /* If a working storage control module is available, it should be */
5 /* attached to the FatFs via a glue function rather than modifying it. */
6 /* This is an example of glue functions to attach various exsisting */
7 /* storage control module to the FatFs module with a defined API. */
8 /*-----------------------------------------------------------------------*/
10 #include "diskio.h" /* FatFs lower layer API */
11 #include "usbdisk.h" /* Example: USB drive control */
12 #include "atadrive.h" /* Example: ATA drive control */
13 #include "sdcard.h" /* Example: MMC/SDC contorl */
15 /* Definitions of physical drive number for each media */
21 /*-----------------------------------------------------------------------*/
22 /* Inidialize a Drive */
23 /*-----------------------------------------------------------------------*/
25 DSTATUS
disk_initialize (
26 BYTE pdrv
/* Physical drive nmuber (0..) */
34 result
= ATA_disk_initialize();
36 // translate the reslut code here
41 result
= MMC_disk_initialize();
43 // translate the reslut code here
48 result
= USB_disk_initialize();
50 // translate the reslut code here
59 /*-----------------------------------------------------------------------*/
61 /*-----------------------------------------------------------------------*/
64 BYTE pdrv
/* Physical drive nmuber (0..) */
72 result
= ATA_disk_status();
74 // translate the reslut code here
79 result
= MMC_disk_status();
81 // translate the reslut code here
86 result
= USB_disk_status();
88 // translate the reslut code here
97 /*-----------------------------------------------------------------------*/
99 /*-----------------------------------------------------------------------*/
102 BYTE pdrv
, /* Physical drive nmuber (0..) */
103 BYTE
*buff
, /* Data buffer to store read data */
104 DWORD sector
, /* Sector address (LBA) */
105 UINT count
/* Number of sectors to read (1..128) */
113 // translate the arguments here
115 result
= ATA_disk_read(buff
, sector
, count
);
117 // translate the reslut code here
122 // translate the arguments here
124 result
= MMC_disk_read(buff
, sector
, count
);
126 // translate the reslut code here
131 // translate the arguments here
133 result
= USB_disk_read(buff
, sector
, count
);
135 // translate the reslut code here
144 /*-----------------------------------------------------------------------*/
145 /* Write Sector(s) */
146 /*-----------------------------------------------------------------------*/
150 BYTE pdrv
, /* Physical drive nmuber (0..) */
151 const BYTE
*buff
, /* Data to be written */
152 DWORD sector
, /* Sector address (LBA) */
153 UINT count
/* Number of sectors to write (1..128) */
161 // translate the arguments here
163 result
= ATA_disk_write(buff
, sector
, count
);
165 // translate the reslut code here
170 // translate the arguments here
172 result
= MMC_disk_write(buff
, sector
, count
);
174 // translate the reslut code here
179 // translate the arguments here
181 result
= USB_disk_write(buff
, sector
, count
);
183 // translate the reslut code here
192 /*-----------------------------------------------------------------------*/
193 /* Miscellaneous Functions */
194 /*-----------------------------------------------------------------------*/
198 BYTE pdrv
, /* Physical drive nmuber (0..) */
199 BYTE cmd
, /* Control code */
200 void *buff
/* Buffer to send/receive control data */
210 result
= ATA_disk_ioctl(cmd
, buff
);
219 result
= MMC_disk_ioctl(cmd
, buff
);
228 result
= USB_disk_ioctl(cmd
, buff
);