aboutsummaryrefslogtreecommitdiff
path: root/hal_io_fmc.c
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2017-12-13 14:15:45 -0500
committerRob Austein <sra@hactrn.net>2017-12-13 14:17:46 -0500
commitbc167c214e97ed35f39d088a7dee3f1a9511340e (patch)
tree7143f5fef99dfe4f605f42664ffc58b904589a5f /hal_io_fmc.c
parente5d8d558e954addf0e26ff887e9494d216da2225 (diff)
parent238e33e53195385dac51e18fffd0f4511244c560 (diff)
Merge branch systolic_crt into master.
This branch was sitting for long enough that master had been through a cleanup pass, so beware of accidental reversions.
Diffstat (limited to 'hal_io_fmc.c')
-rw-r--r--hal_io_fmc.c56
1 files changed, 2 insertions, 54 deletions
diff --git a/hal_io_fmc.c b/hal_io_fmc.c
index 76d6883..0d49f1e 100644
--- a/hal_io_fmc.c
+++ b/hal_io_fmc.c
@@ -47,11 +47,7 @@
static int debug = 0;
static int inited = 0;
-#ifndef FMC_IO_TIMEOUT
-#define FMC_IO_TIMEOUT 100000000
-#endif
-
-static hal_error_t init(void)
+static inline hal_error_t init(void)
{
if (!inited) {
fmc_init();
@@ -62,7 +58,7 @@ static hal_error_t init(void)
/* Translate cryptech register number to FMC address.
*/
-static hal_addr_t fmc_offset(hal_addr_t offset)
+static inline hal_addr_t fmc_offset(hal_addr_t offset)
{
return offset << 2;
}
@@ -136,54 +132,6 @@ hal_error_t hal_io_read(const hal_core_t *core, hal_addr_t offset, uint8_t *buf,
return HAL_OK;
}
-hal_error_t hal_io_init(const hal_core_t *core)
-{
- uint8_t buf[4] = { 0, 0, 0, CTRL_INIT };
- return hal_io_write(core, ADDR_CTRL, buf, sizeof(buf));
-}
-
-hal_error_t hal_io_next(const hal_core_t *core)
-{
- uint8_t buf[4] = { 0, 0, 0, CTRL_NEXT };
- return hal_io_write(core, ADDR_CTRL, buf, sizeof(buf));
-}
-
-hal_error_t hal_io_wait(const hal_core_t *core, uint8_t status, int *count)
-{
- hal_error_t err;
- uint8_t buf[4];
- int i;
-
- for (i = 1; ; ++i) {
-
- if (count && (*count > 0) && (i >= *count))
- return HAL_ERROR_IO_TIMEOUT;
-
- hal_task_yield();
-
- if ((err = hal_io_read(core, ADDR_STATUS, buf, sizeof(buf))) != HAL_OK)
- return err;
-
- if ((buf[3] & status) != 0) {
- if (count)
- *count = i;
- return HAL_OK;
- }
- }
-}
-
-hal_error_t hal_io_wait_ready(const hal_core_t *core)
-{
- int limit = FMC_IO_TIMEOUT;
- return hal_io_wait(core, STATUS_READY, &limit);
-}
-
-hal_error_t hal_io_wait_valid(const hal_core_t *core)
-{
- int limit = FMC_IO_TIMEOUT;
- return hal_io_wait(core, STATUS_VALID, &limit);
-}
-
/*
* Local variables:
* indent-tabs-mode: nil