From 517e06f63177c36968564b68c2d9d6274e212039 Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Fri, 13 Jan 2017 13:27:26 +0000 Subject: Integrated latest FatFS 0.12b. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10045 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/various/fatfs_bindings/fatfs_diskio.c | 36 ++++++++++++++++--------------- os/various/fatfs_bindings/fatfs_syscall.c | 4 ++-- 2 files changed, 21 insertions(+), 19 deletions(-) (limited to 'os/various') 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" -- cgit v1.2.3