summaryrefslogtreecommitdiffstats
path: root/firmware/microblaze
diff options
context:
space:
mode:
authorNick Foster <nick@nerdnetworks.org>2010-07-27 20:11:05 -0700
committerNick Foster <nick@nerdnetworks.org>2010-07-27 20:11:05 -0700
commit9b63845669056ace2ca50a2c406ce6cf3657ec74 (patch)
treeec10b8a0ccd3e7e83b7d65595dc355854fc0a0d7 /firmware/microblaze
parent06b0fc51c92a933d2641395c0b3974bb95df18d0 (diff)
downloaduhd-9b63845669056ace2ca50a2c406ce6cf3657ec74.tar.gz
uhd-9b63845669056ace2ca50a2c406ce6cf3657ec74.tar.bz2
uhd-9b63845669056ace2ca50a2c406ce6cf3657ec74.zip
Ethernet mods for activity LED.
Diffstat (limited to 'firmware/microblaze')
-rw-r--r--firmware/microblaze/lib/eth_mac.c2
-rw-r--r--firmware/microblaze/lib/pic.c2
-rw-r--r--firmware/microblaze/usrp2p/eth_phy.h25
-rw-r--r--firmware/microblaze/usrp2p/ethernet.c8
4 files changed, 33 insertions, 4 deletions
diff --git a/firmware/microblaze/lib/eth_mac.c b/firmware/microblaze/lib/eth_mac.c
index cd0179deb..034a4d494 100644
--- a/firmware/microblaze/lib/eth_mac.c
+++ b/firmware/microblaze/lib/eth_mac.c
@@ -104,7 +104,7 @@ eth_mac_miim_write(int addr, int value)
eth_mac->miitx_data = value;
eth_mac->miicommand = MIIC_WCTRLDATA;
- //printf("MIIM-WRITE ADDR 0x%x VAL 0x%x\n",addr,value);
+// printf("MIIM-WRITE ADDR 0x%x VAL 0x%x\n",addr,value);
while((eth_mac->miistatus & MIIS_BUSY) != 0)
;
}
diff --git a/firmware/microblaze/lib/pic.c b/firmware/microblaze/lib/pic.c
index 4575bd775..e89d2b755 100644
--- a/firmware/microblaze/lib/pic.c
+++ b/firmware/microblaze/lib/pic.c
@@ -44,7 +44,7 @@ pic_init(void)
// uP is level triggered
pic_regs->mask = ~0; // mask all interrupts
- pic_regs->edge_enable = PIC_ONETIME_INT | PIC_PHY_INT;
+ pic_regs->edge_enable = PIC_ONETIME_INT;
pic_regs->polarity = ~0 & ~PIC_PHY_INT; // rising edge
pic_regs->pending = ~0; // clear all pending ints
}
diff --git a/firmware/microblaze/usrp2p/eth_phy.h b/firmware/microblaze/usrp2p/eth_phy.h
index 9328debee..d233e96e8 100644
--- a/firmware/microblaze/usrp2p/eth_phy.h
+++ b/firmware/microblaze/usrp2p/eth_phy.h
@@ -42,6 +42,7 @@
#define PHY_INT_MASK 24
#define PHY_INT_STATUS 25
#define PHY_PHY_STATUS 26
+#define PHY_LED2 28
/* Bit definitions for some of the registers above */
@@ -207,4 +208,28 @@
#define PHY_INT_MDIO_SYNC_LOST (1 << 9)
#define PHY_INT_TDR_IP_PHONE (1 << 10)
+/* PHY LED status register 2 (used for controlling link LED for activity light) */
+#define PHY_LED_TXRX_LSB 12
+#define PHY_LED_LINK_LSB 8
+#define PHY_LED_100_LSB 4
+#define PHY_LED_1000_LSB 0
+
+#define LED_1000 0
+#define LED_100_TX 1
+#define LED_10 2
+#define LED_1000_ON_100_BLINK 3
+#define LED_LINK 4
+#define LED_TX 5
+#define LED_RX 6
+#define LED_ACTIVITY 7
+#define LED_FULLDUPLEX 8
+#define LED_COLLISION 9
+#define LED_LINK_ON_ACTIVITY_BLINK 10
+#define LED_LINK_ON_RX_BLINK 11
+#define LED_FULL_DUPLEX_ON_COLLISION_BLINK 12
+#define LED_BLINK 13
+#define LED_ON 14
+#define LED_OFF 15
+
+
#endif /* INCLUDED_ETH_PHY_H */
diff --git a/firmware/microblaze/usrp2p/ethernet.c b/firmware/microblaze/usrp2p/ethernet.c
index 134650326..07224d3b7 100644
--- a/firmware/microblaze/usrp2p/ethernet.c
+++ b/firmware/microblaze/usrp2p/ethernet.c
@@ -29,7 +29,7 @@
#include <i2c.h>
#include "usrp2/fw_common.h"
-#define VERBOSE 1
+#define VERBOSE 0
static ethernet_t ed_state;
static ethernet_link_changed_callback_t ed_callback = 0;
@@ -222,9 +222,13 @@ ethernet_init(void)
| PHY_INT_RX_STATUS_CHANGE
);
- eth_mac_miim_read(PHY_INT_STATUS);
+ eth_mac_miim_read(PHY_INT_STATUS); //clear interrupts
eth_mac_miim_write(PHY_INT_MASK, mask); // enable the ones we want
+ //set the LED behavior to activity instead of link
+ unsigned led = (LED_ACTIVITY << PHY_LED_LINK_LSB);
+ eth_mac_miim_write(PHY_LED2, led);
+
pic_register_handler(IRQ_PHY, eth_phy_irq_handler);
// Advertise our flow control configuation.