mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-03 06:28:27 -04:00
3d8bd9315c
be really careful to catch aborted erases take care to protect shared structures in io thread if flash corruption is detected try and recover whole files overwrite format in erase to make sure erase happens output useful messages at critical times a block is 64k a sector is 4k, rename internal variables appropriately cope with log wrapping when sending log listings over mavlink
34 lines
891 B
C++
34 lines
891 B
C++
/*
|
|
block based logging backend for SITL, simulating a flash storage
|
|
chip
|
|
*/
|
|
#pragma once
|
|
|
|
#include <AP_HAL/AP_HAL.h>
|
|
|
|
#if CONFIG_HAL_BOARD == HAL_BOARD_SITL
|
|
|
|
#include "AP_Logger_Block.h"
|
|
|
|
class AP_Logger_SITL : public AP_Logger_Block {
|
|
public:
|
|
AP_Logger_SITL(AP_Logger &front, LoggerMessageWriter_DFLogStart *writer) :
|
|
AP_Logger_Block(front, writer) {}
|
|
void Init() override;
|
|
bool CardInserted() const override;
|
|
static constexpr const char *filename = "dataflash.bin";
|
|
|
|
private:
|
|
void BufferToPage(uint32_t PageAdr) override;
|
|
void PageToBuffer(uint32_t PageAdr) override;
|
|
void SectorErase(uint32_t SectorAdr) override;
|
|
void Sector4kErase(uint32_t SectorAdr) override;
|
|
void StartErase() override;
|
|
bool InErase() override;
|
|
|
|
int flash_fd;
|
|
uint32_t erase_started_ms;
|
|
};
|
|
|
|
#endif // CONFIG_HAL_BOARD == HAL_BOARD_SITL
|