aboutsummaryrefslogtreecommitdiff
path: root/projects/board-test
diff options
context:
space:
mode:
authorPaul Selkirk <paul@psgd.org>2017-10-15 21:34:00 -0400
committerPaul Selkirk <paul@psgd.org>2017-10-15 21:34:00 -0400
commit5af4a915edf3e77705fa2625081200b61f8dda26 (patch)
tree46d8e3cc6e27627e9f3e78c5a0b4a3573d1b1de3 /projects/board-test
parentb159bf0bb24a99c7d3ff1b3855f840add63198e5 (diff)
Cleanup: All drivers return HAL_StatusTypeDef rather than magic values.
Note: This affects libhal/ks_token.c, which uses the keystore driver directly.
Diffstat (limited to 'projects/board-test')
-rw-r--r--projects/board-test/keystore-perf.c22
-rw-r--r--projects/board-test/spiflash-perf.c16
2 files changed, 19 insertions, 19 deletions
diff --git a/projects/board-test/keystore-perf.c b/projects/board-test/keystore-perf.c
index 09528a2..3552d30 100644
--- a/projects/board-test/keystore-perf.c
+++ b/projects/board-test/keystore-perf.c
@@ -16,11 +16,11 @@ static void test_read_data(void)
{
uint8_t read_buf[KEYSTORE_SUBSECTOR_SIZE];
uint32_t i;
- int err;
+ HAL_StatusTypeDef err;
for (i = 0; i < KEYSTORE_NUM_SUBSECTORS; ++i) {
err = keystore_read_data(i * KEYSTORE_SUBSECTOR_SIZE, read_buf, KEYSTORE_SUBSECTOR_SIZE);
- if (err != 1) {
+ if (err != HAL_OK) {
uart_send_string("ERROR: keystore_read_data returned ");
uart_send_integer(err, 0);
uart_send_string("\r\n");
@@ -36,11 +36,11 @@ static void _read_verify(uint8_t *vrfy_buf)
{
uint8_t read_buf[KEYSTORE_SUBSECTOR_SIZE];
uint32_t i;
- int err;
+ HAL_StatusTypeDef err;
for (i = 0; i < KEYSTORE_NUM_SUBSECTORS; ++i) {
err = keystore_read_data(i * KEYSTORE_SUBSECTOR_SIZE, read_buf, KEYSTORE_SUBSECTOR_SIZE);
- if (err != 1) {
+ if (err != HAL_OK) {
uart_send_string("ERROR: keystore_read_data returned ");
uart_send_integer(err, 0);
uart_send_string("\r\n");
@@ -61,11 +61,11 @@ static void _read_verify(uint8_t *vrfy_buf)
static void test_erase_sector(void)
{
uint32_t i;
- int err;
+ HAL_StatusTypeDef err;
for (i = 0; i < KEYSTORE_NUM_SECTORS; ++i) {
err = keystore_erase_sector(i);
- if (err != 1) {
+ if (err != HAL_OK) {
uart_send_string("ERROR: keystore_erase_sector returned ");
uart_send_integer(err, 0);
uart_send_string("\r\n");
@@ -80,11 +80,11 @@ static void test_erase_sector(void)
static void test_erase_subsector(void)
{
uint32_t i;
- int err;
+ HAL_StatusTypeDef err;
for (i = 0; i < KEYSTORE_NUM_SUBSECTORS; ++i) {
err = keystore_erase_subsector(i);
- if (err != 1) {
+ if (err != HAL_OK) {
uart_send_string("ERROR: keystore_erase_subsector returned ");
uart_send_integer(err, 0);
uart_send_string("\r\n");
@@ -114,14 +114,14 @@ static void test_write_data(void)
{
uint8_t write_buf[KEYSTORE_SUBSECTOR_SIZE];
uint32_t i;
- int err;
+ HAL_StatusTypeDef err;
for (i = 0; i < sizeof(write_buf); ++i)
write_buf[i] = i & 0xFF;
for (i = 0; i < KEYSTORE_NUM_SUBSECTORS; ++i) {
err = keystore_write_data(i * KEYSTORE_SUBSECTOR_SIZE, write_buf, KEYSTORE_SUBSECTOR_SIZE);
- if (err != 1) {
+ if (err != HAL_OK) {
uart_send_string("ERROR: keystore_write_data returned ");
uart_send_integer(err, 0);
uart_send_string(" for subsector ");
@@ -179,7 +179,7 @@ int main(void)
stm_init();
uart_set_default(STM_UART_MGMT);
- if (keystore_check_id() != 1) {
+ if (keystore_check_id() != HAL_OK) {
uart_send_string("ERROR: keystore_check_id failed\r\n");
return 0;
}
diff --git a/projects/board-test/spiflash-perf.c b/projects/board-test/spiflash-perf.c
index 53f29cb..2691504 100644
--- a/projects/board-test/spiflash-perf.c
+++ b/projects/board-test/spiflash-perf.c
@@ -33,7 +33,7 @@ static void test_read_page(void)
for (i = 0; i < N25Q128_NUM_PAGES; ++i) {
err = n25q128_read_page(ctx, i, read_buf);
- if (err != 1) {
+ if (err != HAL_OK) {
uart_send_string("ERROR: n25q128_read_page returned ");
uart_send_integer(err, 0);
uart_send_string("\r\n");
@@ -53,7 +53,7 @@ static void test_read_subsector(void)
for (i = 0; i < N25Q128_NUM_SUBSECTORS; ++i) {
err = n25q128_read_subsector(ctx, i, read_buf);
- if (err != 1) {
+ if (err != HAL_OK) {
uart_send_string("ERROR: n25q128_read_subsector returned ");
uart_send_integer(err, 0);
uart_send_string("\r\n");
@@ -75,7 +75,7 @@ static void _read_verify(uint8_t *vrfy_buf)
for (i = 0; i < N25Q128_NUM_PAGES; ++i) {
err = n25q128_read_page(ctx, i, read_buf);
- if (err != 1) {
+ if (err != HAL_OK) {
uart_send_string("ERROR: n25q128_read_page returned ");
uart_send_integer(err, 0);
uart_send_string("\r\n");
@@ -100,7 +100,7 @@ static void test_erase_sector(void)
for (i = 0; i < N25Q128_NUM_SECTORS; ++i) {
err = n25q128_erase_sector(ctx, i);
- if (err != 1) {
+ if (err != HAL_OK) {
uart_send_string("ERROR: n25q128_erase_sector returned ");
uart_send_integer(err, 0);
uart_send_string("\r\n");
@@ -119,7 +119,7 @@ static void test_erase_subsector(void)
for (i = 0; i < N25Q128_NUM_SUBSECTORS; ++i) {
err = n25q128_erase_subsector(ctx, i);
- if (err != 1) {
+ if (err != HAL_OK) {
uart_send_string("ERROR: n25q128_erase_subsector returned ");
uart_send_integer(err, 0);
uart_send_string("\r\n");
@@ -136,7 +136,7 @@ static void test_erase_bulk(void)
int err;
err = n25q128_erase_bulk(ctx);
- if (err != 1) {
+ if (err != HAL_OK) {
uart_send_string("ERROR: n25q128_erase_bulk returned ");
uart_send_integer(err, 0);
uart_send_string("\r\n");
@@ -171,7 +171,7 @@ static void test_write_page(void)
for (i = 0; i < N25Q128_NUM_PAGES; ++i) {
err = n25q128_write_page(ctx, i, write_buf);
- if (err != 1) {
+ if (err != HAL_OK) {
uart_send_string("ERROR: n25q128_write_page returned ");
uart_send_integer(err, 0);
uart_send_string(" for page ");
@@ -229,7 +229,7 @@ int main(void)
stm_init();
uart_set_default(STM_UART_MGMT);
- if (n25q128_check_id(ctx) != 1) {
+ if (n25q128_check_id(ctx) != HAL_OK) {
uart_send_string("ERROR: n25q128_check_id failed\r\n");
return 0;
}