ALSA: asihpi - Add hd radio blend functions
[safe/jmp/linux-2.6] / sound / pci / asihpi / hpi.h
1 /******************************************************************************
2
3     AudioScience HPI driver
4     Copyright (C) 1997-2010  AudioScience Inc. <support@audioscience.com>
5
6     This program is free software; you can redistribute it and/or modify
7     it under the terms of version 2 of the GNU General Public License as
8     published by the Free Software Foundation;
9
10     This program is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13     GNU General Public License for more details.
14
15     You should have received a copy of the GNU General Public License
16     along with this program; if not, write to the Free Software
17     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
19 */
20 /** \file hpi.h
21
22  AudioScience Hardware Programming Interface (HPI)
23  public API definition.
24
25  The HPI is a low-level hardware abstraction layer to all
26  AudioScience digital audio adapters
27 */
28 /*
29  You must define one operating system that the HPI is to be compiled under
30  HPI_OS_WIN32_USER   32bit Windows
31  HPI_OS_DSP_C6000    DSP TI C6000  (automatically set)
32  HPI_OS_WDM          Windows WDM kernel driver
33  HPI_OS_LINUX        Linux userspace
34  HPI_OS_LINUX_KERNEL Linux kernel (automatically set)
35
36 (C) Copyright AudioScience Inc. 1998-2010
37 ******************************************************************************/
38 #ifndef _HPI_H_
39 #define _HPI_H_
40 /* HPI Version
41 If HPI_VER_MINOR is odd then its a development release not intended for the
42 public. If HPI_VER_MINOR is even then is a release version
43 i.e 3.05.02 is a development version
44 */
45 #define HPI_VERSION_CONSTRUCTOR(maj, min, rel) \
46         ((maj << 16) + (min << 8) + rel)
47
48 #define HPI_VER_MAJOR(v) ((int)(v >> 16))
49 #define HPI_VER_MINOR(v) ((int)((v >> 8) & 0xFF))
50 #define HPI_VER_RELEASE(v) ((int)(v & 0xFF))
51
52 /* Use single digits for versions less that 10 to avoid octal. */
53 #define HPI_VER HPI_VERSION_CONSTRUCTOR(4L, 3, 25)
54
55 /* Library version as documented in hpi-api-versions.txt */
56 #define HPI_LIB_VER  HPI_VERSION_CONSTRUCTOR(9, 0, 0)
57
58 #include <linux/types.h>
59 #define HPI_EXCLUDE_DEPRECATED
60
61 /******************************************************************************/
62 /******************************************************************************/
63 /********       HPI API DEFINITIONS                                       *****/
64 /******************************************************************************/
65 /******************************************************************************/
66 /*******************************************/
67 /**  Audio format types
68 \ingroup stream
69 */
70 enum HPI_FORMATS {
71 /** Used internally on adapter. */
72         HPI_FORMAT_MIXER_NATIVE = 0,
73 /** 8-bit unsigned PCM. Windows equivalent is WAVE_FORMAT_PCM. */
74         HPI_FORMAT_PCM8_UNSIGNED = 1,
75 /** 16-bit signed PCM. Windows equivalent is WAVE_FORMAT_PCM. */
76         HPI_FORMAT_PCM16_SIGNED = 2,
77 /** MPEG-1 Layer-1. */
78         HPI_FORMAT_MPEG_L1 = 3,
79 /** MPEG-1 Layer-2.
80
81 Windows equivalent is WAVE_FORMAT_MPEG.
82
83 The following table shows what combinations of mode and bitrate are possible:
84
85 <table border=1 cellspacing=0 cellpadding=5>
86 <tr>
87 <td><p><b>Bitrate (kbs)</b></p>
88 <td><p><b>Mono</b></p>
89 <td><p><b>Stereo,<br>Joint Stereo or<br>Dual Channel</b></p>
90
91 <tr><td>32<td>X<td>_
92 <tr><td>40<td>_<td>_
93 <tr><td>48<td>X<td>_
94 <tr><td>56<td>X<td>_
95 <tr><td>64<td>X<td>X
96 <tr><td>80<td>X<td>_
97 <tr><td>96<td>X<td>X
98 <tr><td>112<td>X<td>X
99 <tr><td>128<td>X<td>X
100 <tr><td>160<td>X<td>X
101 <tr><td>192<td>X<td>X
102 <tr><td>224<td>_<td>X
103 <tr><td>256<td>-<td>X
104 <tr><td>320<td>-<td>X
105 <tr><td>384<td>_<td>X
106 </table>
107 */
108         HPI_FORMAT_MPEG_L2 = 4,
109 /** MPEG-1 Layer-3.
110 Windows equivalent is WAVE_FORMAT_MPEG.
111
112 The following table shows what combinations of mode and bitrate are possible:
113
114 <table border=1 cellspacing=0 cellpadding=5>
115 <tr>
116 <td><p><b>Bitrate (kbs)</b></p>
117 <td><p><b>Mono<br>Stereo @ 8,<br>11.025 and<br>12kHz*</b></p>
118 <td><p><b>Mono<br>Stereo @ 16,<br>22.050 and<br>24kHz*</b></p>
119 <td><p><b>Mono<br>Stereo @ 32,<br>44.1 and<br>48kHz</b></p>
120
121 <tr><td>16<td>X<td>X<td>_
122 <tr><td>24<td>X<td>X<td>_
123 <tr><td>32<td>X<td>X<td>X
124 <tr><td>40<td>X<td>X<td>X
125 <tr><td>48<td>X<td>X<td>X
126 <tr><td>56<td>X<td>X<td>X
127 <tr><td>64<td>X<td>X<td>X
128 <tr><td>80<td>_<td>X<td>X
129 <tr><td>96<td>_<td>X<td>X
130 <tr><td>112<td>_<td>X<td>X
131 <tr><td>128<td>_<td>X<td>X
132 <tr><td>144<td>_<td>X<td>_
133 <tr><td>160<td>_<td>X<td>X
134 <tr><td>192<td>_<td>_<td>X
135 <tr><td>224<td>_<td>_<td>X
136 <tr><td>256<td>-<td>_<td>X
137 <tr><td>320<td>-<td>_<td>X
138 </table>
139 \b * Available on the ASI6000 series only
140 */
141         HPI_FORMAT_MPEG_L3 = 5,
142 /** Dolby AC-2. */
143         HPI_FORMAT_DOLBY_AC2 = 6,
144 /** Dolbt AC-3. */
145         HPI_FORMAT_DOLBY_AC3 = 7,
146 /** 16-bit PCM big-endian. */
147         HPI_FORMAT_PCM16_BIGENDIAN = 8,
148 /** TAGIT-1 algorithm - hits. */
149         HPI_FORMAT_AA_TAGIT1_HITS = 9,
150 /** TAGIT-1 algorithm - inserts. */
151         HPI_FORMAT_AA_TAGIT1_INSERTS = 10,
152 /** 32-bit signed PCM. Windows equivalent is WAVE_FORMAT_PCM.
153 Each sample is a 32bit word. The most significant 24 bits contain a 24-bit
154 sample and the least significant 8 bits are set to 0.
155 */
156         HPI_FORMAT_PCM32_SIGNED = 11,
157 /** Raw bitstream - unknown format. */
158         HPI_FORMAT_RAW_BITSTREAM = 12,
159 /** TAGIT-1 algorithm hits - extended. */
160         HPI_FORMAT_AA_TAGIT1_HITS_EX1 = 13,
161 /** 32-bit PCM as an IEEE float. Windows equivalent is WAVE_FORMAT_IEEE_FLOAT.
162 Each sample is a 32bit word in IEEE754 floating point format.
163 The range is +1.0 to -1.0, which corresponds to digital fullscale.
164 */
165         HPI_FORMAT_PCM32_FLOAT = 14,
166 /** 24-bit PCM signed. Windows equivalent is WAVE_FORMAT_PCM. */
167         HPI_FORMAT_PCM24_SIGNED = 15,
168 /** OEM format 1 - private. */
169         HPI_FORMAT_OEM1 = 16,
170 /** OEM format 2 - private. */
171         HPI_FORMAT_OEM2 = 17,
172 /** Undefined format. */
173         HPI_FORMAT_UNDEFINED = 0xffff
174 };
175
176 /******************************************* in/out Stream states */
177 /*******************************************/
178 /** Stream States
179 \ingroup stream
180 */
181 enum HPI_STREAM_STATES {
182         /** State stopped - stream is stopped. */
183         HPI_STATE_STOPPED = 1,
184         /** State playing - stream is playing audio. */
185         HPI_STATE_PLAYING = 2,
186         /** State recording - stream is recording. */
187         HPI_STATE_RECORDING = 3,
188         /** State drained - playing stream ran out of data to play. */
189         HPI_STATE_DRAINED = 4,
190         /** State generate sine - to be implemented. */
191         HPI_STATE_SINEGEN = 5,
192         /** State wait - used for inter-card sync to mean waiting for all
193                 cards to be ready. */
194         HPI_STATE_WAIT = 6
195 };
196 /******************************************* mixer source node types */
197 /** Source node types
198 \ingroup mixer
199 */
200 enum HPI_SOURCENODES {
201         /** This define can be used instead of 0 to indicate
202         that there is no valid source node. A control that
203         exists on a destination node can be searched for using a source
204         node value of either 0, or HPI_SOURCENODE_NONE */
205         HPI_SOURCENODE_NONE = 100,
206         /** \deprecated Use HPI_SOURCENODE_NONE instead. */
207         HPI_SOURCENODE_BASE = 100,
208         /** Out Stream (Play) node. */
209         HPI_SOURCENODE_OSTREAM = 101,
210         /** Line in node - could be analog, AES/EBU or network. */
211         HPI_SOURCENODE_LINEIN = 102,
212         HPI_SOURCENODE_AESEBU_IN = 103,      /**< AES/EBU input node. */
213         HPI_SOURCENODE_TUNER = 104,          /**< tuner node. */
214         HPI_SOURCENODE_RF = 105,             /**< RF input node. */
215         HPI_SOURCENODE_CLOCK_SOURCE = 106,   /**< clock source node. */
216         HPI_SOURCENODE_RAW_BITSTREAM = 107,  /**< raw bitstream node. */
217         HPI_SOURCENODE_MICROPHONE = 108,     /**< microphone node. */
218         /** Cobranet input node -
219             Audio samples come from the Cobranet network and into the device. */
220         HPI_SOURCENODE_COBRANET = 109,
221         HPI_SOURCENODE_ANALOG = 110,         /**< analog input node. */
222         HPI_SOURCENODE_ADAPTER = 111,        /**< adapter node. */
223         /* !!!Update this  AND hpidebug.h if you add a new sourcenode type!!! */
224         HPI_SOURCENODE_LAST_INDEX = 111      /**< largest ID */
225                 /* AX6 max sourcenode types = 15 */
226 };
227
228 /******************************************* mixer dest node types */
229 /** Destination node types
230 \ingroup mixer
231 */
232 enum HPI_DESTNODES {
233         /** This define can be used instead of 0 to indicate
234         that there is no valid destination node. A control that
235         exists on a source node can be searched for using a destination
236         node value of either 0, or HPI_DESTNODE_NONE */
237         HPI_DESTNODE_NONE = 200,
238         /** \deprecated Use HPI_DESTNODE_NONE instead. */
239         HPI_DESTNODE_BASE = 200,
240         /** In Stream (Record) node. */
241         HPI_DESTNODE_ISTREAM = 201,
242         HPI_DESTNODE_LINEOUT = 202,         /**< line out node. */
243         HPI_DESTNODE_AESEBU_OUT = 203,       /**< AES/EBU output node. */
244         HPI_DESTNODE_RF = 204,               /**< RF output node. */
245         HPI_DESTNODE_SPEAKER = 205,          /**< speaker output node. */
246         /** Cobranet output node -
247             Audio samples from the device are sent out on the Cobranet network.*/
248         HPI_DESTNODE_COBRANET = 206,
249         HPI_DESTNODE_ANALOG = 207,           /**< analog output node. */
250
251         /* !!!Update this AND hpidebug.h if you add a new destnode type!!! */
252         HPI_DESTNODE_LAST_INDEX = 207        /**< largest ID */
253                 /* AX6 max destnode types = 15 */
254 };
255
256 /*******************************************/
257 /** Mixer control types
258 \ingroup mixer
259 */
260 enum HPI_CONTROLS {
261         HPI_CONTROL_GENERIC = 0,        /**< generic control. */
262         HPI_CONTROL_CONNECTION = 1, /**< A connection between nodes. */
263         HPI_CONTROL_VOLUME = 2,       /**< volume control - works in dB_fs. */
264         HPI_CONTROL_METER = 3,  /**< peak meter control. */
265         HPI_CONTROL_MUTE = 4,   /*mute control - not used at present. */
266         HPI_CONTROL_MULTIPLEXER = 5,    /**< multiplexer control. */
267
268         HPI_CONTROL_AESEBU_TRANSMITTER = 6,     /**< AES/EBU transmitter control. */
269         HPI_CONTROL_AESEBUTX = HPI_CONTROL_AESEBU_TRANSMITTER,
270
271         HPI_CONTROL_AESEBU_RECEIVER = 7, /**< AES/EBU receiver control. */
272         HPI_CONTROL_AESEBURX = HPI_CONTROL_AESEBU_RECEIVER,
273
274         HPI_CONTROL_LEVEL = 8, /**< level/trim control - works in d_bu. */
275         HPI_CONTROL_TUNER = 9,  /**< tuner control. */
276 /*      HPI_CONTROL_ONOFFSWITCH =       10 */
277         HPI_CONTROL_VOX = 11,   /**< vox control. */
278 /*      HPI_CONTROL_AES18_TRANSMITTER = 12 */
279 /*      HPI_CONTROL_AES18_RECEIVER = 13 */
280 /*      HPI_CONTROL_AES18_BLOCKGENERATOR  = 14 */
281         HPI_CONTROL_CHANNEL_MODE = 15,  /**< channel mode control. */
282
283         HPI_CONTROL_BITSTREAM = 16,     /**< bitstream control. */
284         HPI_CONTROL_SAMPLECLOCK = 17,   /**< sample clock control. */
285         HPI_CONTROL_MICROPHONE = 18,    /**< microphone control. */
286         HPI_CONTROL_PARAMETRIC_EQ = 19, /**< parametric EQ control. */
287         HPI_CONTROL_EQUALIZER = HPI_CONTROL_PARAMETRIC_EQ,
288
289         HPI_CONTROL_COMPANDER = 20,     /**< compander control. */
290         HPI_CONTROL_COBRANET = 21,      /**< cobranet control. */
291         HPI_CONTROL_TONEDETECTOR = 22,  /**< tone detector control. */
292         HPI_CONTROL_SILENCEDETECTOR = 23,       /**< silence detector control. */
293         HPI_CONTROL_PAD = 24,   /**< tuner PAD control. */
294         HPI_CONTROL_SRC = 25,   /**< samplerate converter control. */
295         HPI_CONTROL_UNIVERSAL = 26,     /**< universal control. */
296
297 /*  !!! Update this AND hpidebug.h if you add a new control type!!!*/
298         HPI_CONTROL_LAST_INDEX = 26 /**<highest control type ID */
299 /* WARNING types 256 or greater impact bit packing in all AX6 DSP code */
300 };
301
302 /* Shorthand names that match attribute names */
303
304 /******************************************* ADAPTER ATTRIBUTES ****/
305
306 /** Adapter properties
307 These are used in HPI_AdapterSetProperty() and HPI_AdapterGetProperty()
308 \ingroup adapter
309 */
310 enum HPI_ADAPTER_PROPERTIES {
311 /** \internal Used in dwProperty field of HPI_AdapterSetProperty() and
312 HPI_AdapterGetProperty(). This errata applies to all ASI6000 cards with both
313 analog and digital outputs. The CS4224 A/D+D/A has a one sample delay between
314 left and right channels on both its input (ADC) and output (DAC).
315 More details are available in Cirrus Logic errata ER284B2.
316 PDF available from www.cirrus.com, released by Cirrus in 2001.
317 */
318         HPI_ADAPTER_PROPERTY_ERRATA_1 = 1,
319
320 /** Adapter grouping property
321 Indicates whether the adapter supports the grouping API (for ASIO and SSX2)
322 */
323         HPI_ADAPTER_PROPERTY_GROUPING = 2,
324
325 /** Driver SSX2 property
326 Tells the kernel driver to turn on SSX2 stream mapping.
327 This feature is not used by the DSP. In fact the call is completely processed
328 by the driver and is not passed on to the DSP at all.
329 */
330         HPI_ADAPTER_PROPERTY_ENABLE_SSX2 = 3,
331
332 /** Adapter SSX2 property
333 Indicates the state of the adapter's SSX2 setting. This setting is stored in
334 non-volatile memory on the adapter. A typical call sequence would be to use
335 HPI_ADAPTER_PROPERTY_SSX2_SETTING to set SSX2 on the adapter and then to reload
336 the driver. The driver would query HPI_ADAPTER_PROPERTY_SSX2_SETTING during startup
337 and if SSX2 is set, it would then call HPI_ADAPTER_PROPERTY_ENABLE_SSX2 to enable
338 SSX2 stream mapping within the kernel level of the driver.
339 */
340         HPI_ADAPTER_PROPERTY_SSX2_SETTING = 4,
341
342 /** Base number for readonly properties */
343         HPI_ADAPTER_PROPERTY_READONLYBASE = 256,
344
345 /** Readonly adapter latency property.
346 This property returns in the input and output latency in samples.
347 Property 1 is the estimated input latency
348 in samples, while Property 2 is that output latency in  samples.
349 */
350         HPI_ADAPTER_PROPERTY_LATENCY = 256,
351
352 /** Readonly adapter granularity property.
353 The granulariy is the smallest size chunk of stereo samples that is processed by
354 the adapter.
355 This property returns the record granularity in samples in Property 1.
356 Property 2 returns the play granularity.
357 */
358         HPI_ADAPTER_PROPERTY_GRANULARITY = 257,
359
360 /** Readonly adapter number of current channels property.
361 Property 1 is the number of record channels per record device.
362 Property 2 is the number of play channels per playback device.*/
363         HPI_ADAPTER_PROPERTY_CURCHANNELS = 258,
364
365 /** Readonly adapter software version.
366 The SOFTWARE_VERSION property returns the version of the software running
367 on the adapter as Major.Minor.Release.
368 Property 1 contains Major in bits 15..8 and Minor in bits 7..0.
369 Property 2 contains Release in bits 7..0. */
370         HPI_ADAPTER_PROPERTY_SOFTWARE_VERSION = 259,
371
372 /** Readonly adapter MAC address MSBs.
373 The MAC_ADDRESS_MSB property returns
374 the most significant 32 bits of the MAC address.
375 Property 1 contains bits 47..32 of the MAC address.
376 Property 2 contains bits 31..16 of the MAC address. */
377         HPI_ADAPTER_PROPERTY_MAC_ADDRESS_MSB = 260,
378
379 /** Readonly adapter MAC address LSBs
380 The MAC_ADDRESS_LSB property returns
381 the least significant 16 bits of the MAC address.
382 Property 1 contains bits 15..0 of the MAC address. */
383         HPI_ADAPTER_PROPERTY_MAC_ADDRESS_LSB = 261,
384
385 /** Readonly extended adapter type number
386 The EXTENDED_ADAPTER_TYPE property returns the 4 digits of an extended
387 adapter type, i.e ASI8920-0022, 0022 is the extended type.
388 The digits are returned as ASCII characters rather than the hex digits that
389 are returned for the main type
390 Property 1 returns the 1st two (left most) digits, i.e "00"
391 in the example above, the upper byte being the left most digit.
392 Property 2 returns the 2nd two digits, i.e "22" in the example above*/
393         HPI_ADAPTER_PROPERTY_EXTENDED_ADAPTER_TYPE = 262,
394
395 /** Readonly debug log buffer information */
396         HPI_ADAPTER_PROPERTY_LOGTABLEN = 263,
397         HPI_ADAPTER_PROPERTY_LOGTABBEG = 264,
398
399 /** Readonly adapter IP address
400 For 192.168.1.101
401 Property 1 returns the 1st two (left most) digits, i.e 192*256 + 168
402 in the example above, the upper byte being the left most digit.
403 Property 2 returns the 2nd two digits, i.e 1*256 + 101 in the example above, */
404         HPI_ADAPTER_PROPERTY_IP_ADDRESS = 265,
405
406 /** Readonly adapter buffer processed count. Returns a buffer processed count
407 that is incremented every time all buffers for all streams are updated. This
408 is useful for checking completion of all stream operations across the adapter
409 when using grouped streams.
410 */
411         HPI_ADAPTER_PROPERTY_BUFFER_UPDATE_COUNT = 266,
412
413 /** Readonly mixer and stream intervals
414
415 These intervals are  measured in mixer frames.
416 To convert to time, divide  by the adapter samplerate.
417
418 The mixer interval is the number of frames processed in one mixer iteration.
419 The stream update interval is the interval at which streams check for and
420 process data, and BBM host buffer counters are updated.
421
422 Property 1 is the mixer interval in mixer frames.
423 Property 2 is the stream update interval in mixer frames.
424 */
425         HPI_ADAPTER_PROPERTY_INTERVAL = 267,
426 /** Adapter capabilities 1
427 Property 1 - adapter can do multichannel (SSX1)
428 Property 2 - adapter can do stream grouping (supports SSX2)
429 */
430         HPI_ADAPTER_PROPERTY_CAPS1 = 268,
431 /** Adapter capabilities 2
432 Property 1 - adapter can do samplerate conversion (MRX)
433 Property 2 - adapter can do timestretch (TSX)
434 */
435         HPI_ADAPTER_PROPERTY_CAPS2 = 269
436 };
437
438 /** Adapter mode commands
439
440 Used in wQueryOrSet field of HPI_AdapterSetModeEx().
441 \ingroup adapter
442 */
443 enum HPI_ADAPTER_MODE_CMDS {
444         HPI_ADAPTER_MODE_SET = 0,
445         HPI_ADAPTER_MODE_QUERY = 1
446 };
447
448 /** Adapter Modes
449         These are used by HPI_AdapterSetModeEx()
450
451 \warning - more than 16 possible modes breaks
452 a bitmask in the Windows WAVE DLL
453 \ingroup adapter
454 */
455 enum HPI_ADAPTER_MODES {
456 /** 4 outstream mode.
457 - ASI6114: 1 instream
458 - ASI6044: 4 instreams
459 - ASI6012: 1 instream
460 - ASI6102: no instreams
461 - ASI6022, ASI6122: 2 instreams
462 - ASI5111, ASI5101: 2 instreams
463 - ASI652x, ASI662x: 2 instreams
464 - ASI654x, ASI664x: 4 instreams
465 */
466         HPI_ADAPTER_MODE_4OSTREAM = 1,
467
468 /** 6 outstream mode.
469 - ASI6012: 1 instream,
470 - ASI6022, ASI6122: 2 instreams
471 - ASI652x, ASI662x: 4 instreams
472 */
473         HPI_ADAPTER_MODE_6OSTREAM = 2,
474
475 /** 8 outstream mode.
476 - ASI6114: 8 instreams
477 - ASI6118: 8 instreams
478 - ASI6585: 8 instreams
479 */
480         HPI_ADAPTER_MODE_8OSTREAM = 3,
481
482 /** 16 outstream mode.
483 - ASI6416 16 instreams
484 - ASI6518, ASI6618 16 instreams
485 - ASI6118 16 mono out and in streams
486 */
487         HPI_ADAPTER_MODE_16OSTREAM = 4,
488
489 /** one outstream mode.
490 - ASI5111 1 outstream, 1 instream
491 */
492         HPI_ADAPTER_MODE_1OSTREAM = 5,
493
494 /** ASI504X mode 1. 12 outstream, 4 instream 0 to 48kHz sample rates
495         (see ASI504X datasheet for more info).
496 */
497         HPI_ADAPTER_MODE_1 = 6,
498
499 /** ASI504X mode 2. 4 outstreams, 4 instreams at 0 to 192kHz sample rates
500         (see ASI504X datasheet for more info).
501 */
502         HPI_ADAPTER_MODE_2 = 7,
503
504 /** ASI504X mode 3. 4 outstreams, 4 instreams at 0 to 192kHz sample rates
505         (see ASI504X datasheet for more info).
506 */
507         HPI_ADAPTER_MODE_3 = 8,
508
509 /** ASI504X multichannel mode.
510         2 outstreams -> 4 line outs = 1 to 8 channel streams),
511         4 lineins -> 1 instream (1 to 8 channel streams) at 0-48kHz.
512         For more info see the SSX Specification.
513 */
514         HPI_ADAPTER_MODE_MULTICHANNEL = 9,
515
516 /** 12 outstream mode.
517 - ASI6514, ASI6614: 2 instreams
518 - ASI6540,ASI6544: 8 instreams
519 - ASI6640,ASI6644: 8 instreams
520 */
521         HPI_ADAPTER_MODE_12OSTREAM = 10,
522
523 /** 9 outstream mode.
524 - ASI6044: 8 instreams
525 */
526         HPI_ADAPTER_MODE_9OSTREAM = 11,
527
528 /** mono mode.
529 - ASI6416: 16 outstreams/instreams
530 - ASI5402: 2 outstreams/instreams
531 */
532         HPI_ADAPTER_MODE_MONO = 12,
533
534 /** Low latency mode.
535 - ASI6416/ASI6316: 1 16 channel outstream and instream
536 */
537         HPI_ADAPTER_MODE_LOW_LATENCY = 13
538 };
539
540 /* Note, adapters can have more than one capability -
541 encoding as bitfield is recommended. */
542 #define HPI_CAPABILITY_NONE             (0)
543 #define HPI_CAPABILITY_MPEG_LAYER3      (1)
544
545 /* Set this equal to maximum capability index,
546 Must not be greater than 32 - see axnvdef.h */
547 #define HPI_CAPABILITY_MAX                      1
548 /* #define HPI_CAPABILITY_AAC              2 */
549
550 /******************************************* STREAM ATTRIBUTES ****/
551
552 /** MPEG Ancillary Data modes
553
554 The mode for the ancillary data insertion or extraction to operate in.
555 \ingroup stream
556 */
557 enum HPI_MPEG_ANC_MODES {
558         /** the MPEG frames have energy information stored in them (5 bytes per stereo frame, 3 per mono) */
559         HPI_MPEG_ANC_HASENERGY = 0,
560         /** the entire ancillary data field is taken up by data from the Anc data buffer
561         On encode, the encoder will insert the energy bytes before filling the remainder
562         of the ancillary data space with data from the ancillary data buffer.
563         */
564         HPI_MPEG_ANC_RAW = 1
565 };
566
567 /** Ancillary Data Alignment
568 \ingroup instream
569 */
570 enum HPI_ISTREAM_MPEG_ANC_ALIGNS {
571         /** data is packed against the end of data, then padded to the end of frame */
572         HPI_MPEG_ANC_ALIGN_LEFT = 0,
573         /** data is packed against the end of the frame */
574         HPI_MPEG_ANC_ALIGN_RIGHT = 1
575 };
576
577 /** MPEG modes
578 MPEG modes - can be used optionally for HPI_FormatCreate()
579 parameter dwAttributes.
580
581 Using any mode setting other than HPI_MPEG_MODE_DEFAULT
582 with single channel format will return an error.
583 \ingroup stream
584 */
585 enum HPI_MPEG_MODES {
586 /** Causes the MPEG-1 Layer II bitstream to be recorded
587 in single_channel mode when the number of channels is 1 and in stereo when the
588 number of channels is 2. */
589         HPI_MPEG_MODE_DEFAULT = 0,
590         /** Standard stereo without joint-stereo compression */
591         HPI_MPEG_MODE_STEREO = 1,
592         /** Joint stereo  */
593         HPI_MPEG_MODE_JOINTSTEREO = 2,
594         /** Left and Right channels are completely independent */
595         HPI_MPEG_MODE_DUALCHANNEL = 3
596 };
597 /******************************************* MIXER ATTRIBUTES ****/
598
599 /* \defgroup mixer_flags Mixer flags for HPI_MIXER_GET_CONTROL_MULTIPLE_VALUES
600 {
601 */
602 #define HPI_MIXER_GET_CONTROL_MULTIPLE_CHANGED  (0)
603 #define HPI_MIXER_GET_CONTROL_MULTIPLE_RESET    (1)
604 /*}*/
605
606 /** Commands used by HPI_MixerStore()
607 \ingroup mixer
608 */
609 enum HPI_MIXER_STORE_COMMAND {
610 /** Save all mixer control settings. */
611         HPI_MIXER_STORE_SAVE = 1,
612 /** Restore all controls from saved. */
613         HPI_MIXER_STORE_RESTORE = 2,
614 /** Delete saved control settings. */
615         HPI_MIXER_STORE_DELETE = 3,
616 /** Enable auto storage of some control settings. */
617         HPI_MIXER_STORE_ENABLE = 4,
618 /** Disable auto storage of some control settings. */
619         HPI_MIXER_STORE_DISABLE = 5,
620 /** Save the attributes of a single control. */
621         HPI_MIXER_STORE_SAVE_SINGLE = 6
622 };
623
624 /************************************* CONTROL ATTRIBUTE VALUES ****/
625 /** Used by mixer plugin enable functions
626
627 E.g. HPI_ParametricEQ_SetState()
628 \ingroup mixer
629 */
630 enum HPI_SWITCH_STATES {
631         HPI_SWITCH_OFF = 0,     /**< turn the mixer plugin on. */
632         HPI_SWITCH_ON = 1       /**< turn the mixer plugin off. */
633 };
634
635 /* Volume control special gain values */
636 /** volumes units are 100ths of a dB
637 \ingroup volume
638 */
639 #define HPI_UNITS_PER_dB                100
640 /** turns volume control OFF or MUTE
641 \ingroup volume
642 */
643 #define HPI_GAIN_OFF                    (-100 * HPI_UNITS_PER_dB)
644
645 /** value returned for no signal
646 \ingroup meter
647 */
648 #define HPI_METER_MINIMUM               (-150 * HPI_UNITS_PER_dB)
649
650 /** autofade profiles
651 \ingroup volume
652 */
653 enum HPI_VOLUME_AUTOFADES {
654 /** log fade - dB attenuation changes linearly over time */
655         HPI_VOLUME_AUTOFADE_LOG = 2,
656 /** linear fade - amplitude changes linearly */
657         HPI_VOLUME_AUTOFADE_LINEAR = 3
658 };
659
660 /** The physical encoding format of the AESEBU I/O.
661
662 Used in HPI_AESEBU_Transmitter_SetFormat(), HPI_AESEBU_Receiver_SetFormat()
663 along with related Get and Query functions
664 \ingroup aestx
665 */
666 enum HPI_AESEBU_FORMATS {
667 /** AES/EBU physical format - AES/EBU balanced "professional"  */
668         HPI_AESEBU_FORMAT_AESEBU = 1,
669 /** AES/EBU physical format - S/PDIF unbalanced "consumer"      */
670         HPI_AESEBU_FORMAT_SPDIF = 2
671 };
672
673 /** AES/EBU error status bits
674
675 Returned by HPI_AESEBU_Receiver_GetErrorStatus()
676 \ingroup aesrx
677 */
678 enum HPI_AESEBU_ERRORS {
679 /**  bit0: 1 when PLL is not locked */
680         HPI_AESEBU_ERROR_NOT_LOCKED = 0x01,
681 /**  bit1: 1 when signal quality is poor */
682         HPI_AESEBU_ERROR_POOR_QUALITY = 0x02,
683 /** bit2: 1 when there is a parity error */
684         HPI_AESEBU_ERROR_PARITY_ERROR = 0x04,
685 /**  bit3: 1 when there is a bi-phase coding violation */
686         HPI_AESEBU_ERROR_BIPHASE_VIOLATION = 0x08,
687 /**  bit4: 1 when the validity bit is high */
688         HPI_AESEBU_ERROR_VALIDITY = 0x10,
689 /**  bit5: 1 when the CRC error bit is high */
690         HPI_AESEBU_ERROR_CRC = 0x20
691 };
692
693 /** \addtogroup pad
694 \{
695 */
696 /** The text string containing the station/channel combination. */
697 #define HPI_PAD_CHANNEL_NAME_LEN        16
698 /** The text string containing the artist. */
699 #define HPI_PAD_ARTIST_LEN              64
700 /** The text string containing the title. */
701 #define HPI_PAD_TITLE_LEN               64
702 /** The text string containing the comment. */
703 #define HPI_PAD_COMMENT_LEN             256
704 /** The PTY when the tuner has not recieved any PTY. */
705 #define HPI_PAD_PROGRAM_TYPE_INVALID    0xffff
706 /** \} */
707
708 /** Data types for PTY string translation.
709 \ingroup rds
710 */
711 enum eHPI_RDS_type {
712         HPI_RDS_DATATYPE_RDS = 0,       /**< RDS bitstream.*/
713         HPI_RDS_DATATYPE_RBDS = 1       /**< RBDS bitstream.*/
714 };
715
716 /** Tuner bands
717
718 Used for HPI_Tuner_SetBand(),HPI_Tuner_GetBand()
719 \ingroup tuner
720 */
721 enum HPI_TUNER_BAND {
722         HPI_TUNER_BAND_AM = 1,   /**< AM band */
723         HPI_TUNER_BAND_FM = 2,   /**< FM band (mono) */
724         HPI_TUNER_BAND_TV_NTSC_M = 3,    /**< NTSC-M TV band*/
725         HPI_TUNER_BAND_TV = 3,  /* use TV_NTSC_M */
726         HPI_TUNER_BAND_FM_STEREO = 4,    /**< FM band (stereo) */
727         HPI_TUNER_BAND_AUX = 5,  /**< auxiliary input */
728         HPI_TUNER_BAND_TV_PAL_BG = 6,    /**< PAL-B/G TV band*/
729         HPI_TUNER_BAND_TV_PAL_I = 7,     /**< PAL-I TV band*/
730         HPI_TUNER_BAND_TV_PAL_DK = 8,    /**< PAL-D/K TV band*/
731         HPI_TUNER_BAND_TV_SECAM_L = 9,   /**< SECAM-L TV band*/
732         HPI_TUNER_BAND_LAST = 9 /**< the index of the last tuner band. */
733 };
734
735 /** Tuner mode attributes
736
737 Used by HPI_Tuner_SetMode(), HPI_Tuner_GetMode()
738 \ingroup tuner
739
740 */
741 enum HPI_TUNER_MODES {
742         HPI_TUNER_MODE_RSS = 1, /**< control  RSS */
743         HPI_TUNER_MODE_RDS = 2  /**< control  RBDS/RDS */
744 };
745
746 /** Tuner mode attribute values
747
748 Used by HPI_Tuner_SetMode(), HPI_Tuner_GetMode()
749 \ingroup tuner
750 */
751 enum HPI_TUNER_MODE_VALUES {
752 /* RSS attribute values */
753         HPI_TUNER_MODE_RSS_DISABLE = 0, /**< RSS disable */
754         HPI_TUNER_MODE_RSS_ENABLE = 1,  /**< RSS enable */
755
756 /* RDS mode attributes */
757         HPI_TUNER_MODE_RDS_DISABLE = 0, /**< RDS - disabled */
758         HPI_TUNER_MODE_RDS_RDS = 1,  /**< RDS - RDS mode */
759         HPI_TUNER_MODE_RDS_RBDS = 2 /**<  RDS - RBDS mode */
760 };
761
762 /** Tuner Level settings
763 \ingroup tuner
764 */
765 enum HPI_TUNER_LEVEL {
766         HPI_TUNER_LEVEL_AVERAGE = 0,
767         HPI_TUNER_LEVEL_RAW = 1
768 };
769
770 /** Tuner Status Bits
771
772 These bitfield values are returned by a call to HPI_Tuner_GetStatus().
773 Multiple fields are returned from a single call.
774 \ingroup tuner
775 */
776 enum HPI_TUNER_STATUS_BITS {
777         HPI_TUNER_VIDEO_COLOR_PRESENT = 0x0001, /**< video color is present. */
778         HPI_TUNER_VIDEO_IS_60HZ = 0x0020,       /**< 60 hz video detected. */
779         HPI_TUNER_VIDEO_HORZ_SYNC_MISSING = 0x0040,     /**< video HSYNC is missing. */
780         HPI_TUNER_VIDEO_STATUS_VALID = 0x0100,  /**< video status is valid. */
781         HPI_TUNER_PLL_LOCKED = 0x1000,          /**< the tuner's PLL is locked. */
782         HPI_TUNER_FM_STEREO = 0x2000,           /**< tuner reports back FM stereo. */
783         HPI_TUNER_DIGITAL = 0x0200,             /**< tuner reports digital programming. */
784         HPI_TUNER_MULTIPROGRAM = 0x0400         /**< tuner reports multiple programs. */
785 };
786
787 /** Channel Modes
788 Used for HPI_ChannelModeSet/Get()
789 \ingroup channelmode
790 */
791 enum HPI_CHANNEL_MODES {
792 /** Left channel out = left channel in, Right channel out = right channel in. */
793         HPI_CHANNEL_MODE_NORMAL = 1,
794 /** Left channel out = right channel in, Right channel out = left channel in. */
795         HPI_CHANNEL_MODE_SWAP = 2,
796 /** Left channel out = left channel in, Right channel out = left channel in. */
797         HPI_CHANNEL_MODE_LEFT_TO_STEREO = 3,
798 /** Left channel out = right channel in, Right channel out = right channel in.*/
799         HPI_CHANNEL_MODE_RIGHT_TO_STEREO = 4,
800 /** Left channel out = (left channel in + right channel in)/2,
801     Right channel out = mute. */
802         HPI_CHANNEL_MODE_STEREO_TO_LEFT = 5,
803 /** Left channel out = mute,
804     Right channel out = (right channel in + left channel in)/2. */
805         HPI_CHANNEL_MODE_STEREO_TO_RIGHT = 6,
806         HPI_CHANNEL_MODE_LAST = 6
807 };
808
809 /** SampleClock source values
810 \ingroup sampleclock
811 */
812 enum HPI_SAMPLECLOCK_SOURCES {
813 /** The sampleclock output is derived from its local samplerate generator.
814     The local samplerate may be set using HPI_SampleClock_SetLocalRate(). */
815         HPI_SAMPLECLOCK_SOURCE_LOCAL = 1,
816 /** \deprecated Use HPI_SAMPLECLOCK_SOURCE_LOCAL instead */
817         HPI_SAMPLECLOCK_SOURCE_ADAPTER = 1,
818 /** The adapter is clocked from a dedicated AES/EBU SampleClock input.*/
819         HPI_SAMPLECLOCK_SOURCE_AESEBU_SYNC = 2,
820 /** From external wordclock connector */
821         HPI_SAMPLECLOCK_SOURCE_WORD = 3,
822 /** Board-to-board header */
823         HPI_SAMPLECLOCK_SOURCE_WORD_HEADER = 4,
824 /** FUTURE - SMPTE clock. */
825         HPI_SAMPLECLOCK_SOURCE_SMPTE = 5,
826 /** One of the aesebu inputs */
827         HPI_SAMPLECLOCK_SOURCE_AESEBU_INPUT = 6,
828 /** \deprecated The first aesebu input with a valid signal
829 Superseded by separate Auto enable flag
830 */
831         HPI_SAMPLECLOCK_SOURCE_AESEBU_AUTO = 7,
832 /** From a network interface e.g. Cobranet or Livewire at either 48 or 96kHz */
833         HPI_SAMPLECLOCK_SOURCE_NETWORK = 8,
834 /** From previous adjacent module (ASI2416 only)*/
835         HPI_SAMPLECLOCK_SOURCE_PREV_MODULE = 10,
836 /*! Update this if you add a new clock source.*/
837         HPI_SAMPLECLOCK_SOURCE_LAST = 10
838 };
839
840 /** Equalizer filter types. Used by HPI_ParametricEQ_SetBand()
841 \ingroup parmeq
842 */
843 enum HPI_FILTER_TYPE {
844         HPI_FILTER_TYPE_BYPASS = 0,     /**< filter is turned off */
845
846         HPI_FILTER_TYPE_LOWSHELF = 1,   /**< EQ low shelf */
847         HPI_FILTER_TYPE_HIGHSHELF = 2,  /**< EQ high shelf */
848         HPI_FILTER_TYPE_EQ_BAND = 3,    /**< EQ gain */
849
850         HPI_FILTER_TYPE_LOWPASS = 4,    /**< standard low pass */
851         HPI_FILTER_TYPE_HIGHPASS = 5,   /**< standard high pass */
852         HPI_FILTER_TYPE_BANDPASS = 6,   /**< standard band pass */
853         HPI_FILTER_TYPE_BANDSTOP = 7    /**< standard band stop/notch */
854 };
855
856 /** Async Event sources
857 \ingroup async
858 */
859 enum ASYNC_EVENT_SOURCES {
860         HPI_ASYNC_EVENT_GPIO = 1,       /**< GPIO event. */
861         HPI_ASYNC_EVENT_SILENCE = 2,    /**< silence event detected. */
862         HPI_ASYNC_EVENT_TONE = 3        /**< tone event detected. */
863 };
864 /*******************************************/
865 /** HPI Error codes
866
867 Almost all HPI functions return an error code
868 A return value of zero means there was no error.
869 Otherwise one of these error codes is returned.
870 Error codes can be converted to a descriptive string using HPI_GetErrorText()
871
872 \note When a new error code is added HPI_GetErrorText() MUST be updated.
873 \note Codes 1-100 are reserved for driver use
874 \ingroup utility
875 */
876 enum HPI_ERROR_CODES {
877         /** Message type does not exist. */
878         HPI_ERROR_INVALID_TYPE = 100,
879         /** Object type does not exist. */
880         HPI_ERROR_INVALID_OBJ = 101,
881         /** Function does not exist. */
882         HPI_ERROR_INVALID_FUNC = 102,
883         /** The specified object (adapter/Stream) does not exist. */
884         HPI_ERROR_INVALID_OBJ_INDEX = 103,
885         /** Trying to access an object that has not been opened yet. */
886         HPI_ERROR_OBJ_NOT_OPEN = 104,
887         /** Trying to open an already open object. */
888         HPI_ERROR_OBJ_ALREADY_OPEN = 105,
889         /** PCI, ISA resource not valid. */
890         HPI_ERROR_INVALID_RESOURCE = 106,
891         /** GetInfo call from SubSysFindAdapters failed. */
892         HPI_ERROR_SUBSYSFINDADAPTERS_GETINFO = 107,
893         /** Default response was never updated with actual error code. */
894         HPI_ERROR_INVALID_RESPONSE = 108,
895         /** wSize field of response was not updated,
896         indicating that the message was not processed. */
897         HPI_ERROR_PROCESSING_MESSAGE = 109,
898         /** The network did not respond in a timely manner. */
899         HPI_ERROR_NETWORK_TIMEOUT = 110,
900         /** An HPI handle is invalid (uninitialised?). */
901         HPI_ERROR_INVALID_HANDLE = 111,
902         /** A function or attribute has not been implemented yet. */
903         HPI_ERROR_UNIMPLEMENTED = 112,
904         /** There are too many clients attempting to access a network resource. */
905         HPI_ERROR_NETWORK_TOO_MANY_CLIENTS = 113,
906         /** Response buffer passed to HPI_Message was smaller than returned response */
907         HPI_ERROR_RESPONSE_BUFFER_TOO_SMALL = 114,
908         /** The returned response did not match the sent message */
909         HPI_ERROR_RESPONSE_MISMATCH = 115,
910
911         /** Too many adapters.*/
912         HPI_ERROR_TOO_MANY_ADAPTERS = 200,
913         /** Bad adpater. */
914         HPI_ERROR_BAD_ADAPTER = 201,
915         /** Adapter number out of range or not set properly. */
916         HPI_ERROR_BAD_ADAPTER_NUMBER = 202,
917         /** 2 adapters with the same adapter number. */
918         HPI_DUPLICATE_ADAPTER_NUMBER = 203,
919         /** DSP code failed to bootload. */
920         HPI_ERROR_DSP_BOOTLOAD = 204,
921         /** Adapter failed DSP code self test. */
922         HPI_ERROR_DSP_SELFTEST = 205,
923         /** Couldn't find or open the DSP code file. */
924         HPI_ERROR_DSP_FILE_NOT_FOUND = 206,
925         /** Internal DSP hardware error. */
926         HPI_ERROR_DSP_HARDWARE = 207,
927         /** Could not allocate memory in DOS. */
928         HPI_ERROR_DOS_MEMORY_ALLOC = 208,
929         /** Could not allocate memory */
930         HPI_ERROR_MEMORY_ALLOC = 208,
931         /** Failed to correctly load/config PLD .*/
932         HPI_ERROR_PLD_LOAD = 209,
933         /** Unexpected end of file, block length too big etc. */
934         HPI_ERROR_DSP_FILE_FORMAT = 210,
935
936         /** Found but could not open DSP code file. */
937         HPI_ERROR_DSP_FILE_ACCESS_DENIED = 211,
938         /** First DSP code section header not found in DSP file. */
939         HPI_ERROR_DSP_FILE_NO_HEADER = 212,
940         /** File read operation on DSP code file failed. */
941         HPI_ERROR_DSP_FILE_READ_ERROR = 213,
942         /** DSP code for adapter family not found. */
943         HPI_ERROR_DSP_SECTION_NOT_FOUND = 214,
944         /** Other OS specific error opening DSP file. */
945         HPI_ERROR_DSP_FILE_OTHER_ERROR = 215,
946         /** Sharing violation opening DSP code file. */
947         HPI_ERROR_DSP_FILE_SHARING_VIOLATION = 216,
948         /** DSP code section header had size == 0. */
949         HPI_ERROR_DSP_FILE_NULL_HEADER = 217,
950
951         /** Base number for flash errors. */
952         HPI_ERROR_FLASH = 220,
953
954         /** Flash has bad checksum */
955         HPI_ERROR_BAD_CHECKSUM = (HPI_ERROR_FLASH + 1),
956         HPI_ERROR_BAD_SEQUENCE = (HPI_ERROR_FLASH + 2),
957         HPI_ERROR_FLASH_ERASE = (HPI_ERROR_FLASH + 3),
958         HPI_ERROR_FLASH_PROGRAM = (HPI_ERROR_FLASH + 4),
959         HPI_ERROR_FLASH_VERIFY = (HPI_ERROR_FLASH + 5),
960         HPI_ERROR_FLASH_TYPE = (HPI_ERROR_FLASH + 6),
961         HPI_ERROR_FLASH_START = (HPI_ERROR_FLASH + 7),
962
963         /** Reserved for OEMs. */
964         HPI_ERROR_RESERVED_1 = 290,
965
966         /** Stream does not exist. */
967         HPI_ERROR_INVALID_STREAM = 300,
968         /** Invalid compression format. */
969         HPI_ERROR_INVALID_FORMAT = 301,
970         /** Invalid format samplerate */
971         HPI_ERROR_INVALID_SAMPLERATE = 302,
972         /** Invalid format number of channels. */
973         HPI_ERROR_INVALID_CHANNELS = 303,
974         /** Invalid format bitrate. */
975         HPI_ERROR_INVALID_BITRATE = 304,
976         /** Invalid datasize used for stream read/write. */
977         HPI_ERROR_INVALID_DATASIZE = 305,
978         /** Stream buffer is full during stream write. */
979         HPI_ERROR_BUFFER_FULL = 306,
980         /** Stream buffer is empty during stream read. */
981         HPI_ERROR_BUFFER_EMPTY = 307,
982         /** Invalid datasize used for stream read/write. */
983         HPI_ERROR_INVALID_DATA_TRANSFER = 308,
984         /** Packet ordering error for stream read/write. */
985         HPI_ERROR_INVALID_PACKET_ORDER = 309,
986
987         /** Object can't do requested operation in its current
988         state, eg set format, change rec mux state while recording.*/
989         HPI_ERROR_INVALID_OPERATION = 310,
990
991         /** Where an SRG is shared amongst streams, an incompatible samplerate is one
992         that is different to any currently playing or recording stream. */
993         HPI_ERROR_INCOMPATIBLE_SAMPLERATE = 311,
994         /** Adapter mode is illegal.*/
995         HPI_ERROR_BAD_ADAPTER_MODE = 312,
996
997         /** There have been too many attempts to set the adapter's
998         capabilities (using bad keys), the card should be returned
999         to ASI if further capabilities updates are required */
1000         HPI_ERROR_TOO_MANY_CAPABILITY_CHANGE_ATTEMPTS = 313,
1001         /** Streams on different adapters cannot be grouped. */
1002         HPI_ERROR_NO_INTERADAPTER_GROUPS = 314,
1003         /** Streams on different DSPs cannot be grouped. */
1004         HPI_ERROR_NO_INTERDSP_GROUPS = 315,
1005
1006         /** Invalid mixer node for this adapter. */
1007         HPI_ERROR_INVALID_NODE = 400,
1008         /** Invalid control. */
1009         HPI_ERROR_INVALID_CONTROL = 401,
1010         /** Invalid control value was passed. */
1011         HPI_ERROR_INVALID_CONTROL_VALUE = 402,
1012         /** Control attribute not supported by this control. */
1013         HPI_ERROR_INVALID_CONTROL_ATTRIBUTE = 403,
1014         /** Control is disabled. */
1015         HPI_ERROR_CONTROL_DISABLED = 404,
1016         /** I2C transaction failed due to a missing ACK. */
1017         HPI_ERROR_CONTROL_I2C_MISSING_ACK = 405,
1018         /** Control attribute is valid, but not supported by this hardware. */
1019         HPI_ERROR_UNSUPPORTED_CONTROL_ATTRIBUTE = 406,
1020         /** Control is busy, or coming out of
1021         reset and cannot be accessed at this time. */
1022         HPI_ERROR_CONTROL_NOT_READY = 407,
1023
1024         /** Non volatile memory */
1025         HPI_ERROR_NVMEM_BUSY = 450,
1026         HPI_ERROR_NVMEM_FULL = 451,
1027         HPI_ERROR_NVMEM_FAIL = 452,
1028
1029         /** I2C */
1030         HPI_ERROR_I2C_MISSING_ACK = HPI_ERROR_CONTROL_I2C_MISSING_ACK,
1031         HPI_ERROR_I2C_BAD_ADR = 460,
1032
1033         /** Entity errors */
1034         HPI_ERROR_ENTITY_TYPE_MISMATCH = 470,
1035         HPI_ERROR_ENTITY_ITEM_COUNT = 471,
1036         HPI_ERROR_ENTITY_TYPE_INVALID = 472,
1037         HPI_ERROR_ENTITY_ROLE_INVALID = 473,
1038
1039         /* AES18 specific errors were 500..507 */
1040
1041         /** custom error to use for debugging */
1042         HPI_ERROR_CUSTOM = 600,
1043
1044         /** hpioct32.c can't obtain mutex */
1045         HPI_ERROR_MUTEX_TIMEOUT = 700,
1046
1047         /** errors from HPI backends have values >= this */
1048         HPI_ERROR_BACKEND_BASE = 900,
1049
1050         /** indicates a cached u16 value is invalid. */
1051         HPI_ERROR_ILLEGAL_CACHE_VALUE = 0xffff
1052 };
1053
1054 /** \defgroup maximums HPI maximum values
1055 \{
1056 */
1057 /** Maximum number of adapters per HPI sub-system
1058    WARNING: modifying this value changes the response structure size.*/
1059 #define HPI_MAX_ADAPTERS                20
1060 /** Maximum number of in or out streams per adapter */
1061 #define HPI_MAX_STREAMS                 16
1062 #define HPI_MAX_CHANNELS                2       /* per stream */
1063 #define HPI_MAX_NODES                   8       /* per mixer ? */
1064 #define HPI_MAX_CONTROLS                4       /* per node ? */
1065 /** maximum number of ancillary bytes per MPEG frame */
1066 #define HPI_MAX_ANC_BYTES_PER_FRAME     (64)
1067 #define HPI_STRING_LEN                  16
1068
1069 /** Velocity units */
1070 #define HPI_OSTREAM_VELOCITY_UNITS      4096
1071 /** OutStream timescale units */
1072 #define HPI_OSTREAM_TIMESCALE_UNITS     10000
1073 /** OutStream timescale passthrough - turns timescaling on in passthough mode */
1074 #define HPI_OSTREAM_TIMESCALE_PASSTHROUGH       99999
1075
1076 /**\}*/
1077
1078 /* ////////////////////////////////////////////////////////////////////// */
1079 /* STRUCTURES */
1080 #ifndef DISABLE_PRAGMA_PACK1
1081 #pragma pack(push, 1)
1082 #endif
1083
1084 /** Structure containing sample format information.
1085     See also HPI_FormatCreate().
1086   */
1087 struct hpi_format {
1088         u32 sample_rate;
1089                                 /**< 11025, 32000, 44100 ... */
1090         u32 bit_rate;         /**< for MPEG */
1091         u32 attributes;
1092                                 /**< Stereo/JointStereo/Mono */
1093         u16 mode_legacy;
1094                                 /**< Legacy ancillary mode or idle bit  */
1095         u16 unused;           /**< unused */
1096         u16 channels; /**< 1,2..., (or ancillary mode or idle bit */
1097         u16 format;   /**< HPI_FORMAT_PCM16, _MPEG etc. see #HPI_FORMATS. */
1098 };
1099
1100 struct hpi_anc_frame {
1101         u32 valid_bits_in_this_frame;
1102         u8 b_data[HPI_MAX_ANC_BYTES_PER_FRAME];
1103 };
1104
1105 /** An object for containing a single async event.
1106 */
1107 struct hpi_async_event {
1108         u16 event_type; /**< type of event. \sa async_event  */
1109         u16 sequence;  /**< sequence number, allows lost event detection */
1110         u32 state;    /**< new state */
1111         u32 h_object;    /**< handle to the object returning the event. */
1112         union {
1113                 struct {
1114                         u16 index; /**< GPIO bit index. */
1115                 } gpio;
1116                 struct {
1117                         u16 node_index; /**< what node is the control on ? */
1118                         u16 node_type;  /**< what type of node is the control on ? */
1119                 } control;
1120         } u;
1121 };
1122
1123 /*/////////////////////////////////////////////////////////////////////////// */
1124 /* Public HPI Entity related definitions                                     */
1125
1126 struct hpi_entity;
1127
1128 enum e_entity_type {
1129         entity_type_null,
1130         entity_type_sequence,   /* sequence of potentially heterogeneous TLV entities */
1131
1132         entity_type_reference,  /* refers to a TLV entity or NULL */
1133
1134         entity_type_int,        /* 32 bit */
1135         entity_type_float,      /* ieee754 binary 32 bit encoding */
1136         entity_type_double,
1137
1138         entity_type_cstring,
1139         entity_type_octet,
1140         entity_type_ip4_address,
1141         entity_type_ip6_address,
1142         entity_type_mac_address,
1143
1144         LAST_ENTITY_TYPE
1145 };
1146
1147 enum e_entity_role {
1148         entity_role_null,
1149         entity_role_value,
1150         entity_role_classname,
1151
1152         entity_role_units,
1153         entity_role_flags,
1154         entity_role_range,
1155
1156         entity_role_mapping,
1157         entity_role_enum,
1158
1159         entity_role_instance_of,
1160         entity_role_depends_on,
1161         entity_role_member_of_group,
1162         entity_role_value_constraint,
1163         entity_role_parameter_port,
1164
1165         entity_role_block,
1166         entity_role_node_group,
1167         entity_role_audio_port,
1168         entity_role_clock_port,
1169         LAST_ENTITY_ROLE
1170 };
1171
1172 /* skip host side function declarations for
1173    DSP compile and documentation extraction */
1174
1175 struct hpi_hsubsys {
1176         int not_really_used;
1177 };
1178
1179 #ifndef DISABLE_PRAGMA_PACK1
1180 #pragma pack(pop)
1181 #endif
1182
1183 /*////////////////////////////////////////////////////////////////////////// */
1184 /* HPI FUNCTIONS */
1185
1186 /*/////////////////////////// */
1187 /* DATA and FORMAT and STREAM */
1188
1189 u16 hpi_stream_estimate_buffer_size(struct hpi_format *pF,
1190         u32 host_polling_rate_in_milli_seconds, u32 *recommended_buffer_size);
1191
1192 /*/////////// */
1193 /* SUB SYSTEM */
1194 struct hpi_hsubsys *hpi_subsys_create(void
1195         );
1196
1197 void hpi_subsys_free(const struct hpi_hsubsys *ph_subsys);
1198
1199 u16 hpi_subsys_get_version(const struct hpi_hsubsys *ph_subsys,
1200         u32 *pversion);
1201
1202 u16 hpi_subsys_get_version_ex(const struct hpi_hsubsys *ph_subsys,
1203         u32 *pversion_ex);
1204
1205 u16 hpi_subsys_get_info(const struct hpi_hsubsys *ph_subsys, u32 *pversion,
1206         u16 *pw_num_adapters, u16 aw_adapter_list[], u16 list_length);
1207
1208 u16 hpi_subsys_find_adapters(const struct hpi_hsubsys *ph_subsys,
1209         u16 *pw_num_adapters, u16 aw_adapter_list[], u16 list_length);
1210
1211 u16 hpi_subsys_get_num_adapters(const struct hpi_hsubsys *ph_subsys,
1212         int *pn_num_adapters);
1213
1214 u16 hpi_subsys_get_adapter(const struct hpi_hsubsys *ph_subsys, int iterator,
1215         u32 *padapter_index, u16 *pw_adapter_type);
1216
1217 u16 hpi_subsys_ssx2_bypass(const struct hpi_hsubsys *ph_subsys, u16 bypass);
1218
1219 u16 hpi_subsys_set_host_network_interface(const struct hpi_hsubsys *ph_subsys,
1220         const char *sz_interface);
1221
1222 /*///////// */
1223 /* ADAPTER */
1224
1225 u16 hpi_adapter_open(const struct hpi_hsubsys *ph_subsys, u16 adapter_index);
1226
1227 u16 hpi_adapter_close(const struct hpi_hsubsys *ph_subsys, u16 adapter_index);
1228
1229 u16 hpi_adapter_get_info(const struct hpi_hsubsys *ph_subsys,
1230         u16 adapter_index, u16 *pw_num_outstreams, u16 *pw_num_instreams,
1231         u16 *pw_version, u32 *pserial_number, u16 *pw_adapter_type);
1232
1233 u16 hpi_adapter_get_module_by_index(const struct hpi_hsubsys *ph_subsys,
1234         u16 adapter_index, u16 module_index, u16 *pw_num_outputs,
1235         u16 *pw_num_inputs, u16 *pw_version, u32 *pserial_number,
1236         u16 *pw_module_type, u32 *ph_module);
1237
1238 u16 hpi_adapter_set_mode(const struct hpi_hsubsys *ph_subsys,
1239         u16 adapter_index, u32 adapter_mode);
1240
1241 u16 hpi_adapter_set_mode_ex(const struct hpi_hsubsys *ph_subsys,
1242         u16 adapter_index, u32 adapter_mode, u16 query_or_set);
1243
1244 u16 hpi_adapter_get_mode(const struct hpi_hsubsys *ph_subsys,
1245         u16 adapter_index, u32 *padapter_mode);
1246
1247 u16 hpi_adapter_get_assert(const struct hpi_hsubsys *ph_subsys,
1248         u16 adapter_index, u16 *assert_present, char *psz_assert,
1249         u16 *pw_line_number);
1250
1251 u16 hpi_adapter_get_assert_ex(const struct hpi_hsubsys *ph_subsys,
1252         u16 adapter_index, u16 *assert_present, char *psz_assert,
1253         u32 *pline_number, u16 *pw_assert_on_dsp);
1254
1255 u16 hpi_adapter_test_assert(const struct hpi_hsubsys *ph_subsys,
1256         u16 adapter_index, u16 assert_id);
1257
1258 u16 hpi_adapter_enable_capability(const struct hpi_hsubsys *ph_subsys,
1259         u16 adapter_index, u16 capability, u32 key);
1260
1261 u16 hpi_adapter_self_test(const struct hpi_hsubsys *ph_subsys,
1262         u16 adapter_index);
1263
1264 u16 hpi_adapter_debug_read(const struct hpi_hsubsys *ph_subsys,
1265         u16 adapter_index, u32 dsp_address, char *p_bytes, int *count_bytes);
1266
1267 u16 hpi_adapter_set_property(const struct hpi_hsubsys *ph_subsys,
1268         u16 adapter_index, u16 property, u16 paramter1, u16 paramter2);
1269
1270 u16 hpi_adapter_get_property(const struct hpi_hsubsys *ph_subsys,
1271         u16 adapter_index, u16 property, u16 *pw_paramter1,
1272         u16 *pw_paramter2);
1273
1274 u16 hpi_adapter_enumerate_property(const struct hpi_hsubsys *ph_subsys,
1275         u16 adapter_index, u16 index, u16 what_to_enumerate,
1276         u16 property_index, u32 *psetting);
1277
1278 /*////////////// */
1279 /* NonVol Memory */
1280 u16 hpi_nv_memory_open(const struct hpi_hsubsys *ph_subsys, u16 adapter_index,
1281         u32 *ph_nv_memory, u16 *pw_size_in_bytes);
1282
1283 u16 hpi_nv_memory_read_byte(const struct hpi_hsubsys *ph_subsys,
1284         u32 h_nv_memory, u16 index, u16 *pw_data);
1285
1286 u16 hpi_nv_memory_write_byte(const struct hpi_hsubsys *ph_subsys,
1287         u32 h_nv_memory, u16 index, u16 data);
1288
1289 /*////////////// */
1290 /* Digital I/O */
1291 u16 hpi_gpio_open(const struct hpi_hsubsys *ph_subsys, u16 adapter_index,
1292         u32 *ph_gpio, u16 *pw_number_input_bits, u16 *pw_number_output_bits);
1293
1294 u16 hpi_gpio_read_bit(const struct hpi_hsubsys *ph_subsys, u32 h_gpio,
1295         u16 bit_index, u16 *pw_bit_data);
1296
1297 u16 hpi_gpio_read_all_bits(const struct hpi_hsubsys *ph_subsys, u32 h_gpio,
1298         u16 aw_all_bit_data[4]
1299         );
1300
1301 u16 hpi_gpio_write_bit(const struct hpi_hsubsys *ph_subsys, u32 h_gpio,
1302         u16 bit_index, u16 bit_data);
1303
1304 u16 hpi_gpio_write_status(const struct hpi_hsubsys *ph_subsys, u32 h_gpio,
1305         u16 aw_all_bit_data[4]
1306         );
1307
1308 /**********************/
1309 /* Async Event Object */
1310 /**********************/
1311 u16 hpi_async_event_open(const struct hpi_hsubsys *ph_subsys,
1312         u16 adapter_index, u32 *ph_async);
1313
1314 u16 hpi_async_event_close(const struct hpi_hsubsys *ph_subsys, u32 h_async);
1315
1316 u16 hpi_async_event_wait(const struct hpi_hsubsys *ph_subsys, u32 h_async,
1317         u16 maximum_events, struct hpi_async_event *p_events,
1318         u16 *pw_number_returned);
1319
1320 u16 hpi_async_event_get_count(const struct hpi_hsubsys *ph_subsys,
1321         u32 h_async, u16 *pw_count);
1322
1323 u16 hpi_async_event_get(const struct hpi_hsubsys *ph_subsys, u32 h_async,
1324         u16 maximum_events, struct hpi_async_event *p_events,
1325         u16 *pw_number_returned);
1326
1327 /*/////////// */
1328 /* WATCH-DOG  */
1329 u16 hpi_watchdog_open(const struct hpi_hsubsys *ph_subsys, u16 adapter_index,
1330         u32 *ph_watchdog);
1331
1332 u16 hpi_watchdog_set_time(const struct hpi_hsubsys *ph_subsys, u32 h_watchdog,
1333         u32 time_millisec);
1334
1335 u16 hpi_watchdog_ping(const struct hpi_hsubsys *ph_subsys, u32 h_watchdog);
1336
1337 /**************/
1338 /* OUT STREAM */
1339 /**************/
1340 u16 hpi_outstream_open(const struct hpi_hsubsys *ph_subsys, u16 adapter_index,
1341         u16 outstream_index, u32 *ph_outstream);
1342
1343 u16 hpi_outstream_close(const struct hpi_hsubsys *ph_subsys, u32 h_outstream);
1344
1345 u16 hpi_outstream_get_info_ex(const struct hpi_hsubsys *ph_subsys,
1346         u32 h_outstream, u16 *pw_state, u32 *pbuffer_size, u32 *pdata_to_play,
1347         u32 *psamples_played, u32 *pauxiliary_data_to_play);
1348
1349 u16 hpi_outstream_write_buf(const struct hpi_hsubsys *ph_subsys,
1350         u32 h_outstream, const u8 *pb_write_buf, u32 bytes_to_write,
1351         const struct hpi_format *p_format);
1352
1353 u16 hpi_outstream_start(const struct hpi_hsubsys *ph_subsys, u32 h_outstream);
1354
1355 u16 hpi_outstream_wait_start(const struct hpi_hsubsys *ph_subsys,
1356         u32 h_outstream);
1357
1358 u16 hpi_outstream_stop(const struct hpi_hsubsys *ph_subsys, u32 h_outstream);
1359
1360 u16 hpi_outstream_sinegen(const struct hpi_hsubsys *ph_subsys,
1361         u32 h_outstream);
1362
1363 u16 hpi_outstream_reset(const struct hpi_hsubsys *ph_subsys, u32 h_outstream);
1364
1365 u16 hpi_outstream_query_format(const struct hpi_hsubsys *ph_subsys,
1366         u32 h_outstream, struct hpi_format *p_format);
1367
1368 u16 hpi_outstream_set_format(const struct hpi_hsubsys *ph_subsys,
1369         u32 h_outstream, struct hpi_format *p_format);
1370
1371 u16 hpi_outstream_set_punch_in_out(const struct hpi_hsubsys *ph_subsys,
1372         u32 h_outstream, u32 punch_in_sample, u32 punch_out_sample);
1373
1374 u16 hpi_outstream_set_velocity(const struct hpi_hsubsys *ph_subsys,
1375         u32 h_outstream, short velocity);
1376
1377 u16 hpi_outstream_ancillary_reset(const struct hpi_hsubsys *ph_subsys,
1378         u32 h_outstream, u16 mode);
1379
1380 u16 hpi_outstream_ancillary_get_info(const struct hpi_hsubsys *ph_subsys,
1381         u32 h_outstream, u32 *pframes_available);
1382
1383 u16 hpi_outstream_ancillary_read(const struct hpi_hsubsys *ph_subsys,
1384         u32 h_outstream, struct hpi_anc_frame *p_anc_frame_buffer,
1385         u32 anc_frame_buffer_size_in_bytes,
1386         u32 number_of_ancillary_frames_to_read);
1387
1388 u16 hpi_outstream_set_time_scale(const struct hpi_hsubsys *ph_subsys,
1389         u32 h_outstream, u32 time_scaleX10000);
1390
1391 u16 hpi_outstream_host_buffer_allocate(const struct hpi_hsubsys *ph_subsys,
1392         u32 h_outstream, u32 size_in_bytes);
1393
1394 u16 hpi_outstream_host_buffer_free(const struct hpi_hsubsys *ph_subsys,
1395         u32 h_outstream);
1396
1397 u16 hpi_outstream_group_add(const struct hpi_hsubsys *ph_subsys,
1398         u32 h_outstream, u32 h_stream);
1399
1400 u16 hpi_outstream_group_get_map(const struct hpi_hsubsys *ph_subsys,
1401         u32 h_outstream, u32 *poutstream_map, u32 *pinstream_map);
1402
1403 u16 hpi_outstream_group_reset(const struct hpi_hsubsys *ph_subsys,
1404         u32 h_outstream);
1405
1406 /*////////// */
1407 /* IN_STREAM */
1408 u16 hpi_instream_open(const struct hpi_hsubsys *ph_subsys, u16 adapter_index,
1409         u16 instream_index, u32 *ph_instream);
1410
1411 u16 hpi_instream_close(const struct hpi_hsubsys *ph_subsys, u32 h_instream);
1412
1413 u16 hpi_instream_query_format(const struct hpi_hsubsys *ph_subsys,
1414         u32 h_instream, const struct hpi_format *p_format);
1415
1416 u16 hpi_instream_set_format(const struct hpi_hsubsys *ph_subsys,
1417         u32 h_instream, const struct hpi_format *p_format);
1418
1419 u16 hpi_instream_read_buf(const struct hpi_hsubsys *ph_subsys, u32 h_instream,
1420         u8 *pb_read_buf, u32 bytes_to_read);
1421
1422 u16 hpi_instream_start(const struct hpi_hsubsys *ph_subsys, u32 h_instream);
1423
1424 u16 hpi_instream_wait_start(const struct hpi_hsubsys *ph_subsys,
1425         u32 h_instream);
1426
1427 u16 hpi_instream_stop(const struct hpi_hsubsys *ph_subsys, u32 h_instream);
1428
1429 u16 hpi_instream_reset(const struct hpi_hsubsys *ph_subsys, u32 h_instream);
1430
1431 u16 hpi_instream_get_info_ex(const struct hpi_hsubsys *ph_subsys,
1432         u32 h_instream, u16 *pw_state, u32 *pbuffer_size, u32 *pdata_recorded,
1433         u32 *psamples_recorded, u32 *pauxiliary_data_recorded);
1434
1435 u16 hpi_instream_ancillary_reset(const struct hpi_hsubsys *ph_subsys,
1436         u32 h_instream, u16 bytes_per_frame, u16 mode, u16 alignment,
1437         u16 idle_bit);
1438
1439 u16 hpi_instream_ancillary_get_info(const struct hpi_hsubsys *ph_subsys,
1440         u32 h_instream, u32 *pframe_space);
1441
1442 u16 hpi_instream_ancillary_write(const struct hpi_hsubsys *ph_subsys,
1443         u32 h_instream, const struct hpi_anc_frame *p_anc_frame_buffer,
1444         u32 anc_frame_buffer_size_in_bytes,
1445         u32 number_of_ancillary_frames_to_write);
1446
1447 u16 hpi_instream_host_buffer_allocate(const struct hpi_hsubsys *ph_subsys,
1448         u32 h_instream, u32 size_in_bytes);
1449
1450 u16 hpi_instream_host_buffer_free(const struct hpi_hsubsys *ph_subsys,
1451         u32 h_instream);
1452
1453 u16 hpi_instream_group_add(const struct hpi_hsubsys *ph_subsys,
1454         u32 h_instream, u32 h_stream);
1455
1456 u16 hpi_instream_group_get_map(const struct hpi_hsubsys *ph_subsys,
1457         u32 h_instream, u32 *poutstream_map, u32 *pinstream_map);
1458
1459 u16 hpi_instream_group_reset(const struct hpi_hsubsys *ph_subsys,
1460         u32 h_instream);
1461
1462 /*********/
1463 /* MIXER */
1464 /*********/
1465 u16 hpi_mixer_open(const struct hpi_hsubsys *ph_subsys, u16 adapter_index,
1466         u32 *ph_mixer);
1467
1468 u16 hpi_mixer_close(const struct hpi_hsubsys *ph_subsys, u32 h_mixer);
1469
1470 u16 hpi_mixer_get_control(const struct hpi_hsubsys *ph_subsys, u32 h_mixer,
1471         u16 src_node_type, u16 src_node_type_index, u16 dst_node_type,
1472         u16 dst_node_type_index, u16 control_type, u32 *ph_control);
1473
1474 u16 hpi_mixer_get_control_by_index(const struct hpi_hsubsys *ph_subsys,
1475         u32 h_mixer, u16 control_index, u16 *pw_src_node_type,
1476         u16 *pw_src_node_index, u16 *pw_dst_node_type, u16 *pw_dst_node_index,
1477         u16 *pw_control_type, u32 *ph_control);
1478
1479 u16 hpi_mixer_store(const struct hpi_hsubsys *ph_subsys, u32 h_mixer,
1480         enum HPI_MIXER_STORE_COMMAND command, u16 index);
1481 /*************************/
1482 /* mixer CONTROLS                */
1483 /*************************/
1484 /*************************/
1485 /* volume control                */
1486 /*************************/
1487 u16 hpi_volume_set_gain(const struct hpi_hsubsys *ph_subsys, u32 h_control,
1488         short an_gain0_01dB[HPI_MAX_CHANNELS]
1489         );
1490
1491 u16 hpi_volume_get_gain(const struct hpi_hsubsys *ph_subsys, u32 h_control,
1492         short an_gain0_01dB_out[HPI_MAX_CHANNELS]
1493         );
1494
1495 #define hpi_volume_get_range hpi_volume_query_range
1496 u16 hpi_volume_query_range(const struct hpi_hsubsys *ph_subsys, u32 h_control,
1497         short *min_gain_01dB, short *max_gain_01dB, short *step_gain_01dB);
1498
1499 u16 hpi_volume_query_channels(const struct hpi_hsubsys *ph_subsys,
1500         const u32 h_volume, u32 *p_channels);
1501
1502 u16 hpi_volume_auto_fade(const struct hpi_hsubsys *ph_subsys, u32 h_control,
1503         short an_stop_gain0_01dB[HPI_MAX_CHANNELS], u32 duration_ms);
1504
1505 u16 hpi_volume_auto_fade_profile(const struct hpi_hsubsys *ph_subsys,
1506         u32 h_control, short an_stop_gain0_01dB[HPI_MAX_CHANNELS],
1507         u32 duration_ms, u16 profile);
1508
1509 /*************************/
1510 /* level control         */
1511 /*************************/
1512 u16 hpi_level_query_range(const struct hpi_hsubsys *ph_subsys, u32 h_control,
1513         short *min_gain_01dB, short *max_gain_01dB, short *step_gain_01dB);
1514
1515 u16 hpi_level_set_gain(const struct hpi_hsubsys *ph_subsys, u32 h_control,
1516         short an_gain0_01dB[HPI_MAX_CHANNELS]
1517         );
1518
1519 u16 hpi_level_get_gain(const struct hpi_hsubsys *ph_subsys, u32 h_control,
1520         short an_gain0_01dB_out[HPI_MAX_CHANNELS]
1521         );
1522
1523 /*************************/
1524 /* meter control                 */
1525 /*************************/
1526 u16 hpi_meter_query_channels(const struct hpi_hsubsys *ph_subsys,
1527         const u32 h_meter, u32 *p_channels);
1528
1529 u16 hpi_meter_get_peak(const struct hpi_hsubsys *ph_subsys, u32 h_control,
1530         short an_peak0_01dB_out[HPI_MAX_CHANNELS]
1531         );
1532
1533 u16 hpi_meter_get_rms(const struct hpi_hsubsys *ph_subsys, u32 h_control,
1534         short an_peak0_01dB_out[HPI_MAX_CHANNELS]
1535         );
1536
1537 u16 hpi_meter_set_peak_ballistics(const struct hpi_hsubsys *ph_subsys,
1538         u32 h_control, u16 attack, u16 decay);
1539
1540 u16 hpi_meter_set_rms_ballistics(const struct hpi_hsubsys *ph_subsys,
1541         u32 h_control, u16 attack, u16 decay);
1542
1543 u16 hpi_meter_get_peak_ballistics(const struct hpi_hsubsys *ph_subsys,
1544         u32 h_control, u16 *attack, u16 *decay);
1545
1546 u16 hpi_meter_get_rms_ballistics(const struct hpi_hsubsys *ph_subsys,
1547         u32 h_control, u16 *attack, u16 *decay);
1548
1549 /*************************/
1550 /* channel mode control  */
1551 /*************************/
1552 u16 hpi_channel_mode_query_mode(const struct hpi_hsubsys *ph_subsys,
1553         const u32 h_mode, const u32 index, u16 *pw_mode);
1554
1555 u16 hpi_channel_mode_set(const struct hpi_hsubsys *ph_subsys, u32 h_control,
1556         u16 mode);
1557
1558 u16 hpi_channel_mode_get(const struct hpi_hsubsys *ph_subsys, u32 h_control,
1559         u16 *mode);
1560
1561 /*************************/
1562 /* Tuner control                 */
1563 /*************************/
1564 u16 hpi_tuner_query_band(const struct hpi_hsubsys *ph_subsys,
1565         const u32 h_tuner, const u32 index, u16 *pw_band);
1566
1567 u16 hpi_tuner_set_band(const struct hpi_hsubsys *ph_subsys, u32 h_control,
1568         u16 band);
1569
1570 u16 hpi_tuner_get_band(const struct hpi_hsubsys *ph_subsys, u32 h_control,
1571         u16 *pw_band);
1572
1573 u16 hpi_tuner_query_frequency(const struct hpi_hsubsys *ph_subsys,
1574         const u32 h_tuner, const u32 index, const u16 band, u32 *pfreq);
1575
1576 u16 hpi_tuner_set_frequency(const struct hpi_hsubsys *ph_subsys,
1577         u32 h_control, u32 freq_ink_hz);
1578
1579 u16 hpi_tuner_get_frequency(const struct hpi_hsubsys *ph_subsys,
1580         u32 h_control, u32 *pw_freq_ink_hz);
1581
1582 u16 hpi_tuner_getRF_level(const struct hpi_hsubsys *ph_subsys, u32 h_control,
1583         short *pw_level);
1584
1585 u16 hpi_tuner_get_rawRF_level(const struct hpi_hsubsys *ph_subsys,
1586         u32 h_control, short *pw_level);
1587
1588 u16 hpi_tuner_query_gain(const struct hpi_hsubsys *ph_subsys,
1589         const u32 h_tuner, const u32 index, u16 *pw_gain);
1590
1591 u16 hpi_tuner_set_gain(const struct hpi_hsubsys *ph_subsys, u32 h_control,
1592         short gain);
1593
1594 u16 hpi_tuner_get_gain(const struct hpi_hsubsys *ph_subsys, u32 h_control,
1595         short *pn_gain);
1596
1597 u16 hpi_tuner_get_status(const struct hpi_hsubsys *ph_subsys, u32 h_control,
1598         u16 *pw_status_mask, u16 *pw_status);
1599
1600 u16 hpi_tuner_set_mode(const struct hpi_hsubsys *ph_subsys, u32 h_control,
1601         u32 mode, u32 value);
1602
1603 u16 hpi_tuner_get_mode(const struct hpi_hsubsys *ph_subsys, u32 h_control,
1604         u32 mode, u32 *pn_value);
1605
1606 u16 hpi_tuner_getRDS(const struct hpi_hsubsys *ph_subsys, u32 h_control,
1607         char *p_rds_data);
1608
1609 u16 hpi_tuner_query_deemphasis(const struct hpi_hsubsys *ph_subsys,
1610         const u32 h_tuner, const u32 index, const u16 band, u32 *pdeemphasis);
1611
1612 u16 hpi_tuner_set_deemphasis(const struct hpi_hsubsys *ph_subsys,
1613         u32 h_control, u32 deemphasis);
1614 u16 hpi_tuner_get_deemphasis(const struct hpi_hsubsys *ph_subsys,
1615         u32 h_control, u32 *pdeemphasis);
1616
1617 u16 hpi_tuner_query_program(const struct hpi_hsubsys *ph_subsys,
1618         const u32 h_tuner, u32 *pbitmap_program);
1619
1620 u16 hpi_tuner_set_program(const struct hpi_hsubsys *ph_subsys, u32 h_control,
1621         u32 program);
1622
1623 u16 hpi_tuner_get_program(const struct hpi_hsubsys *ph_subsys, u32 h_control,
1624         u32 *pprogram);
1625
1626 u16 hpi_tuner_get_hd_radio_dsp_version(const struct hpi_hsubsys *ph_subsys,
1627         u32 h_control, char *psz_dsp_version, const u32 string_size);
1628
1629 u16 hpi_tuner_get_hd_radio_sdk_version(const struct hpi_hsubsys *ph_subsys,
1630         u32 h_control, char *psz_sdk_version, const u32 string_size);
1631
1632 u16 hpi_tuner_get_hd_radio_signal_quality(const struct hpi_hsubsys *ph_subsys,
1633         u32 h_control, u32 *pquality);
1634
1635 u16 hpi_tuner_get_hd_radio_signal_blend(const struct hpi_hsubsys *ph_subsys,
1636         u32 h_control, u32 *pblend);
1637
1638 u16 hpi_tuner_set_hd_radio_signal_blend(const struct hpi_hsubsys *ph_subsys,
1639         u32 h_control, const u32 blend);
1640
1641 /****************************/
1642 /* PADs control             */
1643 /****************************/
1644
1645 u16 HPI_PAD__get_channel_name(const struct hpi_hsubsys *ph_subsys,
1646         u32 h_control, char *psz_string, const u32 string_length);
1647
1648 u16 HPI_PAD__get_artist(const struct hpi_hsubsys *ph_subsys, u32 h_control,
1649         char *psz_string, const u32 string_length);
1650
1651 u16 HPI_PAD__get_title(const struct hpi_hsubsys *ph_subsys, u32 h_control,
1652         char *psz_string, const u32 string_length);
1653
1654 u16 HPI_PAD__get_comment(const struct hpi_hsubsys *ph_subsys, u32 h_control,
1655         char *psz_string, const u32 string_length);
1656
1657 u16 HPI_PAD__get_program_type(const struct hpi_hsubsys *ph_subsys,
1658         u32 h_control, u32 *ppTY);
1659
1660 u16 HPI_PAD__get_rdsPI(const struct hpi_hsubsys *ph_subsys, u32 h_control,
1661         u32 *ppI);
1662
1663 u16 HPI_PAD__get_program_type_string(const struct hpi_hsubsys *ph_subsys,
1664         u32 h_control, const u32 data_type, const u32 pTY, char *psz_string,
1665         const u32 string_length);
1666
1667 /****************************/
1668 /* AES/EBU Receiver control */
1669 /****************************/
1670 u16 HPI_AESEBU__receiver_query_format(const struct hpi_hsubsys *ph_subsys,
1671         const u32 h_aes_rx, const u32 index, u16 *pw_format);
1672
1673 u16 HPI_AESEBU__receiver_set_format(const struct hpi_hsubsys *ph_subsys,
1674         u32 h_control, u16 source);
1675
1676 u16 HPI_AESEBU__receiver_get_format(const struct hpi_hsubsys *ph_subsys,
1677         u32 h_control, u16 *pw_source);
1678
1679 u16 HPI_AESEBU__receiver_get_sample_rate(const struct hpi_hsubsys *ph_subsys,
1680         u32 h_control, u32 *psample_rate);
1681
1682 u16 HPI_AESEBU__receiver_get_user_data(const struct hpi_hsubsys *ph_subsys,
1683         u32 h_control, u16 index, u16 *pw_data);
1684
1685 u16 HPI_AESEBU__receiver_get_channel_status(const struct hpi_hsubsys
1686         *ph_subsys, u32 h_control, u16 index, u16 *pw_data);
1687
1688 u16 HPI_AESEBU__receiver_get_error_status(const struct hpi_hsubsys *ph_subsys,
1689         u32 h_control, u16 *pw_error_data);
1690
1691 /*******************************/
1692 /* AES/EBU Transmitter control */
1693 /*******************************/
1694 u16 HPI_AESEBU__transmitter_set_sample_rate(const struct hpi_hsubsys
1695         *ph_subsys, u32 h_control, u32 sample_rate);
1696
1697 u16 HPI_AESEBU__transmitter_set_user_data(const struct hpi_hsubsys *ph_subsys,
1698         u32 h_control, u16 index, u16 data);
1699
1700 u16 HPI_AESEBU__transmitter_set_channel_status(const struct hpi_hsubsys
1701         *ph_subsys, u32 h_control, u16 index, u16 data);
1702
1703 u16 HPI_AESEBU__transmitter_get_channel_status(const struct hpi_hsubsys
1704         *ph_subsys, u32 h_control, u16 index, u16 *pw_data);
1705
1706 u16 HPI_AESEBU__transmitter_query_format(const struct hpi_hsubsys *ph_subsys,
1707         const u32 h_aes_tx, const u32 index, u16 *pw_format);
1708
1709 u16 HPI_AESEBU__transmitter_set_format(const struct hpi_hsubsys *ph_subsys,
1710         u32 h_control, u16 output_format);
1711
1712 u16 HPI_AESEBU__transmitter_get_format(const struct hpi_hsubsys *ph_subsys,
1713         u32 h_control, u16 *pw_output_format);
1714
1715 /***********************/
1716 /* multiplexer control */
1717 /***********************/
1718 u16 hpi_multiplexer_set_source(const struct hpi_hsubsys *ph_subsys,
1719         u32 h_control, u16 source_node_type, u16 source_node_index);
1720
1721 u16 hpi_multiplexer_get_source(const struct hpi_hsubsys *ph_subsys,
1722         u32 h_control, u16 *source_node_type, u16 *source_node_index);
1723
1724 u16 hpi_multiplexer_query_source(const struct hpi_hsubsys *ph_subsys,
1725         u32 h_control, u16 index, u16 *source_node_type,
1726         u16 *source_node_index);
1727
1728 /***************/
1729 /* VOX control */
1730 /***************/
1731 u16 hpi_vox_set_threshold(const struct hpi_hsubsys *ph_subsys, u32 h_control,
1732         short an_gain0_01dB);
1733
1734 u16 hpi_vox_get_threshold(const struct hpi_hsubsys *ph_subsys, u32 h_control,
1735         short *an_gain0_01dB);
1736
1737 /*********************/
1738 /* Bitstream control */
1739 /*********************/
1740 u16 hpi_bitstream_set_clock_edge(const struct hpi_hsubsys *ph_subsys,
1741         u32 h_control, u16 edge_type);
1742
1743 u16 hpi_bitstream_set_data_polarity(const struct hpi_hsubsys *ph_subsys,
1744         u32 h_control, u16 polarity);
1745
1746 u16 hpi_bitstream_get_activity(const struct hpi_hsubsys *ph_subsys,
1747         u32 h_control, u16 *pw_clk_activity, u16 *pw_data_activity);
1748
1749 /***********************/
1750 /* SampleClock control */
1751 /***********************/
1752
1753 u16 hpi_sample_clock_query_source(const struct hpi_hsubsys *ph_subsys,
1754         const u32 h_clock, const u32 index, u16 *pw_source);
1755
1756 u16 hpi_sample_clock_set_source(const struct hpi_hsubsys *ph_subsys,
1757         u32 h_control, u16 source);
1758
1759 u16 hpi_sample_clock_get_source(const struct hpi_hsubsys *ph_subsys,
1760         u32 h_control, u16 *pw_source);
1761
1762 u16 hpi_sample_clock_query_source_index(const struct hpi_hsubsys *ph_subsys,
1763         const u32 h_clock, const u32 index, const u32 source,
1764         u16 *pw_source_index);
1765
1766 u16 hpi_sample_clock_set_source_index(const struct hpi_hsubsys *ph_subsys,
1767         u32 h_control, u16 source_index);
1768
1769 u16 hpi_sample_clock_get_source_index(const struct hpi_hsubsys *ph_subsys,
1770         u32 h_control, u16 *pw_source_index);
1771
1772 u16 hpi_sample_clock_get_sample_rate(const struct hpi_hsubsys *ph_subsys,
1773         u32 h_control, u32 *psample_rate);
1774
1775 u16 hpi_sample_clock_query_local_rate(const struct hpi_hsubsys *ph_subsys,
1776         const u32 h_clock, const u32 index, u32 *psource);
1777
1778 u16 hpi_sample_clock_set_local_rate(const struct hpi_hsubsys *ph_subsys,
1779         u32 h_control, u32 sample_rate);
1780
1781 u16 hpi_sample_clock_get_local_rate(const struct hpi_hsubsys *ph_subsys,
1782         u32 h_control, u32 *psample_rate);
1783
1784 u16 hpi_sample_clock_set_auto(const struct hpi_hsubsys *ph_subsys,
1785         u32 h_control, u32 enable);
1786
1787 u16 hpi_sample_clock_get_auto(const struct hpi_hsubsys *ph_subsys,
1788         u32 h_control, u32 *penable);
1789
1790 u16 hpi_sample_clock_set_local_rate_lock(const struct hpi_hsubsys *ph_subsys,
1791         u32 h_control, u32 lock);
1792
1793 u16 hpi_sample_clock_get_local_rate_lock(const struct hpi_hsubsys *ph_subsys,
1794         u32 h_control, u32 *plock);
1795
1796 /***********************/
1797 /* Microphone control */
1798 /***********************/
1799 u16 hpi_microphone_set_phantom_power(const struct hpi_hsubsys *ph_subsys,
1800         u32 h_control, u16 on_off);
1801
1802 u16 hpi_microphone_get_phantom_power(const struct hpi_hsubsys *ph_subsys,
1803         u32 h_control, u16 *pw_on_off);
1804
1805 /*******************************
1806   Parametric Equalizer control
1807 *******************************/
1808 u16 hpi_parametricEQ__get_info(const struct hpi_hsubsys *ph_subsys,
1809         u32 h_control, u16 *pw_number_of_bands, u16 *pw_enabled);
1810
1811 u16 hpi_parametricEQ__set_state(const struct hpi_hsubsys *ph_subsys,
1812         u32 h_control, u16 on_off);
1813
1814 u16 hpi_parametricEQ__set_band(const struct hpi_hsubsys *ph_subsys,
1815         u32 h_control, u16 index, u16 type, u32 frequency_hz, short q100,
1816         short gain0_01dB);
1817
1818 u16 hpi_parametricEQ__get_band(const struct hpi_hsubsys *ph_subsys,
1819         u32 h_control, u16 index, u16 *pn_type, u32 *pfrequency_hz,
1820         short *pnQ100, short *pn_gain0_01dB);
1821
1822 u16 hpi_parametricEQ__get_coeffs(const struct hpi_hsubsys *ph_subsys,
1823         u32 h_control, u16 index, short coeffs[5]
1824         );
1825
1826 /*******************************
1827   Compressor Expander control
1828 *******************************/
1829
1830 u16 hpi_compander_set(const struct hpi_hsubsys *ph_subsys, u32 h_control,
1831         u16 attack, u16 decay, short ratio100, short threshold0_01dB,
1832         short makeup_gain0_01dB);
1833
1834 u16 hpi_compander_get(const struct hpi_hsubsys *ph_subsys, u32 h_control,
1835         u16 *pw_attack, u16 *pw_decay, short *pw_ratio100,
1836         short *pn_threshold0_01dB, short *pn_makeup_gain0_01dB);
1837
1838 /*******************************
1839   Cobranet HMI control
1840 *******************************/
1841 u16 hpi_cobranet_hmi_write(const struct hpi_hsubsys *ph_subsys, u32 h_control,
1842         u32 hmi_address, u32 byte_count, u8 *pb_data);
1843
1844 u16 hpi_cobranet_hmi_read(const struct hpi_hsubsys *ph_subsys, u32 h_control,
1845         u32 hmi_address, u32 max_byte_count, u32 *pbyte_count, u8 *pb_data);
1846
1847 u16 hpi_cobranet_hmi_get_status(const struct hpi_hsubsys *ph_subsys,
1848         u32 h_control, u32 *pstatus, u32 *preadable_size,
1849         u32 *pwriteable_size);
1850
1851 /*Read the current IP address
1852 */
1853 u16 hpi_cobranet_getI_paddress(const struct hpi_hsubsys *ph_subsys,
1854         u32 h_control, u32 *pi_paddress);
1855
1856 /* Write the current IP address
1857 */
1858 u16 hpi_cobranet_setI_paddress(const struct hpi_hsubsys *ph_subsys,
1859         u32 h_control, u32 i_paddress);
1860
1861 /* Read the static IP address
1862 */
1863 u16 hpi_cobranet_get_staticI_paddress(const struct hpi_hsubsys *ph_subsys,
1864         u32 h_control, u32 *pi_paddress);
1865
1866 /* Write the static IP address
1867 */
1868 u16 hpi_cobranet_set_staticI_paddress(const struct hpi_hsubsys *ph_subsys,
1869         u32 h_control, u32 i_paddress);
1870
1871 /* Read the MAC address
1872 */
1873 u16 hpi_cobranet_getMA_caddress(const struct hpi_hsubsys *ph_subsys,
1874         u32 h_control, u32 *pmAC_MS_bs, u32 *pmAC_LS_bs);
1875
1876 /*******************************
1877   Tone Detector control
1878 *******************************/
1879 u16 hpi_tone_detector_get_state(const struct hpi_hsubsys *ph_subsys, u32 hC,
1880         u32 *state);
1881
1882 u16 hpi_tone_detector_set_enable(const struct hpi_hsubsys *ph_subsys, u32 hC,
1883         u32 enable);
1884
1885 u16 hpi_tone_detector_get_enable(const struct hpi_hsubsys *ph_subsys, u32 hC,
1886         u32 *enable);
1887
1888 u16 hpi_tone_detector_set_event_enable(const struct hpi_hsubsys *ph_subsys,
1889         u32 hC, u32 event_enable);
1890
1891 u16 hpi_tone_detector_get_event_enable(const struct hpi_hsubsys *ph_subsys,
1892         u32 hC, u32 *event_enable);
1893
1894 u16 hpi_tone_detector_set_threshold(const struct hpi_hsubsys *ph_subsys,
1895         u32 hC, int threshold);
1896
1897 u16 hpi_tone_detector_get_threshold(const struct hpi_hsubsys *ph_subsys,
1898         u32 hC, int *threshold);
1899
1900 u16 hpi_tone_detector_get_frequency(const struct hpi_hsubsys *ph_subsys,
1901         u32 hC, u32 index, u32 *frequency);
1902
1903 /*******************************
1904   Silence Detector control
1905 *******************************/
1906 u16 hpi_silence_detector_get_state(const struct hpi_hsubsys *ph_subsys,
1907         u32 hC, u32 *state);
1908
1909 u16 hpi_silence_detector_set_enable(const struct hpi_hsubsys *ph_subsys,
1910         u32 hC, u32 enable);
1911
1912 u16 hpi_silence_detector_get_enable(const struct hpi_hsubsys *ph_subsys,
1913         u32 hC, u32 *enable);
1914
1915 u16 hpi_silence_detector_set_event_enable(const struct hpi_hsubsys *ph_subsys,
1916         u32 hC, u32 event_enable);
1917
1918 u16 hpi_silence_detector_get_event_enable(const struct hpi_hsubsys *ph_subsys,
1919         u32 hC, u32 *event_enable);
1920
1921 u16 hpi_silence_detector_set_delay(const struct hpi_hsubsys *ph_subsys,
1922         u32 hC, u32 delay);
1923
1924 u16 hpi_silence_detector_get_delay(const struct hpi_hsubsys *ph_subsys,
1925         u32 hC, u32 *delay);
1926
1927 u16 hpi_silence_detector_set_threshold(const struct hpi_hsubsys *ph_subsys,
1928         u32 hC, int threshold);
1929
1930 u16 hpi_silence_detector_get_threshold(const struct hpi_hsubsys *ph_subsys,
1931         u32 hC, int *threshold);
1932
1933 /*******************************
1934   Universal control
1935 *******************************/
1936 u16 hpi_entity_find_next(struct hpi_entity *container_entity,
1937         enum e_entity_type type, enum e_entity_role role, int recursive_flag,
1938         struct hpi_entity **current_match);
1939
1940 u16 hpi_entity_copy_value_from(struct hpi_entity *entity,
1941         enum e_entity_type type, size_t item_count, void *value_dst_p);
1942
1943 u16 hpi_entity_unpack(struct hpi_entity *entity, enum e_entity_type *type,
1944         size_t *items, enum e_entity_role *role, void **value);
1945
1946 u16 hpi_entity_alloc_and_pack(const enum e_entity_type type,
1947         const size_t item_count, const enum e_entity_role role, void *value,
1948         struct hpi_entity **entity);
1949
1950 void hpi_entity_free(struct hpi_entity *entity);
1951
1952 u16 hpi_universal_info(const struct hpi_hsubsys *ph_subsys, u32 hC,
1953         struct hpi_entity **info);
1954
1955 u16 hpi_universal_get(const struct hpi_hsubsys *ph_subsys, u32 hC,
1956         struct hpi_entity **value);
1957
1958 u16 hpi_universal_set(const struct hpi_hsubsys *ph_subsys, u32 hC,
1959         struct hpi_entity *value);
1960
1961 /*/////////// */
1962 /* DSP CLOCK  */
1963 /*/////////// */
1964 u16 hpi_clock_open(const struct hpi_hsubsys *ph_subsys, u16 adapter_index,
1965         u32 *ph_dsp_clock);
1966
1967 u16 hpi_clock_set_time(const struct hpi_hsubsys *ph_subsys, u32 h_clock,
1968         u16 hour, u16 minute, u16 second, u16 milli_second);
1969
1970 u16 hpi_clock_get_time(const struct hpi_hsubsys *ph_subsys, u32 h_clock,
1971         u16 *pw_hour, u16 *pw_minute, u16 *pw_second, u16 *pw_milli_second);
1972
1973 /*/////////// */
1974 /* PROFILE        */
1975 /*/////////// */
1976 u16 hpi_profile_open_all(const struct hpi_hsubsys *ph_subsys,
1977         u16 adapter_index, u16 profile_index, u32 *ph_profile,
1978         u16 *pw_max_profiles);
1979
1980 u16 hpi_profile_get(const struct hpi_hsubsys *ph_subsys, u32 h_profile,
1981         u16 index, u16 *pw_seconds, u32 *pmicro_seconds, u32 *pcall_count,
1982         u32 *pmax_micro_seconds, u32 *pmin_micro_seconds);
1983
1984 u16 hpi_profile_start_all(const struct hpi_hsubsys *ph_subsys, u32 h_profile);
1985
1986 u16 hpi_profile_stop_all(const struct hpi_hsubsys *ph_subsys, u32 h_profile);
1987
1988 u16 hpi_profile_get_name(const struct hpi_hsubsys *ph_subsys, u32 h_profile,
1989         u16 index, char *sz_profile_name, u16 profile_name_length);
1990
1991 u16 hpi_profile_get_utilization(const struct hpi_hsubsys *ph_subsys,
1992         u32 h_profile, u32 *putilization);
1993
1994 /*//////////////////// */
1995 /* UTILITY functions */
1996
1997 u16 hpi_format_create(struct hpi_format *p_format, u16 channels, u16 format,
1998         u32 sample_rate, u32 bit_rate, u32 attributes);
1999
2000 /* Until it's verified, this function is for Windows OSs only */
2001
2002 #endif   /*_H_HPI_ */
2003 /*
2004 ///////////////////////////////////////////////////////////////////////////////
2005 // See CVS for history.  Last complete set in rev 1.146
2006 ////////////////////////////////////////////////////////////////////////////////
2007 */