summaryrefslogtreecommitdiff
path: root/firmware/drivers/rds.c
diff options
context:
space:
mode:
authorWolfram Sang <wsa@the-dreams.de>2021-12-10 16:13:49 +0100
committerWolfram Sang <wsa@the-dreams.de>2022-02-07 22:01:20 +0100
commit5b8873bf333add9ec7208901c62bbd30ad7ea8c3 (patch)
treef17916b7dcf0fb8059354094858a9f691c703b9f /firmware/drivers/rds.c
parent8d453ae9c3beef82bd61401af6216f74a400cbd0 (diff)
downloadrockbox-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/rds.c')
-rw-r--r--firmware/drivers/rds.c21
1 files changed, 0 insertions, 21 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 */
85static const uint16_t rds_tbl_g0[0x100-0x20] = 76static 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 */
196void rds_reset(void) 187void 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 */
224void rds_sync(void) 211void 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 */
459size_t rds_pull_info(enum rds_info_id info_id, uintptr_t data, size_t size) 442size_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}