Skip to content

Commit

Permalink
Adding littlefs driver
Browse files Browse the repository at this point in the history
***WIP***
  • Loading branch information
josesimoes committed Jul 1, 2024
1 parent 685c77a commit 68789da
Show file tree
Hide file tree
Showing 3 changed files with 1,186 additions and 39 deletions.
59 changes: 20 additions & 39 deletions targets/ESP32/ESP32/target_FileSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,19 @@
#include <nanoHAL_v2.h>
#include <nanoHAL_Types.h>
#include <nanoPAL_FileSystem.h>
// #include <littlefs_FS_Driver.h>
#include <littlefs_FS_Driver.h>
#include <fatfs_FS_Driver.h>
#include "Target_System_IO_FileSystem.h"

// extern FILESYSTEM_DRIVER_INTERFACE g_LITTLEFS_FILE_SYSTEM_DriverInterface;
extern FILESYSTEM_DRIVER_INTERFACE g_LITTLEFS_FILE_SYSTEM_DriverInterface;
extern STREAM_DRIVER_INTERFACE g_FATFS_STREAM_DriverInterface;

// extern STREAM_DRIVER_INTERFACE g_LITTLEFS_STREAM_DriverInterface;
extern STREAM_DRIVER_INTERFACE g_LITTLEFS_STREAM_DriverInterface;
extern FILESYSTEM_DRIVER_INTERFACE g_FATFS_FILE_SYSTEM_DriverInterface;

// #if HAL_USE_SDC
// #include <target_windows_storage_config.h>
// extern "C" void SdCardDetectCallback(void *arg);
// #endif

FILESYSTEM_INTERFACES g_AvailableFSInterfaces[] = {
{&g_FATFS_FILE_SYSTEM_DriverInterface, &g_FATFS_STREAM_DriverInterface},
// {&g_LITTLEFS_FILE_SYSTEM_DriverInterface, &g_LITTLEFS_STREAM_DriverInterface},
{&g_LITTLEFS_FILE_SYSTEM_DriverInterface, &g_LITTLEFS_STREAM_DriverInterface},
};

const size_t g_InstalledFSCount = ARRAYSIZE(g_AvailableFSInterfaces);
Expand All @@ -35,38 +30,24 @@ FileSystemVolume *g_FS_Volumes;

void FS_AddVolumes()
{
// // 2 SPI flash devices
// g_FS_NumVolumes = 2;

// g_FS_Volumes = new FileSystemVolume[g_FS_NumVolumes];
// g_FS_DriverDetails = new STREAM_DRIVER_DETAILS[g_FS_NumVolumes];

// // AT25SF641, drive I:, volume 0
// FileSystemVolumeList::AddVolume(
// &g_FS_Volumes[0],
// "I:",
// 0,
// g_AvailableFSInterfaces[1].streamDriver,
// g_AvailableFSInterfaces[1].fsDriver,
// 0,
// FALSE);

// // W25Q128, drive F:, volume 1
// FileSystemVolumeList::AddVolume(
// &g_FS_Volumes[1],
// "J:",
// 0,
// g_AvailableFSInterfaces[1].streamDriver,
// g_AvailableFSInterfaces[1].fsDriver,
// 1,
// FALSE);
// one internal storage in littlefs partition
g_FS_NumVolumes = 1;

g_FS_Volumes = new FileSystemVolume[g_FS_NumVolumes];
g_FS_DriverDetails = new STREAM_DRIVER_DETAILS[g_FS_NumVolumes];

// littlefs partition
FileSystemVolumeList::AddVolume(
&g_FS_Volumes[0],
"I:",
0,
g_AvailableFSInterfaces[1].streamDriver,
g_AvailableFSInterfaces[1].fsDriver,
0,
FALSE);
}

void FS_MountRemovableVolumes()
{

// #if HAL_USE_SDC
// SdCardDetectCallback(&SD_CARD_DRIVER);
// #endif

// nothing to do here
}
Loading

0 comments on commit 68789da

Please sign in to comment.