通过阅读FatFs源码发现,diskio.c文件中提供了4个接口函数(API):- extern int MMC_disk_status();
; y2 S# { S4 l- J' G { - extern int MMC_disk_initialize();
$ i) r1 J8 J5 C. |! F2 O, W5 b3 z - extern int MMC_disk_read(! ]/ K# h) I& V
- BYTE *buff, /* Data buffer to store read data */
' ^" m1 R0 t3 O9 W5 g- B - DWORD sector, /* Sector address in LBA */
& ?' k- b& \1 B9 Z8 f3 L" j - UINT count /* Number of sectors to read */
/ B' d" P- P% ^$ t/ g9 V - );
$ |# J& g- |, | - extern int MMC_disk_write(
p; Z Y$ ~7 ]$ N - const BYTE *buff, /* Data buffer to store read data */
4 r# o3 z% P; E' \/ s - DWORD sector, /* Sector address in LBA */
7 |7 X3 h6 I- o; t, j! d1 d2 S - UINT count /* Number of sectors to read */ Z' Y$ z. `9 A7 Y. o
- );
复制代码 它只有一个框架,这个函数需要我们自己去实现它,你可以在diskio.c中实现,为了层次清晰,我新建了驱动层spi_sd.c文件,并实现了初始化。+ R/ n7 C, G$ _
朋友们以后移植的时候只修改此文件即可,ff.c是不需要修改的哦~~·
! ~# o1 ]. z; i+ B0 w9 O( U5 Y3 ?% F% w. t
& Y0 z' B7 r: `# Z! L
/ {& w: X5 x+ Z8 \' I; z; o
1 U$ X# n+ r7 Z3 s+ O
% A/ {" @ W! ?$ } |