laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-e1-hardware/+/26906 ) Change subject: icE1usb fw: Add function to enable/disable E1 led runner ...................................................................... icE1usb fw: Add function to enable/disable E1 led runner Also don't force enable the runner in the e1_platform_led_set callback. Due to GPIO shortage, the E1 leds control are multiplexed with SPI so this adds a method to temporarely stop the runner so SPI can be used. Signed-off-by: Sylvain Munaut <tnt@246tNt.com> Change-Id: Ie671daab5ee5e0b5f58de9d4fef1f0ca7d6d02b6 --- M firmware/ice40-riscv/icE1usb/misc.c M firmware/ice40-riscv/icE1usb/misc.h 2 files changed, 17 insertions(+), 1 deletion(-) Approvals: laforge: Looks good to me, approved Jenkins Builder: Verified diff --git a/firmware/ice40-riscv/icE1usb/misc.c b/firmware/ice40-riscv/icE1usb/misc.c index 4b32fcd..bd9198a 100644 --- a/firmware/ice40-riscv/icE1usb/misc.c +++ b/firmware/ice40-riscv/icE1usb/misc.c @@ -47,6 +47,18 @@ void +e1_led_run(void) +{ + misc_regs->e1_led |= 0x100; +} + +void +e1_led_pause(void) +{ + misc_regs->e1_led &= 0xff; +} + +void e1_led_set(bool enable, uint8_t cfg) { misc_regs->e1_led = (enable ? 0x100 : 0x000) | cfg; @@ -66,10 +78,11 @@ tmp = misc_regs->e1_led; tmp &= ~(3 << shift); - tmp |= 0x100 | ((state & 3) << shift); + tmp |= ((state & 3) << shift); misc_regs->e1_led = tmp; } + uint16_t e1_tick_read(int port) { diff --git a/firmware/ice40-riscv/icE1usb/misc.h b/firmware/ice40-riscv/icE1usb/misc.h index dac5730..b4baef1 100644 --- a/firmware/ice40-riscv/icE1usb/misc.h +++ b/firmware/ice40-riscv/icE1usb/misc.h @@ -26,7 +26,10 @@ void pdm_set(int chan, bool enable, unsigned value, bool normalize); +void e1_led_run(void); +void e1_led_pause(void); void e1_led_set(bool enable, uint8_t cfg); + uint16_t e1_tick_read(int port); void reboot(int fw); -- To view, visit https://gerrit.osmocom.org/c/osmo-e1-hardware/+/26906 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: Ie671daab5ee5e0b5f58de9d4fef1f0ca7d6d02b6 Gerrit-Change-Number: 26906 Gerrit-PatchSet: 2 Gerrit-Owner: tnt <tnt@246tNt.com> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge@osmocom.org> Gerrit-MessageType: merged