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 | |
parent | 3e37013218781f92ecacdfc01f1b958491a31d6b (diff) | |
download | rockbox-4cbb5b42010309677f3590e3a716c69c12e8adf2.tar.gz rockbox-4cbb5b42010309677f3590e3a716c69c12e8adf2.zip |
x1000: trigger the virtual LED on disk activity
Change-Id: Ic129e79e0b192cb0c39e5f05ad602e0ea7a9213f
-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 @@ | |||
21 | 21 | ||
22 | #include "system.h" | 22 | #include "system.h" |
23 | #include "panic.h" | 23 | #include "panic.h" |
24 | #include "led.h" | ||
24 | #include "msc-x1000.h" | 25 | #include "msc-x1000.h" |
25 | #include "gpio-x1000.h" | 26 | #include "gpio-x1000.h" |
26 | #include "irq-x1000.h" | 27 | #include "irq-x1000.h" |
@@ -223,6 +224,16 @@ bool msc_card_detect(msc_drv* d) | |||
223 | return gpio_get_level(d->config->cd_gpio) == d->config->cd_active_level; | 224 | return gpio_get_level(d->config->cd_gpio) == d->config->cd_active_level; |
224 | } | 225 | } |
225 | 226 | ||
227 | void msc_led_trigger(void) | ||
228 | { | ||
229 | bool state = false; | ||
230 | for(int i = 0; i < MSC_COUNT; ++i) | ||
231 | if(msc_drivers[i].req_running) | ||
232 | state = true; | ||
233 | |||
234 | led(state); | ||
235 | } | ||
236 | |||
226 | /* --------------------------------------------------------------------------- | 237 | /* --------------------------------------------------------------------------- |
227 | * Controller API | 238 | * Controller API |
228 | */ | 239 | */ |
@@ -377,6 +388,8 @@ static void msc_finish_request(msc_drv* d, int status) | |||
377 | d->req->status = status; | 388 | d->req->status = status; |
378 | d->req_running = 0; | 389 | d->req_running = 0; |
379 | d->iflag_done = 0; | 390 | d->iflag_done = 0; |
391 | |||
392 | msc_led_trigger(); | ||
380 | timeout_cancel(&d->cmd_tmo); | 393 | timeout_cancel(&d->cmd_tmo); |
381 | semaphore_release(&d->cmd_done); | 394 | semaphore_release(&d->cmd_done); |
382 | } | 395 | } |
@@ -464,6 +477,7 @@ void msc_async_start(msc_drv* d, msc_req* r) | |||
464 | /* Begin processing */ | 477 | /* Begin processing */ |
465 | d->req = r; | 478 | d->req = r; |
466 | d->req_running = 1; | 479 | d->req_running = 1; |
480 | msc_led_trigger(); | ||
467 | jz_writef(MSC_CTRL(d->msc_nr), START_OP(1)); | 481 | jz_writef(MSC_CTRL(d->msc_nr), START_OP(1)); |
468 | if(r->flags & MSC_RF_DATA) | 482 | if(r->flags & MSC_RF_DATA) |
469 | jz_writef(MSC_DMAC(d->msc_nr), ENABLE(1)); | 483 | 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); | |||
148 | extern void msc_full_reset(msc_drv* d); | 148 | extern void msc_full_reset(msc_drv* d); |
149 | extern bool msc_card_detect(msc_drv* d); | 149 | extern bool msc_card_detect(msc_drv* d); |
150 | 150 | ||
151 | extern void msc_led_trigger(void); | ||
152 | |||
151 | /* Controller API */ | 153 | /* Controller API */ |
152 | extern void msc_ctl_reset(msc_drv* d); | 154 | extern void msc_ctl_reset(msc_drv* d); |
153 | extern void msc_set_clock_mode(msc_drv* d, int mode); | 155 | extern void msc_set_clock_mode(msc_drv* d, int mode); |