aboutsummaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorPaul Selkirk <paul@psgd.org>2015-11-14 19:39:55 -0500
committerPaul Selkirk <paul@psgd.org>2015-11-14 19:39:55 -0500
commit6c6a0f2b54814206873df2ac9611bf37c2a492dc (patch)
treef061c9ef161de52628fea219901d6bb09e6098fc /utils
parenta7037d918cbf60bd829e44ccc6d1522f55d5d8b1 (diff)
Catch up with other branch merges.
- TRNG cores are contiguous (but they still have their own mux, so occupy a block of 16 cores). - Use Rob's updated libhal in my new apps.
Diffstat (limited to 'utils')
-rw-r--r--utils/cores.c37
1 files changed, 6 insertions, 31 deletions
diff --git a/utils/cores.c b/utils/cores.c
index da823a7..d59f834 100644
--- a/utils/cores.c
+++ b/utils/cores.c
@@ -40,41 +40,16 @@
#include <sys/time.h>
#include <hal.h>
-
-off_t cores[] = {
- BOARD_ADDR_BASE,
- COMM_ADDR_BASE,
- SHA1_ADDR_BASE,
- SHA256_ADDR_BASE,
- SHA512_ADDR_BASE,
- TRNG_ADDR_BASE,
- ENTROPY1_ADDR_BASE,
- ENTROPY2_ADDR_BASE,
- MIXER_ADDR_BASE,
- CSPRNG_ADDR_BASE,
- AES_ADDR_BASE,
- CHACHA_ADDR_BASE,
- MODEXPS6_ADDR_BASE
-};
+#include <verilog_constants.h>
int main(int argc, char *argv[])
{
- uint8_t name[9] = {0}, version[5] = {0};
- hal_error_t err;
- int i;
-
- /*
- * Initialize EIM and report what cores we've got.
- */
- for (i = 0; i < sizeof(cores)/sizeof(cores[0]); ++i) {
- if ((err = hal_io_read(cores[i], name, 8)) != HAL_OK ||
- (err = hal_io_read(cores[i] + 2, version, 4)) != HAL_OK) {
- printf("hal_io_read failed: %s\n", hal_error_string(err));
- return 1;
- }
+ const hal_core_t *core;
+ const hal_core_info_t *info;
- if (name[0] != 0)
- printf("%08lx: %8s %4s\n", cores[i], name, version);
+ for (core = hal_core_iterate(NULL); core != NULL; core = hal_core_iterate(core)) {
+ info = hal_core_info(core);
+ printf("%08lx: %8.8s %4.4s\n", info->base, info->name, info->version);
}
return 0;