lib/fatfs: Unify fatfs configuration.

- A single ffcon.h file to configure fatfs settings across ports.
- A single diskio.h file with common drive definitions.
- Removed now reduntand ffconf_template.h.
This commit is contained in:
Alex March 2015-11-06 22:56:48 +00:00 committed by Damien George
parent 6e68a68d18
commit 34472302d6
2 changed files with 339 additions and 266 deletions

View File

@ -38,6 +38,10 @@ DRESULT disk_read (BYTE pdrv, BYTE* buff, DWORD sector, UINT count);
DRESULT disk_write (BYTE pdrv, const BYTE* buff, DWORD sector, UINT count);
DRESULT disk_ioctl (BYTE pdrv, BYTE cmd, void* buff);
/* Definitions of physical drive number for each media */
#define PD_FLASH (0) /* Map FLASH drive to drive number 0 */
#define PD_SDCARD (1) /* Map SDCARD drive to drive number 1 */
#define PD_USER (2) /* Map USER mounts to drive number 2 */
/* Disk Status Bits (DSTATUS) */

View File

@ -1,14 +1,45 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
*
* Original file from:
* FatFs - FAT file system module configuration file R0.10c (C)ChaN, 2014
*
* The MIT License (MIT)
*
* Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
/*---------------------------------------------------------------------------/
/ FatFs - FAT file system module configuration file R0.11 (C)ChaN, 2015
/---------------------------------------------------------------------------*/
#ifndef _FFCONF
#define _FFCONF 32020 /* Revision ID */
#include "py/mpconfig.h"
/*---------------------------------------------------------------------------/
/ Functions and Buffer Configurations
/---------------------------------------------------------------------------*/
#define _FS_TINY 0
#define _FS_TINY 1
/* This option switches tiny buffer configuration. (0:Normal or 1:Tiny)
/ At the tiny configuration, size of the file object (FIL) is reduced _MAX_SS
/ bytes. Instead of private sector buffer eliminated from the file object,
@ -47,15 +78,18 @@
/ f_findfirst() and f_findnext(). (0:Disable or 1:Enable) */
#define _USE_MKFS 0
#define _USE_MKFS 1
/* This option switches f_mkfs() function. (0:Disable or 1:Enable) */
#define _USE_FASTSEEK 0
/* This option switches fast seek feature. (0:Disable or 1:Enable) */
#ifdef MICROPY_FATFS_USE_LABEL
#define _USE_LABEL (MICROPY_FATFS_USE_LABEL)
#else
#define _USE_LABEL 0
#endif
/* This option switches volume label functions, f_getlabel() and f_setlabel().
/ (0:Disable or 1:Enable) */
@ -68,8 +102,11 @@
/*---------------------------------------------------------------------------/
/ Locale and Namespace Configurations
/---------------------------------------------------------------------------*/
#define _CODE_PAGE 932
#ifdef MICROPY_FATFS_LFN_CODE_PAGE
#define _CODE_PAGE (MICROPY_FATFS_LFN_CODE_PAGE)
#else
#define _CODE_PAGE 1
#endif
/* This option specifies the OEM code page to be used on the target system.
/ Incorrect setting of the code page can cause a file open failure.
/
@ -92,9 +129,16 @@
/ 950 - Traditional Chinese Big5 (DBCS)
*/
#ifdef MICROPY_FATFS_ENABLE_LFN
#define _USE_LFN (MICROPY_FATFS_ENABLE_LFN)
#else
#define _USE_LFN 0
#endif
#ifdef MICROPY_FATFS_MAX_LFN
#define _MAX_LFN (MICROPY_FATFS_MAX_LFN)
#else
#define _MAX_LFN 255
#endif
/* The _USE_LFN option switches the LFN feature.
/
/ 0: Disable LFN feature. _MAX_LFN has no effect.
@ -126,8 +170,11 @@
/
/ When _LFN_UNICODE is 0, this option has no effect. */
#ifdef MICROPY_FATFS_RPATH
#define _FS_RPATH (MICROPY_FATFS_RPATH)
#else
#define _FS_RPATH 0
#endif
/* This option configures relative path feature.
/
/ 0: Disable relative path feature and remove related functions.
@ -141,7 +188,11 @@
/ Drive/Volume Configurations
/---------------------------------------------------------------------------*/
#ifdef MICROPY_FATFS_VOLUMES
#define _VOLUMES (MICROPY_FATFS_VOLUMES)
#else
#define _VOLUMES 1
#endif
/* Number of volumes (logical drives) to be used. */
@ -153,8 +204,11 @@
/ logical drives. Number of items must be equal to _VOLUMES. Valid characters for
/ the drive ID strings are: A-Z and 0-9. */
#ifdef MICROPY_FATFS_MULTI_PARTITION
#define _MULTI_PARTITION (MICROPY_FATFS_MULTI_PARTITION)
#else
#define _MULTI_PARTITION 0
#endif
/* This option switches multi-partition feature. By default (0), each logical drive
/ number is bound to the same physical drive number and only an FAT volume found on
/ the physical drive will be mounted. When multi-partition feature is enabled (1),
@ -220,10 +274,24 @@
/ can be opened simultaneously under file lock control. Note that the file
/ lock feature is independent of re-entrancy. */
#ifdef MICROPY_FATFS_REENTRANT
#define _FS_REENTRANT (MICROPY_FATFS_REENTRANT)
#else
#define _FS_REENTRANT 0
#endif
// milliseconds
#ifdef MICROPY_FATFS_TIMEOUT
#define _FS_TIMEOUT (MICROPY_FATFS_TIMEOUT)
#else
#define _FS_TIMEOUT 1000
#endif
#ifdef MICROPY_FATFS_SYNC_T
#define _SYNC_t MICROPY_FATFS_SYNC_T
#else
#define _SYNC_t HANDLE
#endif
/* The _FS_REENTRANT option switches the re-entrancy (thread safe) of the FatFs
/ module itself. Note that regardless of this option, file access to different
/ volume is always re-entrant and volume control functions, f_mount(), f_mkfs()
@ -264,3 +332,4 @@
/ PIC32 0 H8/300H 0 8051 0/1
*/
#endif // _FFCONF