Commit Graph

124 Commits

Author SHA1 Message Date
Ivan Grokhotkov
5ac28e843d fatfs: clean up diskio code
- clean up diskio_spiflash, fix the max number of volumes supported
- move SDMMC code into a separate file
2017-05-05 15:21:38 +08:00
Ivan Grokhotkov
4e3ea66ec4 fatfs: run same fatfs tests for WL and SDMMC
This change moves actual test code into test_fatfs_common.c and
refactors setup/teardown code to be contained within separate functions.
For each SDMMC FATFS test, identical test is added which can run with
WL partition in flash.
2017-05-05 15:21:38 +08:00
Ivan Grokhotkov
d18157e108 vfs_fat: allocate FIL structures on the heap in vfs_fat_link
vfs_fat_link opened two files to perform copy operation. File structures
were allocated on the stack. When _MAX_SS setting was increased in
ffconf.h due to wear levelling feature, the size of these structures
increased to ~4k each (~8k total). This exceeds stack size allocated for
tasks in most typical cases.

This change makes file structures dynamically allocated.
2017-05-05 15:21:37 +08:00
Ivan Grokhotkov
1a73b41b10 vfs_fat: fix prepend_drive_to_path
Originally, prepend_drive_to_path was designed to be a macro, and it
modified local path variables to point to a temporary buffers.
When it was converted into a function, modification to path variables
were no longer visible outside of this function.

In addition to that, prepend_drive_to_path allocated 2k bytes on the
stack for temporary path buffers. This is replaced with path buffers
allocated as part of vfs_fat context object. Locking is added around
parts of code which use these temporary buffers.

Additionally, _lock member of vfs_fat_ctx_t was placed after the
variable-sized files array, which caused the first entry in the
array to be never used. This change fixes the order of members
and adds comments.
2017-05-05 15:21:37 +08:00
Nineis K
b65779eefe Fix vfs_fat_spiflash failed to mount / f_mkfs() 2017-05-04 17:31:14 +08:00
Ivan Grokhotkov
b540322dc1 Merge branch 'feature/wear_levelling' into 'master'
wear levelling

This MR adds wear levelling component. It presents an interface similar to the interface of spi_flash and esp_partition. Inside, it stores data inside a partition to in a way that reduces worst case number of erase cycles for any given sector.

Also included are APIs similar to the ones provided for SDMMC to mount FAT filesystem on top of the wear levelling partition. A simple example shows how this API can be used.

Ref TW10338.

See merge request !567
2017-04-25 19:46:11 +08:00
Ivan Grokhotkov
8f02730e1f fat/sdmmc: unmount FATFS object on error
Failure to call f_mount(NULL,...) makes FATFS attempt to clean up the old
FS object upon next mount. If previous mount operation has failed, some
parts of FS object may not be fully initialized, which will cause errors
(such as attempting to delete a mutex which wasn’t allocated).
2017-04-19 15:03:30 +08:00
Ivan Grokhotkov
52b51df859 add wear_levelling component and example 2017-04-17 11:01:17 +08:00
Dmitry Yakovlev
aeabbd305c fatfs: add support for small disc sizes (less then 16 MB) 2017-04-17 11:01:17 +08:00
Ivan Grokhotkov
7388efa953 fatfs: add support for variable sector size 2017-04-17 11:01:17 +08:00
Angus Gratton
5f549aab2e fatfs: Support for Long Filenames 2017-03-08 09:54:40 +11:00
Ivan Grokhotkov
4ecd26ce77 Merge branch 'feature/fatfs_dynamic_pdrv' into 'master'
FATFS enable support for multiple drives

Current implementation has drive numbers and paths hardcoded to support
only one FATFS drive. Arduino has it's own SPI driver to allow
compatibility and flexibility. With the MR it is possible to have up to
```_VOLUMES``` drives connected (SPI, SDMMC and others) at the same
time and accessed through VFS

See merge request !478
2017-03-03 11:40:37 +08:00
Ivan Grokhotkov
c17e05040a vfs_fat_sdmmc: if card init fails, fail cleanly
This fixes the issue with sdmmc_host not returned to clean state after
a failed attempt to mount the card, with no SD card in the slot.
2017-02-24 21:04:22 +08:00
Angus Gratton
9cea5ea075 fatfs: Add unit test for overwrite/append fix 2017-02-15 18:04:28 +11:00
nineisk
57af0d70d3 Fix fopen() in “a” (append) mode
fopen() does not work when file is opened in “a” (append) mode
2017-02-14 16:15:08 +11:00
me-no-dev
0eeda99a8c pick better name for unregister function and update docs 2017-02-02 12:24:38 +02:00
me-no-dev
972c6f0cae implement review recomendations 2017-02-01 17:55:25 +02:00
me-no-dev
a57b6326e3 Fix ``if`` breaking the path 2017-01-31 17:43:22 +02:00
me-no-dev
84590ec0a4 FATFS enable support for multiple drives
Current implementation has drive numbers and paths hardcoded to support
only one FATFS drive. Arduino has it's own SPI driver to allow
compatibility and flexibility. With the MR it is possible to have up to
```_VOLUMES``` drives connected (SPI, SDMMC and others) at the same
time and accessed through VFS
2017-01-31 17:23:25 +02:00
antti
f8b5c29346 esp32: add [ignore] tag to some unit test cases for CI
Add ignore tag on unit test cases that are not supported in CI yet
2017-01-18 17:08:20 +08:00
Ivan Grokhotkov
44ce833d76 fatfs: add vfs support 2017-01-09 05:54:04 +08:00
Ivan Grokhotkov
d418776982 fatfs: rename DIR to FF_DIR to avoid conflict with dirent.h 2017-01-09 04:51:24 +08:00
Ivan Grokhotkov
9398d1b1cc fatfs: add pluggable diskio layer, sdmmc implementation 2017-01-09 04:51:24 +08:00
Ivan Grokhotkov
1440c866fc fatfs: import version 0.12b 2017-01-09 04:51:24 +08:00