/usr/include/android/hardware/fmradio.h is in android-headers 4.2.2-2-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | /*
* Copyright (C) ST-Ericsson SA 2010
* Copyright (C) 2010 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Author: johan.xj.palmaeus@stericsson.com for ST-Ericsson
*/
/*
* Interface file between the vendor specific drivers and the fmradio
* jni layer. The vendor driver need to define register function with
* name defined by FMRADIO_REGISTER_FUNC of type fmradio_reg_func_t that
* will return a pointer to a signature (FMRADIO_SIGNATURE) to make sure
* it executed correctly and fill struct fmradio_vendor_methods with
* functions implementing functions (or NULL if not supported).
*/
#ifndef ANDROID_FMRADIO_INTERFACE_H
#define ANDROID_FMRADIO_INTERFACE_H
__BEGIN_DECLS
#define FMRADIO_REGISTER_FUNC "register_fmradio_functions"
#define FMRADIO_SIGNATURE 0xDEADBABE
#define FMRADIO_CAPABILITY_RECEIVER 0x0001
#define FMRADIO_CAPABILITY_TRANSMITTER 0x0002
#define FMRADIO_CAPABILITY_TUNER_WRAP_AROUND 0x0004
#define FMRADIO_CAPABILITY_RDS_SUPPORTED 0x0008
/*
* return values. Not defined as enum since some functions either
* return a positive value or these codes, like getFrequency.
*/
#define FMRADIO_OK 0
#define FMRADIO_INVALID_STATE -1 /* internally in jni layer */
#define FMRADIO_UNSUPPORTED_OPERATION -2
#define FMRADIO_IO_ERROR -3
#define FMRADIO_INVALID_PARAMETER -4
#define FMRADIO_FORCED_RESET -5
/* RDS */
#define RDS_MAX_AFS 25
#define RDS_PSN_MAX_LENGTH 8
#define RDS_RT_MAX_LENGTH 64
#define RDS_CT_MAX_LENGTH 14
#define RDS_PTYN_MAX_LENGTH 8
#define RDS_NUMBER_OF_TMC 3
enum fmradio_band_t {
FMRADIO_BAND_US,
FMRADIO_BAND_EU,
FMRADIO_BAND_JAPAN,
FMRADIO_BAND_CHINA
};
enum fmradio_seek_direction_t {
FMRADIO_SEEK_DOWN,
FMRADIO_SEEK_UP
};
enum fmradio_reset_reason_t {
FMRADIO_RESET_NON_CRITICAL = 0,
FMRADIO_RESET_CRITICAL,
FMRADIO_RESET_OTHER_IN_USE, /* internally in jni layer */
FMRADIO_RESET_RADIO_FORBIDDEN, /* internally in java layer */
};
enum fmradio_extra_command_type_t {
FMRADIO_TYPE_INT,
FMRADIO_TYPE_STRING
};
enum fmradio_switch_reason_t {
FMRADIO_SWITCH_AF,
FMRADIO_SWITCH_TA,
FMRADIO_SWITCH_TA_END
};
union fmradio_extra_data_t {
int int_value;
char *string_value;
};
struct fmradio_rds_bundle_t {
unsigned short pi;
short tp;
short pty;
short ta;
short ms;
short num_afs;
int af[RDS_MAX_AFS];
char psn[RDS_PSN_MAX_LENGTH + 1];
char rt[RDS_RT_MAX_LENGTH + 1];
char ct[RDS_CT_MAX_LENGTH + 1];
char ptyn[RDS_PTYN_MAX_LENGTH + 1];
short tmc[RDS_NUMBER_OF_TMC];
int taf;
};
struct fmradio_extra_command_ret_item_t {
char *key;
enum fmradio_extra_command_type_t type;
union fmradio_extra_data_t data;
};
/* vendor callbacks only for RX */
struct fmradio_vendor_callbacks_t {
void (*on_playing_in_stereo_changed) (int is_stereo);
void (*on_rds_data_found) (struct fmradio_rds_bundle_t * rds_bundle,
int frequency);
void (*on_signal_strength_changed) (int new_level);
void (*on_automatic_switch) (int new_freq,
enum fmradio_switch_reason_t reason);
void (*on_forced_reset) (enum fmradio_reset_reason_t reason);
};
struct fmradio_vendor_methods_t {
int (*rx_start) (void ** session_data,
const struct fmradio_vendor_callbacks_t * callbacks,
int low_freq, int high_freq, int default_freq, int grid);
int (*tx_start) (void ** session_data,
const struct fmradio_vendor_callbacks_t * callbacks,
int low_freq, int high_freq, int default_freq, int grid);
int (*pause) (void ** session_data);
int (*resume) (void ** session_data);
int (*reset) (void ** session_data);
int (*set_frequency) (void ** session_data, int frequency);
int (*get_frequency) (void ** session_data);
int (*stop_scan) (void ** session_data);
int (*send_extra_command) (void ** session_data, const char * command,
char ** parameters,
struct fmradio_extra_command_ret_item_t ** out_parameters);
/* rx only */
int (*scan) (void ** session_data, enum fmradio_seek_direction_t direction);
int (*full_scan) (void ** session_data, int ** found_freqs,
int ** signal_strenghts);
int (*get_signal_strength) (void ** session_data);
int (*is_playing_in_stereo) (void ** session_data);
int (*is_rds_data_supported) (void ** session_data);
int (*is_tuned_to_valid_channel) (void ** session_data);
int (*set_automatic_af_switching) (void ** session_data, int automatic);
int (*set_automatic_ta_switching) (void ** session_data, int automatic);
int (*set_force_mono) (void ** session_data, int force_mono);
int (*get_threshold) (void ** session_data);
int (*set_threshold) (void ** session_data, int threshold);
int (*set_rds_reception) (void ** session_data, int use_rds);
/* tx only */
int (*block_scan) (void ** session_data, int low_freq, int high_freq,
int ** found_freqs, int ** signal_strenghts);
int (*set_rds_data) (void ** session_data, char * key, void * value);
};
typedef int (*fmradio_reg_func_t) (unsigned int * signature_p,
struct fmradio_vendor_methods_t * vendor_funcs_p);
__END_DECLS
#endif // ANDROID_FMRADIO_INTERFACE_H
|