Browse Source

AP_Filesystem: avoid ff.h in header

this avoids the chibios hal includes
gps-1.3.1
Andrew Tridgell 3 years ago
parent
commit
7bd45fcb50
  1. 19
      libraries/AP_Filesystem/AP_Filesystem.h
  2. 1
      libraries/AP_Filesystem/AP_Filesystem_FATFS.cpp
  3. 7
      libraries/AP_Filesystem/AP_Filesystem_FATFS.h

19
libraries/AP_Filesystem/AP_Filesystem.h

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

1
libraries/AP_Filesystem/AP_Filesystem_FATFS.cpp

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

7
libraries/AP_Filesystem/AP_Filesystem_FATFS.h

@ -9,7 +9,6 @@
#include <fcntl.h> #include <fcntl.h>
#include <errno.h> #include <errno.h>
#include <stddef.h> #include <stddef.h>
#include <ff.h>
#include "AP_Filesystem_backend.h" #include "AP_Filesystem_backend.h"
// Seek offset macros // Seek offset macros
@ -17,12 +16,6 @@
#define SEEK_CUR 1 #define SEEK_CUR 1
#define SEEK_END 2 #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 class AP_Filesystem_FATFS : public AP_Filesystem_Backend
{ {
public: public:

Loading…
Cancel
Save