diff options
Diffstat (limited to 'firmware/target/hosted/android/dx50/tinyalsa/asoundlib.h')
-rw-r--r-- | firmware/target/hosted/android/dx50/tinyalsa/asoundlib.h | 257 |
1 files changed, 0 insertions, 257 deletions
diff --git a/firmware/target/hosted/android/dx50/tinyalsa/asoundlib.h b/firmware/target/hosted/android/dx50/tinyalsa/asoundlib.h deleted file mode 100644 index 6aacae46d6..0000000000 --- a/firmware/target/hosted/android/dx50/tinyalsa/asoundlib.h +++ /dev/null | |||
@@ -1,257 +0,0 @@ | |||
1 | /* asoundlib.h | ||
2 | ** | ||
3 | ** Copyright 2011, The Android Open Source Project | ||
4 | ** | ||
5 | ** Redistribution and use in source and binary forms, with or without | ||
6 | ** modification, are permitted provided that the following conditions are met: | ||
7 | ** * Redistributions of source code must retain the above copyright | ||
8 | ** notice, this list of conditions and the following disclaimer. | ||
9 | ** * Redistributions in binary form must reproduce the above copyright | ||
10 | ** notice, this list of conditions and the following disclaimer in the | ||
11 | ** documentation and/or other materials provided with the distribution. | ||
12 | ** * Neither the name of The Android Open Source Project nor the names of | ||
13 | ** its contributors may be used to endorse or promote products derived | ||
14 | ** from this software without specific prior written permission. | ||
15 | ** | ||
16 | ** THIS SOFTWARE IS PROVIDED BY The Android Open Source Project ``AS IS'' AND | ||
17 | ** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
18 | ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
19 | ** ARE DISCLAIMED. IN NO EVENT SHALL The Android Open Source Project BE LIABLE | ||
20 | ** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
21 | ** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
22 | ** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
23 | ** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
24 | ** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
25 | ** OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | ||
26 | ** DAMAGE. | ||
27 | */ | ||
28 | |||
29 | #ifndef ASOUNDLIB_H | ||
30 | #define ASOUNDLIB_H | ||
31 | |||
32 | #include <sys/time.h> | ||
33 | #include <stddef.h> | ||
34 | |||
35 | #if defined(__cplusplus) | ||
36 | extern "C" { | ||
37 | #endif | ||
38 | |||
39 | /* | ||
40 | * PCM API | ||
41 | */ | ||
42 | |||
43 | struct pcm; | ||
44 | |||
45 | #define PCM_OUT 0x00000000 | ||
46 | #define PCM_IN 0x10000000 | ||
47 | #define PCM_MMAP 0x00000001 | ||
48 | #define PCM_NOIRQ 0x00000002 | ||
49 | #define PCM_NORESTART 0x00000004 /* PCM_NORESTART - when set, calls to | ||
50 | * pcm_write for a playback stream will not | ||
51 | * attempt to restart the stream in the case | ||
52 | * of an underflow, but will return -EPIPE | ||
53 | * instead. After the first -EPIPE error, the | ||
54 | * stream is considered to be stopped, and a | ||
55 | * second call to pcm_write will attempt to | ||
56 | * restart the stream. | ||
57 | */ | ||
58 | |||
59 | /* PCM runtime states */ | ||
60 | #define PCM_STATE_OPEN 0 | ||
61 | #define PCM_STATE_SETUP 1 | ||
62 | #define PCM_STATE_PREPARED 2 | ||
63 | #define PCM_STATE_RUNNING 3 | ||
64 | #define PCM_STATE_XRUN 4 | ||
65 | #define PCM_STATE_DRAINING 5 | ||
66 | #define PCM_STATE_PAUSED 6 | ||
67 | #define PCM_STATE_SUSPENDED 7 | ||
68 | #define PCM_STATE_DISCONNECTED 8 | ||
69 | |||
70 | /* Bit formats */ | ||
71 | enum pcm_format { | ||
72 | PCM_FORMAT_S16_LE = 0, | ||
73 | PCM_FORMAT_S32_LE, | ||
74 | PCM_FORMAT_S8, | ||
75 | PCM_FORMAT_S24_LE, | ||
76 | |||
77 | PCM_FORMAT_MAX, | ||
78 | }; | ||
79 | |||
80 | /* Configuration for a stream */ | ||
81 | struct pcm_config { | ||
82 | unsigned int channels; | ||
83 | unsigned int rate; | ||
84 | unsigned int period_size; | ||
85 | unsigned int period_count; | ||
86 | enum pcm_format format; | ||
87 | |||
88 | /* Values to use for the ALSA start, stop and silence thresholds. Setting | ||
89 | * any one of these values to 0 will cause the default tinyalsa values to be | ||
90 | * used instead. Tinyalsa defaults are as follows. | ||
91 | * | ||
92 | * start_threshold : period_count * period_size | ||
93 | * stop_threshold : period_count * period_size | ||
94 | * silence_threshold : 0 | ||
95 | */ | ||
96 | unsigned int start_threshold; | ||
97 | unsigned int stop_threshold; | ||
98 | unsigned int silence_threshold; | ||
99 | }; | ||
100 | |||
101 | /* PCM parameters */ | ||
102 | enum pcm_param | ||
103 | { | ||
104 | PCM_PARAM_SAMPLE_BITS, | ||
105 | PCM_PARAM_FRAME_BITS, | ||
106 | PCM_PARAM_CHANNELS, | ||
107 | PCM_PARAM_RATE, | ||
108 | PCM_PARAM_PERIOD_TIME, | ||
109 | PCM_PARAM_PERIOD_SIZE, | ||
110 | PCM_PARAM_PERIOD_BYTES, | ||
111 | PCM_PARAM_PERIODS, | ||
112 | PCM_PARAM_BUFFER_TIME, | ||
113 | PCM_PARAM_BUFFER_SIZE, | ||
114 | PCM_PARAM_BUFFER_BYTES, | ||
115 | PCM_PARAM_TICK_TIME, | ||
116 | }; | ||
117 | |||
118 | /* Mixer control types */ | ||
119 | enum mixer_ctl_type { | ||
120 | MIXER_CTL_TYPE_BOOL, | ||
121 | MIXER_CTL_TYPE_INT, | ||
122 | MIXER_CTL_TYPE_ENUM, | ||
123 | MIXER_CTL_TYPE_BYTE, | ||
124 | MIXER_CTL_TYPE_IEC958, | ||
125 | MIXER_CTL_TYPE_INT64, | ||
126 | MIXER_CTL_TYPE_UNKNOWN, | ||
127 | |||
128 | MIXER_CTL_TYPE_MAX, | ||
129 | }; | ||
130 | |||
131 | /* Open and close a stream */ | ||
132 | struct pcm *pcm_open(unsigned int card, unsigned int device, | ||
133 | unsigned int flags, struct pcm_config *config); | ||
134 | int pcm_close(struct pcm *pcm); | ||
135 | int pcm_is_ready(struct pcm *pcm); | ||
136 | |||
137 | /* Obtain the parameters for a PCM */ | ||
138 | struct pcm_params *pcm_params_get(unsigned int card, unsigned int device, | ||
139 | unsigned int flags); | ||
140 | void pcm_params_free(struct pcm_params *pcm_params); | ||
141 | unsigned int pcm_params_get_min(struct pcm_params *pcm_params, | ||
142 | enum pcm_param param); | ||
143 | unsigned int pcm_params_get_max(struct pcm_params *pcm_params, | ||
144 | enum pcm_param param); | ||
145 | |||
146 | /* Set and get config */ | ||
147 | int pcm_get_config(struct pcm *pcm, struct pcm_config *config); | ||
148 | int pcm_set_config(struct pcm *pcm, struct pcm_config *config); | ||
149 | |||
150 | /* Returns a human readable reason for the last error */ | ||
151 | const char *pcm_get_error(struct pcm *pcm); | ||
152 | |||
153 | /* Returns the sample size in bits for a PCM format. | ||
154 | * As with ALSA formats, this is the storage size for the format, whereas the | ||
155 | * format represents the number of significant bits. For example, | ||
156 | * PCM_FORMAT_S24_LE uses 32 bits of storage. | ||
157 | */ | ||
158 | unsigned int pcm_format_to_bits(enum pcm_format format); | ||
159 | |||
160 | /* Returns the buffer size (int frames) that should be used for pcm_write. */ | ||
161 | unsigned int pcm_get_buffer_size(struct pcm *pcm); | ||
162 | unsigned int pcm_frames_to_bytes(struct pcm *pcm, unsigned int frames); | ||
163 | unsigned int pcm_bytes_to_frames(struct pcm *pcm, unsigned int bytes); | ||
164 | |||
165 | /* Returns the pcm latency in ms */ | ||
166 | unsigned int pcm_get_latency(struct pcm *pcm); | ||
167 | |||
168 | /* Returns available frames in pcm buffer and corresponding time stamp. | ||
169 | * For an input stream, frames available are frames ready for the | ||
170 | * application to read. | ||
171 | * For an output stream, frames available are the number of empty frames available | ||
172 | * for the application to write. | ||
173 | */ | ||
174 | int pcm_get_htimestamp(struct pcm *pcm, unsigned int *avail, | ||
175 | struct timespec *tstamp); | ||
176 | |||
177 | /* Write data to the fifo. | ||
178 | * Will start playback on the first write or on a write that | ||
179 | * occurs after a fifo underrun. | ||
180 | */ | ||
181 | int pcm_write(struct pcm *pcm, const void *data, unsigned int count); | ||
182 | int pcm_read(struct pcm *pcm, void *data, unsigned int count); | ||
183 | |||
184 | /* | ||
185 | * mmap() support. | ||
186 | */ | ||
187 | int pcm_mmap_write(struct pcm *pcm, const void *data, unsigned int count); | ||
188 | int pcm_mmap_begin(struct pcm *pcm, void **areas, unsigned int *offset, | ||
189 | unsigned int *frames); | ||
190 | int pcm_mmap_commit(struct pcm *pcm, unsigned int offset, unsigned int frames); | ||
191 | |||
192 | |||
193 | /* Start and stop a PCM channel that doesn't transfer data */ | ||
194 | int pcm_start(struct pcm *pcm); | ||
195 | int pcm_stop(struct pcm *pcm); | ||
196 | |||
197 | /* Interrupt driven API */ | ||
198 | int pcm_wait(struct pcm *pcm, int timeout); | ||
199 | |||
200 | int pcm_avail_update(struct pcm *pcm); | ||
201 | |||
202 | int pcm_state(struct pcm *pcm); | ||
203 | |||
204 | |||
205 | /* | ||
206 | * MIXER API | ||
207 | */ | ||
208 | |||
209 | struct mixer; | ||
210 | struct mixer_ctl; | ||
211 | |||
212 | /* Open and close a mixer */ | ||
213 | struct mixer *mixer_open(unsigned int card); | ||
214 | void mixer_close(struct mixer *mixer); | ||
215 | |||
216 | /* Get info about a mixer */ | ||
217 | const char *mixer_get_name(struct mixer *mixer); | ||
218 | |||
219 | /* Obtain mixer controls */ | ||
220 | unsigned int mixer_get_num_ctls(struct mixer *mixer); | ||
221 | struct mixer_ctl *mixer_get_ctl(struct mixer *mixer, unsigned int id); | ||
222 | struct mixer_ctl *mixer_get_ctl_by_name(struct mixer *mixer, const char *name); | ||
223 | |||
224 | /* Get info about mixer controls */ | ||
225 | const char *mixer_ctl_get_name(struct mixer_ctl *ctl); | ||
226 | enum mixer_ctl_type mixer_ctl_get_type(struct mixer_ctl *ctl); | ||
227 | const char *mixer_ctl_get_type_string(struct mixer_ctl *ctl); | ||
228 | unsigned int mixer_ctl_get_num_values(struct mixer_ctl *ctl); | ||
229 | unsigned int mixer_ctl_get_num_enums(struct mixer_ctl *ctl); | ||
230 | const char *mixer_ctl_get_enum_string(struct mixer_ctl *ctl, | ||
231 | unsigned int enum_id); | ||
232 | |||
233 | /* Some sound cards update their controls due to external events, | ||
234 | * such as HDMI EDID byte data changing when an HDMI cable is | ||
235 | * connected. This API allows the count of elements to be updated. | ||
236 | */ | ||
237 | void mixer_ctl_update(struct mixer_ctl *ctl); | ||
238 | |||
239 | /* Set and get mixer controls */ | ||
240 | int mixer_ctl_get_percent(struct mixer_ctl *ctl, unsigned int id); | ||
241 | int mixer_ctl_set_percent(struct mixer_ctl *ctl, unsigned int id, int percent); | ||
242 | |||
243 | int mixer_ctl_get_value(struct mixer_ctl *ctl, unsigned int id); | ||
244 | int mixer_ctl_get_array(struct mixer_ctl *ctl, void *array, size_t count); | ||
245 | int mixer_ctl_set_value(struct mixer_ctl *ctl, unsigned int id, int value); | ||
246 | int mixer_ctl_set_array(struct mixer_ctl *ctl, const void *array, size_t count); | ||
247 | int mixer_ctl_set_enum_by_string(struct mixer_ctl *ctl, const char *string); | ||
248 | |||
249 | /* Determe range of integer mixer controls */ | ||
250 | int mixer_ctl_get_range_min(struct mixer_ctl *ctl); | ||
251 | int mixer_ctl_get_range_max(struct mixer_ctl *ctl); | ||
252 | |||
253 | #if defined(__cplusplus) | ||
254 | } /* extern "C" */ | ||
255 | #endif | ||
256 | |||
257 | #endif | ||