Files
Upsilon/ion/test/device/n0110/external_flash_write.cpp
Ruben Dashyan bc0b21463e [quiz][ion/test] Move time measurements to quiz
to be able to do measurements in any test
2020-06-04 14:50:00 +02:00

26 lines
905 B
C++

#include <quiz.h>
#include <quiz/stopwatch.h>
#include <drivers/external_flash.h>
#include "external_flash_helper.h"
// Choose some not too uniform data to program the external flash memory with.
QUIZ_CASE(ion_ext_flash_erase) {
uint64_t startTime = quiz_stopwatch_start();
Ion::Device::ExternalFlash::MassErase();
quiz_stopwatch_print_lap(startTime);
}
QUIZ_CASE(ion_ext_flash_program) {
// Program separately each page of the flash memory
uint64_t startTime = quiz_stopwatch_start();
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::Device::ExternalFlash::Config::StartAddress + page * 256 + byte));
}
Ion::Device::ExternalFlash::WriteMemory(reinterpret_cast<uint8_t *>(page * 256), buffer, 256);
}
quiz_stopwatch_print_lap(startTime);
}