2019-01-18 18:45:36 -04:00
|
|
|
/*
|
|
|
|
block based logging backend for SITL, simulating a flash storage
|
|
|
|
chip
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <AP_HAL/AP_HAL.h>
|
|
|
|
|
|
|
|
#include "AP_Logger_Block.h"
|
|
|
|
|
2021-01-06 22:04:09 -04:00
|
|
|
#if HAL_LOGGING_SITL_ENABLED
|
|
|
|
|
2019-01-18 18:45:36 -04:00
|
|
|
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;
|
2019-02-11 04:38:01 -04:00
|
|
|
static constexpr const char *filename = "dataflash.bin";
|
2019-01-18 18:45:36 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
void BufferToPage(uint32_t PageAdr) override;
|
|
|
|
void PageToBuffer(uint32_t PageAdr) override;
|
|
|
|
void SectorErase(uint32_t SectorAdr) override;
|
2019-12-15 18:08:10 -04:00
|
|
|
void Sector4kErase(uint32_t SectorAdr) override;
|
2019-01-18 18:45:36 -04:00
|
|
|
void StartErase() override;
|
|
|
|
bool InErase() override;
|
|
|
|
|
|
|
|
int flash_fd;
|
|
|
|
uint32_t erase_started_ms;
|
|
|
|
};
|
|
|
|
|
2021-01-06 22:04:09 -04:00
|
|
|
#endif // HAL_LOGGING_SITL_ENABLED
|