AP_Logger_SITL.h 837 B

1234567891011121314151617181920212223242526272829303132
  1. /*
  2. block based logging backend for SITL, simulating a flash storage
  3. chip
  4. */
  5. #pragma once
  6. #include <AP_HAL/AP_HAL.h>
  7. #if CONFIG_HAL_BOARD == HAL_BOARD_SITL
  8. #include "AP_Logger_Block.h"
  9. class AP_Logger_SITL : public AP_Logger_Block {
  10. public:
  11. AP_Logger_SITL(AP_Logger &front, LoggerMessageWriter_DFLogStart *writer) :
  12. AP_Logger_Block(front, writer) {}
  13. void Init() override;
  14. bool CardInserted() const override;
  15. static constexpr const char *filename = "dataflash.bin";
  16. private:
  17. void BufferToPage(uint32_t PageAdr) override;
  18. void PageToBuffer(uint32_t PageAdr) override;
  19. void SectorErase(uint32_t SectorAdr) override;
  20. void StartErase() override;
  21. bool InErase() override;
  22. int flash_fd;
  23. uint32_t erase_started_ms;
  24. };
  25. #endif // CONFIG_HAL_BOARD == HAL_BOARD_SITL