diff options
author | Wolfram Sang <wsa@the-dreams.de> | 2021-11-18 09:14:37 +0100 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2021-11-18 16:53:57 -0500 |
commit | 336ea51af65c8511ba38f0c3ccfdf7634b87c12d (patch) | |
tree | c2c2f4a946c2e4fa9d89be94e259c4100c6edc29 /firmware/target | |
parent | de0346065b415e03efad5746ffdee99d607a0d3c (diff) | |
download | rockbox-336ea51af65c8511ba38f0c3ccfdf7634b87c12d.tar.gz rockbox-336ea51af65c8511ba38f0c3ccfdf7634b87c12d.zip |
WIP: Samsung YPR0/1: switch to generic SI47xx polling
Should work(tm). But I don't have the hardware, so it needs to be
tested.
Change-Id: Ic086434f570dcddacb5b7e7a1acce4b8cafc5c03
Diffstat (limited to 'firmware/target')
-rw-r--r-- | firmware/target/hosted/samsungypr/radio-ypr.c | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/firmware/target/hosted/samsungypr/radio-ypr.c b/firmware/target/hosted/samsungypr/radio-ypr.c index 42d485231d..ef7fb84aa0 100644 --- a/firmware/target/hosted/samsungypr/radio-ypr.c +++ b/firmware/target/hosted/samsungypr/radio-ypr.c | |||
@@ -126,62 +126,3 @@ int fmradio_i2c_read(unsigned char address, unsigned char* buf, int count) | |||
126 | (void)address; | 126 | (void)address; |
127 | return read(radio_dev, buf, count); | 127 | return read(radio_dev, buf, count); |
128 | } | 128 | } |
129 | |||
130 | #ifdef HAVE_RDS_CAP | ||
131 | |||
132 | /* Register we are going to poll */ | ||
133 | #define STATUSRSSI (0xA) | ||
134 | #define STATUSRSSI_RDSR (0x1 << 15) | ||
135 | |||
136 | /* Low-level RDS Support */ | ||
137 | static struct event_queue rds_queue; | ||
138 | static uint32_t rds_stack[DEFAULT_STACK_SIZE / sizeof(uint32_t)]; | ||
139 | |||
140 | enum { | ||
141 | Q_POWERUP, | ||
142 | }; | ||
143 | |||
144 | static void NORETURN_ATTR rds_thread(void) | ||
145 | { | ||
146 | /* start up frozen */ | ||
147 | int timeout = TIMEOUT_BLOCK; | ||
148 | struct queue_event ev; | ||
149 | bool rds_rdy = false; | ||
150 | struct si4700_dbg_info radio_regs; | ||
151 | |||
152 | while (true) { | ||
153 | queue_wait_w_tmo(&rds_queue, &ev, timeout); | ||
154 | switch (ev.id) { | ||
155 | case Q_POWERUP: | ||
156 | /* power up: timeout after 1 tick, else block indefinitely */ | ||
157 | timeout = ev.data ? 1 : TIMEOUT_BLOCK; | ||
158 | break; | ||
159 | case SYS_TIMEOUT: | ||
160 | /* Captures RDS data and processes it */ | ||
161 | si4700_dbg_info(&radio_regs); | ||
162 | bool rdsr = radio_regs.regs[STATUSRSSI] & STATUSRSSI_RDSR; | ||
163 | if (rdsr != rds_rdy) { | ||
164 | rds_rdy = rdsr; | ||
165 | if (rdsr) { | ||
166 | si4700_rds_process(); | ||
167 | } | ||
168 | } | ||
169 | break; | ||
170 | } | ||
171 | } | ||
172 | } | ||
173 | |||
174 | /* true after full radio power up, and false before powering down */ | ||
175 | void si4700_rds_powerup(bool on) | ||
176 | { | ||
177 | queue_post(&rds_queue, Q_POWERUP, on); | ||
178 | } | ||
179 | |||
180 | /* One-time RDS init at startup */ | ||
181 | void si4700_rds_init(void) | ||
182 | { | ||
183 | queue_init(&rds_queue, false); | ||
184 | create_thread(rds_thread, rds_stack, sizeof(rds_stack), 0, "rds" | ||
185 | IF_PRIO(, PRIORITY_PLAYBACK) IF_COP(, CPU)); | ||
186 | } | ||
187 | #endif /* HAVE_RDS_CAP */ | ||