fatfs: create separate ffsystem.c for host side testing
This commit is contained in:
parent
66bdeca603
commit
8f6606141a
7 changed files with 70 additions and 27 deletions
|
@ -3,7 +3,7 @@ idf_component_register(SRCS "diskio/diskio.c"
|
||||||
"diskio/diskio_sdmmc.c"
|
"diskio/diskio_sdmmc.c"
|
||||||
"diskio/diskio_wl.c"
|
"diskio/diskio_wl.c"
|
||||||
"src/ff.c"
|
"src/ff.c"
|
||||||
"port/ffsystem.c"
|
"port/freertos/ffsystem.c"
|
||||||
"src/ffunicode.c"
|
"src/ffunicode.c"
|
||||||
"vfs/vfs_fat.c"
|
"vfs/vfs_fat.c"
|
||||||
"vfs/vfs_fat_sdmmc.c"
|
"vfs/vfs_fat_sdmmc.c"
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
COMPONENT_ADD_INCLUDEDIRS := diskio vfs src
|
COMPONENT_ADD_INCLUDEDIRS := diskio vfs src
|
||||||
COMPONENT_SRCDIRS := diskio vfs port src
|
COMPONENT_SRCDIRS := diskio vfs port/freertos src
|
||||||
COMPONENT_OBJEXCLUDE := src/diskio.o src/ffsystem.o
|
COMPONENT_OBJEXCLUDE := src/diskio.o src/ffsystem.o
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include "diskio_impl.h"
|
#include "diskio_impl.h"
|
||||||
#include "ffconf.h"
|
#include "ffconf.h"
|
||||||
|
|
|
@ -12,12 +12,6 @@
|
||||||
#include "esp_heap_caps.h"
|
#include "esp_heap_caps.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------*/
|
|
||||||
/* Allocate a memory block */
|
|
||||||
/*------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
void* ff_memalloc ( /* Returns pointer to the allocated memory block (null on not enough core) */
|
void* ff_memalloc ( /* Returns pointer to the allocated memory block (null on not enough core) */
|
||||||
unsigned msize /* Number of bytes to allocate */
|
unsigned msize /* Number of bytes to allocate */
|
||||||
)
|
)
|
||||||
|
@ -111,4 +105,4 @@ void ff_rel_grant (
|
||||||
xSemaphoreGive(sobj);
|
xSemaphoreGive(sobj);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif // FF_FS_REENTRANT
|
46
components/fatfs/port/linux/ffsystem.c
Normal file
46
components/fatfs/port/linux/ffsystem.c
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
/*------------------------------------------------------------------------*/
|
||||||
|
/* OS Dependent Functions for FatFs */
|
||||||
|
/* (C)ChaN, 2018 */
|
||||||
|
/*------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "ff.h"
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
/* This is the implementation for host-side testing on Linux.
|
||||||
|
* Host-side tests are single threaded, so lock functionality isn't needed.
|
||||||
|
*/
|
||||||
|
|
||||||
|
void* ff_memalloc(UINT msize)
|
||||||
|
{
|
||||||
|
return malloc(msize);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ff_memfree(void* mblock)
|
||||||
|
{
|
||||||
|
free(mblock);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 1:Function succeeded, 0:Could not create the sync object */
|
||||||
|
int ff_cre_syncobj(BYTE vol, FF_SYNC_t* sobj)
|
||||||
|
{
|
||||||
|
*sobj = NULL;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 1:Function succeeded, 0:Could not delete due to an error */
|
||||||
|
int ff_del_syncobj(FF_SYNC_t sobj)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 1:Function succeeded, 0:Could not acquire lock */
|
||||||
|
int ff_req_grant (FF_SYNC_t sobj)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ff_rel_grant (FF_SYNC_t sobj)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#include "sdkconfig.h"
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------/
|
/*---------------------------------------------------------------------------/
|
||||||
/ FatFs Functional Configurations
|
/ FatFs Functional Configurations
|
||||||
/---------------------------------------------------------------------------*/
|
/---------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
SOURCE_FILES := \
|
SOURCE_FILES := \
|
||||||
$(addprefix ../src/, \
|
$(addprefix ../src/, \
|
||||||
ff.c \
|
ff.c \
|
||||||
ffsystem.c \
|
|
||||||
ffunicode.c \
|
ffunicode.c \
|
||||||
) \
|
) \
|
||||||
$(addprefix ../diskio/,\
|
$(addprefix ../diskio/,\
|
||||||
diskio.c \
|
diskio.c \
|
||||||
diskio_wl.c \
|
diskio_wl.c \
|
||||||
)
|
) \
|
||||||
|
../port/linux/ffsystem.c
|
||||||
|
|
||||||
INCLUDE_DIRS := \
|
INCLUDE_DIRS := \
|
||||||
. \
|
. \
|
||||||
|
|
Loading…
Reference in a new issue