Fortschrittspeichern funktionstüchtig.
[hackover2013-badge-firmware.git] / dataflash / diskio.c
1 #include "projectconfig.h"
2 #include "diskio.h"
3
4 #if CFG_HAVE_SDCARD == 1
5 #include "mmc.h"
6 #endif
7
8 #include "at45db041d.h"
9
10 /* diskio interface */
11
12 DSTATUS disk_initialize(BYTE drv) {
13 #if CFG_HAVE_SDCARD == 1
14 switch (drv) {
15 case 0:
16 #endif
17 return dataflash_initialize();
18 #if CFG_HAVE_SDCARD == 1
19 case 1:
20 return mmc_initialize();
21 default:
22 return STA_NOINIT;
23 }
24 #endif
25 }
26
27 DSTATUS disk_status(BYTE drv) {
28 #if CFG_HAVE_SDCARD == 1
29 switch (drv) {
30 case 0:
31 #endif
32 return dataflash_status();
33 #if CFG_HAVE_SDCARD == 1
34 case 1:
35 return mmc_status();
36 default:
37 return STA_NOINIT;
38 }
39 #endif
40 }
41
42 DRESULT disk_read(BYTE drv, BYTE *buff, DWORD sector, BYTE count) {
43 #if CFG_HAVE_SDCARD == 1
44 switch (drv) {
45 case 0:
46 #endif
47 return dataflash_read(buff, sector, count);
48 #if CFG_HAVE_SDCARD == 1
49 case 1:
50 return mmc_read(buff, sector, count);
51 default:
52 return RES_PARERR;
53 }
54 #endif
55 }
56
57 #if _READONLY == 0
58 DRESULT disk_write(BYTE drv, const BYTE *buff, DWORD sector, BYTE count) {
59 #if CFG_HAVE_SDCARD == 1
60 switch (drv) {
61 case 0:
62 #endif
63 return dataflash_write(buff, sector, count);
64 #if CFG_HAVE_SDCARD == 1
65 case 1:
66 return mmc_write(buff, sector, count);
67 default:
68 return RES_PARERR;
69 }
70 #endif
71 }
72 #endif /* _READONLY == 0 */
73
74 #if _USE_IOCTL != 0
75 DRESULT disk_ioctl(BYTE drv, BYTE ctrl, void *buff) {
76 #if CFG_HAVE_SDCARD == 1
77 switch (drv) {
78 case 0:
79 #endif
80 return dataflash_ioctl(ctrl, buff);
81 #if CFG_HAVE_SDCARD == 1
82 case 1:
83 return mmc_ioctl(ctrl, buff);
84 default:
85 return RES_PARERR;
86 }
87 #endif
88 }
89 #endif /* _USE_IOCTL != 0 */
This page took 0.047587 seconds and 5 git commands to generate.