Merge branch 'patches/geiger/u2_rx_stream_at' of git@gnuradio.org:jcorgan
[debian/gnuradio] / usrp2 / firmware / apps / factory_test.c
index 1f8d936a26de409e853d5f52b53a18326c3110a3..e7dde524a2fcbc6d3b112a101a7ce006db4a1041 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007,2008 Free Software Foundation, Inc.
+ * Copyright 2007,2008,2009 Free Software Foundation, Inc.
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -40,9 +40,6 @@
 #include <clocks.h>
 #include "sd.h"
 
-#define HW_REV_MAJOR 3
-#define HW_REV_MINOR 1
-
 #define FW_SETS_SEQNO  1       // define to 0 or 1 (FIXME must be 1 for now)
 
 #if (FW_SETS_SEQNO)
@@ -157,7 +154,7 @@ restart_streaming(void)
   dsp_rx_regs->rx_command =
     MK_RX_CMD(FRAMES_PER_CMD * streaming_items_per_frame,
              streaming_items_per_frame,
-             1, 1);                            
+             1, 1);
 
   dsp_rx_regs->rx_time = 0;            // enqueue second command
 }
@@ -173,6 +170,7 @@ start_rx_streaming_cmd(const u2_mac_addr_t *host, op_start_rx_streaming_t *p)
   u2_eth_packet_t      pkt;
   memset(&pkt, 0, sizeof(pkt));
   pkt.ehdr.dst = *host;
+  pkt.ehdr.src = *ethernet_mac_addr();
   pkt.ehdr.ethertype = U2_ETHERTYPE;
   u2p_set_word0(&pkt.fixed, 0, 0);
   // DSP RX will fill in timestamp
@@ -189,6 +187,11 @@ start_rx_streaming_cmd(const u2_mac_addr_t *host, op_start_rx_streaming_t *p)
 }
 
 
+void start_rx_streaming_at_cmd(const u2_mac_addr_t *host, op_start_rx_streaming_t *p, uint32_t time)
+{}
+void restart_streaming_at(uint32_t time)
+{}
+
 void
 stop_rx_cmd(void)
 {
@@ -226,7 +229,7 @@ setup_tx()
  * that we didn't handle the packet.  A bit of a kludge
  * but it should work.
  */
-bool 
+bool
 fw_sets_seqno_inspector(dbsm_t *sm, int buf_this)      // returns false
 {
   uint32_t *p = buffer_ram(buf_this);
@@ -261,22 +264,22 @@ int test_ram()
 {
   int i,j,k;
   output_regs->ram_page = 1<<10;
-  
+
   extram[0] = 0xDEADBEEF;
   extram[1] = 0xF00D1234;
   extram[7] = 0x76543210;
-  
+
   output_regs->ram_page = 2<<10;
   extram[7] = 0x55555555;
   extram[1] = 0xaaaaaaaa;
   extram[0] = 0xeeeeeeee;
-  
+
   output_regs->ram_page = 1<<10;
-  
+
   i = extram[0];
   k = extram[1];
   j = extram[7];
-  
+
   if((i != 0xDEADBEEF)||(j!=0x76543210)||(k!=0xF00D1234)) {
     puts("RAM FAIL1!\n");
     puthex32_nl(i);
@@ -284,7 +287,7 @@ int test_ram()
     puthex32_nl(k);
     return 0;
   }
-  
+
   output_regs->ram_page = 2<<10;
 
   j = extram[7];
@@ -308,7 +311,7 @@ int test_sd()
     puts("FAILED INIT of Card\n");
     return 0;
   }
-  
+
   unsigned char buf[512];
   i = sd_read_block(2048,buf);
   if(i == 0) {
@@ -329,29 +332,17 @@ main(void)
 {
   u2_init();
 
-  putstr("\nFactory Test TXRX\n");
+  putstr("\nFactory Test\n");
 
-  bool ok = true;
-  unsigned char maj = HW_REV_MAJOR;
-  unsigned char min = HW_REV_MINOR;
-  ok = eeprom_write(I2C_ADDR_MBOARD, MBOARD_REV_MSB, &maj, 1);
-  ok &= eeprom_write(I2C_ADDR_MBOARD, MBOARD_REV_LSB, &min, 1);
-
-  putstr("\nset_hw_rev\n");
-  if (ok)
-    printf("OK: set h/w rev to %d.%d\n", HW_REV_MAJOR, HW_REV_MINOR);
-  else {
-    printf("FAILED to set h/w rev to %d.%d\n", HW_REV_MAJOR, HW_REV_MINOR);
-    hal_finish();
-    return 0;
-  }
+  print_mac_addr(ethernet_mac_addr()->addr);
+  newline();
 
   if(test_sd())
     puts("SD OK\n");
   else {
     puts("SD FAIL\n");
-    hal_finish();
-    return 0;
+    //    hal_finish();
+    //return 0;
   }
   if(test_ram())
     puts("RAM OK\n");