1 /*-----------------------------------------------------------------------*/
2 /* Low level disk I/O module skeleton for FatFs (C)ChaN, 2007 */
3 /*-----------------------------------------------------------------------*/
4 /* This is a stub disk I/O module that acts as front end of the existing */
5 /* disk I/O modules and attach it to FatFs module with common interface. */
6 /*-----------------------------------------------------------------------*/
10 /*-----------------------------------------------------------------------*/
11 /* Initialize a Drive */
13 DSTATUS disk_initialize (
14 BYTE drv /* Physical drive number (0..) */
22 /*-----------------------------------------------------------------------*/
23 /* Return Disk Status */
26 BYTE drv /* Physical drive number (0..) */
34 /*-----------------------------------------------------------------------*/
38 BYTE drv, /* Physical drive number (0..) */
39 BYTE *buff, /* Data buffer to store read data */
40 DWORD sector, /* Sector address (LBA) */
41 BYTE count /* Number of sectors to read (1..128) */
44 DataflashManager_ReadBlocks_RAM(sector, count, buff);
50 /*-----------------------------------------------------------------------*/
55 BYTE drv, /* Physical drive number (0..) */
56 const BYTE *buff, /* Data to be written */
57 DWORD sector, /* Sector address (LBA) */
58 BYTE count /* Number of sectors to write (1..128) */
61 DataflashManager_WriteBlocks_RAM(sector, count, buff);
64 #endif /* _READONLY */
68 /*-----------------------------------------------------------------------*/
69 /* Miscellaneous Functions */
72 BYTE drv, /* Physical drive number (0..) */
73 BYTE ctrl, /* Control code */
74 void *buff /* Buffer to send/receive control data */
77 if (ctrl == CTRL_SYNC)
84 DWORD get_fattime (void)
86 TimeDate_t CurrTimeDate;
88 RTC_GetTimeDate(&CurrTimeDate);
91 return ((DWORD)(20 + CurrTimeDate.Year) << 25) |
92 ((DWORD)CurrTimeDate.Month << 21) |
93 ((DWORD)CurrTimeDate.Day << 16) |
94 ((DWORD)CurrTimeDate.Hour << 11) |
95 ((DWORD)CurrTimeDate.Minute << 5) |
96 (((DWORD)CurrTimeDate.Second >> 1) << 0);