commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r6503 - gnuradio/branches/developers/matt/u2f/firmware


From: matt
Subject: [Commit-gnuradio] r6503 - gnuradio/branches/developers/matt/u2f/firmware
Date: Sat, 22 Sep 2007 02:36:49 -0600 (MDT)

Author: matt
Date: 2007-09-22 02:36:49 -0600 (Sat, 22 Sep 2007)
New Revision: 6503

Added:
   gnuradio/branches/developers/matt/u2f/firmware/eth_test.c
Modified:
   gnuradio/branches/developers/matt/u2f/firmware/Makefile
Log:
new program to test ethernet


Modified: gnuradio/branches/developers/matt/u2f/firmware/Makefile
===================================================================
--- gnuradio/branches/developers/matt/u2f/firmware/Makefile     2007-09-21 
13:54:45 UTC (rev 6502)
+++ gnuradio/branches/developers/matt/u2f/firmware/Makefile     2007-09-22 
08:36:49 UTC (rev 6503)
@@ -13,14 +13,17 @@
 
 .PRECIOUS : %.bin
 
-ROMS = test1.rom
-DUMPS = test1.dump
+ROMS = test1.rom eth_test.rom
+DUMPS = test1.dump eth_test.dump
 
 all: $(ROMS) $(DUMPS)
 
 test1.exe: test1_main.o u2_init.o spi.o buffer_pool.o sim_io.o
        $(CC) $^ -o $@
 
+eth_test.exe: eth_test.o u2_init.o spi.o buffer_pool.o sim_io.o
+       $(CC) $^ -o $@
+
 clean:
        rm -f *.o *.bin *.rom *.exe *.dump
 
@@ -33,5 +36,6 @@
 buffer_pool.o: memory_map.h buffer_pool.h buffer_pool.c
 sim_io.o: sim_io.h
 test1_main.o: u2_init.h memory_map.h spi.h buffer_pool.h sim_io.h test1_main.c
+eth_test.o: u2_init.h memory_map.h spi.h buffer_pool.h sim_io.h eth_test.c
 eth.o: u2_init.h memory_map.h spi.h buffer_pool.h sim_io.h eth.c
 

Added: gnuradio/branches/developers/matt/u2f/firmware/eth_test.c
===================================================================
--- gnuradio/branches/developers/matt/u2f/firmware/eth_test.c                   
        (rev 0)
+++ gnuradio/branches/developers/matt/u2f/firmware/eth_test.c   2007-09-22 
08:36:49 UTC (rev 6503)
@@ -0,0 +1,109 @@
+#include "u2_init.h"
+#include "memory_map.h"
+#include "spi.h"
+#include "sim_io.h"
+#include "buffer_pool.h"
+
+// Globals
+#define EMPTY 0
+#define FILLING 1
+#define FULL 2
+#define EMPTYING 3
+
+#define PORT 2    // ethernet = 2, serdes = 0
+int dsp_rx_buf, dsp_tx_buf, serdes_rx_buf, serdes_tx_buf;
+int dsp_rx_idle, dsp_tx_idle, serdes_rx_idle, serdes_tx_idle;
+
+int buffer_state[4];
+
+void int_handler_func () __attribute__ ((interrupt_handler));
+
+void double_buffering();
+
+void int_handler_func () {
+  //double_buffering(PORT);
+}
+
+int
+main(void)
+{
+  int i;
+  
+  u2_init();
+  
+  sim_puts("Start Program\n");
+  
+  // Write data to be sent into the first buffer
+  int *buffer0 = (int *)(BUFFER_BASE + BUFFER_0);
+  int *buffer1 = (int *)(BUFFER_BASE + BUFFER_1);
+  
+  // Buffer status info
+  volatile unsigned int *status = (unsigned int *) 0xB020;
+  
+  sim_puts("Starting to fill in RAM\n");
+  for(i=0;i<512;i++) 
+    buffer0[i] = ((437+i)<<16) + 5395-i;
+  sim_puts("Filled in RAM\n");
+  
+  // Set up  receive buffer
+  receive_to_buf(1, 2, 1, 0, 511);  // Fill from ethernet
+  sim_puts("Set up RX buffer\n");
+  
+  
+  // Set up send buffer
+  send_from_buf(0, 2, 1, 0, 20);
+  sim_puts("Set up TX Buffer\n");
+
+  while(*status != 3) {}
+  clear_buf(0);
+  clear_buf(1);
+
+  sim_puts("Both are done\n");
+  
+  // Send a bunch, let them pile up in FIFO
+  send_from_buf(0, 2, 1, 21, 80);  while(*status == 0) {}
+  clear_buf(0);
+  sim_puts("First add'l TX done\n");
+  send_from_buf(0, 2, 1, 81, 288);  while(*status == 0) {}
+  clear_buf(0);
+  send_from_buf(0, 2, 1, 289, 292);  while(*status == 0) {}
+  clear_buf(0);
+  send_from_buf(0, 2, 1, 293, 326);  while(*status == 0) {}
+  clear_buf(0);
+  send_from_buf(0, 2, 1, 327, 399);  while(*status == 0) {}
+  clear_buf(0);
+  send_from_buf(0, 2, 1, 400, 511);  while(*status == 0) {}
+  clear_buf(0);
+  sim_puts("All add'l TX done\n");
+  
+  receive_to_buf(1, 2, 1, 21, 80);  while(*status == 0) {}
+  clear_buf(1);
+  sim_puts("First add'l RX done\n");
+  receive_to_buf(1, 2, 1, 81, 288);  while(*status == 0) {}
+  clear_buf(1);
+  receive_to_buf(1, 2, 1, 289, 292);  while(*status == 0) {}
+  clear_buf(1);
+  receive_to_buf(1, 2, 1, 293, 326);  while(*status == 0) {}
+  clear_buf(1);
+  receive_to_buf(1, 2, 1, 327, 399);  while(*status == 0) {}
+  clear_buf(1);
+  receive_to_buf(1, 2, 1, 400, 511);  while(*status == 0) {}
+  clear_buf(1);
+  sim_puts("All add'l RX done\n");
+
+  for(i=0;i<512;i++)
+    if(buffer0[i] != buffer1[i]) {
+      sim_puts("ERROR at location: ");
+      sim_puthex_nl(i);
+      sim_puts("Value sent: ");
+      sim_puthex_nl(buffer0[i]);
+      sim_puts("Value rcvd: ");
+      sim_puthex_nl(buffer1[i]);
+      break;
+    }
+  
+  sim_puts("Done Testing\n");
+  
+  sim_finish();
+  return 1;
+}





reply via email to

[Prev in Thread] Current Thread [Next in Thread]