[fix][fatfs] add user macro FS_MAX_SS,fix pDiskioDriver register when using one more interface
This commit is contained in:
parent
2bbc0486ec
commit
65c7e5238f
@ -40,21 +40,37 @@ FATFS_DiskioDriverTypeDef pDiskioDriver = {
|
|||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
void disk_driver_callback_init(FATFS_DiskioDriverTypeDef *pNewDriver)
|
void disk_driver_callback_init(FATFS_DiskioDriverTypeDef *pNewDriver)
|
||||||
{
|
{
|
||||||
|
if (pNewDriver->RAM_disk_status)
|
||||||
pDiskioDriver.RAM_disk_status = pNewDriver->RAM_disk_status;
|
pDiskioDriver.RAM_disk_status = pNewDriver->RAM_disk_status;
|
||||||
|
if (pNewDriver->MMC_disk_status)
|
||||||
pDiskioDriver.MMC_disk_status = pNewDriver->MMC_disk_status;
|
pDiskioDriver.MMC_disk_status = pNewDriver->MMC_disk_status;
|
||||||
|
if (pNewDriver->USB_disk_status)
|
||||||
pDiskioDriver.USB_disk_status = pNewDriver->USB_disk_status;
|
pDiskioDriver.USB_disk_status = pNewDriver->USB_disk_status;
|
||||||
|
if (pNewDriver->RAM_disk_initialize)
|
||||||
pDiskioDriver.RAM_disk_initialize = pNewDriver->RAM_disk_initialize;
|
pDiskioDriver.RAM_disk_initialize = pNewDriver->RAM_disk_initialize;
|
||||||
|
if (pNewDriver->MMC_disk_initialize)
|
||||||
pDiskioDriver.MMC_disk_initialize = pNewDriver->MMC_disk_initialize;
|
pDiskioDriver.MMC_disk_initialize = pNewDriver->MMC_disk_initialize;
|
||||||
|
if (pNewDriver->USB_disk_initialize)
|
||||||
pDiskioDriver.USB_disk_initialize = pNewDriver->USB_disk_initialize;
|
pDiskioDriver.USB_disk_initialize = pNewDriver->USB_disk_initialize;
|
||||||
|
if (pNewDriver->RAM_disk_read)
|
||||||
pDiskioDriver.RAM_disk_read = pNewDriver->RAM_disk_read;
|
pDiskioDriver.RAM_disk_read = pNewDriver->RAM_disk_read;
|
||||||
|
if (pNewDriver->MMC_disk_read)
|
||||||
pDiskioDriver.MMC_disk_read = pNewDriver->MMC_disk_read;
|
pDiskioDriver.MMC_disk_read = pNewDriver->MMC_disk_read;
|
||||||
|
if (pNewDriver->USB_disk_read)
|
||||||
pDiskioDriver.USB_disk_read = pNewDriver->USB_disk_read;
|
pDiskioDriver.USB_disk_read = pNewDriver->USB_disk_read;
|
||||||
|
if (pNewDriver->RAM_disk_write)
|
||||||
pDiskioDriver.RAM_disk_write = pNewDriver->RAM_disk_write;
|
pDiskioDriver.RAM_disk_write = pNewDriver->RAM_disk_write;
|
||||||
|
if (pNewDriver->MMC_disk_write)
|
||||||
pDiskioDriver.MMC_disk_write = pNewDriver->MMC_disk_write;
|
pDiskioDriver.MMC_disk_write = pNewDriver->MMC_disk_write;
|
||||||
|
if (pNewDriver->USB_disk_write)
|
||||||
pDiskioDriver.USB_disk_write = pNewDriver->USB_disk_write;
|
pDiskioDriver.USB_disk_write = pNewDriver->USB_disk_write;
|
||||||
|
if (pNewDriver->RAM_disk_ioctl)
|
||||||
pDiskioDriver.RAM_disk_ioctl = pNewDriver->RAM_disk_ioctl;
|
pDiskioDriver.RAM_disk_ioctl = pNewDriver->RAM_disk_ioctl;
|
||||||
|
if (pNewDriver->MMC_disk_ioctl)
|
||||||
pDiskioDriver.MMC_disk_ioctl = pNewDriver->MMC_disk_ioctl;
|
pDiskioDriver.MMC_disk_ioctl = pNewDriver->MMC_disk_ioctl;
|
||||||
|
if (pNewDriver->USB_disk_ioctl)
|
||||||
pDiskioDriver.USB_disk_ioctl = pNewDriver->USB_disk_ioctl;
|
pDiskioDriver.USB_disk_ioctl = pNewDriver->USB_disk_ioctl;
|
||||||
|
if (pNewDriver->Translate_Result_Code)
|
||||||
pDiskioDriver.Translate_Result_Code = pNewDriver->Translate_Result_Code;
|
pDiskioDriver.Translate_Result_Code = pNewDriver->Translate_Result_Code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,10 +30,11 @@
|
|||||||
#include "fatfs_posix_api.h"
|
#include "fatfs_posix_api.h"
|
||||||
#include "ff.h"
|
#include "ff.h"
|
||||||
#include "stdlib.h"
|
#include "stdlib.h"
|
||||||
|
#include "string.h"
|
||||||
|
|
||||||
/*Memory request interface*/
|
/*Memory request interface*/
|
||||||
static void *(*vfs_malloc)(size_t size) = mmheap_alloc; //默认的内存申请接口
|
static void *(*vfs_malloc)(size_t size) = malloc; //默认的内存申请接口
|
||||||
static void (*vfs_free)(void *ptr) = mmheap_free; //默认的内存释放接口
|
static void (*vfs_free)(void *ptr) = free; //默认的内存释放接口
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief fs init
|
* @brief fs init
|
||||||
|
@ -36,7 +36,7 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "ff.h"
|
#include "ff.h"
|
||||||
#include "drv_mmheap.h"
|
#include "stdio.h"
|
||||||
|
|
||||||
typedef int ff_dev_t; //32为int数据,高12位主设备号,低20位次设备号
|
typedef int ff_dev_t; //32为int数据,高12位主设备号,低20位次设备号
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@
|
|||||||
/* Number of volumes (logical drives) to be used. (1-10) */
|
/* Number of volumes (logical drives) to be used. (1-10) */
|
||||||
|
|
||||||
#define FF_STR_VOLUME_ID 1
|
#define FF_STR_VOLUME_ID 1
|
||||||
#define FF_VOLUME_STRS "sd2", "sd", "ram", "nand", "cg", "usb",
|
#define FF_VOLUME_STRS "ram", "sd", "usb", "nand", "cg", "sd2",
|
||||||
/* FF_STR_VOLUME_ID switches support for volume ID in arbitrary strings.
|
/* FF_STR_VOLUME_ID switches support for volume ID in arbitrary strings.
|
||||||
/ When FF_STR_VOLUME_ID is set to 1 or 2, arbitrary strings can be used as drive
|
/ When FF_STR_VOLUME_ID is set to 1 or 2, arbitrary strings can be used as drive
|
||||||
/ number in the path name. FF_VOLUME_STRS defines the volume ID strings for each
|
/ number in the path name. FF_VOLUME_STRS defines the volume ID strings for each
|
||||||
@ -172,7 +172,9 @@
|
|||||||
/ funciton will be available. */
|
/ funciton will be available. */
|
||||||
|
|
||||||
#define FF_MIN_SS 512
|
#define FF_MIN_SS 512
|
||||||
|
#ifndef FF_MAX_SS
|
||||||
#define FF_MAX_SS 512
|
#define FF_MAX_SS 512
|
||||||
|
#endif
|
||||||
/* This set of options configures the range of sector size to be supported. (512,
|
/* This set of options configures the range of sector size to be supported. (512,
|
||||||
/ 1024, 2048 or 4096) Always set both 512 for most systems, generic memory card and
|
/ 1024, 2048 or 4096) Always set both 512 for most systems, generic memory card and
|
||||||
/ harddisk. But a larger value may be required for on-board flash memory and some
|
/ harddisk. But a larger value may be required for on-board flash memory and some
|
||||||
|
Reference in New Issue
Block a user