]>
cloudbase.mooo.com Git - z180-stamp.git/blob - fatfs/source/diskio.c
1 /*-----------------------------------------------------------------------*/
2 /* Low level disk I/O module skeleton for FatFs (C)ChaN, 2016 */
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 modules to the FatFs module with a defined API. */
8 /*-----------------------------------------------------------------------*/
10 #include "diskio.h" /* FatFs lower layer API */
12 /* Definitions of physical drive number for each drive */
13 #define DEV_RAM 0 /* Example: Map Ramdisk to physical drive 0 */
14 #define DEV_MMC 1 /* Example: Map MMC/SD card to physical drive 1 */
15 #define DEV_USB 2 /* Example: Map USB MSD to physical drive 2 */
18 /*-----------------------------------------------------------------------*/
19 /* Get Drive Status */
20 /*-----------------------------------------------------------------------*/
23 BYTE pdrv
/* Physical drive nmuber to identify the drive */
31 result
= RAM_disk_status();
33 // translate the reslut code here
38 result
= MMC_disk_status();
40 // translate the reslut code here
45 result
= USB_disk_status();
47 // translate the reslut code here
56 /*-----------------------------------------------------------------------*/
57 /* Inidialize a Drive */
58 /*-----------------------------------------------------------------------*/
60 DSTATUS
disk_initialize (
61 BYTE pdrv
/* Physical drive nmuber to identify the drive */
69 result
= RAM_disk_initialize();
71 // translate the reslut code here
76 result
= MMC_disk_initialize();
78 // translate the reslut code here
83 result
= USB_disk_initialize();
85 // translate the reslut code here
94 /*-----------------------------------------------------------------------*/
96 /*-----------------------------------------------------------------------*/
99 BYTE pdrv
, /* Physical drive nmuber to identify the drive */
100 BYTE
*buff
, /* Data buffer to store read data */
101 DWORD sector
, /* Start sector in LBA */
102 UINT count
/* Number of sectors to read */
110 // translate the arguments here
112 result
= RAM_disk_read(buff
, sector
, count
);
114 // translate the reslut code here
119 // translate the arguments here
121 result
= MMC_disk_read(buff
, sector
, count
);
123 // translate the reslut code here
128 // translate the arguments here
130 result
= USB_disk_read(buff
, sector
, count
);
132 // translate the reslut code here
142 /*-----------------------------------------------------------------------*/
143 /* Write Sector(s) */
144 /*-----------------------------------------------------------------------*/
147 BYTE pdrv
, /* Physical drive nmuber to identify the drive */
148 const BYTE
*buff
, /* Data to be written */
149 DWORD sector
, /* Start sector in LBA */
150 UINT count
/* Number of sectors to write */
158 // translate the arguments here
160 result
= RAM_disk_write(buff
, sector
, count
);
162 // translate the reslut code here
167 // translate the arguments here
169 result
= MMC_disk_write(buff
, sector
, count
);
171 // translate the reslut code here
176 // translate the arguments here
178 result
= USB_disk_write(buff
, sector
, count
);
180 // translate the reslut code here
190 /*-----------------------------------------------------------------------*/
191 /* Miscellaneous Functions */
192 /*-----------------------------------------------------------------------*/
195 BYTE pdrv
, /* Physical drive nmuber (0..) */
196 BYTE cmd
, /* Control code */
197 void *buff
/* Buffer to send/receive control data */
206 // Process of the command for the RAM drive
212 // Process of the command for the MMC/SD card
218 // Process of the command the USB drive