fatfs: create separate ffsystem.c for host side testing

This commit is contained in:
Ivan Grokhotkov 2019-06-21 15:33:10 +08:00
parent 66bdeca603
commit 8f6606141a
7 changed files with 70 additions and 27 deletions

View file

@ -3,7 +3,7 @@ idf_component_register(SRCS "diskio/diskio.c"
"diskio/diskio_sdmmc.c"
"diskio/diskio_wl.c"
"src/ff.c"
"port/ffsystem.c"
"port/freertos/ffsystem.c"
"src/ffunicode.c"
"vfs/vfs_fat.c"
"vfs/vfs_fat_sdmmc.c"

View file

@ -1,3 +1,3 @@
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

View file

@ -10,6 +10,7 @@
#include <string.h>
#include <time.h>
#include <stdlib.h>
#include <sys/time.h>
#include "diskio_impl.h"
#include "ffconf.h"

View file

@ -12,12 +12,6 @@
#include "esp_heap_caps.h"
#endif
/*------------------------------------------------------------------------*/
/* Allocate a memory block */
/*------------------------------------------------------------------------*/
void* ff_memalloc ( /* Returns pointer to the allocated memory block (null on not enough core) */
unsigned msize /* Number of bytes to allocate */
)
@ -111,4 +105,4 @@ void ff_rel_grant (
xSemaphoreGive(sobj);
}
#endif
#endif // FF_FS_REENTRANT

View 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)
{
}

View file

@ -1,3 +1,5 @@
#include "sdkconfig.h"
/*---------------------------------------------------------------------------/
/ FatFs Functional Configurations
/---------------------------------------------------------------------------*/

View file

@ -1,13 +1,13 @@
SOURCE_FILES := \
$(addprefix ../src/, \
ff.c \
ffsystem.c \
ffunicode.c \
) \
$(addprefix ../diskio/,\
diskio.c \
diskio_wl.c \
)
) \
../port/linux/ffsystem.c
INCLUDE_DIRS := \
. \