diff options
Diffstat (limited to 'firmware/tuner.c')
-rw-r--r-- | firmware/tuner.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/firmware/tuner.c b/firmware/tuner.c index c9c5bc0639..565850c659 100644 --- a/firmware/tuner.c +++ b/firmware/tuner.c | |||
@@ -24,6 +24,9 @@ | |||
24 | #include "kernel.h" | 24 | #include "kernel.h" |
25 | #include "tuner.h" | 25 | #include "tuner.h" |
26 | #include "fmradio.h" | 26 | #include "fmradio.h" |
27 | #ifdef HAVE_RDS_CAP | ||
28 | #include "rds.h" | ||
29 | #endif /* HAVE_RDS_CAP */ | ||
27 | 30 | ||
28 | /* General region information */ | 31 | /* General region information */ |
29 | const struct fm_region_data fm_region_data[TUNER_NUM_REGIONS] = | 32 | const struct fm_region_data fm_region_data[TUNER_NUM_REGIONS] = |
@@ -102,4 +105,24 @@ void tuner_init(void) | |||
102 | #endif | 105 | #endif |
103 | } | 106 | } |
104 | } | 107 | } |
108 | |||
109 | #ifdef HAVE_RDS_CAP | ||
110 | size_t tuner_get_rds_info(int setting, void *dst, size_t dstsize) | ||
111 | { | ||
112 | /* TODO: integrate this into tuner_get/set */ | ||
113 | static const unsigned char info_id_tbl[] = | ||
114 | { | ||
115 | [RADIO_RDS_NAME] = RDS_INFO_PS, | ||
116 | [RADIO_RDS_TEXT] = RDS_INFO_RT, | ||
117 | [RADIO_RDS_PROGRAM_INFO] = RDS_INFO_PI, | ||
118 | [RADIO_RDS_CURRENT_TIME] = RDS_INFO_CT, | ||
119 | }; | ||
120 | |||
121 | if ((unsigned int)setting >= ARRAYLEN(info_id_tbl)) | ||
122 | return 0; | ||
123 | |||
124 | return rds_pull_info(info_id_tbl[setting], (uintptr_t)dst, dstsize); | ||
125 | } | ||
126 | #endif /* HAVE_RDS_CAP */ | ||
127 | |||
105 | #endif /* SIMULATOR */ | 128 | #endif /* SIMULATOR */ |