From ce446b196aad77ca18a1c855e5da4d0aa85fd639 Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Thu, 7 Sep 2017 09:16:39 +0000 Subject: FatFS 0.13 integrated. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10562 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/various/fatfs_bindings/fatfs.mk | 2 +- os/various/fatfs_bindings/fatfs_diskio.c | 20 ++++++++++---------- os/various/fatfs_bindings/fatfs_syscall.c | 16 ++++++++-------- os/various/fatfs_bindings/readme.txt | 12 +++++++++--- 4 files changed, 28 insertions(+), 22 deletions(-) (limited to 'os/various') diff --git a/os/various/fatfs_bindings/fatfs.mk b/os/various/fatfs_bindings/fatfs.mk index b5441d026..d1282115b 100644 --- a/os/various/fatfs_bindings/fatfs.mk +++ b/os/various/fatfs_bindings/fatfs.mk @@ -2,6 +2,6 @@ FATFSSRC = $(CHIBIOS)/os/various/fatfs_bindings/fatfs_diskio.c \ $(CHIBIOS)/os/various/fatfs_bindings/fatfs_syscall.c \ $(CHIBIOS)/ext/fatfs/src/ff.c \ - $(CHIBIOS)/ext/fatfs/src/option/unicode.c + $(CHIBIOS)/ext/fatfs/src/ffunicode.c FATFSINC = $(CHIBIOS)/ext/fatfs/src diff --git a/os/various/fatfs_bindings/fatfs_diskio.c b/os/various/fatfs_bindings/fatfs_diskio.c index 5460eb75c..a3f9831a2 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 number (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 number (0..) */ ) { DSTATUS stat; @@ -107,7 +107,7 @@ DSTATUS disk_status ( /* Read Sector(s) */ DRESULT disk_read ( - BYTE pdrv, /* Physical drive nmuber (0..) */ + BYTE pdrv, /* Physical drive number (0..) */ BYTE *buff, /* Data buffer to store read data */ DWORD sector, /* Sector address (LBA) */ UINT count /* Number of sectors to read (1..255) */ @@ -146,9 +146,9 @@ DRESULT disk_read ( /*-----------------------------------------------------------------------*/ /* Write Sector(s) */ -#if !_FS_READONLY +#if !FF_FS_READONLY DRESULT disk_write ( - BYTE pdrv, /* Physical drive nmuber (0..) */ + BYTE pdrv, /* Physical drive number (0..) */ const BYTE *buff, /* Data to be written */ DWORD sector, /* Sector address (LBA) */ UINT count /* Number of sectors to write (1..255) */ @@ -191,7 +191,7 @@ DRESULT disk_write ( /* Miscellaneous Functions */ DRESULT disk_ioctl ( - BYTE pdrv, /* Physical drive nmuber (0..) */ + BYTE pdrv, /* Physical drive number (0..) */ BYTE cmd, /* Control code */ void *buff /* Buffer to send/receive control data */ ) @@ -204,12 +204,12 @@ DRESULT disk_ioctl ( switch (cmd) { case CTRL_SYNC: return RES_OK; -#if _MAX_SS > _MIN_SS +#if FF_MAX_SS > FF_MIN_SS case GET_SECTOR_SIZE: *((WORD *)buff) = MMCSD_BLOCK_SIZE; return RES_OK; #endif -#if _USE_TRIM +#if FF_USE_TRIM case CTRL_TRIM: mmcErase(&MMCD1, *((DWORD *)buff), *((DWORD *)buff + 1)); return RES_OK; @@ -225,7 +225,7 @@ DRESULT disk_ioctl ( case GET_SECTOR_COUNT: *((DWORD *)buff) = mmcsdGetCardCapacity(&SDCD1); return RES_OK; -#if _MAX_SS > _MIN_SS +#if FF_MAX_SS > FF_MIN_SS case GET_SECTOR_SIZE: *((WORD *)buff) = MMCSD_BLOCK_SIZE; return RES_OK; @@ -233,7 +233,7 @@ DRESULT disk_ioctl ( case GET_BLOCK_SIZE: *((DWORD *)buff) = 256; /* 512b blocks in one erase block */ return RES_OK; -#if _USE_TRIM +#if FF_USE_TRIM case CTRL_TRIM: sdcErase(&SDCD1, *((DWORD *)buff), *((DWORD *)buff + 1)); return RES_OK; diff --git a/os/various/fatfs_bindings/fatfs_syscall.c b/os/various/fatfs_bindings/fatfs_syscall.c index b72f2dd56..b7ff0306e 100644 --- a/os/various/fatfs_bindings/fatfs_syscall.c +++ b/os/various/fatfs_bindings/fatfs_syscall.c @@ -22,16 +22,16 @@ #include "hal.h" #include "ff.h" -#if _FS_REENTRANT +#if FF_FS_REENTRANT /*------------------------------------------------------------------------*/ /* Static array of Synchronization Objects */ /*------------------------------------------------------------------------*/ -static semaphore_t ff_sem[_VOLUMES]; +static semaphore_t ff_sem[FF_VOLUMES]; /*------------------------------------------------------------------------*/ /* Create a Synchronization Object */ /*------------------------------------------------------------------------*/ -int ff_cre_syncobj(BYTE vol, _SYNC_t *sobj) { +int ff_cre_syncobj(BYTE vol, FF_SYNC_t *sobj) { *sobj = &ff_sem[vol]; chSemObjectInit(*sobj, 1); @@ -41,7 +41,7 @@ int ff_cre_syncobj(BYTE vol, _SYNC_t *sobj) { /*------------------------------------------------------------------------*/ /* Delete a Synchronization Object */ /*------------------------------------------------------------------------*/ -int ff_del_syncobj(_SYNC_t sobj) { +int ff_del_syncobj(FF_SYNC_t sobj) { chSemReset(sobj, 0); return TRUE; @@ -50,22 +50,22 @@ int ff_del_syncobj(_SYNC_t sobj) { /*------------------------------------------------------------------------*/ /* Request Grant to Access the Volume */ /*------------------------------------------------------------------------*/ -int ff_req_grant(_SYNC_t sobj) { +int ff_req_grant(FF_SYNC_t sobj) { - msg_t msg = chSemWaitTimeout(sobj, (systime_t)_FS_TIMEOUT); + msg_t msg = chSemWaitTimeout(sobj, (systime_t)FF_FS_TIMEOUT); return msg == MSG_OK; } /*------------------------------------------------------------------------*/ /* Release Grant to Access the Volume */ /*------------------------------------------------------------------------*/ -void ff_rel_grant(_SYNC_t sobj) { +void ff_rel_grant(FF_SYNC_t sobj) { chSemSignal(sobj); } #endif /* _FS_REENTRANT */ -#if _USE_LFN == 3 /* LFN with a working buffer on the heap */ +#if FF_USE_LFN == 3 /* LFN with a working buffer on the heap */ /*------------------------------------------------------------------------*/ /* Allocate a memory block */ /*------------------------------------------------------------------------*/ diff --git a/os/various/fatfs_bindings/readme.txt b/os/various/fatfs_bindings/readme.txt index 8735cce54..b6000aeab 100644 --- a/os/various/fatfs_bindings/readme.txt +++ b/os/various/fatfs_bindings/readme.txt @@ -1,6 +1,12 @@ This directory contains the ChibiOS/RT "official" bindings with the FatFS library by ChaN: http://elm-chan.org -In order to use FatFS within ChibiOS/RT project, unzip FatFS under -./ext/fatfs then include $(CHIBIOS)/os/various/fatfs_bindings/fatfs.mk -in your makefile. +In order to use FatFS within ChibiOS/RT project: +1. unzip FatFS under ./ext/fatfs [See Note 2] +2. include $(CHIBIOS)/os/various/fatfs_bindings/fatfs.mk in your makefile. +3. Add $(FATFSSRC) to $(CSRC) +4. Add $(FATFSINC) to $(INCDIR) + +Note: +1. These files modified for use with version 0.13 of fatfs. +2. In the original distribution, the source directory is called 'source' rather than 'src' -- cgit v1.2.3