ardupilot/libraries/SITL/SIM_RAMTRON.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

46 lines
800 B
C
Raw Permalink Normal View History

2021-07-12 22:37:51 -03:00
#pragma once
#include <AP_HAL/AP_HAL_Boards.h>
#ifndef AP_SIM_RAMTRON_ENABLED
#define AP_SIM_RAMTRON_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL)
#endif
#if AP_SIM_RAMTRON_ENABLED
2021-07-12 22:37:51 -03:00
#include "SIM_SPIDevice.h"
namespace SITL {
class RAMTRON : public SPIDevice
{
public:
int rdwr(uint8_t count, SPI::spi_ioc_transfer *&data) override;
protected:
virtual void fill_rdid(uint8_t *buf, uint8_t len) = 0;
virtual uint32_t storage_size() const = 0; // in bytes
virtual const char *filename() const = 0;
private:
enum class State {
WAITING,
READING_RDID,
READING,
WRITING,
} state = State::WAITING;
bool write_enabled;
uint32_t xfr_addr;
void open_storage_fd();
int storage_fd = -1;
};
}
#endif // AP_SIM_RAMTRON_ENABLED