summaryrefslogtreecommitdiff
path: root/usrp2/firmware/lib
diff options
context:
space:
mode:
authorMatt Ettus2009-09-04 22:23:27 -0700
committerMatt Ettus2009-09-04 22:23:27 -0700
commit9e05f0770b92f9c85f09e3629f875011e8f1ac24 (patch)
tree1c7c39e97bd582b17da7a1c31624cf14ab0830e4 /usrp2/firmware/lib
parent7ab7f93a1d7eecc873155026ea06d70d2d2b2846 (diff)
downloadgnuradio-9e05f0770b92f9c85f09e3629f875011e8f1ac24.tar.gz
gnuradio-9e05f0770b92f9c85f09e3629f875011e8f1ac24.tar.bz2
gnuradio-9e05f0770b92f9c85f09e3629f875011e8f1ac24.zip
Implement Eth flow control using pause frames
Not fully tested, but it seems to work without frame errors, sequence number errors or ethernet overruns. Still of course will get tx underruns on a slow machine, and the transmitted signal has some issues though.
Diffstat (limited to 'usrp2/firmware/lib')
-rw-r--r--usrp2/firmware/lib/eth_mac.c5
-rw-r--r--usrp2/firmware/lib/eth_mac_regs.h3
2 files changed, 7 insertions, 1 deletions
diff --git a/usrp2/firmware/lib/eth_mac.c b/usrp2/firmware/lib/eth_mac.c
index becd93644..2ef1f73f4 100644
--- a/usrp2/firmware/lib/eth_mac.c
+++ b/usrp2/firmware/lib/eth_mac.c
@@ -46,7 +46,10 @@ eth_mac_init(const u2_mac_addr_t *src)
eth_mac->miimoder = 25; // divider from CPU clock (50MHz/25 = 2MHz)
eth_mac_set_addr(src);
- eth_mac->settings = MAC_SET_PAUSE_EN | MAC_SET_PASS_BCAST | MAC_SET_PASS_UCAST; // 0x39;
+ eth_mac->settings = MAC_SET_PAUSE_EN | MAC_SET_PASS_BCAST | MAC_SET_PASS_UCAST | MAC_SET_PAUSE_SEND_EN;
+
+ eth_mac->pause_time = 38;
+ eth_mac->pause_thresh = 1200;
// 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
diff --git a/usrp2/firmware/lib/eth_mac_regs.h b/usrp2/firmware/lib/eth_mac_regs.h
index a14c00641..d680f8de0 100644
--- a/usrp2/firmware/lib/eth_mac_regs.h
+++ b/usrp2/firmware/lib/eth_mac_regs.h
@@ -35,6 +35,8 @@ typedef struct {
volatile int miicommand;
volatile int miistatus;
volatile int miirx_data;
+ volatile int pause_time;
+ volatile int pause_thresh;
} eth_mac_regs_t;
// settings register
@@ -44,6 +46,7 @@ typedef struct {
#define MAC_SET_PASS_BCAST (1 << 3) // Sends broadcast frames through (normally on)
#define MAC_SET_PASS_MCAST (1 << 4) // Sends multicast frames that match mcast addr (normally off)
#define MAC_SET_PASS_UCAST (1 << 5) // Sends unicast (normal) frames through if they hit in address filter (normally on)
+#define MAC_SET_PAUSE_SEND_EN (1 << 6) // Enables sending pause frames
// miicommand register
#define MIIC_SCANSSTAT (1 << 0) // Scan status