summaryrefslogtreecommitdiffstats
path: root/firmware/target/arm
diff options
context:
space:
mode:
authorTomasz Moń <desowin@gmail.com>2021-07-07 12:52:05 +0200
committerTomasz Moń <desowin@gmail.com>2021-07-07 14:51:15 +0000
commit99bf5064077ec8b3daef592cf076b72cb82b7693 (patch)
tree70b99571ade00107b771df31383219767accd74c /firmware/target/arm
parente9ae1e9a8b5ad8e1bf21540bf6547d292df9ade5 (diff)
downloadrockbox-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
Diffstat (limited to 'firmware/target/arm')
-rw-r--r--firmware/target/arm/tms320dm320/sansa-connect/avr-sansaconnect.c14
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)
{