You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
595 B
35 lines
595 B
#pragma once |
|
|
|
#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; |
|
}; |
|
|
|
}
|
|
|