diff options
author | Aidan MacDonald <amachronic@protonmail.com> | 2021-08-18 23:07:15 +0100 |
---|---|---|
committer | Aidan MacDonald <amachronic@protonmail.com> | 2021-08-18 23:17:07 +0100 |
commit | 4cbb5b42010309677f3590e3a716c69c12e8adf2 (patch) | |
tree | 320f89a0950ea9513a5f26435f68991962d06e95 /firmware | |
parent | 3e37013218781f92ecacdfc01f1b958491a31d6b (diff) |
x1000: trigger the virtual LED on disk activity
Change-Id: Ic129e79e0b192cb0c39e5f05ad602e0ea7a9213f
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/target/mips/ingenic_x1000/msc-x1000.c | 14 | ||||
-rw-r--r-- | firmware/target/mips/ingenic_x1000/msc-x1000.h | 2 |
2 files changed, 16 insertions, 0 deletions
diff --git a/firmware/target/mips/ingenic_x1000/msc-x1000.c b/firmware/target/mips/ingenic_x1000/msc-x1000.c index dbc1ebbe89..62172fa213 100644 --- a/firmware/target/mips/ingenic_x1000/msc-x1000.c +++ b/firmware/target/mips/ingenic_x1000/msc-x1000.c @@ -21,6 +21,7 @@ #include "system.h" #include "panic.h" +#include "led.h" #include "msc-x1000.h" #include "gpio-x1000.h" #include "irq-x1000.h" @@ -223,6 +224,16 @@ bool msc_card_detect(msc_drv* d) return gpio_get_level(d->config->cd_gpio) == d->config->cd_active_level; } +void msc_led_trigger(void) +{ + bool state = false; + for(int i = 0; i < MSC_COUNT; ++i) + if(msc_drivers[i].req_running) + state = true; + + led(state); +} + /* --------------------------------------------------------------------------- * Controller API */ @@ -377,6 +388,8 @@ static void msc_finish_request(msc_drv* d, int status) d->req->status = status; d->req_running = 0; d->iflag_done = 0; + + msc_led_trigger(); timeout_cancel(&d->cmd_tmo); semaphore_release(&d->cmd_done); } @@ -464,6 +477,7 @@ void msc_async_start(msc_drv* d, msc_req* r) /* Begin processing */ d->req = r; d->req_running = 1; + msc_led_trigger(); jz_writef(MSC_CTRL(d->msc_nr), START_OP(1)); if(r->flags & MSC_RF_DATA) jz_writef(MSC_DMAC(d->msc_nr), ENABLE(1)); diff --git a/firmware/target/mips/ingenic_x1000/msc-x1000.h b/firmware/target/mips/ingenic_x1000/msc-x1000.h index b7b05b859d..3ebdd3adc3 100644 --- a/firmware/target/mips/ingenic_x1000/msc-x1000.h +++ b/firmware/target/mips/ingenic_x1000/msc-x1000.h @@ -148,6 +148,8 @@ extern void msc_unlock(msc_drv* d); extern void msc_full_reset(msc_drv* d); extern bool msc_card_detect(msc_drv* d); +extern void msc_led_trigger(void); + /* Controller API */ extern void msc_ctl_reset(msc_drv* d); extern void msc_set_clock_mode(msc_drv* d, int mode); |