commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r7095 - in usrp2/trunk/firmware: apps lib


From: eb
Subject: [Commit-gnuradio] r7095 - in usrp2/trunk/firmware: apps lib
Date: Sun, 9 Dec 2007 22:50:05 -0700 (MST)

Author: eb
Date: 2007-12-09 22:50:04 -0700 (Sun, 09 Dec 2007)
New Revision: 7095

Modified:
   usrp2/trunk/firmware/apps/Makefile.am
   usrp2/trunk/firmware/apps/gen_eth_packets.c
   usrp2/trunk/firmware/apps/gen_pause_frames.c
   usrp2/trunk/firmware/apps/rcv_eth_packets.c
   usrp2/trunk/firmware/apps/test_phy_comm.c
   usrp2/trunk/firmware/lib/eth_mac.c
   usrp2/trunk/firmware/lib/eth_mac.h
   usrp2/trunk/firmware/lib/eth_mac_regs.h
Log:
enable automatic generation of pause frames

Modified: usrp2/trunk/firmware/apps/Makefile.am
===================================================================
--- usrp2/trunk/firmware/apps/Makefile.am       2007-12-10 05:49:17 UTC (rev 
7094)
+++ usrp2/trunk/firmware/apps/Makefile.am       2007-12-10 05:50:04 UTC (rev 
7095)
@@ -26,7 +26,6 @@
        buf_ram_zero \
        eth_test \
        gen_eth_packets \
-       gen_pause_frames \
        hello \
        ibs_rx_test \
        ibs_tx_test \

Modified: usrp2/trunk/firmware/apps/gen_eth_packets.c
===================================================================
--- usrp2/trunk/firmware/apps/gen_eth_packets.c 2007-12-10 05:49:17 UTC (rev 
7094)
+++ usrp2/trunk/firmware/apps/gen_eth_packets.c 2007-12-10 05:50:04 UTC (rev 
7095)
@@ -36,10 +36,6 @@
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff
 };
 
-unsigned char src_mac_addr[6] = {
-  0x00, 0x0A, 0x35, 0x98, 0x76, 0x54
-};
-
 #define U2_ETHERTYPE 0xBEEF
 
 
@@ -175,7 +171,7 @@
 
   for (i = 0; i < 6; i++){
     pkt.ehdr.dst_addr[i] = dst_mac_addr[i];
-    pkt.ehdr.src_addr[i] = src_mac_addr[i];
+    pkt.ehdr.src_addr[i] = 0;                  // filled in by mac
   }
   pkt.ehdr.ethertype = U2_ETHERTYPE;
 
@@ -208,7 +204,7 @@
 
   eth_driver_register_link_changed_callback(link_changed_callback);
 
-  eth_mac_init(src_mac_addr);
+  eth_mac_init();
   eth_driver_init();
 
   // eth_mac->speed = 4;       // FIXME hardcode mac speed to 1000

Modified: usrp2/trunk/firmware/apps/gen_pause_frames.c
===================================================================
--- usrp2/trunk/firmware/apps/gen_pause_frames.c        2007-12-10 05:49:17 UTC 
(rev 7094)
+++ usrp2/trunk/firmware/apps/gen_pause_frames.c        2007-12-10 05:50:04 UTC 
(rev 7095)
@@ -211,7 +211,7 @@
 
   eth_driver_register_link_changed_callback(link_changed_callback);
 
-  eth_mac_init(src_mac_addr);
+  eth_mac_init();
   eth_driver_init();
 
   eth_mac->pause_frame_send_en = 1;

Modified: usrp2/trunk/firmware/apps/rcv_eth_packets.c
===================================================================
--- usrp2/trunk/firmware/apps/rcv_eth_packets.c 2007-12-10 05:49:17 UTC (rev 
7094)
+++ usrp2/trunk/firmware/apps/rcv_eth_packets.c 2007-12-10 05:50:04 UTC (rev 
7095)
@@ -237,7 +237,7 @@
 
   eth_driver_register_link_changed_callback(link_changed_callback);
 
-  eth_mac_init(src_mac_addr);
+  eth_mac_init();
   eth_driver_init();
 
   //eth_mac->speed = 4;        // FIXME hardcode mac speed to 1000

Modified: usrp2/trunk/firmware/apps/test_phy_comm.c
===================================================================
--- usrp2/trunk/firmware/apps/test_phy_comm.c   2007-12-10 05:49:17 UTC (rev 
7094)
+++ usrp2/trunk/firmware/apps/test_phy_comm.c   2007-12-10 05:50:04 UTC (rev 
7095)
@@ -106,7 +106,7 @@
   output_regs->phy_ctrl = 1;   /* reset the eth PHY */
   output_regs->phy_ctrl = 0;
 
-  eth_mac_init(src_mac_addr);
+  eth_mac_init();
   eth_driver_init();
 
   u2_infinite_loop();

Modified: usrp2/trunk/firmware/lib/eth_mac.c
===================================================================
--- usrp2/trunk/firmware/lib/eth_mac.c  2007-12-10 05:49:17 UTC (rev 7094)
+++ usrp2/trunk/firmware/lib/eth_mac.c  2007-12-10 05:50:04 UTC (rev 7095)
@@ -24,8 +24,14 @@
 #define PHY_ADDR 1
 
 void 
-eth_mac_init(unsigned char src_mac_addr[6])
+eth_mac_init()
 {
+  // FIXME extract src_mac_addr from EEPROM
+
+  static unsigned char src_mac_addr[6] = {
+    0x00, 0x0A, 0x35, 0x98, 0x76, 0x54
+  };
+
   int i;
   // FIXME more to do?
 
@@ -48,6 +54,16 @@
     eth_mac->mac_rx_add_prom_wr = 0;
   }
   // eth_mac->mac_rx_add_chk_en = 1;  // FIXME enable when everything's working
+
+  eth_mac->tx_pause_en = 1;    // pay attn to pause frames sent to us
+
+  // set rx flow control high and low water marks
+  unsigned int lwmark = (2*2048 + 64)/4; // 2 * 2048-byte frames + 1 * 64-byte 
pause frame
+  eth_mac->fc_lwmark = lwmark;
+  eth_mac->fc_hwmark = lwmark + 2048/4;  // plus a 2048-byte frame
+
+  eth_mac->pause_quanta_set = 38;       // a bit more than 1 max frame 
16kb/512 + fudge
+  eth_mac->pause_frame_send_en = 1;     // enable sending pause frames
 }
 
 int

Modified: usrp2/trunk/firmware/lib/eth_mac.h
===================================================================
--- usrp2/trunk/firmware/lib/eth_mac.h  2007-12-10 05:49:17 UTC (rev 7094)
+++ usrp2/trunk/firmware/lib/eth_mac.h  2007-12-10 05:50:04 UTC (rev 7095)
@@ -19,7 +19,7 @@
 #ifndef INCLUDED_ETH_MAC_H
 #define INCLUDED_ETH_MAC_H
 
-void eth_mac_init(unsigned char src_mac_addr[6]);
+void eth_mac_init(void);
 int  eth_mac_read_rmon(int addr);
 int  eth_mac_miim_read(int addr);
 void eth_mac_miim_write(int addr, int value);

Modified: usrp2/trunk/firmware/lib/eth_mac_regs.h
===================================================================
--- usrp2/trunk/firmware/lib/eth_mac_regs.h     2007-12-10 05:49:17 UTC (rev 
7094)
+++ usrp2/trunk/firmware/lib/eth_mac_regs.h     2007-12-10 05:50:04 UTC (rev 
7095)
@@ -29,8 +29,13 @@
 typedef struct {
   volatile int tx_hwmark;
   volatile int tx_lwmark;
+
+  //! if set, send pause frames automatically
   volatile int pause_frame_send_en;
+
+  //! quanta value for pause frame in units of 512 bit times.
   volatile int pause_quanta_set;
+
   volatile int ifg_set;
   volatile int full_duplex;
   volatile int max_retry;
@@ -38,9 +43,17 @@
   volatile int mac_tx_add_prom_data;
   volatile int mac_tx_add_prom_add;
   volatile int mac_tx_add_prom_wr;
+
+  //! if set, other end can pause us (i.e., we pay attention to pause frames)
   volatile int tx_pause_en;
-  volatile int xoff_cpu;
-  volatile int xon_cpu;
+
+  // Flow Control high and low water marks
+  //! when space available (in 32-bit lines) > hwmark, send un-pause frame
+  volatile int fc_hwmark;      
+
+  //! when space avail (in 32-bit lines) < lwmark, send pause frame
+  volatile int fc_lwmark;      
+
   volatile int mac_rx_add_chk_en;
   volatile int mac_rx_add_prom_data;
   volatile int mac_rx_add_prom_add;





reply via email to

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