mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
[ion] Add configuration for Flash of N0101 and N0100
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
// Choose some not too uniform data to program and test the external flash memory with.
|
||||
|
||||
static inline uint8_t expected_value_at(uint8_t * ptr) {
|
||||
uint32_t address = reinterpret_cast<uint32_t>(ptr) - Ion::ExternalFlash::Device::QSPIBaseAddress;
|
||||
uint32_t address = reinterpret_cast<uint32_t>(ptr) - Ion::ExternalFlash::Device::StartAddress;
|
||||
return (address / 0x10000) + (address / 0x100) + address;
|
||||
// Example: the value expected at the address 0x123456 is 0x12 + 0x34 + 0x56.
|
||||
}
|
||||
@@ -31,8 +31,8 @@ static inline void check(volatile T * p, int repeat) {
|
||||
|
||||
template <typename T>
|
||||
void test(int accessType, int repeat) {
|
||||
uint8_t * start = reinterpret_cast<uint8_t *>(Ion::ExternalFlash::Device::QSPIBaseAddress);
|
||||
uint8_t * end = reinterpret_cast<uint8_t *>(Ion::ExternalFlash::Device::QSPIBaseAddress + Ion::ExternalFlash::Device::FlashAddressSpaceSize);
|
||||
uint8_t * start = reinterpret_cast<uint8_t *>(Ion::ExternalFlash::Device::StartAddress);
|
||||
uint8_t * end = reinterpret_cast<uint8_t *>(Ion::ExternalFlash::Device::StartAddress + Ion::ExternalFlash::Device::FlashAddressSpaceSize);
|
||||
|
||||
// Forward sequential access
|
||||
if (accessType == 0) {
|
||||
@@ -52,10 +52,10 @@ void test(int accessType, int repeat) {
|
||||
|
||||
// Random access
|
||||
if (accessType == 2) {
|
||||
T * endT = reinterpret_cast<T *>(Ion::ExternalFlash::Device::QSPIBaseAddress + Ion::ExternalFlash::Device::FlashAddressSpaceSize);
|
||||
T * endT = reinterpret_cast<T *>(Ion::ExternalFlash::Device::StartAddress + Ion::ExternalFlash::Device::FlashAddressSpaceSize);
|
||||
for (size_t i=0; i<Ion::ExternalFlash::Device::FlashAddressSpaceSize; i++) {
|
||||
uint32_t randomAddr = Ion::random() >> (32 - Ion::ExternalFlash::Device::NumberOfAddressBitsInChip);
|
||||
volatile T * q = reinterpret_cast<T *>(randomAddr + Ion::ExternalFlash::Device::QSPIBaseAddress);
|
||||
volatile T * q = reinterpret_cast<T *>(randomAddr + Ion::ExternalFlash::Device::StartAddress);
|
||||
if (q <= endT - 1) {
|
||||
check(q, repeat);
|
||||
}
|
||||
@@ -101,7 +101,7 @@ QUIZ_CASE(ion_ext_flash_program) {
|
||||
for (int page = 0; page < (1<<15); page++) {
|
||||
uint8_t buffer[256];
|
||||
for (int byte = 0; byte < 256; byte++) {
|
||||
buffer[byte] = expected_value_at(reinterpret_cast<uint8_t *>(Ion::ExternalFlash::Device::QSPIBaseAddress + page * 256 + byte));
|
||||
buffer[byte] = expected_value_at(reinterpret_cast<uint8_t *>(Ion::ExternalFlash::Device::StartAddress + page * 256 + byte));
|
||||
}
|
||||
Ion::ExternalFlash::Device::WriteMemory(reinterpret_cast<uint8_t *>(page * 256), buffer, 256);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user