aboutsummaryrefslogtreecommitdiff
path: root/projects/board-test
diff options
context:
space:
mode:
Diffstat (limited to 'projects/board-test')
-rw-r--r--projects/board-test/keystore-perf.c4
-rw-r--r--projects/board-test/spiflash-perf.c23
2 files changed, 24 insertions, 3 deletions
diff --git a/projects/board-test/keystore-perf.c b/projects/board-test/keystore-perf.c
index 75b4e3f..09528a2 100644
--- a/projects/board-test/keystore-perf.c
+++ b/projects/board-test/keystore-perf.c
@@ -64,7 +64,7 @@ static void test_erase_sector(void)
int err;
for (i = 0; i < KEYSTORE_NUM_SECTORS; ++i) {
- err = keystore_erase_sectors(i, i);
+ err = keystore_erase_sector(i);
if (err != 1) {
uart_send_string("ERROR: keystore_erase_sector returned ");
uart_send_integer(err, 0);
@@ -83,7 +83,7 @@ static void test_erase_subsector(void)
int err;
for (i = 0; i < KEYSTORE_NUM_SUBSECTORS; ++i) {
- err = keystore_erase_subsectors(i, i);
+ err = keystore_erase_subsector(i);
if (err != 1) {
uart_send_string("ERROR: keystore_erase_subsector returned ");
uart_send_integer(err, 0);
diff --git a/projects/board-test/spiflash-perf.c b/projects/board-test/spiflash-perf.c
index 1abcd7b..53f29cb 100644
--- a/projects/board-test/spiflash-perf.c
+++ b/projects/board-test/spiflash-perf.c
@@ -23,7 +23,7 @@ extern struct spiflash_ctx keystore_ctx;
static struct spiflash_ctx *ctx = &keystore_ctx;
/*
- * 1. Read the entire flash by pages, ignoring data.
+ * 1a. Read the entire flash by pages, ignoring data.
*/
static void test_read_page(void)
{
@@ -43,6 +43,26 @@ static void test_read_page(void)
}
/*
+ * 1b. Read the entire flash by subsectors, ignoring data.
+ */
+static void test_read_subsector(void)
+{
+ uint8_t read_buf[N25Q128_SUBSECTOR_SIZE];
+ uint32_t i;
+ int err;
+
+ for (i = 0; i < N25Q128_NUM_SUBSECTORS; ++i) {
+ err = n25q128_read_subsector(ctx, i, read_buf);
+ if (err != 1) {
+ uart_send_string("ERROR: n25q128_read_subsector returned ");
+ uart_send_integer(err, 0);
+ uart_send_string("\r\n");
+ break;
+ }
+ }
+}
+
+/*
* Read the flash data and verify it against a known pattern.
* It turns out that verification doesn't slow us down in any measurable
* way, because memcmp on 256 bytes is pretty inconsequential.
@@ -217,6 +237,7 @@ int main(void)
uart_send_string("Starting...\r\n");
time_check("read page ", test_read_page(), N25Q128_NUM_PAGES);
+ time_check("read subsector ", test_read_subsector(), N25Q128_NUM_SUBSECTORS);
time_check("erase subsector ", test_erase_subsector(), N25Q128_NUM_SUBSECTORS);
time_check("erase sector ", test_erase_sector(), N25Q128_NUM_SECTORS);
time_check("erase bulk ", test_erase_bulk(), 1);