diff options
Diffstat (limited to 'os/various/fatfs_bindings')
-rw-r--r-- | os/various/fatfs_bindings/fatfs_diskio.c | 36 | ||||
-rw-r--r-- | os/various/fatfs_bindings/fatfs_syscall.c | 4 |
2 files changed, 21 insertions, 19 deletions
diff --git a/os/various/fatfs_bindings/fatfs_diskio.c b/os/various/fatfs_bindings/fatfs_diskio.c index 9cd3ea894..93b5a44b3 100644 --- a/os/various/fatfs_bindings/fatfs_diskio.c +++ b/os/various/fatfs_bindings/fatfs_diskio.c @@ -37,7 +37,7 @@ extern RTCDriver RTCD1; /* Inidialize a Drive */
DSTATUS disk_initialize (
- BYTE pdrv /* Physical drive nmuber (0..) */
+ BYTE pdrv /* Physical drive nmuber (0..) */
)
{
DSTATUS stat;
@@ -72,7 +72,7 @@ DSTATUS disk_initialize ( /* Return Disk Status */
DSTATUS disk_status (
- BYTE pdrv /* Physical drive nmuber (0..) */
+ BYTE pdrv /* Physical drive nmuber (0..) */
)
{
DSTATUS stat;
@@ -108,8 +108,8 @@ DSTATUS disk_status ( DRESULT disk_read (
BYTE pdrv, /* Physical drive nmuber (0..) */
- BYTE *buff, /* Data buffer to store read data */
- DWORD sector, /* Sector address (LBA) */
+ BYTE *buff, /* Data buffer to store read data */
+ DWORD sector, /* Sector address (LBA) */
UINT count /* Number of sectors to read (1..255) */
)
{
@@ -146,12 +146,12 @@ DRESULT disk_read ( /*-----------------------------------------------------------------------*/
/* Write Sector(s) */
-#if _USE_WRITE
+#if !_FS_READONLY
DRESULT disk_write (
- BYTE pdrv, /* Physical drive nmuber (0..) */
- const BYTE *buff, /* Data to be written */
- DWORD sector, /* Sector address (LBA) */
- UINT count /* Number of sectors to write (1..255) */
+ BYTE pdrv, /* Physical drive nmuber (0..) */
+ const BYTE *buff, /* Data to be written */
+ DWORD sector, /* Sector address (LBA) */
+ UINT count /* Number of sectors to write (1..255) */
)
{
switch (pdrv) {
@@ -183,17 +183,16 @@ DRESULT disk_write ( }
return RES_PARERR;
}
-#endif /* _USE_WRITE */
+#endif /* _FS_READONLY */
/*-----------------------------------------------------------------------*/
/* Miscellaneous Functions */
-#if _USE_IOCTL
DRESULT disk_ioctl (
BYTE pdrv, /* Physical drive nmuber (0..) */
- BYTE cmd, /* Control code */
+ BYTE cmd, /* Control code */
void *buff /* Buffer to send/receive control data */
)
{
@@ -203,11 +202,13 @@ DRESULT disk_ioctl ( switch (cmd) {
case CTRL_SYNC:
return RES_OK;
+#if _MAX_SS > _MIN_SS
case GET_SECTOR_SIZE:
*((WORD *)buff) = MMCSD_BLOCK_SIZE;
return RES_OK;
-#if _USE_ERASE
- case CTRL_ERASE_SECTOR:
+#endif
+#if _USE_TRIM
+ case CTRL_TRIM:
mmcErase(&MMCD1, *((DWORD *)buff), *((DWORD *)buff + 1));
return RES_OK;
#endif
@@ -222,14 +223,16 @@ DRESULT disk_ioctl ( case GET_SECTOR_COUNT:
*((DWORD *)buff) = mmcsdGetCardCapacity(&SDCD1);
return RES_OK;
+#if _MAX_SS > _MIN_SS
case GET_SECTOR_SIZE:
*((WORD *)buff) = MMCSD_BLOCK_SIZE;
return RES_OK;
+#endif
case GET_BLOCK_SIZE:
*((DWORD *)buff) = 256; /* 512b blocks in one erase block */
return RES_OK;
-#if _USE_ERASE
- case CTRL_ERASE_SECTOR:
+#if _USE_TRIM
+ case CTRL_TRIM:
sdcErase(&SDCD1, *((DWORD *)buff), *((DWORD *)buff + 1));
return RES_OK;
#endif
@@ -240,7 +243,6 @@ DRESULT disk_ioctl ( }
return RES_PARERR;
}
-#endif /* _USE_IOCTL */
DWORD get_fattime(void) {
#if HAL_USE_RTC
diff --git a/os/various/fatfs_bindings/fatfs_syscall.c b/os/various/fatfs_bindings/fatfs_syscall.c index 48dc3e7cf..b72f2dd56 100644 --- a/os/various/fatfs_bindings/fatfs_syscall.c +++ b/os/various/fatfs_bindings/fatfs_syscall.c @@ -15,8 +15,8 @@ */
/*------------------------------------------------------------------------*/
-/* Sample code of OS dependent controls for FatFs R0.08b */
-/* (C)ChaN, 2011 */
+/* Sample code of OS dependent controls for FatFs */
+/* (C)ChaN, 2014 */
/*------------------------------------------------------------------------*/
#include "hal.h"
|