~cyphermox/libhybris/android-headers-wifi-compat-check

« back to all changes in this revision

Viewing changes to hardware/fmradio.h

  • Committer: Ricardo Salveti de Araujo
  • Date: 2014-06-17 22:37:31 UTC
  • Revision ID: ricardo.salveti@canonical.com-20140617223731-ymupy7qrjv2c315d
* New upstream release
* Bumping standards-version to 3.9.5 

Show diffs side-by-side

added added

removed removed

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