10#define DSY_QSPI_TEXT \
11 __attribute__((section( \
13#define DSY_QSPI_DATA \
14 __attribute__((section( \
17 __attribute__((section( \
184#include "../tests/TestIsolator.h"
207 static Result ResetAndClear()
209 testIsolator_.GetStateForCurrentTest()->memory_.clear();
214 static Result Write(uint32_t address, uint32_t size, uint8_t* buffer)
217 uint32_t adjusted_addr = (address) & (uint32_t)(~0xff);
219 uint32_t total_bytes = adjusted_addr + size;
220 AdaptToSize(total_bytes);
222 uint8_t* dest = testIsolator_.GetStateForCurrentTest()->memory_.data();
223 std::copy(&buffer[adjusted_addr],
224 &buffer[adjusted_addr + size],
225 &dest[adjusted_addr]);
229 static Result Erase(uint32_t start_addr, uint32_t end_addr)
231 uint32_t adjusted_start_addr = (start_addr) & (uint32_t)(~0xff);
232 uint32_t adjusted_end_addr = (end_addr) & (uint32_t)(~0xff);
235 assert(adjusted_start_addr < kMaxAdjustedAddr);
236 assert(adjusted_end_addr < kMaxAdjustedAddr);
240 AdaptToSize(adjusted_end_addr);
241 uint8_t* buff = testIsolator_.GetStateForCurrentTest()->memory_.data();
243 std::fill(&buff[adjusted_start_addr], &buff[adjusted_end_addr], 0xff);
249 static void*
GetData(uint32_t offset = 0)
251 assert(offset < kMaxAdjustedAddr);
252 AdaptToSize(offset + 1);
253 return (
void*)(testIsolator_.GetStateForCurrentTest()->memory_.data()
261 static size_t GetCurrentSize()
263 return testIsolator_.GetStateForCurrentTest()->memory_.size();
268 static void AdaptToSize(uint32_t required_bytes)
270 if(testIsolator_.GetStateForCurrentTest()->memory_.size()
272 testIsolator_.GetStateForCurrentTest()->memory_.resize(
273 required_bytes, 0x00);
275 static constexpr uint32_t kMaxAdjustedAddr = 0x800000;
279 std::vector<uint8_t> memory_;
281 static TestIsolator<QSPIState> testIsolator_;
Definition leddriver.h:33
const Config & GetConfig() const
QSPIHandle(const QSPIHandle &other)=default
Status
Definition qspi.h:50
@ GOOD
Definition qspi.h:51
@ E_INVALID_MODE
Definition qspi.h:54
@ E_HAL_ERROR
Definition qspi.h:52
@ E_SWITCHING_MODES
Definition qspi.h:53
QSPIHandle & operator=(const QSPIHandle &other)=default
Result EraseSector(uint32_t address)
Result Erase(uint32_t start_addr, uint32_t end_addr)
Result Init(const Config &config)
QSPIHandle()
Definition qspi.h:167
void * GetData(uint32_t offset=0)
Result
Definition qspi.h:35
@ ERR
Definition qspi.h:37
Result Write(uint32_t address, uint32_t size, uint8_t *buffer)
Result WritePage(uint32_t address, uint32_t size, uint8_t *buffer)
Hardware defines and helpers for daisy field platform.
Definition index.h:2
representation of hardware port/pin combination
Definition daisy_core.h:193
Device
Definition qspi.h:62
@ IS25LP064A
Definition qspi.h:64
@ DEVICE_LAST
Definition qspi.h:65
@ IS25LP080D
Definition qspi.h:63
Pin io0
Definition qspi.h:85
Pin ncs
Definition qspi.h:90
Pin io2
Definition qspi.h:87
Pin clk
Definition qspi.h:89
Pin io3
Definition qspi.h:88
Device device
Definition qspi.h:93
struct daisy::QSPIHandle::Config::@16 pin_config
@ MEMORY_MAPPED
Definition qspi.h:77
@ INDIRECT_POLLING
Definition qspi.h:78
@ MODE_LAST
Definition qspi.h:79
Pin io1
Definition qspi.h:86
Mode mode
Definition qspi.h:94