diff options
Diffstat (limited to 'i2c/sw/hash_tester_i2c.c')
-rw-r--r-- | i2c/sw/hash_tester_i2c.c | 48 |
1 files changed, 2 insertions, 46 deletions
diff --git a/i2c/sw/hash_tester_i2c.c b/i2c/sw/hash_tester_i2c.c index c9b8f5f..41a117e 100644 --- a/i2c/sw/hash_tester_i2c.c +++ b/i2c/sw/hash_tester_i2c.c @@ -224,34 +224,6 @@ const uint8_t SHA512_DOUBLE_DIGEST[] = 0xc7, 0xd3, 0x29, 0xee, 0xb6, 0xdd, 0x26, 0x54, 0x5e, 0x96, 0xe5, 0x5b, 0x87, 0x4b, 0xe9, 0x09 }; -/* ---------------- test-case low-level code ---------------- */ - -int tc_init(off_t offset) -{ - uint8_t buf[4] = { 0, 0, 0, CTRL_INIT_CMD }; - - return tc_write(offset, buf, 4); -} - -int tc_next(off_t offset) -{ - uint8_t buf[4] = { 0, 0, 0, CTRL_NEXT_CMD }; - - return tc_write(offset, buf, 4); -} - -int tc_wait_ready(off_t offset) -{ - int limit = 10; - return tc_wait(offset, STATUS_READY_BIT, &limit); -} - -int tc_wait_valid(off_t offset) -{ - int limit = 10; - return tc_wait(offset, STATUS_VALID_BIT, &limit); -} - /* ---------------- sanity test case ---------------- */ int TC0() @@ -595,12 +567,10 @@ int main(int argc, char *argv[]) tcfp sha256_tests[] = { TC4, TC5, TC6, TC7 }; tcfp sha512_tests[] = { TC8, TC9, TC10 }; - char *usage = "Usage: %s [-h] [-d] [-q] [-i I2C_device] [-a I2C_addr] tc...\n"; - char *dev = I2C_dev; - int addr = I2C_addr; + char *usage = "Usage: %s [-h] [-d] [-q] tc...\n"; int i, j, opt; - while ((opt = getopt(argc, argv, "h?dqi:a:")) != -1) { + while ((opt = getopt(argc, argv, "h?dq")) != -1) { switch (opt) { case 'h': case '?': @@ -612,26 +582,12 @@ int main(int argc, char *argv[]) case 'q': quiet = 1; break; - case 'i': - dev = optarg; - break; - case 'a': - addr = (int)strtol(optarg, NULL, 0); - if ((addr < 0x03) || (addr > 0x77)) { - fprintf(stderr, "addr must be between 0x03 and 0x77\n"); - return EXIT_FAILURE; - } - break; default: fprintf(stderr, usage, argv[0]); return EXIT_FAILURE; } } - /* set up I2C */ - if (i2c_open(dev, addr) != 0) - return EXIT_FAILURE; - /* no args == run all tests */ if (optind >= argc) { for (j = 0; j < sizeof(all_tests)/sizeof(all_tests[0]); ++j) |