This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
laforge gerrit-no-reply at lists.osmocom.orglaforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-e1-hardware/+/21731 ) Change subject: icE1usb fw: Use green per-port LED to indicate alignment status ...................................................................... icE1usb fw: Use green per-port LED to indicate alignment status Whenever Rx is aligned, the green LED is permanently on. Whenever Rx is not aligned, the green LED is blinking. What's missing is to check for E1 clock ticks and turn the LED off completely if there are no clock ticks. Change-Id: I42d53544858dbbbae5206d9a62b08672966c9ebf --- M doc/manuals/chapters/firmware.adoc M firmware/ice40-riscv/icE1usb/e1.c M firmware/ice40-riscv/icE1usb/e1.h M firmware/ice40-riscv/icE1usb/misc.c 4 files changed, 51 insertions(+), 4 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-e1-hardware refs/changes/31/21731/1 diff --git a/doc/manuals/chapters/firmware.adoc b/doc/manuals/chapters/firmware.adoc index d0542bd..254e235 100644 --- a/doc/manuals/chapters/firmware.adoc +++ b/doc/manuals/chapters/firmware.adoc @@ -128,9 +128,17 @@ === Use of the E1 Interface LEDs -Each E1 interface has two LEDs integrated into the RJ45 connector. +Each E1 interface has two LEDs integrated into the RJ45 connector. They +are (starting to get) used by the firmware to indicate status +information to the user. -FIXME: describe how they are used. +[options="header"] +|=== +|Color | Pattern | Meaning +|Green | Blinking (slow) | E1 Receiver attempting to align +|Green | On | E1 Receiver fully aligned +|=== + === Use of the Multi-Color RGB LED diff --git a/firmware/ice40-riscv/icE1usb/e1.c b/firmware/ice40-riscv/icE1usb/e1.c index b89b7c7..9ad2798 100644 --- a/firmware/ice40-riscv/icE1usb/e1.c +++ b/firmware/ice40-riscv/icE1usb/e1.c @@ -422,10 +422,14 @@ return; /* HACK: LED link status */ - if (e1_regs->rx.csr & E1_RX_SR_ALIGNED) + if (e1_regs->rx.csr & E1_RX_SR_ALIGNED) { + e1_platform_led_set(0, E1P_LED_GREEN, E1P_LED_ST_ON); led_color(0, 48, 0); - else + } else { + e1_platform_led_set(0, E1P_LED_GREEN, E1P_LED_ST_BLINK); + /* TODO: completely off if rx tick counter not incrementing */ led_color(48, 0, 0); + } /* Recover any done TX BD */ while ( (bd = e1_regs->tx.bd) & E1_BD_VALID ) { diff --git a/firmware/ice40-riscv/icE1usb/e1.h b/firmware/ice40-riscv/icE1usb/e1.h index c56cf0c..c6b6fea 100644 --- a/firmware/ice40-riscv/icE1usb/e1.h +++ b/firmware/ice40-riscv/icE1usb/e1.h @@ -19,3 +19,19 @@ volatile uint8_t *e1_data_ptr(int mf, int frame, int ts); unsigned int e1_data_ofs(int mf, int frame, int ts); + +enum e1_platform_led { + E1P_LED_GREEN = 0, + E1P_LED_YELLOW = 1, +}; + +enum e1_platform_led_state { + E1P_LED_ST_OFF = 0, + E1P_LED_ST_ON = 1, + E1P_LED_ST_BLINK = 2, + E1P_LED_ST_BLINK_FAST = 3 +}; + +/* external function provided by the platform; used by E1 driver to control LEDs */ +extern void e1_platform_led_set(uint8_t port, enum e1_platform_led led, + enum e1_platform_led_state state); diff --git a/firmware/ice40-riscv/icE1usb/misc.c b/firmware/ice40-riscv/icE1usb/misc.c index dca126a..3117be9 100644 --- a/firmware/ice40-riscv/icE1usb/misc.c +++ b/firmware/ice40-riscv/icE1usb/misc.c @@ -10,6 +10,7 @@ #include "config.h" #include "misc.h" +#include "e1.h" struct misc { @@ -51,6 +52,24 @@ misc_regs->e1_led = (enable ? 0x100 : 0x000) | cfg; } +void +e1_platform_led_set(uint8_t port, enum e1_platform_led led, + enum e1_platform_led_state state) +{ + uint32_t tmp; + unsigned int shift; + + if (port >= 2) + return; + + shift = 4*port + 2*led; + + tmp = misc_regs->e1_led; + tmp &= ~(3 << shift); + tmp |= 0x100 | ((state & 3) << shift); + misc_regs->e1_led = tmp; +} + uint16_t e1_tick_read(void) { -- To view, visit https://gerrit.osmocom.org/c/osmo-e1-hardware/+/21731 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1-hardware Gerrit-Branch: master Gerrit-Change-Id: I42d53544858dbbbae5206d9a62b08672966c9ebf Gerrit-Change-Number: 21731 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge at osmocom.org> Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201215/86eea556/attachment.htm>