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 /* Inidialize a Drive                                                    */ 
  13 DSTATUS 
disk_initialize ( 
  14         BYTE drv                                
/* Physical drive nmuber (0..) */ 
  22 /*-----------------------------------------------------------------------*/ 
  23 /* Return Disk Status                                                    */ 
  26         BYTE drv                
/* Physical drive nmuber (0..) */ 
  34 /*-----------------------------------------------------------------------*/ 
  38         BYTE drv
,               /* Physical drive nmuber (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..255) */ 
  44         DataflashManager_ReadBlocks_RAM(sector
, count
, buff
); 
  50 /*-----------------------------------------------------------------------*/ 
  55         BYTE drv
,                       /* Physical drive nmuber (0..) */ 
  56         const BYTE 
*buff
,       /* Data to be written */ 
  57         DWORD sector
,           /* Sector address (LBA) */ 
  58         BYTE count                      
/* Number of sectors to write (1..255) */ 
  61         DataflashManager_WriteBlocks_RAM(sector
, count
, buff
); 
  64 #endif /* _READONLY */ 
  68 /*-----------------------------------------------------------------------*/ 
  69 /* Miscellaneous Functions                                               */ 
  72         BYTE drv
,               /* Physical drive nmuber (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         uint8_t Day
,  Month
,  Year
; 
  87         uint8_t Hour
, Minute
, Second
; 
  89         DS1307_GetDate(&Day
,  &Month
,  &Year
); 
  90         DS1307_GetTime(&Hour
, &Minute
, &Second
); 
  93         return ((DWORD
)(20 + Year
) << 25) | 
  94                      ((DWORD
)Month 
<< 21) | 
  97                      ((DWORD
)Minute 
<< 5) | 
  98               (((DWORD
)Second 
>> 1) << 0);