aboutsummaryrefslogtreecommitdiffstats
path: root/binding/radio_impl.h
diff options
context:
space:
mode:
authorScott Murray <scott.murray@konsulko.com>2017-12-21 20:13:52 -0500
committerScott Murray <scott.murray@konsulko.com>2017-12-21 20:13:52 -0500
commit62518e9fdefa82a8d454e3dbcc28fd2efdc08fa0 (patch)
tree71426b7560d371983b9bcaa8f324b80372922aa5 /binding/radio_impl.h
parent55fddbb3186412f61fb8b8ea57b76a74f392d30b (diff)
Add conditionally compilable support for the Si4689 radio on the M3ULCB Kingfisher infotainment board. The codebase has been refactored to allow multiple radio implementations, and when Kingfisher support is enabled, the binding will first look for a USB RTL-SDR adapter, then fallback to the Kingfisher Si4689 if one is not found. This allows easily switching to a RTL-SDR adapter if this initial Kingfisher support encounters issues. The back end implementation relies on a patched version of the "si_ctl" utility from Cogent Embedded's Kingfisher BSP changes. The modifications to it add FM band plan selection and scanning threshold tweaking for poor radio environments. Audio output is achieved by looping the radio's PulseAudio source to the appropriate sink depending on 4A or non-4A operation. For 4A compatibility, the PulseAudio source is created if it does not exist, which currently is the case due to PulseAudio's udev module being disabled when 4A is enabled. Additionally, the FM band plan for Japan has been corrected to go to 95 MHz, and a README.md file has been added documenting the optional configuration that can be done via /etc/xdg/AGL.conf for band plan selection and scanning sensitivity. Change-Id: I204906fed741d917fc3b8be962deadb4e59989db Signed-off-by: Scott Murray <scott.murray@konsulko.com>
Diffstat (limited to 'binding/radio_impl.h')
-rw-r--r--binding/radio_impl.h37
1 files changed, 21 insertions, 16 deletions
diff --git a/binding/radio_impl.h b/binding/radio_impl.h
index 79e91a4..4b4a2f7 100644
--- a/binding/radio_impl.h
+++ b/binding/radio_impl.h
@@ -38,39 +38,44 @@ typedef enum {
STEREO
} radio_stereo_mode_t;
-int radio_impl_init(void);
+typedef struct {
+ char *name;
-uint32_t radio_impl_get_frequency(void);
+ int (*init)(void);
-void radio_impl_set_frequency(uint32_t frequency);
+ uint32_t (*get_frequency)(void);
-void radio_impl_set_frequency_callback(radio_freq_callback_t callback,
+ void (*set_frequency)(uint32_t frequency);
+
+ void (*set_frequency_callback)(radio_freq_callback_t callback,
void *data);
-radio_band_t radio_impl_get_band(void);
+ radio_band_t (*get_band)(void);
-void radio_impl_set_band(radio_band_t band);
+ void (*set_band)(radio_band_t band);
-int radio_impl_band_supported(radio_band_t band);
+ int (*band_supported)(radio_band_t band);
-uint32_t radio_impl_get_min_frequency(radio_band_t band);
+ uint32_t (*get_min_frequency)(radio_band_t band);
-uint32_t radio_impl_get_max_frequency(radio_band_t band);
+ uint32_t (*get_max_frequency)(radio_band_t band);
-uint32_t radio_impl_get_frequency_step(radio_band_t band);
+ uint32_t (*get_frequency_step)(radio_band_t band);
-void radio_impl_start(void);
+ void (*start)(void);
-void radio_impl_stop(void);
+ void (*stop)(void);
-void radio_impl_scan_start(radio_scan_direction_t direction,
+ void (*scan_start)(radio_scan_direction_t direction,
radio_scan_callback_t callback,
void *data);
-void radio_impl_scan_stop(void);
+ void (*scan_stop)(void);
+
+ radio_stereo_mode_t (*get_stereo_mode)(void);
-radio_stereo_mode_t radio_impl_get_stereo_mode(void);
+ void (*set_stereo_mode)(radio_stereo_mode_t mode);
-void radio_impl_set_stereo_mode(radio_stereo_mode_t mode);
+} radio_impl_ops_t;
#endif /* _RADIO_IMPL_H */