aboutsummaryrefslogtreecommitdiff
path: root/stm-keystore.h
diff options
context:
space:
mode:
Diffstat (limited to 'stm-keystore.h')
-rw-r--r--stm-keystore.h19
1 files changed, 12 insertions, 7 deletions
diff --git a/stm-keystore.h b/stm-keystore.h
index 2c493d2..9aa740c 100644
--- a/stm-keystore.h
+++ b/stm-keystore.h
@@ -3,7 +3,7 @@
* ---------
* Functions and defines for accessing the keystore memory.
*
- * Copyright (c) 2016, NORDUnet A/S All rights reserved.
+ * Copyright (c) 2016-2017, NORDUnet A/S All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -39,7 +39,11 @@
#include "spiflash_n25q128.h"
#define KEYSTORE_PAGE_SIZE N25Q128_PAGE_SIZE
+#define KEYSTORE_NUM_PAGES N25Q128_NUM_PAGES
#define KEYSTORE_SECTOR_SIZE N25Q128_SECTOR_SIZE
+#define KEYSTORE_NUM_SECTORS N25Q128_NUM_SECTORS
+#define KEYSTORE_SUBSECTOR_SIZE N25Q128_SUBSECTOR_SIZE
+#define KEYSTORE_NUM_SUBSECTORS N25Q128_NUM_SUBSECTORS
/* Pins connected to the FPGA config memory (SPI flash) */
#define KSM_PROM_CS_N_Pin GPIO_PIN_0
@@ -51,11 +55,12 @@
gpio_output(KSM_PROM_CS_N_GPIO_Port, KSM_PROM_CS_N_Pin, GPIO_PIN_SET)
-extern SPI_HandleTypeDef hspi_keystore;
-
-extern int keystore_check_id(void);
-extern int keystore_read_data(uint32_t offset, uint8_t *buf, const uint32_t len);
-extern int keystore_write_data(uint32_t offset, const uint8_t *buf, const uint32_t len);
-extern int keystore_erase_sectors(int num);
+extern void keystore_init(void);
+extern HAL_StatusTypeDef keystore_check_id(void);
+extern HAL_StatusTypeDef keystore_read_data(uint32_t offset, uint8_t *buf, const uint32_t len);
+extern HAL_StatusTypeDef keystore_write_data(uint32_t offset, const uint8_t *buf, const uint32_t len);
+extern HAL_StatusTypeDef keystore_erase_subsector(uint32_t subsector_offset);
+extern HAL_StatusTypeDef keystore_erase_sector(uint32_t sector_offset);
+extern HAL_StatusTypeDef keystore_erase_bulk(void);
#endif /* __STM32_KEYSTORE_H */