diff options
author | Tomasz Moń <desowin@gmail.com> | 2021-07-07 12:52:05 +0200 |
---|---|---|
committer | Tomasz Moń <desowin@gmail.com> | 2021-07-07 14:51:15 +0000 |
commit | 99bf5064077ec8b3daef592cf076b72cb82b7693 (patch) | |
tree | 70b99571ade00107b771df31383219767accd74c /firmware/target | |
parent | e9ae1e9a8b5ad8e1bf21540bf6547d292df9ade5 (diff) |
Sansa Connect: Prevent unresponsive interface
AVR interrupt signal can remain active if the state has changed during
state read. In such case, there won't be intterupt and the interface
would appear unresponsive until AVR thread received event (e.g. USB
connection/disconnect). Solve the issue by not waiting for event if AVR
interrupt signal is active prior to event wait.
Change-Id: I86e388c7cd6da76e3abe7bf7114940f331e4c308
Diffstat (limited to 'firmware/target')
-rw-r--r-- | firmware/target/arm/tms320dm320/sansa-connect/avr-sansaconnect.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/firmware/target/arm/tms320dm320/sansa-connect/avr-sansaconnect.c b/firmware/target/arm/tms320dm320/sansa-connect/avr-sansaconnect.c index ed7dab1572..01acc6905e 100644 --- a/firmware/target/arm/tms320dm320/sansa-connect/avr-sansaconnect.c +++ b/firmware/target/arm/tms320dm320/sansa-connect/avr-sansaconnect.c @@ -818,7 +818,19 @@ void avr_thread(void) while (1) { - queue_wait(&avr_queue, &ev); + if (avr_state_changed()) + { + /* We have to read AVR state, simply check if there's any event + * pending but do not block. It is possible that AVR interrupt + * line is held active even though we read the state (change + * occured during read). + */ + queue_wait_w_tmo(&avr_queue, &ev, 0); + } + else + { + queue_wait(&avr_queue, &ev); + } if (ev.id == SYS_USB_CONNECTED) { |