diff options
author | Wolfram Sang <wsa@the-dreams.de> | 2021-12-10 16:13:49 +0100 |
---|---|---|
committer | Wolfram Sang <wsa@the-dreams.de> | 2022-02-07 22:01:20 +0100 |
commit | 5b8873bf333add9ec7208901c62bbd30ad7ea8c3 (patch) | |
tree | f17916b7dcf0fb8059354094858a9f691c703b9f /firmware/drivers | |
parent | 8d453ae9c3beef82bd61401af6216f74a400cbd0 (diff) | |
download | rockbox-5b8873bf333add9ec7208901c62bbd30ad7ea8c3.tar.gz rockbox-5b8873bf333add9ec7208901c62bbd30ad7ea8c3.zip |
RFT: convert Gigabeat RDS to thread
This kind of reverts 7b596416bf ("Gigabeat S: Update RDS processing to
use asynchronous I2C rather than thread."). However, requiring RDS to
run in thread context will a) allow more upcoming features and b) remove
quite some complexity from the codebase (see the diffstat here) because
Gigabeat is the only user. iMX31 should be able to handle one more
thread, as it can even run Linux.
Change-Id: I46130034595ba66392c5417c275d036f4bd26943
Diffstat (limited to 'firmware/drivers')
-rw-r--r-- | firmware/drivers/rds.c | 21 | ||||
-rw-r--r-- | firmware/drivers/tuner/si4700.c | 27 |
2 files changed, 0 insertions, 48 deletions
diff --git a/firmware/drivers/rds.c b/firmware/drivers/rds.c index 0b9b227563..2d8466ae36 100644 --- a/firmware/drivers/rds.c +++ b/firmware/drivers/rds.c | |||
@@ -72,15 +72,6 @@ static int rt_data_idx; /* rt_data[0 or 1] */ | |||
72 | #define RT_DATA_INC(x) rt_data[rt_data_idx ^= (x)] | 72 | #define RT_DATA_INC(x) rt_data[rt_data_idx ^= (x)] |
73 | #endif /* (CONFIG_RDS & RDS_CFG_PROCESS) */ | 73 | #endif /* (CONFIG_RDS & RDS_CFG_PROCESS) */ |
74 | 74 | ||
75 | #if (CONFIG_RDS & RDS_CFG_ISR) | ||
76 | /* Functions are called in ISR context */ | ||
77 | #define rds_disable_irq_save() disable_irq_save() | ||
78 | #define rds_restore_irq(old) restore_irq(old) | ||
79 | #else /* !(CONFIG_RDS & RDS_CFG_ISR) */ | ||
80 | #define rds_disable_irq_save() 0 | ||
81 | #define rds_restore_irq(old) ((void)(old)) | ||
82 | #endif /* (CONFIG_RDS & RDS_CFG_ISR) */ | ||
83 | |||
84 | /* RDS code table G0 to UTF-8 translation */ | 75 | /* RDS code table G0 to UTF-8 translation */ |
85 | static const uint16_t rds_tbl_g0[0x100-0x20] = | 76 | static const uint16_t rds_tbl_g0[0x100-0x20] = |
86 | { | 77 | { |
@@ -195,8 +186,6 @@ static void register_activity(void) | |||
195 | /* resets the rds parser */ | 186 | /* resets the rds parser */ |
196 | void rds_reset(void) | 187 | void rds_reset(void) |
197 | { | 188 | { |
198 | int oldlevel = rds_disable_irq_save(); | ||
199 | |||
200 | /* reset general info */ | 189 | /* reset general info */ |
201 | pi_code = 0; | 190 | pi_code = 0; |
202 | ct_data = 0; | 191 | ct_data = 0; |
@@ -210,8 +199,6 @@ void rds_reset(void) | |||
210 | ps_segment = 0; | 199 | ps_segment = 0; |
211 | rt_segment = 0; | 200 | rt_segment = 0; |
212 | #endif /* (CONFIG_RDS & RDS_CFG_PROCESS) */ | 201 | #endif /* (CONFIG_RDS & RDS_CFG_PROCESS) */ |
213 | |||
214 | rds_restore_irq(oldlevel); | ||
215 | } | 202 | } |
216 | 203 | ||
217 | /* initialises the rds parser */ | 204 | /* initialises the rds parser */ |
@@ -223,8 +210,6 @@ void rds_init(void) | |||
223 | /* sync RDS state */ | 210 | /* sync RDS state */ |
224 | void rds_sync(void) | 211 | void rds_sync(void) |
225 | { | 212 | { |
226 | int oldlevel = rds_disable_irq_save(); | ||
227 | |||
228 | if (rds_active) { | 213 | if (rds_active) { |
229 | if (TIMED_OUT(rds_timeout)) { | 214 | if (TIMED_OUT(rds_timeout)) { |
230 | rds_reset(); | 215 | rds_reset(); |
@@ -238,8 +223,6 @@ void rds_sync(void) | |||
238 | } | 223 | } |
239 | } | 224 | } |
240 | } | 225 | } |
241 | |||
242 | rds_restore_irq(oldlevel); | ||
243 | } | 226 | } |
244 | 227 | ||
245 | #if (CONFIG_RDS & RDS_CFG_PROCESS) | 228 | #if (CONFIG_RDS & RDS_CFG_PROCESS) |
@@ -458,8 +441,6 @@ void rds_push_info(enum rds_info_id info_id, uintptr_t data, size_t size) | |||
458 | /* read fully-processed RDS data */ | 441 | /* read fully-processed RDS data */ |
459 | size_t rds_pull_info(enum rds_info_id info_id, uintptr_t data, size_t size) | 442 | size_t rds_pull_info(enum rds_info_id info_id, uintptr_t data, size_t size) |
460 | { | 443 | { |
461 | int oldlevel = rds_disable_irq_save(); | ||
462 | |||
463 | rds_sync(); | 444 | rds_sync(); |
464 | 445 | ||
465 | switch (info_id) { | 446 | switch (info_id) { |
@@ -490,7 +471,5 @@ size_t rds_pull_info(enum rds_info_id info_id, uintptr_t data, size_t size) | |||
490 | default: | 471 | default: |
491 | size = 0; | 472 | size = 0; |
492 | } | 473 | } |
493 | |||
494 | rds_restore_irq(oldlevel); | ||
495 | return size; | 474 | return size; |
496 | } | 475 | } |
diff --git a/firmware/drivers/tuner/si4700.c b/firmware/drivers/tuner/si4700.c index cce203fde9..7b54526f61 100644 --- a/firmware/drivers/tuner/si4700.c +++ b/firmware/drivers/tuner/si4700.c | |||
@@ -553,32 +553,6 @@ void si4700_dbg_info(struct si4700_dbg_info *nfo) | |||
553 | } | 553 | } |
554 | 554 | ||
555 | #ifdef HAVE_RDS_CAP | 555 | #ifdef HAVE_RDS_CAP |
556 | |||
557 | #if (CONFIG_RDS & RDS_CFG_ISR) | ||
558 | static unsigned char isr_regbuf[(RDSD - STATUSRSSI + 1) * 2]; | ||
559 | |||
560 | /* Called by RDS interrupt on target */ | ||
561 | void si4700_rds_interrupt(void) | ||
562 | { | ||
563 | si4700_rds_read_raw_async(isr_regbuf, sizeof (isr_regbuf)); | ||
564 | } | ||
565 | |||
566 | /* Handle RDS event from ISR */ | ||
567 | void si4700_rds_process(void) | ||
568 | { | ||
569 | uint16_t rds_data[4]; | ||
570 | int index = (RDSA - STATUSRSSI) * 2; | ||
571 | |||
572 | for (int i = 0; i < 4; i++) { | ||
573 | rds_data[i] = isr_regbuf[index] << 8 | isr_regbuf[index + 1]; | ||
574 | index += 2; | ||
575 | } | ||
576 | |||
577 | rds_process(rds_data); | ||
578 | } | ||
579 | |||
580 | #else /* !(CONFIG_RDS & RDS_CFG_ISR) */ | ||
581 | |||
582 | /* Handle RDS event from thread */ | 556 | /* Handle RDS event from thread */ |
583 | void si4700_rds_process(void) | 557 | void si4700_rds_process(void) |
584 | { | 558 | { |
@@ -603,7 +577,6 @@ void si4700_rds_process(void) | |||
603 | 577 | ||
604 | mutex_unlock(&fmr_mutex); | 578 | mutex_unlock(&fmr_mutex); |
605 | } | 579 | } |
606 | #endif /* (CONFIG_RDS & RDS_CFG_ISR) */ | ||
607 | 580 | ||
608 | #if (CONFIG_RDS & RDS_CFG_POLL) | 581 | #if (CONFIG_RDS & RDS_CFG_POLL) |
609 | static struct event_queue rds_queue; | 582 | static struct event_queue rds_queue; |