[Cryptech-Commits] [sw/stm32] 02/03: Whack various bits of sw/stm32 test code to compile on fmc_clk branch.

git at cryptech.is git at cryptech.is
Wed Dec 12 15:49:24 UTC 2018


This is an automated email from the git hooks/post-receive script.

paul at psgd.org pushed a commit to branch fmc_clk
in repository sw/stm32.

commit e79ecc525cf92134e6d67600a41a302e88ae89e3
Author: Rob Austein <sra at hactrn.net>
AuthorDate: Mon Jul 16 15:00:16 2018 -0400

    Whack various bits of sw/stm32 test code to compile on fmc_clk branch.
---
 projects/board-test/fmc-perf.c  | 20 ++++----------------
 projects/board-test/fmc-probe.c |  5 +----
 projects/board-test/fmc-test.c  | 16 ++++++----------
 projects/cli-test/test-fmc.c    | 12 ++----------
 4 files changed, 13 insertions(+), 40 deletions(-)

diff --git a/projects/board-test/fmc-perf.c b/projects/board-test/fmc-perf.c
index 71d0149..5af0946 100644
--- a/projects/board-test/fmc-perf.c
+++ b/projects/board-test/fmc-perf.c
@@ -31,14 +31,8 @@ static void sanity(void)
     uint32_t rnd, data;
   
     rnd = random();  
-    if (fmc_write_32(0, rnd) != 0) {
-	uart_send_string("fmc_write_32 failed\r\n");
-	Error_Handler();
-    }
-    if (fmc_read_32(0, &data) != 0) {
-	uart_send_string("fmc_read_32 failed\r\n");
-	Error_Handler();
-    }
+    fmc_write_32(0, rnd);
+    fmc_read_32(0, &data);
     if (data != rnd) {
 	uart_send_string("Data bus fail: expected ");
 	uart_send_hex(rnd, 8);
@@ -76,10 +70,7 @@ static void test_read(void)
     uint32_t i, data;
     
     for (i = 0; i < TEST_NUM_ROUNDS; ++i) {
-	if (fmc_read_32(0, &data) != 0) {
-	    uart_send_string("fmc_read_32 failed\r\n");
-	    Error_Handler();
-	}
+        fmc_read_32(0, &data);
     }
 }
 
@@ -88,10 +79,7 @@ static void test_write(void)
     uint32_t i;
     
     for (i = 0; i < TEST_NUM_ROUNDS; ++i) {
-	if (fmc_write_32(0, i) != 0) {
-	    uart_send_string("fmc_write_32 failed\r\n");
-	    Error_Handler();
-	}
+	fmc_write_32(0, i);
     }
 }
 
diff --git a/projects/board-test/fmc-probe.c b/projects/board-test/fmc-probe.c
index 5f7fdb5..38897ab 100644
--- a/projects/board-test/fmc-probe.c
+++ b/projects/board-test/fmc-probe.c
@@ -21,10 +21,7 @@ static uint32_t read0(uint32_t addr)
 {
     uint32_t data;
 
-    if (fmc_read_32(addr, &data) != 0) {
-	uart_send_string("fmc_read_32 failed\r\n");
-	Error_Handler();
-    }
+    fmc_read_32(addr, &data);
 
     return data;
 }
diff --git a/projects/board-test/fmc-test.c b/projects/board-test/fmc-test.c
index 1421db0..bd30dd5 100644
--- a/projects/board-test/fmc-test.c
+++ b/projects/board-test/fmc-test.c
@@ -158,7 +158,7 @@ int main(void)
 int test_fpga_data_bus(void)
 //------------------------------------------------------------------------------
 {
-  int c, ok;
+  int c;
   uint32_t rnd, buf;
   HAL_StatusTypeDef hal_result;
 
@@ -171,12 +171,10 @@ 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);
-      if (ok != 0) break;
+      fmc_write_32(0, rnd);
 
       // read value from fpga
-      ok = fmc_read_32(0, &buf);
-      if (ok != 0) break;
+      fmc_read_32(0, &buf);
 
       // compare (abort testing in case of error)
       if (buf != rnd)
@@ -218,7 +216,7 @@ int test_fpga_data_bus(void)
 int test_fpga_address_bus(void)
 //------------------------------------------------------------------------------
 {
-  int c, ok;
+  int c;
   uint32_t rnd, buf;
   HAL_StatusTypeDef hal_result;
 
@@ -239,12 +237,10 @@ 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);
-      if (ok != 0) break;
+      fmc_write_32(rnd, buf);
 
       // read value from fpga
-      ok = fmc_read_32(0, &buf);
-      if (ok != 0) break;
+      fmc_read_32(0, &buf);
 
       // fpga receives address of 32-bit word, while we need
       // byte address here to compare
diff --git a/projects/cli-test/test-fmc.c b/projects/cli-test/test-fmc.c
index 6773cfc..d9b0c9b 100644
--- a/projects/cli-test/test-fmc.c
+++ b/projects/cli-test/test-fmc.c
@@ -80,16 +80,8 @@ static int _write_then_read(struct cli_def *cli, uint32_t addr, uint32_t write_b
 {
     int ok;
 
-    ok = fmc_write_32(addr, write_buf);
-    if (ok != 0) {
-	cli_print(cli, "FMC write failed: 0x%x", ok);
-	return 0;
-    }
-    ok = fmc_read_32(0, read_buf);
-    if (ok != 0) {
-	cli_print(cli, "FMC read failed: 0x%x", ok);
-	return 0;
-    }
+    fmc_write_32(addr, write_buf);
+    fmc_read_32(0, read_buf);
 
     return 1;
 }



More information about the Commits mailing list