commit-gnuradio
[Top][All Lists]
Advanced

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

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


From: eb
Subject: [Commit-gnuradio] r6795 - gnuradio/branches/developers/matt/u2f/firmware
Date: Fri, 2 Nov 2007 16:09:07 -0600 (MDT)

Author: eb
Date: 2007-11-02 16:08:57 -0600 (Fri, 02 Nov 2007)
New Revision: 6795

Modified:
   gnuradio/branches/developers/matt/u2f/firmware/eth_driver.c
   gnuradio/branches/developers/matt/u2f/firmware/eth_mac.c
   gnuradio/branches/developers/matt/u2f/firmware/gen_eth_packets.c
   gnuradio/branches/developers/matt/u2f/firmware/hal_io.c
   gnuradio/branches/developers/matt/u2f/firmware/hal_io.h
Log:
work-in-progress

Modified: gnuradio/branches/developers/matt/u2f/firmware/eth_driver.c
===================================================================
--- gnuradio/branches/developers/matt/u2f/firmware/eth_driver.c 2007-11-02 
21:25:51 UTC (rev 6794)
+++ gnuradio/branches/developers/matt/u2f/firmware/eth_driver.c 2007-11-02 
22:08:57 UTC (rev 6795)
@@ -58,7 +58,7 @@
 static void
 ed_link_up(int speed)
 {
-  hal_puts("ed_link_up: "); hal_puthex_nl(speed);
+  // hal_puts("ed_link_up: "); hal_puthex16_nl(speed);
 
   ed_set_mac_speed(speed);
 
@@ -69,7 +69,7 @@
 static void
 ed_link_down(void)
 {
-  hal_puts("ed_link_down\n");
+  // hal_puts("ed_link_down\n");
 
   if (ed_callback)             // fire link changed callback
     (*ed_callback)(0);
@@ -79,7 +79,7 @@
 static void
 ed_link_speed_change(int speed)
 {
-  hal_puts("ed_link_speed_change: "); hal_puthex_nl(speed);
+  hal_puts("ed_link_speed_change: "); hal_puthex16_nl(speed);
 
   ed_link_down();
   ed_link_up(speed);
@@ -91,7 +91,7 @@
 static void
 ed_check_phy_state(void)
 {
-#if 0  // FIXME
+#if 1
   int lansr = eth_mac_miim_read(PHY_LINK_AN);  //FIXME put back in
 #else
   int lansr = LANSR_LINK_GOOD | LANSR_SPEED_1000;
@@ -99,7 +99,7 @@
   eth_link_state_t new_state = LS_UNKNOWN;
   int new_speed = S_UNKNOWN;
 
-  hal_puts("LANSR: "); hal_puthex_nl(lansr);
+  hal_puts("LANSR: "); hal_puthex16_nl(lansr);
 
   if (lansr & LANSR_LINK_GOOD){                // link's up
     hal_puts_nl("  LINK_GOOD");
@@ -192,9 +192,9 @@
   unsigned read_back = eth_mac_miim_read(PHY_INT_MASK);
 
   hal_puts("eth_driver: wr INT_MASK = ");
-  hal_puthex_nl(mask);
+  hal_puthex16_nl(mask);
   hal_puts("eth_driver: rd INT_MASK = ");
-  hal_puthex_nl(read_back);
+  hal_puthex16_nl(read_back);
 #endif
 
   pic_register_handler(IRQ_PHY, eth_phy_irq_handler);

Modified: gnuradio/branches/developers/matt/u2f/firmware/eth_mac.c
===================================================================
--- gnuradio/branches/developers/matt/u2f/firmware/eth_mac.c    2007-11-02 
21:25:51 UTC (rev 6794)
+++ gnuradio/branches/developers/matt/u2f/firmware/eth_mac.c    2007-11-02 
22:08:57 UTC (rev 6795)
@@ -27,7 +27,7 @@
 void 
 eth_mac_init(void)
 {
-  // FIXME more to do
+  // FIXME more to do?
 
   eth_mac->miimoder = 16;      // divider from CPU clock (33MHz / 16 ~= 2MHz)
 }

Modified: gnuradio/branches/developers/matt/u2f/firmware/gen_eth_packets.c
===================================================================
--- gnuradio/branches/developers/matt/u2f/firmware/gen_eth_packets.c    
2007-11-02 21:25:51 UTC (rev 6794)
+++ gnuradio/branches/developers/matt/u2f/firmware/gen_eth_packets.c    
2007-11-02 22:08:57 UTC (rev 6795)
@@ -94,7 +94,7 @@
   hal_gpio_set_tx(v, LS_MASK); /* set debug bits on d'board */
 
   hal_puts("\neth link changed: speed = ");
-  hal_puthex_nl(speed);
+  hal_puthex16_nl(speed);
 }
 
 void
@@ -136,8 +136,15 @@
 static void
 init_packet(int *buf, const ethernet_packet_t *pkt)
 {
+#if 1
   // copy header into buffer
-  memcpy_wordaligned(buf, pkt, sizeof(pkt));
+  memcpy_wordaligned(buf, pkt, sizeof(*pkt));
+#else
+  buf[1] = 0xffff000A;
+  buf[2] = 0x35987654;
+  buf[3] = 0xBEEF0000;
+#endif
+
   union {
     int         i;
     char c[4];
@@ -180,6 +187,10 @@
 {
   u2_init();
 
+  // setup Rx gpio bits for GPIOM_FPGA_1 -- fpga debug output
+  //hal_gpio_set_rx_mode(15, 0, GPIOM_FPGA_1);
+  hal_gpio_set_rx_mode(15, 0, GPIOM_FPGA_0);
+
   hal_puts("\ngen_eth_packets\n");
   
   // Control LEDs
@@ -199,7 +210,6 @@
   eth_mac->speed = 4;  // FIXME hardcode mac speed to 1000
 
 
-  // int cb = 0;                       // current buffer; alternates btwn 0 & 
1.
   while(1){
     if (/*link_is_up &&*/ send_packet_now){
       send_packet_now = false;
@@ -207,11 +217,11 @@
       // kick off the next packet
       // FIXME set packet number in packet
 
-      bp_clear_buf(0);
       bp_send_from_buf(0, PORT_ETH, 1, 0, 300);
 
       while ((buffer_pool_status->status & (BPS_DONE_0|BPS_ERROR_0)) != 0)
        ;
+      bp_clear_buf(0);
 
       output_regs->leds = (led_counter++) & 0x1;
     }

Modified: gnuradio/branches/developers/matt/u2f/firmware/hal_io.c
===================================================================
--- gnuradio/branches/developers/matt/u2f/firmware/hal_io.c     2007-11-02 
21:25:51 UTC (rev 6794)
+++ gnuradio/branches/developers/matt/u2f/firmware/hal_io.c     2007-11-02 
22:08:57 UTC (rev 6795)
@@ -200,10 +200,23 @@
   hal_puthex16(x);
 }
 
-// %08x\n
 void 
-hal_puthex_nl(unsigned long x)
+hal_puthex8_nl(unsigned long x)
 {
-  hal_puthex(x);
+  hal_puthex8(x);
   hal_newline();
 }
+
+void 
+hal_puthex16_nl(unsigned long x)
+{
+  hal_puthex16(x);
+  hal_newline();
+}
+
+void 
+hal_puthex32_nl(unsigned long x)
+{
+  hal_puthex32(x);
+  hal_newline();
+}

Modified: gnuradio/branches/developers/matt/u2f/firmware/hal_io.h
===================================================================
--- gnuradio/branches/developers/matt/u2f/firmware/hal_io.h     2007-11-02 
21:25:51 UTC (rev 6794)
+++ gnuradio/branches/developers/matt/u2f/firmware/hal_io.h     2007-11-02 
22:08:57 UTC (rev 6795)
@@ -30,12 +30,15 @@
 void hal_putc(unsigned char s);
 void hal_putc_nl(unsigned char s);     // adds \n
 void hal_puts(const char *);
-void hal_puts_nl(const char *s);       // adds \n
+void hal_puts_nl(const char *s);
 void hal_puthex8(unsigned long x);
 void hal_puthex16(unsigned long x);
 void hal_puthex32(unsigned long x);
+void hal_puthex8_nl(unsigned long x);
+void hal_puthex16_nl(unsigned long x);
+void hal_puthex32_nl(unsigned long x);
 #define hal_puthex hal_puthex32
-void hal_puthex_nl(unsigned long x);
+#define hal_puthex_nl hal_puthex32_nl
 void hal_newline();
 
 





reply via email to

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