Merge branch 'feature/fat_configure_volumes_kconfig' into 'master'

FAT: Number of volumes can now be configured through menuconfig

Closes IDFGH-5806

See merge request espressif/esp-idf!15445
This commit is contained in:
Omar Chebib
2021-10-21 06:49:07 +00:00
6 changed files with 22 additions and 32 deletions

View File

@@ -1,5 +1,12 @@
menu "FAT Filesystem support" menu "FAT Filesystem support"
config FATFS_VOLUME_COUNT
int "Number of volumes"
default 2
range 1 10
help
Number of volumes (logical drives) to use.
choice FATFS_CHOOSE_CODEPAGE choice FATFS_CHOOSE_CODEPAGE
prompt "OEM Code Page" prompt "OEM Code Page"
default FATFS_CODEPAGE_437 default FATFS_CODEPAGE_437

View File

@@ -1,16 +1,8 @@
// Copyright 2015-2017 Espressif Systems (Shanghai) PTE LTD /*
// * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
// Licensed under the Apache License, Version 2.0 (the "License"); *
// you may not use this file except in compliance with the License. * SPDX-License-Identifier: Apache-2.0
// You may obtain a copy of the License at */
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include <string.h> #include <string.h>
#include "diskio_impl.h" #include "diskio_impl.h"
@@ -24,8 +16,7 @@
static const char* TAG = "ff_diskio_spiflash"; static const char* TAG = "ff_diskio_spiflash";
wl_handle_t ff_wl_handles[FF_VOLUMES] = { wl_handle_t ff_wl_handles[FF_VOLUMES] = {
WL_INVALID_HANDLE, [0 ... FF_VOLUMES - 1] = WL_INVALID_HANDLE
WL_INVALID_HANDLE,
}; };
DSTATUS ff_wl_initialize (BYTE pdrv) DSTATUS ff_wl_initialize (BYTE pdrv)

View File

@@ -181,7 +181,7 @@
/ Drive/Volume Configurations / Drive/Volume Configurations
/---------------------------------------------------------------------------*/ /---------------------------------------------------------------------------*/
#define FF_VOLUMES 2 #define FF_VOLUMES CONFIG_FATFS_VOLUME_COUNT
/* Number of volumes (logical drives) to be used. (1-10) */ /* Number of volumes (logical drives) to be used. (1-10) */

View File

@@ -11,3 +11,5 @@
#define CONFIG_ESPTOOLPY_FLASHSIZE "8MB" #define CONFIG_ESPTOOLPY_FLASHSIZE "8MB"
//currently use the legacy implementation, since the stubs for new HAL are not done yet //currently use the legacy implementation, since the stubs for new HAL are not done yet
#define CONFIG_SPI_FLASH_USE_LEGACY_IMPL 1 #define CONFIG_SPI_FLASH_USE_LEGACY_IMPL 1
#define CONFIG_FATFS_VOLUME_COUNT 2

View File

@@ -1,16 +1,8 @@
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD /*
// * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
// Licensed under the Apache License, Version 2.0 (the "License"); *
// you may not use this file except in compliance with the License. * SPDX-License-Identifier: Apache-2.0
// You may obtain a copy of the License at */
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
@@ -92,7 +84,7 @@ static int vfs_fat_truncate(void* ctx, const char *path, off_t length);
static int vfs_fat_utime(void* ctx, const char *path, const struct utimbuf *times); static int vfs_fat_utime(void* ctx, const char *path, const struct utimbuf *times);
#endif // CONFIG_VFS_SUPPORT_DIR #endif // CONFIG_VFS_SUPPORT_DIR
static vfs_fat_ctx_t* s_fat_ctxs[FF_VOLUMES] = { NULL, NULL }; static vfs_fat_ctx_t* s_fat_ctxs[FF_VOLUMES] = { NULL };
//backwards-compatibility with esp_vfs_fat_unregister() //backwards-compatibility with esp_vfs_fat_unregister()
static vfs_fat_ctx_t* s_fat_ctx = NULL; static vfs_fat_ctx_t* s_fat_ctx = NULL;

View File

@@ -1244,7 +1244,6 @@ components/fatfs/diskio/diskio_rawflash.c
components/fatfs/diskio/diskio_rawflash.h components/fatfs/diskio/diskio_rawflash.h
components/fatfs/diskio/diskio_sdmmc.c components/fatfs/diskio/diskio_sdmmc.c
components/fatfs/diskio/diskio_sdmmc.h components/fatfs/diskio/diskio_sdmmc.h
components/fatfs/diskio/diskio_wl.c
components/fatfs/diskio/diskio_wl.h components/fatfs/diskio/diskio_wl.h
components/fatfs/port/freertos/ffsystem.c components/fatfs/port/freertos/ffsystem.c
components/fatfs/port/linux/ffsystem.c components/fatfs/port/linux/ffsystem.c
@@ -1264,7 +1263,6 @@ components/fatfs/test_fatfs_host/main.cpp
components/fatfs/test_fatfs_host/sdkconfig/sdkconfig.h components/fatfs/test_fatfs_host/sdkconfig/sdkconfig.h
components/fatfs/test_fatfs_host/test_fatfs.cpp components/fatfs/test_fatfs_host/test_fatfs.cpp
components/fatfs/vfs/esp_vfs_fat.h components/fatfs/vfs/esp_vfs_fat.h
components/fatfs/vfs/vfs_fat.c
components/fatfs/vfs/vfs_fat_internal.h components/fatfs/vfs/vfs_fat_internal.h
components/fatfs/vfs/vfs_fat_sdmmc.c components/fatfs/vfs/vfs_fat_sdmmc.c
components/fatfs/vfs/vfs_fat_spiflash.c components/fatfs/vfs/vfs_fat_spiflash.c