From 9b63845669056ace2ca50a2c406ce6cf3657ec74 Mon Sep 17 00:00:00 2001 From: Nick Foster Date: Tue, 27 Jul 2010 20:11:05 -0700 Subject: Ethernet mods for activity LED. --- firmware/microblaze/lib/eth_mac.c | 2 +- firmware/microblaze/lib/pic.c | 2 +- firmware/microblaze/usrp2p/eth_phy.h | 25 +++++++++++++++++++++++++ firmware/microblaze/usrp2p/ethernet.c | 8 ++++++-- 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 #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. -- cgit v1.2.3