1 #ifndef __FM_RADIO_CONTROLLER_SLSI_H__
2 #define __FM_RADIO_CONTROLLER_SLSI_H__
4 #define FM_RADIO_TEST_MODE
8 #if defined(FM_RADIO_TEST_MODE)
9 #include "FmRadioController_test.h"
11 #include "FmRadioRDSParser.h"
13 #include <linux/videodev2.h>
15 #define FM_RADIO_DEVICE "/dev/radio0"
28 /*******************************************************************************
30 * Definitions for radio basic functions
32 ******************************************************************************/
34 enum fm_radio_seek_dir
36 FM_RADIO_SEEK_DOWN
= 0,
42 FM_RADIO_BAND_EUR
= 0, /* European/U.S. (87.5 - 108)MHz */
43 FM_RADIO_BAND_JAP
, /* Japanese (76 - 90)MHz */
52 enum fm_radio_tuner_mode
54 FM_RADIO_TUNER_MONO
= 0,
55 FM_RADIO_TUNER_STEREO
,
58 #define FM_RADIO_SPACING_50KHZ 5
59 #define FM_RADIO_SPACING_100KHZ 10
60 #define FM_RADIO_SPACING_200KHZ 20
62 enum fm_radio_deconstant_val
64 FM_RADIO_DE_TIME_CONSTANT_0
= 0,
65 FM_RADIO_DE_TIME_CONSTANT_75
,
68 enum fm_radio_search_mode
70 FM_RADIO_STOP_SEARCH_MODE
= 0,
72 FM_RADIO_AUTONOMOUS_SEARCH_MODE
,
73 FM_RADIO_AF_JUMP_MODE
,
74 FM_RADIO_AUTONOMOUS_SEARCH_MODE_SKIP
,
77 #define V4L2_CID_USER_S610_BASE (V4L2_CID_USER_BASE + 0x1070)
80 V4L2_CID_S610_CH_SPACING
= (V4L2_CID_USER_S610_BASE
+ 0x01),
81 V4L2_CID_S610_CH_BAND
= (V4L2_CID_USER_S610_BASE
+ 0x02),
82 V4L2_CID_S610_SOFT_STEREO_BLEND
= (V4L2_CID_USER_S610_BASE
+ 0x03),
83 V4L2_CID_S610_SOFT_STEREO_BLEND_COEFF
= (V4L2_CID_USER_S610_BASE
+ 0x04),
84 V4L2_CID_S610_SOFT_MUTE_COEFF
= (V4L2_CID_USER_S610_BASE
+ 0x05),
85 V4L2_CID_S610_RSSI_CURR
= (V4L2_CID_USER_S610_BASE
+ 0x06),
86 V4L2_CID_S610_SNR_CURR
= (V4L2_CID_USER_S610_BASE
+ 0x07),
87 V4L2_CID_S610_SEEK_CANCEL
= (V4L2_CID_USER_S610_BASE
+ 0x08),
88 V4L2_CID_S610_SEEK_MODE
= (V4L2_CID_USER_S610_BASE
+ 0x09),
89 V4L2_CID_S610_RDS_ON
= (V4L2_CID_USER_S610_BASE
+ 0x0A),
90 V4L2_CID_S610_IF_COUNT1
= (V4L2_CID_USER_S610_BASE
+ 0x0B),
91 V4L2_CID_S610_IF_COUNT2
= (V4L2_CID_USER_S610_BASE
+ 0x0C),
92 V4L2_CID_S610_RSSI_TH
= (V4L2_CID_USER_S610_BASE
+ 0x0D),
95 /*******************************************************************************
97 * Decalarations for RDS
99 ******************************************************************************/
101 #define FM_RADIO_ENABLED_RDS (1 << 0)
102 #define FM_RADIO_ENABLED_DNS (1 << 1)
103 #define FM_RADIO_ENABLED_AF (1 << 2)
104 #define FM_RADIO_ENABLED_ALL (FM_RADIO_ENABLED_RDS | FM_RADIO_ENABLED_DNS | FM_RADIO_ENABLED_AF)
106 #define FM_RADIO_RDS_DATA_MAX 48
108 #define FM_RADIO_RDS_GRP_NUM 3
109 #define FM_RADIO_RDS_BLK_NUM 4
110 #define FM_RADIO_RDS_SET_NUM (FM_RADIO_RDS_GRP_NUM * FM_RADIO_RDS_BLK_NUM)
112 #define FM_RADIO_RDS_BLER_MASK (0x3 << 3)
114 enum fm_radio_rds_index
116 FM_RADIO_RDS_LSB
= 0,
122 RDS_EVT_UPDATE
= 0x0001,
123 RDS_EVT_PI_UPDATE
= 0x0002,
124 RDS_EVT_PTY_UPDATE
= 0x0004,
125 RDS_EVT_PS_UPDATE
= 0x0008,
126 RDS_EVT_RT_UPDATE
= 0x0040,
127 RDS_EVT_AF_JUMP
= 0x0080,
128 RDS_EVT_AF_LIST
= 0x0100,
129 RDS_EVT_AF_LIST_UPDATE
= 0x0200,
130 RDS_EVT_RDS_AVL
= 0x2000,
131 RDS_EVT_RDS_NOT_AVL
= 0x4000,
134 #if !defined(FM_RADIO_TEST_MODE)
135 extern void RDSDataReceived(Final_RDS_data rdsData
);
136 extern void RTPlusDataReceived(RTPlus_data rtplusData
);
137 extern void PIECCDataReceived(PIECC_data PIECCData
);
138 extern void AFDataReceived(long AF
);
139 extern void CallbackAFStarted();
142 /*******************************************************************************
144 * FmRadioController_slsi Class
146 ******************************************************************************/
148 class FmRadioController_slsi
{
161 #if !defined(FM_RADIO_TEST_MODE)
162 FmRadioRDSParser RDSParser
;
165 bool radio_thread_termination
;
166 pthread_t radio_rds_thread
;
167 pthread_t radio_af_thread
;
168 unsigned char is_enabled_functions
;
169 unsigned char is_af_switching
;
170 unsigned short current_pi
;
173 int afvalid_threshold
;
174 bool cancel_af_switching
;
176 /* Sub functions for RDS/DNS/AF */
177 int startThreadforFmRadio(unsigned char func
);
178 int stopThreadforFmRadio(unsigned char func
);
179 static void* radio_thread_handler(void *arg
);
180 void radio_data_proc(unsigned char *buf
, int count
);
181 #if !defined(FM_RADIO_TEST_MODE)
182 void radio_af_switching();
183 static void* radio_af_thread_handler(void *arg
);
184 int af_signal_check(AF_List
*af_list
);
188 FmRadioController_slsi();
189 ~FmRadioController_slsi();
193 void TuneChannel(long channel
);
204 void SetVolume(long volume
);
207 void SetSpeakerOn(bool on
);
208 void SetRecordMode(int on
);
210 void SetBand(int band
);
211 void SetChannelSpacing(int spacing
);
216 void setSoftmute(bool setSoftmute
);
217 void SetDeConstant(long constant
);
219 long GetCurrentRSSI();
220 long GetCurrentSNR();
221 void SetCurrentRSSI(long rssi
);
223 void SetSeekMode(long seek_mode
);
224 int GetChannelSpacing();
225 void SetSoftStereoBlendCoeff(long value
);
226 void SetSoftMuteCoeff(long value
);
234 void CancelAfSwitchingProcess();
235 void SetAF_th(int freq
);
237 void SetAFValid_th(int freq
);
241 void SetSeekRSSI(long freq
);
242 void SetSeekSNR(long freq
);
243 void SetRSSI_th(int threshold
);
244 void SetSNR_th(int threshold
);
245 void SetCnt_th(int threshold
);
249 void setScanning(bool value
);
252 RadioText
GetLrText();
256 #endif /* __FM_RADIO_CONTROLLER_SLSI_H__ */