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 | |
parent | e9ae1e9a8b5ad8e1bf21540bf6547d292df9ade5 (diff) | |
download | rockbox-99bf5064077ec8b3daef592cf076b72cb82b7693.tar.gz rockbox-99bf5064077ec8b3daef592cf076b72cb82b7693.zip |
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
-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) | |||
818 | 818 | ||
819 | while (1) | 819 | while (1) |
820 | { | 820 | { |
821 | queue_wait(&avr_queue, &ev); | 821 | if (avr_state_changed()) |
822 | { | ||
823 | /* We have to read AVR state, simply check if there's any event | ||
824 | * pending but do not block. It is possible that AVR interrupt | ||
825 | * line is held active even though we read the state (change | ||
826 | * occured during read). | ||
827 | */ | ||
828 | queue_wait_w_tmo(&avr_queue, &ev, 0); | ||
829 | } | ||
830 | else | ||
831 | { | ||
832 | queue_wait(&avr_queue, &ev); | ||
833 | } | ||
822 | 834 | ||
823 | if (ev.id == SYS_USB_CONNECTED) | 835 | if (ev.id == SYS_USB_CONNECTED) |
824 | { | 836 | { |