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 19 #ifndef JFMTXNATIVE_H_ 20 #define JFMTXNATIVE_H_ 21 22 extern "C" { 23 #include "jni.h" 24 } 25 26 27 28 #define FM_SUCCESS 0 29 #define FM_FAILED 1 30 #define FM_PENDING 2 31 #define FM_ERR_THREAD_CREATION_FAILED 4 32 33 34 #define DEFAULT_RADIO_DEVICE "/dev/radio0" 35 36 #define FMTX_RDS_AF_SYSFS_ENTRY "/sys/class/video4linux/radio0/fmtx_rds_af" 37 38 #define DEFAULT_FM_ALSA_CARD "hw:CARD=0" 39 40 #define CTL_INDEX_0 0 41 42 #define FM_MODE_SWITCH_CTL_NAME "Mode Switch" 43 #define FM_MODE_OFF 0 44 #define FM_MODE_TX 1 45 #define FM_MODE_TX 2 46 47 #define FM_BAND_SWITCH_CTL_NAME "Region Switch" 48 #define FM_BAND_EUROPE_US 0 49 #define FM_BAND_JAPAN 1 50 51 #define FM_MUTE_ON 0 52 #define FM_MUTE_OFF 1 53 #define FM_MUTE_ATTENUATE 2 54 55 #define FM_RF_DEPENDENT_MUTE_CTL_NAME "RF Dependent Mute" 56 #define FM_TX_GET_RSSI_LVL_CTL_NAME "RSSI Level" 57 #define FM_TX_RSSI_THRESHOLD_LVL_CTL_NAME "RSSI Threshold" 58 #define FM_STEREO_MONO_CTL_NAME "Stereo/Mono" 59 #define FM_TX_DEEMPHASIS_CTL_NAME "De-emphasis Filter" 60 #define FM_RDS_SWITCH_CTL_NAME "RDS Switch" 61 #define FM_RDS_DISABLE 0 62 #define FM_RDS_ENABLE 1 63 #define FM_TX_RDS_OPMODE_CTL_NAME "RDS Operation Mode" 64 #define FM_TX_AF_SWITCH_CTL_NAME "AF Switch" 65 66 67 68 typedef unsigned long FMC_U32; 69 typedef unsigned int FMC_UINT; 70 typedef unsigned char FMC_U8; 71 72 /*------------------------------------------------------------------------------- 73 * FmcRdsRepertoire Type 74 * 75 * RDS Repertoire used for text data encoding and decoding 76 */ 77 typedef FMC_UINT FmcRdsRepertoire; 78 79 #define FMC_RDS_REPERTOIRE_G0_CODE_TABLE ((FmcRdsRepertoire)0) 80 #define FMC_RDS_REPERTOIRE_G1_CODE_TABLE ((FmcRdsRepertoire)1) 81 #define FMC_RDS_REPERTOIRE_G2_CODE_TABLE ((FmcRdsRepertoire)2) 82 83 84 #define RDS_BIT_0_TO_BIT_3 0x0f 85 #define RDS_BIT_4_TO_BIT_7 0xf0 86 87 88 /******************************************************************************** 89 * 90 * Events sent to the application 91 * 92 *******************************************************************************/ 93 94 /*------------------------------------------------------------------------------- 95 * FmTxEventType structure 96 * 97 */ 98 typedef FMC_UINT FmTxEventType; 99 typedef FMC_UINT FmTxStatus; 100 101 102 /*------------------------------------------------------------------------------- 103 * FmTxCmdType structure 104 * 105 */ 106 typedef FMC_UINT FmTxCmdType; 107 108 #define FM_TX_CMD_ENABLE ((FmTxCmdType)0) /* Enable command */ 109 #define FM_TX_CMD_DISABLE ((FmTxCmdType)1) /* Disable command */ 110 #define FM_TX_CMD_SET_BAND ((FmTxCmdType)2) /* Set Band command */ 111 #define FM_TX_CMD_GET_BAND ((FmTxCmdType)3) /* Get Band command */ 112 #define FM_TX_CMD_SET_MONO_STEREO_MODE ((FmTxCmdType)4) /* Set Mono/Stereo command */ 113 #define FM_TX_CMD_GET_MONO_STEREO_MODE ((FmTxCmdType)5) /* Get Mono/Stereo command */ 114 #define FM_TX_CMD_SET_MUTE_MODE ((FmTxCmdType)6) /* Set Mute mode command */ 115 #define FM_TX_CMD_GET_MUTE_MODE ((FmTxCmdType)7) /* Get Mute mode command */ 116 #define FM_TX_CMD_SET_RF_DEPENDENT_MUTE_MODE ((FmTxCmdType)8) /* Set RF-Dependent Mute Mode command */ 117 #define FM_TX_CMD_GET_RF_DEPENDENT_MUTE_MODE ((FmTxCmdType)9) /* Get RF-Dependent Mute Mode command */ 118 #define FM_TX_CMD_SET_RSSI_THRESHOLD ((FmTxCmdType)10) /* Set RSSI Threshold command */ 119 #define FM_TX_CMD_GET_RSSI_THRESHOLD ((FmTxCmdType)11) /* Get RSSI Threshold command */ 120 #define FM_TX_CMD_SET_DEEMPHASIS_FILTER ((FmTxCmdType)12) /* Set De-Emphassi Filter command */ 121 #define FM_TX_CMD_GET_DEEMPHASIS_FILTER ((FmTxCmdType)13) /* Get De-Emphassi Filter command */ 122 #define FM_TX_CMD_SET_VOLUME ((FmTxCmdType)14) /* Set Volume command */ 123 #define FM_TX_CMD_GET_VOLUME ((FmTxCmdType)15) /* Get Volume command */ 124 #define FM_TX_CMD_TUNE ((FmTxCmdType)16) /* Tune command */ 125 #define FM_TX_CMD_GET_TUNED_FREQUENCY ((FmTxCmdType)17) /* Get Tuned Frequency command */ 126 #define FM_TX_CMD_SEEK ((FmTxCmdType)18) /* Seek command */ 127 #define FM_TX_CMD_STOP_SEEK ((FmTxCmdType)19) /* Stop Seek command */ 128 #define FM_TX_CMD_GET_RSSI ((FmTxCmdType)20) /* Get RSSI command */ 129 #define FM_TX_CMD_ENABLE_RDS ((FmTxCmdType)21) /* Enable RDS command */ 130 #define FM_TX_CMD_DISABLE_RDS ((FmTxCmdType)22) /* Disable RDS command */ 131 #define FM_TX_CMD_SET_RDS_SYSTEM ((FmTxCmdType)23) /* Set RDS System command */ 132 #define FM_TX_CMD_GET_RDS_SYSTEM ((FmTxCmdType)24) /* Get RDS System command */ 133 #define FM_TX_CMD_SET_RDS_GROUP_MASK ((FmTxCmdType)25) /* Set RDS groups to be recieved */ 134 #define FM_TX_CMD_GET_RDS_GROUP_MASK ((FmTxCmdType)26) /* Get RDS groups to be recieved*/ 135 #define FM_TX_CMD_SET_RDS_AF_SWITCH_MODE ((FmTxCmdType)27) /* Set AF Switch Mode command */ 136 #define FM_TX_CMD_GET_RDS_AF_SWITCH_MODE ((FmTxCmdType)28) /* Get AF Switch Mode command */ 137 #define FM_TX_CMD_ENABLE_AUDIO ((FmTxCmdType)29) /* Set Audio Routing command */ 138 #define FM_TX_CMD_DISABLE_AUDIO ((FmTxCmdType)30) /* Get Audio Routing command */ 139 #define FM_TX_CMD_DESTROY ((FmTxCmdType)31) /* Destroy command */ 140 #define FM_TX_CMD_CHANGE_AUDIO_TARGET ((FmTxCmdType)32) /* Change the audio target*/ 141 #define FM_TX_CMD_CHANGE_DIGITAL_AUDIO_CONFIGURATION ((FmTxCmdType)33) /* Change the digital target configuration*/ 142 #define FM_TX_INIT_ASYNC ((FmTxCmdType)34) /* */ 143 #define FM_TX_CMD_INIT ((FmTxCmdType)35) /* */ 144 #define FM_TX_CMD_DEINIT ((FmTxCmdType)36) /* */ 145 #define FM_TX_CMD_SET_CHANNEL_SPACING ((FmTxCmdType)37) /* */ 146 #define FM_TX_CMD_GET_CHANNEL_SPACING ((FmTxCmdType)38) /* */ 147 #define FM_TX_CMD_GET_FW_VERSION ((FmTxCmdType)39) /*Gets the FW version */ 148 #define FM_TX_CMD_IS_CHANNEL_VALID ((FmTxCmdType)40) /*Verify that the tuned channel is valid*/ 149 #define FM_TX_CMD_COMPLETE_SCAN ((FmTxCmdType)41) /*Perfrom Complete Scan on the selected Band*/ 150 #define FM_TX_CMD_COMPLETE_SCAN_PROGRESS ((FmTxCmdType)42) 151 #define FM_TX_CMD_STOP_COMPLETE_SCAN ((FmTxCmdType)43) 152 #define FM_TX_CMD_START_TRANSMISSION ((FmTxCmdType)44) 153 #define FM_TX_CMD_STOP_TRANSMISSION ((FmTxCmdType)45) 154 #define FM_TX_CMD_SET_RDS_TEXT_RT_MSG ((FmTxCmdType)46) 155 #define FM_TX_CMD_SET_RDS_TEXT_PS_MSG ((FmTxCmdType)47) 156 #define FM_TX_CMD_SET_RDS_PTY_CODE ((FmTxCmdType)48) 157 #define FM_TX_CMD_GET_RDS_PTY_CODE ((FmTxCmdType)49) 158 #define FM_TX_CMD_SET_RDS_AF_CODE ((FmTxCmdType)50) 159 160 #define FM_TX_LAST_API_CMD (FM_TX_CMD_SET_RDS_AF_CODE) 161 #define FM_TX_CMD_NONE 0xFFFFFFFF 162 163 164 namespace android { 165 166 extern JNIEnv *getJBtlEnv(); 167 extern void setJBtlEnv(JNIEnv *env); 168 169 } 170 171 /* Following macros and structs are re-declared since android 172 file system has old videodev2.h but kfmapp needs new K35 videodev2.h 173 declarations, So need to remove these definitions once android headers 174 move to K35 plus */ 175 176 #define V4L2_CTRL_CLASS_FM_TX 0x009b0000 /* FM Modulator control class */ 177 /* FM Modulator class control IDs */ 178 #define V4L2_CID_FM_TX_CLASS_BASE (V4L2_CTRL_CLASS_FM_TX | 0x900) 179 #define V4L2_CID_FM_TX_CLASS (V4L2_CTRL_CLASS_FM_TX | 1) 180 181 #define V4L2_CID_TUNE_PREEMPHASIS (V4L2_CID_FM_TX_CLASS_BASE + 112) 182 183 #define V4L2_CID_RDS_TX_DEVIATION (V4L2_CID_FM_TX_CLASS_BASE + 1) 184 #define V4L2_CID_RDS_TX_PI (V4L2_CID_FM_TX_CLASS_BASE + 2) 185 #define V4L2_CID_RDS_TX_PTY (V4L2_CID_FM_TX_CLASS_BASE + 3) 186 #define V4L2_CID_RDS_TX_PS_NAME (V4L2_CID_FM_TX_CLASS_BASE + 5) 187 #define V4L2_CID_RDS_TX_RADIO_TEXT (V4L2_CID_FM_TX_CLASS_BASE + 6) 188 189 #define V4L2_CID_TUNE_POWER_LEVEL (V4L2_CID_FM_TX_CLASS_BASE + 113) 190 #define V4L2_CID_TUNE_ANTENNA_CAPACITOR (V4L2_CID_FM_TX_CLASS_BASE + 114) 191 #define V4L2_TUNER_SUB_RDS 0x0010 192 193 194 #undef VIDIOC_S_MODULATOR 195 #define VIDIOC_S_MODULATOR 1078220343 196 197 struct v4l2_ext_control_kfmapp { 198 __u32 id; 199 __u32 size; 200 __u32 reserved2[1]; 201 union { 202 __s32 value; 203 __s64 value64; 204 char *string; 205 }; 206 } __attribute__ ((packed)); 207 208 struct v4l2_ext_controls_kfmapp { 209 __u32 ctrl_class; 210 __u32 count; 211 __u32 error_idx; 212 __u32 reserved[2]; 213 struct v4l2_ext_control_kfmapp *controls; 214 }; 215 #endif /* JFMTXNATIVE_H_ */ 216