diff options
author | Paul Selkirk <paul@psgd.org> | 2017-10-15 21:34:00 -0400 |
---|---|---|
committer | Paul Selkirk <paul@psgd.org> | 2017-10-15 21:34:00 -0400 |
commit | 5af4a915edf3e77705fa2625081200b61f8dda26 (patch) | |
tree | 46d8e3cc6e27627e9f3e78c5a0b4a3573d1b1de3 /projects/board-test/keystore-perf.c | |
parent | b159bf0bb24a99c7d3ff1b3855f840add63198e5 (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/keystore-perf.c')
-rw-r--r-- | projects/board-test/keystore-perf.c | 22 |
1 files changed, 11 insertions, 11 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; } |