• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *
3  * Copyright 2001-2011 Texas Instruments, Inc. - http://www.ti.com/
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef JFMRXNATIVE_H_
19 #define JFMRXNATIVE_H_
20 
21 extern "C" {
22 #include "jni.h"
23 }
24 
25 
26 
27 #define FM_SUCCESS 0
28 #define FM_FAILED 1
29 #define FM_PENDING 2
30 #define FM_ERR_THREAD_CREATION_FAILED 4
31 
32 
33 #define DEFAULT_RADIO_DEVICE    "/dev/radio0"
34 #define DEFAULT_FM_ALSA_CARD    "hw:CARD=0"
35 #define FM_BAND_SYSFS_ENTRY    "/sys/class/video4linux/radio0/fmrx_band"
36 #define FM_RDS_AF_SYSFS_ENTRY    "/sys/class/video4linux/radio0/fmrx_rds_af"
37 #define FM_RSSI_LVL_SYSFS_ENTRY    "/sys/class/video4linux/radio0/fmrx_rssi_lvl"
38 
39 #define CTL_INDEX_0                0
40 
41 #define FM_MODE_SWITCH_CTL_NAME   "Mode Switch"
42 #define FM_MODE_OFF		   0
43 #define FM_MODE_TX		   1
44 #define FM_MODE_RX	           2
45 
46 #define FM_BAND_SWITCH_CTL_NAME    "Region Switch"
47 #define FM_BAND_EUROPE_US          0
48 #define FM_BAND_JAPAN              1
49 
50 
51 #define FM_RF_DEPENDENT_MUTE_CTL_NAME     "RF Dependent Mute"
52 #define FM_RX_GET_RSSI_LVL_CTL_NAME 	  "RSSI Level"
53 #define FM_RX_RSSI_THRESHOLD_LVL_CTL_NAME "RSSI Threshold"
54 #define FM_STEREO_MONO_CTL_NAME	          "Stereo/Mono"
55 #define FM_RX_DEEMPHASIS_CTL_NAME    	  "De-emphasis Filter"
56 #define FM_RDS_SWITCH_CTL_NAME    	  "RDS Switch"
57 #define FM_RDS_DISABLE                    0
58 #define FM_RDS_ENABLE                     1
59 #define FM_RX_RDS_OPMODE_CTL_NAME	  "RDS Operation Mode"
60 #define FM_RX_AF_SWITCH_CTL_NAME	  "AF Switch"
61 
62 
63 
64 typedef unsigned long    FMC_U32;
65 typedef unsigned int     FMC_UINT;
66 typedef unsigned char    FMC_U8;
67 
68 /*-------------------------------------------------------------------------------
69  * FmcRdsRepertoire Type
70  *
71  * 	RDS Repertoire used for text data encoding and decoding
72  */
73 typedef  FMC_UINT  FmcRdsRepertoire;
74 
75 #define FMC_RDS_REPERTOIRE_G0_CODE_TABLE			((FmcRdsRepertoire)0)
76 #define FMC_RDS_REPERTOIRE_G1_CODE_TABLE			((FmcRdsRepertoire)1)
77 #define FMC_RDS_REPERTOIRE_G2_CODE_TABLE			((FmcRdsRepertoire)2)
78 
79 
80 #define RDS_BIT_0_TO_BIT_3		0x0f
81 #define RDS_BIT_4_TO_BIT_7		0xf0
82 
83 
84 /********************************************************************************
85  *
86  * Events sent to the application
87  *
88  *******************************************************************************/
89 
90 /*-------------------------------------------------------------------------------
91  * FmRxEventType structure
92  *
93  */
94 typedef FMC_UINT FmRxEventType;
95 typedef FMC_UINT FmRxStatus;
96 
97 
98 /*-------------------------------------------------------------------------------
99  * FmRxCmdType structure
100  *
101  */
102 typedef FMC_UINT FmRxCmdType;
103 
104 #define FM_RX_CMD_ENABLE							((FmRxCmdType)0)	/* Enable command */
105 #define FM_RX_CMD_DISABLE							((FmRxCmdType)1)	/* Disable command */
106 #define FM_RX_CMD_SET_BAND						((FmRxCmdType)2)	/* Set Band command */
107 #define FM_RX_CMD_GET_BAND						((FmRxCmdType)3)	/* Get Band command */
108 #define FM_RX_CMD_SET_MONO_STEREO_MODE			((FmRxCmdType)4)	/* Set Mono/Stereo command */
109 #define FM_RX_CMD_GET_MONO_STEREO_MODE			((FmRxCmdType)5)	/* Get Mono/Stereo command */
110 #define FM_RX_CMD_SET_MUTE_MODE					((FmRxCmdType)6)	/* Set Mute mode command */
111 #define FM_RX_CMD_GET_MUTE_MODE					((FmRxCmdType)7)	/* Get Mute mode command */
112 #define FM_RX_CMD_SET_RF_DEPENDENT_MUTE_MODE	((FmRxCmdType)8)	/* Set RF-Dependent Mute Mode command */
113 #define FM_RX_CMD_GET_RF_DEPENDENT_MUTE_MODE	((FmRxCmdType)9)	/* Get RF-Dependent Mute Mode command */
114 #define FM_RX_CMD_SET_RSSI_THRESHOLD				((FmRxCmdType)10)	/* Set RSSI Threshold command */
115 #define FM_RX_CMD_GET_RSSI_THRESHOLD				((FmRxCmdType)11)	/* Get RSSI Threshold command */
116 #define FM_RX_CMD_SET_DEEMPHASIS_FILTER			((FmRxCmdType)12)	/* Set De-Emphassi Filter command */
117 #define FM_RX_CMD_GET_DEEMPHASIS_FILTER			((FmRxCmdType)13)	/* Get De-Emphassi Filter command */
118 #define FM_RX_CMD_SET_VOLUME						((FmRxCmdType)14)	/* Set Volume command */
119 #define FM_RX_CMD_GET_VOLUME						((FmRxCmdType)15)	/* Get Volume command */
120 #define FM_RX_CMD_TUNE								((FmRxCmdType)16)	/* Tune command */
121 #define FM_RX_CMD_GET_TUNED_FREQUENCY			((FmRxCmdType)17)	/* Get Tuned Frequency command */
122 #define FM_RX_CMD_SEEK								((FmRxCmdType)18)	/* Seek command */
123 #define FM_RX_CMD_STOP_SEEK						((FmRxCmdType)19)	/* Stop Seek command */
124 #define FM_RX_CMD_GET_RSSI						((FmRxCmdType)20)	/* Get RSSI command */
125 #define FM_RX_CMD_ENABLE_RDS						((FmRxCmdType)21)	/* Enable RDS command */
126 #define FM_RX_CMD_DISABLE_RDS						((FmRxCmdType)22)	/* Disable RDS command */
127 #define FM_RX_CMD_SET_RDS_SYSTEM					((FmRxCmdType)23)	/* Set RDS System command */
128 #define FM_RX_CMD_GET_RDS_SYSTEM					((FmRxCmdType)24)	/* Get RDS System command */
129 #define FM_RX_CMD_SET_RDS_GROUP_MASK			((FmRxCmdType)25)	/* Set RDS groups to be recieved */
130 #define FM_RX_CMD_GET_RDS_GROUP_MASK			((FmRxCmdType)26)	/*  Get RDS groups to be recieved*/
131 #define FM_RX_CMD_SET_RDS_AF_SWITCH_MODE		((FmRxCmdType)27)	/* Set AF Switch Mode command */
132 #define FM_RX_CMD_GET_RDS_AF_SWITCH_MODE		((FmRxCmdType)28)	/* Get AF Switch Mode command */
133 #define FM_RX_CMD_ENABLE_AUDIO				((FmRxCmdType)29)	/* Set Audio Routing command */
134 #define FM_RX_CMD_DISABLE_AUDIO 				((FmRxCmdType)30)	/* Get Audio Routing command */
135 #define FM_RX_CMD_DESTROY							((FmRxCmdType)31)	/* Destroy command */
136 #define FM_RX_CMD_CHANGE_AUDIO_TARGET					((FmRxCmdType)32)	/* Change the audio target*/
137 #define FM_RX_CMD_CHANGE_DIGITAL_AUDIO_CONFIGURATION	((FmRxCmdType)33)	/* Change the digital target configuration*/
138 #define FM_RX_INIT_ASYNC                              	((FmRxCmdType)34)	/* */
139 #define FM_RX_CMD_INIT                              	((FmRxCmdType)35)	/* */
140 #define FM_RX_CMD_DEINIT                              	((FmRxCmdType)36)	/* */
141 #define FM_RX_CMD_SET_CHANNEL_SPACING                              	((FmRxCmdType)37)	/* */
142 #define FM_RX_CMD_GET_CHANNEL_SPACING                              	((FmRxCmdType)38)	/* */
143 #define FM_RX_CMD_GET_FW_VERSION                            	((FmRxCmdType)39)	/*Gets the FW version */
144 #define FM_RX_CMD_IS_CHANNEL_VALID                            	((FmRxCmdType)40)	/*Verify that the tuned channel is valid*/
145 #define FM_RX_CMD_COMPLETE_SCAN                            	((FmRxCmdType)41)	/*Perfrom Complete Scan on the selected Band*/
146 #define FM_RX_CMD_COMPLETE_SCAN_PROGRESS                            	((FmRxCmdType)42)
147 #define FM_RX_CMD_STOP_COMPLETE_SCAN                            	((FmRxCmdType)43)
148 #define FM_RX_LAST_API_CMD						(FM_RX_CMD_STOP_COMPLETE_SCAN)
149 #define FM_RX_CMD_NONE					0xFFFFFFFF
150 
151 
152 namespace android {
153 
154 extern JNIEnv *getJBtlEnv();
155 extern void setJBtlEnv(JNIEnv *env);
156 
157 }
158 
159 /* Presently android videodev2.h is from k2.6.35 so remove below struct when
160  * android header files moves to k3.0+ kernel header
161  * */
162 struct ti_v4l2_hw_freq_seek {
163     __u32                 tuner;
164     enum v4l2_tuner_type  type;
165     __u32                 seek_upward;
166     __u32                 wrap_around;
167     __u32                 spacing;
168     __u32                 reserved[7];
169 };
170 
171 #define V4L2_TUNER_SUB_RDS              0x0010
172 #endif /* JFMRXNATIVE_H_ */
173