aboutsummaryrefslogtreecommitdiff
path: root/hal_io_eim.c
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2017-09-09 00:59:35 -0400
committerRob Austein <sra@hactrn.net>2017-09-09 00:59:35 -0400
commitca6432daebfcca16d55c07e588f96202d77109fb (patch)
treee3282d9e622281e506b9e4090f7b7d7f8ba4efde /hal_io_eim.c
parent63636301593c8a3952afae61c1b5f279c27f69ea (diff)
Start hacking for systolic modexp.
Work in progress. Probably won't even compile, much less run. Requires corresponding new core/math/modexpa7 core. No support (yet) for ASN.1 encoding of speedup factors or storage of same in keystore. No support (yet) for running CRT algorithm in parallel cores. Minor cleanup of ancient bus I/O code, including EIM and I2C bus code we'll probably never use again.
Diffstat (limited to 'hal_io_eim.c')
-rw-r--r--hal_io_eim.c31
1 files changed, 5 insertions, 26 deletions
diff --git a/hal_io_eim.c b/hal_io_eim.c
index 5824f5b..eabc42e 100644
--- a/hal_io_eim.c
+++ b/hal_io_eim.c
@@ -47,7 +47,7 @@ static int inited = 0;
#define EIM_IO_TIMEOUT 100000000
#endif
-static hal_error_t init(void)
+static inline hal_error_t init(void)
{
if (inited)
return HAL_OK;
@@ -61,7 +61,7 @@ static hal_error_t init(void)
/* translate cryptech register number to EIM address
*/
-static hal_addr_t eim_offset(hal_addr_t offset)
+static inline hal_addr_t eim_offset(hal_addr_t offset)
{
return EIM_BASE_ADDR + (offset << 2);
}
@@ -134,24 +134,15 @@ 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;
+ if (count && *count == -1)
+ *count = EIM_IO_TIMEOUT;
+
for (i = 1; ; ++i) {
if (count && (*count > 0) && (i >= *count))
@@ -168,18 +159,6 @@ hal_error_t hal_io_wait(const hal_core_t *core, uint8_t status, int *count)
}
}
-hal_error_t hal_io_wait_ready(const hal_core_t *core)
-{
- int limit = EIM_IO_TIMEOUT;
- return hal_io_wait(core, STATUS_READY, &limit);
-}
-
-hal_error_t hal_io_wait_valid(const hal_core_t *core)
-{
- int limit = EIM_IO_TIMEOUT;
- return hal_io_wait(core, STATUS_VALID, &limit);
-}
-
/*
* Local variables:
* indent-tabs-mode: nil