diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2017-02-11 23:16:39 -0500 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2017-02-11 23:16:39 -0500 |
commit | 523ef4edbdccf8198fbb7787afba2fe3f46f1ca8 (patch) | |
tree | 3238ca1502c92ce2078ff58a6f2a2589eaa68a95 | |
parent | fc9695eb47732e1c189e2f033dbd55e5c346e8c4 (diff) | |
download | rockbox-523ef4edbdccf8198fbb7787afba2fe3f46f1ca8.tar.gz rockbox-523ef4edbdccf8198fbb7787afba2fe3f46f1ca8.zip |
Fix warnings and errors from fc9695e
* fmradio.c needs an implementation of tuner_get_rds_info() for the
sim (kill all the sims).
* Some macro bitflags shouldn't be seen unless HAVE_RDS_CAP is
defined.
Change-Id: Idd00c94ca2fc43cf32f9223aa4530d5a02fb3454
-rw-r--r-- | firmware/drivers/tuner/si4700.c | 2 | ||||
-rw-r--r-- | uisimulator/common/fmradio.c | 56 |
2 files changed, 45 insertions, 13 deletions
diff --git a/firmware/drivers/tuner/si4700.c b/firmware/drivers/tuner/si4700.c index c7d942f293..af5795a83f 100644 --- a/firmware/drivers/tuner/si4700.c +++ b/firmware/drivers/tuner/si4700.c | |||
@@ -28,7 +28,9 @@ | |||
28 | #include "tuner.h" /* tuner abstraction interface */ | 28 | #include "tuner.h" /* tuner abstraction interface */ |
29 | #include "fmradio.h" | 29 | #include "fmradio.h" |
30 | #include "fmradio_i2c.h" /* physical interface driver */ | 30 | #include "fmradio_i2c.h" /* physical interface driver */ |
31 | #ifdef HAVE_RDS_CAP | ||
31 | #include "rds.h" | 32 | #include "rds.h" |
33 | #endif | ||
32 | 34 | ||
33 | #if defined(SANSA_CLIP) || defined(SANSA_E200V2) || defined(SANSA_FUZE) || defined(SANSA_C200V2) \ | 35 | #if defined(SANSA_CLIP) || defined(SANSA_E200V2) || defined(SANSA_FUZE) || defined(SANSA_C200V2) \ |
34 | || defined(SANSA_FUZEPLUS) | 36 | || defined(SANSA_FUZEPLUS) |
diff --git a/uisimulator/common/fmradio.c b/uisimulator/common/fmradio.c index 6f6b0f914f..a18db819f2 100644 --- a/uisimulator/common/fmradio.c +++ b/uisimulator/common/fmradio.c | |||
@@ -23,6 +23,11 @@ | |||
23 | #include "config.h" | 23 | #include "config.h" |
24 | #include "debug.h" | 24 | #include "debug.h" |
25 | #include "tuner.h" | 25 | #include "tuner.h" |
26 | #ifdef HAVE_RDS_CAP | ||
27 | #include <strlcpy.h> | ||
28 | #include "system.h" | ||
29 | #include "rds.h" | ||
30 | #endif | ||
26 | 31 | ||
27 | #if CONFIG_TUNER | 32 | #if CONFIG_TUNER |
28 | 33 | ||
@@ -124,21 +129,46 @@ bool tuner_power(bool status) | |||
124 | } | 129 | } |
125 | 130 | ||
126 | #ifdef HAVE_RDS_CAP | 131 | #ifdef HAVE_RDS_CAP |
127 | char* tuner_get_rds_info(int setting) | 132 | size_t tuner_get_rds_info(int setting, void *dst, size_t dstsize) |
128 | { | 133 | { |
129 | char *text = NULL; | 134 | /* TODO: integrate this into tuner_get/set */ |
130 | 135 | static const unsigned char info_id_tbl[] = | |
131 | switch(setting) | ||
132 | { | 136 | { |
133 | case RADIO_RDS_NAME: | 137 | [RADIO_RDS_NAME] = RDS_INFO_PS, |
134 | text = "Rockbox Radio"; | 138 | [RADIO_RDS_TEXT] = RDS_INFO_RT, |
135 | break; | 139 | [RADIO_RDS_PROGRAM_INFO] = RDS_INFO_PI, |
140 | [RADIO_RDS_CURRENT_TIME] = RDS_INFO_CT, | ||
141 | }; | ||
136 | 142 | ||
137 | case RADIO_RDS_TEXT: | 143 | if ((unsigned int)setting >= ARRAYLEN(info_id_tbl)) |
138 | text = "http://www.rockbox.org" ; | 144 | return 0; |
139 | break; | 145 | |
146 | switch (info_id_tbl[setting]) | ||
147 | { | ||
148 | case RDS_INFO_PI: | ||
149 | if (dstsize >= sizeof (uint16_t)) { | ||
150 | *(uint16_t *)dst = 0; | ||
151 | } | ||
152 | dstsize = sizeof (uint16_t); | ||
153 | break; | ||
154 | case RDS_INFO_PS: | ||
155 | dstsize = strlcpy(dst, "Rockbox Radio", dstsize); | ||
156 | break; | ||
157 | case RDS_INFO_RT: | ||
158 | dstsize = strlcpy(dst, "http://www.rockbox.org", dstsize); | ||
159 | break; | ||
160 | case RDS_INFO_CT: | ||
161 | if (dstsize >= sizeof (time_t)) { | ||
162 | *(time_t *)dst = 0; | ||
163 | } | ||
164 | dstsize = sizeof (time_t); | ||
165 | break; | ||
166 | |||
167 | default: | ||
168 | dstsize = 0; | ||
140 | } | 169 | } |
141 | return text; | 170 | |
171 | return dstsize; | ||
142 | } | 172 | } |
143 | #endif | 173 | #endif /* HAVE_RDS_CAP */ |
144 | #endif | 174 | #endif /* CONFIG_TUNER */ |