aboutsummaryrefslogtreecommitdiffstats
path: root/os/various
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2017-01-13 13:27:26 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2017-01-13 13:27:26 +0000
commit517e06f63177c36968564b68c2d9d6274e212039 (patch)
tree898079ba3d561f866f115aab3142a96f1c9915e7 /os/various
parentc1883b77595e416c8693a60fb370a6b78d4aadf5 (diff)
downloadChibiOS-517e06f63177c36968564b68c2d9d6274e212039.tar.gz
ChibiOS-517e06f63177c36968564b68c2d9d6274e212039.tar.bz2
ChibiOS-517e06f63177c36968564b68c2d9d6274e212039.zip
Integrated latest FatFS 0.12b.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10045 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/various')
-rw-r--r--os/various/fatfs_bindings/fatfs_diskio.c36
-rw-r--r--os/various/fatfs_bindings/fatfs_syscall.c4
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"