123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229 |
- #include "ff.h"
- #include "diskio.h"
- #define DEV_RAM 0
- #define DEV_MMC 1
- #define DEV_USB 2
- DSTATUS disk_status (
- BYTE pdrv
- )
- {
- DSTATUS stat;
- int result;
- switch (pdrv) {
- case DEV_RAM :
- result = RAM_disk_status();
-
- return stat;
- case DEV_MMC :
- result = MMC_disk_status();
-
- return stat;
- case DEV_USB :
- result = USB_disk_status();
-
- return stat;
- }
- return STA_NOINIT;
- }
- DSTATUS disk_initialize (
- BYTE pdrv
- )
- {
- DSTATUS stat;
- int result;
- switch (pdrv) {
- case DEV_RAM :
- result = RAM_disk_initialize();
-
- return stat;
- case DEV_MMC :
- result = MMC_disk_initialize();
-
- return stat;
- case DEV_USB :
- result = USB_disk_initialize();
-
- return stat;
- }
- return STA_NOINIT;
- }
- DRESULT disk_read (
- BYTE pdrv,
- BYTE *buff,
- LBA_t sector,
- UINT count
- )
- {
- DRESULT res;
- int result;
- switch (pdrv) {
- case DEV_RAM :
-
- result = RAM_disk_read(buff, sector, count);
-
- return res;
- case DEV_MMC :
-
- result = MMC_disk_read(buff, sector, count);
-
- return res;
- case DEV_USB :
-
- result = USB_disk_read(buff, sector, count);
-
- return res;
- }
- return RES_PARERR;
- }
- #if FF_FS_READONLY == 0
- DRESULT disk_write (
- BYTE pdrv,
- const BYTE *buff,
- LBA_t sector,
- UINT count
- )
- {
- DRESULT res;
- int result;
- switch (pdrv) {
- case DEV_RAM :
-
- result = RAM_disk_write(buff, sector, count);
-
- return res;
- case DEV_MMC :
-
- result = MMC_disk_write(buff, sector, count);
-
- return res;
- case DEV_USB :
-
- result = USB_disk_write(buff, sector, count);
-
- return res;
- }
- return RES_PARERR;
- }
- #endif
- DRESULT disk_ioctl (
- BYTE pdrv,
- BYTE cmd,
- void *buff
- )
- {
- DRESULT res;
- int result;
- switch (pdrv) {
- case DEV_RAM :
-
- return res;
- case DEV_MMC :
-
- return res;
- case DEV_USB :
-
- return res;
- }
- return RES_PARERR;
- }
|