7 #ifndef USE_FLASH_STORAGE 8 #define USE_FLASH_STORAGE 0 13 #include <systemlib/perf_counter.h> 17 #define VRBRAIN_STORAGE_SIZE HAL_STORAGE_SIZE 22 #define VRBRAIN_STORAGE_LINE_SHIFT 3 24 #define VRBRAIN_STORAGE_LINE_SHIFT 9 27 #define VRBRAIN_STORAGE_LINE_SIZE (1<<VRBRAIN_STORAGE_LINE_SHIFT) 28 #define VRBRAIN_STORAGE_NUM_LINES (VRBRAIN_STORAGE_SIZE/VRBRAIN_STORAGE_LINE_SIZE) 35 void read_block(
void *dst, uint16_t src,
size_t n);
36 void write_block(uint16_t dst,
const void* src,
size_t n);
51 #if !USE_FLASH_STORAGE 56 #if defined (CONFIG_ARCH_BOARD_PX4FMU_V4) 60 #else // USE_FLASH_STORAGE 61 bool _flash_write_data(uint8_t sector, uint32_t offset,
const uint8_t *data, uint16_t length);
62 bool _flash_read_data(uint8_t sector, uint32_t offset, uint8_t *data, uint16_t length);
63 bool _flash_erase_sector(uint8_t sector);
64 bool _flash_erase_ok(
void);
70 FUNCTOR_BIND_MEMBER(&VRBRAINStorage::_flash_write_data,
bool, uint8_t, uint32_t,
const uint8_t *, uint16_t),
71 FUNCTOR_BIND_MEMBER(&VRBRAINStorage::_flash_read_data,
bool, uint8_t, uint32_t, uint8_t *, uint16_t),
75 void _flash_load(
void);
76 void _flash_write(uint16_t line);
void read_block(void *dst, uint16_t src, size_t n)
uint8_t _buffer [VRBRAIN_STORAGE_SIZE] __attribute__((aligned(4)))
void _timer_tick(void) override
void write_block(uint16_t dst, const void *src, size_t n)
perf_counter_t _perf_storage
void _mtd_write(uint16_t line)
uint32_t _last_re_init_ms
#define VRBRAIN_STORAGE_NUM_LINES
#define VRBRAIN_STORAGE_SIZE
volatile bool _initialised
#define FUNCTOR_BIND_MEMBER(func, rettype,...)
perf_counter_t _perf_errors
void _mark_dirty(uint16_t loc, uint16_t length)
void _storage_create(void)