AP_Filesystem: avoid ff.h in header

this avoids the chibios hal includes
This commit is contained in:
Andrew Tridgell 2022-02-21 14:46:19 +11:00
parent 075f349156
commit 7bd45fcb50
3 changed files with 13 additions and 14 deletions

View File

@ -24,21 +24,24 @@
#include "AP_Filesystem_Available.h"
#ifndef MAX_NAME_LEN
#define MAX_NAME_LEN 255
#endif
#if CONFIG_HAL_BOARD == HAL_BOARD_CHIBIOS
#if HAVE_FILESYSTEM_SUPPORT
#include "AP_Filesystem_FATFS.h"
#endif
#define DT_REG 0
#define DT_DIR 1
#if defined(FF_MAX_LFN) && FF_USE_LFN != 0
#define MAX_NAME_LEN FF_MAX_LFN
#else
#define MAX_NAME_LEN 13
#endif
struct dirent {
char d_name[MAX_NAME_LEN]; /* filename */
uint8_t d_type;
};
#endif // HAL_BOARD_CHIBIOS
#include <fcntl.h>
#include <errno.h>
#include <unistd.h>
@ -46,10 +49,12 @@ struct dirent {
#ifndef AP_FILESYSTEM_FORMAT_ENABLED
// only enable for SDMMC filesystems for now as other types can't query
// block size
#define AP_FILESYSTEM_FORMAT_ENABLED (STM32_SDC_USE_SDMMC1==TRUE || STM32_SDC_USE_SDMMC2==TRUE)
#ifndef HAL_USE_SDMMC
#define HAL_USE_SDMMC 0
#endif
#define AP_FILESYSTEM_FORMAT_ENABLED HAL_USE_SDMMC
#endif
#endif // HAL_BOARD_CHIBIOS
#if CONFIG_HAL_BOARD == HAL_BOARD_LINUX || CONFIG_HAL_BOARD == HAL_BOARD_SITL
#include "AP_Filesystem_posix.h"
#endif

View File

@ -9,6 +9,7 @@
#if HAVE_FILESYSTEM_SUPPORT && CONFIG_HAL_BOARD == HAL_BOARD_CHIBIOS
#include <ff.h>
#include <AP_HAL_ChibiOS/sdcard.h>
#include <GCS_MAVLink/GCS.h>

View File

@ -9,7 +9,6 @@
#include <fcntl.h>
#include <errno.h>
#include <stddef.h>
#include <ff.h>
#include "AP_Filesystem_backend.h"
// Seek offset macros
@ -17,12 +16,6 @@
#define SEEK_CUR 1
#define SEEK_END 2
#if FF_USE_LFN != 0
#define MAX_NAME_LEN FF_MAX_LFN
#else
#define MAX_NAME_LEN 13
#endif
class AP_Filesystem_FATFS : public AP_Filesystem_Backend
{
public: