diff options
Diffstat (limited to 'projects')
-rw-r--r-- | projects/board-test/fmc-perf.c | 4 | ||||
-rw-r--r-- | projects/board-test/fmc-test.c | 4 | ||||
-rw-r--r-- | projects/cli-test/test-fmc.c | 10 | ||||
-rw-r--r-- | projects/hsm/hsm.c | 14 |
4 files changed, 21 insertions, 11 deletions
diff --git a/projects/board-test/fmc-perf.c b/projects/board-test/fmc-perf.c index e87f282..71d0149 100644 --- a/projects/board-test/fmc-perf.c +++ b/projects/board-test/fmc-perf.c @@ -31,7 +31,7 @@ static void sanity(void) uint32_t rnd, data; rnd = random(); - if (fmc_write_32(0, &rnd) != 0) { + if (fmc_write_32(0, rnd) != 0) { uart_send_string("fmc_write_32 failed\r\n"); Error_Handler(); } @@ -88,7 +88,7 @@ static void test_write(void) uint32_t i; for (i = 0; i < TEST_NUM_ROUNDS; ++i) { - if (fmc_write_32(0, &i) != 0) { + if (fmc_write_32(0, i) != 0) { uart_send_string("fmc_write_32 failed\r\n"); Error_Handler(); } diff --git a/projects/board-test/fmc-test.c b/projects/board-test/fmc-test.c index 2002f57..1421db0 100644 --- a/projects/board-test/fmc-test.c +++ b/projects/board-test/fmc-test.c @@ -171,7 +171,7 @@ int test_fpga_data_bus(void) if (hal_result != HAL_OK) break; // write value to fpga at address 0 - ok = fmc_write_32(0, &rnd); + ok = fmc_write_32(0, rnd); if (ok != 0) break; // read value from fpga @@ -239,7 +239,7 @@ int test_fpga_address_bus(void) if (rnd == 0) continue; // write dummy value to fpga at some non-zero address - ok = fmc_write_32(rnd, &buf); + ok = fmc_write_32(rnd, buf); if (ok != 0) break; // read value from fpga diff --git a/projects/cli-test/test-fmc.c b/projects/cli-test/test-fmc.c index 87f80ce..6773cfc 100644 --- a/projects/cli-test/test-fmc.c +++ b/projects/cli-test/test-fmc.c @@ -76,7 +76,7 @@ volatile uint32_t data_diff = 0; volatile uint32_t addr_diff = 0; -static int _write_then_read(struct cli_def *cli, uint32_t addr, uint32_t *write_buf, uint32_t *read_buf) +static int _write_then_read(struct cli_def *cli, uint32_t addr, uint32_t write_buf, uint32_t *read_buf) { int ok; @@ -115,7 +115,7 @@ int test_fpga_data_bus(struct cli_def *cli, uint32_t test_rounds) } /* write value to fpga at address 0 and then read it back from the test register */ - if (! _write_then_read(cli, 0, &rnd, &buf)) break; + if (! _write_then_read(cli, 0, rnd, &buf)) break; /* compare (abort testing in case of error) */ data_diff = buf ^ rnd; @@ -137,7 +137,7 @@ int test_fpga_data_bus(struct cli_def *cli, uint32_t test_rounds) for (i = 0; i < 31; i++) { data = 1 << i; - if (! _write_then_read(cli, 0, &data, &buf)) break; + if (! _write_then_read(cli, 0, data, &buf)) break; if (data == buf) { cli_print(cli, "Data 0x%08lx (FMC_D%02i) - OK", data, i + 1); @@ -181,7 +181,7 @@ int test_fpga_address_bus(struct cli_def *cli, uint32_t test_rounds) /* write dummy value to fpga at some non-zero address and then read from the test register to see what address the FPGA thought we wrote to */ - if (! _write_then_read(cli, addr, &dummy, &buf)) break; + if (! _write_then_read(cli, addr, dummy, &buf)) break; /* fpga receives address of 32-bit word, while we need byte address here to compare @@ -210,7 +210,7 @@ int test_fpga_address_bus(struct cli_def *cli, uint32_t test_rounds) shifted_addr = addr << 2; - if (! _write_then_read(cli, shifted_addr, &dummy, &buf)) break; + if (! _write_then_read(cli, shifted_addr, dummy, &buf)) break; if (addr == buf) { cli_print(cli, "Address 0x%08lx (FMC_A%02i) - OK", addr, i + 1); diff --git a/projects/hsm/hsm.c b/projects/hsm/hsm.c index c9d8d28..29509e8 100644 --- a/projects/hsm/hsm.c +++ b/projects/hsm/hsm.c @@ -99,7 +99,7 @@ typedef struct rpc_buffer_s { } rpc_buffer_t; /* RPC input (requst) buffers */ -static rpc_buffer_t ibufs[NUM_RPC_TASK]; +static rpc_buffer_t *ibufs; /* ibuf queue structure */ typedef struct { @@ -439,6 +439,12 @@ task_mutex_t ks_mutex = { 0 }; void hal_ks_lock(void) { task_mutex_lock(&ks_mutex); } void hal_ks_unlock(void) { task_mutex_unlock(&ks_mutex); } +/* A mutex to arbitrary concurrent access to the RSA blinding factors cache. + */ +task_mutex_t rsa_bf_mutex = { 0 }; +void hal_rsa_bf_lock(void) { task_mutex_lock(&rsa_bf_mutex); } +void hal_rsa_bf_unlock(void) { task_mutex_unlock(&rsa_bf_mutex); } + /* Sleep for specified number of seconds. */ void hal_sleep(const unsigned seconds) { task_delay(seconds * 1000); } @@ -455,9 +461,13 @@ int main(void) Error_Handler(); /* Initialize the ibuf queues. */ + ibufs = (rpc_buffer_t *)sdram_malloc(NUM_RPC_TASK * sizeof(rpc_buffer_t)); + if (ibufs == NULL) + Error_Handler(); + memset(ibufs, 0, NUM_RPC_TASK * sizeof(rpc_buffer_t)); memset(&ibuf_waiting, 0, sizeof(ibuf_waiting)); memset(&ibuf_ready, 0, sizeof(ibuf_ready)); - for (size_t i = 0; i < sizeof(ibufs)/sizeof(ibufs[0]); ++i) + for (size_t i = 0; i < NUM_RPC_TASK; ++i) ibuf_put(&ibuf_waiting, &ibufs[i]); /* Create the rpc dispatch worker tasks. */ |