25 #ifndef HAL_USE_EMPTY_STORAGE 38 using_fram = fram.init();
64 uint16_t
end = loc + length;
74 if (loc >=
sizeof(_buffer)-(n-1)) {
78 memcpy(dst, &_buffer[loc], n);
83 if (loc >=
sizeof(_buffer)-(n-1)) {
86 if (memcmp(src, &_buffer[loc], n) != 0) {
88 memcpy(&_buffer[loc], src, n);
108 if (i == CH_STORAGE_NUM_LINES) {
165 hal.
console->
printf(
"Storage: failed at %u:%u for %u - re-init %u\n",
166 (
unsigned)sector, (
unsigned)offset, (
unsigned)length, (
unsigned)ok);
178 const uint8_t *b = ((
const uint8_t *)base_address)+offset;
179 memcpy(data, b, length);
200 #endif // HAL_USE_EMPTY_STORAGE bool get_soft_armed() const
void write_block(uint16_t dst, const void *src, size_t n)
const AP_HAL::HAL & hal
-*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-
AP_HAL::UARTDriver * console
volatile bool _initialised
void _mark_dirty(uint16_t loc, uint16_t length)
bool _flash_erase_ok(void)
bool _flash_read_data(uint8_t sector, uint32_t offset, uint8_t *data, uint16_t length)
virtual void printf(const char *,...) FMT_PRINTF(2
bool get(uint16_t bit) const
bool stm32_flash_erasepage(uint32_t page)
bool _flash_erase_sector(uint8_t sector)
void _timer_tick(void) override
void read_block(void *dst, uint16_t src, size_t n)
bool write(uint16_t offset, uint16_t length)
#define CH_STORAGE_NUM_LINES
uint32_t _last_re_init_ms
bool _flash_write_data(uint8_t sector, uint32_t offset, const uint8_t *data, uint16_t length)
#define CH_STORAGE_LINE_SHIFT
#define CH_STORAGE_LINE_SIZE
uint32_t stm32_flash_getpageaddr(uint32_t page)
void panic(const char *errormsg,...) FMT_PRINTF(1
int32_t stm32_flash_write(uint32_t addr, const void *buf, uint32_t count)
void _flash_write(uint16_t line)