diff --git a/README.md b/README.md index 2164c50..590390d 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,6 @@ FatFs has being developped as a personal project of the author, ChaN. See [elm-chan.org/fsw/ff](http://elm-chan.org/fsw/ff/00index_e.html) -Modified by ST, see the st_readme.txt. -Modified to fit Arduino libraries specifications. +Modified by ST, used source from [stm32_mw_fatfs](https://github.com/STMicroelectronics/stm32_mw_fatfs) and modified to fit Arduino libraries specifications. -It is used by the STM32SD library. +It is used by the [STM32SD](https://github.com/stm32duino/STM32SD) library. diff --git a/library.json b/library.json new file mode 100644 index 0000000..a0a5f1d --- /dev/null +++ b/library.json @@ -0,0 +1,26 @@ +{ + "name": "FatFS", + "keywords": "Fat, FS, Storage", + "description": "FAT file system based on open-source FatFS solution", + "repository": { + "type": "git", + "url": "https://github.com/stm32duino/FatFs.git" + }, + "version": "2.0.4", + "authors": [ + { + "url": "http://elm-chan.org/fsw/ff/00index_e.html", + "maintainer": false, + "email": "user5@elm-chan.org", + "name": "Chan" + }, + { + "url": "https://www.st.com/", + "maintainer": false, + "email": null, + "name": "STMicroelectronics" + } + ], + "frameworks": "*", + "platforms": "*" +} diff --git a/library.properties b/library.properties index ab65880..f7b0598 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=FatFs -version=2.0.3 +version=2.0.4 author=Chan , ST maintainer=stm32duino sentence=FAT file system based on open-source FatFS solution. diff --git a/src/drivers/sd_diskio.c b/src/drivers/sd_diskio.c index 3c51dad..84abc6a 100644 --- a/src/drivers/sd_diskio.c +++ b/src/drivers/sd_diskio.c @@ -105,13 +105,10 @@ const Diskio_drvTypeDef SD_Driver = /* Private functions ---------------------------------------------------------*/ static DSTATUS SD_CheckStatus(BYTE lun) { + (void)lun; Stat = STA_NOINIT; -#ifndef STM32L1xx if(BSP_SD_GetCardState() == MSD_OK) -#else /* STM32L1xx */ - if(BSP_SD_GetStatus() == MSD_OK) -#endif { Stat &= ~STA_NOINIT; } @@ -128,7 +125,6 @@ DSTATUS SD_initialize(BYTE lun) { Stat = STA_NOINIT; #if !defined(DISABLE_SD_INIT) - if(BSP_SD_Init() == MSD_OK) { Stat = SD_CheckStatus(lun); @@ -160,7 +156,7 @@ DSTATUS SD_status(BYTE lun) */ DRESULT SD_read(BYTE lun, BYTE *buff, DWORD sector, UINT count) { -#ifndef STM32L1xx + (void)lun; DRESULT res = RES_ERROR; if(BSP_SD_ReadBlocks((uint32_t*)buff, @@ -173,17 +169,6 @@ DRESULT SD_read(BYTE lun, BYTE *buff, DWORD sector, UINT count) } res = RES_OK; } -#else /* STM32L1xx */ - DRESULT res = RES_OK; - - if(BSP_SD_ReadBlocks((uint32_t*)buff, - (uint64_t) (sector * SD_DEFAULT_BLOCK_SIZE), - SD_DEFAULT_BLOCK_SIZE, - count) != MSD_OK) - { - res = RES_ERROR; - } -#endif return res; } @@ -198,7 +183,7 @@ DRESULT SD_read(BYTE lun, BYTE *buff, DWORD sector, UINT count) #if _USE_WRITE == 1 DRESULT SD_write(BYTE lun, const BYTE *buff, DWORD sector, UINT count) { -#ifndef STM32L1xx + (void)lun; DRESULT res = RES_ERROR; if(BSP_SD_WriteBlocks((uint32_t*)buff, @@ -211,16 +196,6 @@ DRESULT SD_write(BYTE lun, const BYTE *buff, DWORD sector, UINT count) } res = RES_OK; } -#else /* STM32L1xx */ - DRESULT res = RES_OK; - - if(BSP_SD_WriteBlocks((uint32_t*)buff, - (uint64_t)(sector * SD_DEFAULT_BLOCK_SIZE), - SD_DEFAULT_BLOCK_SIZE, count) != MSD_OK) - { - res = RES_ERROR; - } -#endif return res; } #endif /* _USE_WRITE == 1 */ @@ -235,12 +210,9 @@ DRESULT SD_write(BYTE lun, const BYTE *buff, DWORD sector, UINT count) #if _USE_IOCTL == 1 DRESULT SD_ioctl(BYTE lun, BYTE cmd, void *buff) { + (void)lun; DRESULT res = RES_ERROR; -#ifndef STM32L1xx - BSP_SD_CardInfo CardInfo; -#else /* STM32L1xx */ SD_CardInfo CardInfo; -#endif if (Stat & STA_NOINIT) return RES_NOTRDY; switch (cmd) @@ -253,33 +225,21 @@ DRESULT SD_ioctl(BYTE lun, BYTE cmd, void *buff) /* Get number of sectors on the disk (DWORD) */ case GET_SECTOR_COUNT : BSP_SD_GetCardInfo(&CardInfo); -#ifndef STM32L1xx *(DWORD*)buff = CardInfo.LogBlockNbr; -#else /* STM32L1xx */ - *(DWORD*)buff = CardInfo.CardCapacity / SD_DEFAULT_BLOCK_SIZE; -#endif res = RES_OK; break; /* Get R/W sector size (WORD) */ case GET_SECTOR_SIZE : -#ifndef STM32L1xx BSP_SD_GetCardInfo(&CardInfo); *(WORD*)buff = CardInfo.LogBlockSize; -#else /* STM32L1xx */ - *(WORD*)buff = SD_DEFAULT_BLOCK_SIZE; -#endif res = RES_OK; break; /* Get erase block size in unit of sector (DWORD) */ case GET_BLOCK_SIZE : -#ifndef STM32L1xx BSP_SD_GetCardInfo(&CardInfo); *(DWORD*)buff = CardInfo.LogBlockSize / SD_DEFAULT_BLOCK_SIZE; -#else /* STM32L1xx */ - *(DWORD*)buff = SD_DEFAULT_BLOCK_SIZE; -#endif res = RES_OK; break; diff --git a/src/ff_gen_drv.c b/src/ff_gen_drv.c index 5cb050e..5fc14a0 100644 --- a/src/ff_gen_drv.c +++ b/src/ff_gen_drv.c @@ -109,6 +109,7 @@ uint8_t FATFS_LinkDriver(const Diskio_drvTypeDef *drv, char *path) */ uint8_t FATFS_UnLinkDriverEx(char *path, uint8_t lun) { + (void)lun; uint8_t DiskNum = 0; uint8_t ret = 1;