• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/linux/linux-2.6/sound/pci/asihpi/
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
19HPI internal definitions
20
21(C) Copyright AudioScience Inc. 1996-2009
22******************************************************************************/
23
24#ifndef _HPI_INTERNAL_H_
25#define _HPI_INTERNAL_H_
26
27#include "hpi.h"
28/** maximum number of memory regions mapped to an adapter */
29#define HPI_MAX_ADAPTER_MEM_SPACES (2)
30
31/* Each OS needs its own hpios.h, or specific define as above */
32#include "hpios.h"
33
34/* physical memory allocation */
35void hpios_locked_mem_init(void
36	);
37void hpios_locked_mem_free_all(void
38	);
39#define hpios_locked_mem_prepare(a, b, c, d);
40#define hpios_locked_mem_unprepare(a)
41
42/** Allocate and map an area of locked memory for bus master DMA operations.
43
44On success, *pLockedMemeHandle is a valid handle, and 0 is returned
45On error *pLockedMemHandle marked invalid, non-zero returned.
46
47If this function succeeds, then HpiOs_LockedMem_GetVirtAddr() and
48HpiOs_LockedMem_GetPyhsAddr() will always succed on the returned handle.
49*/
50u16 hpios_locked_mem_alloc(struct consistent_dma_area *p_locked_mem_handle,
51							   /**< memory handle */
52	u32 size, /**< size in bytes to allocate */
53	struct pci_dev *p_os_reference
54	/**< OS specific data required for memory allocation */
55	);
56
57/** Free mapping and memory represented by LockedMemHandle
58
59Frees any resources, then invalidates the handle.
60Returns 0 on success, 1 if handle is invalid.
61
62*/
63u16 hpios_locked_mem_free(struct consistent_dma_area *locked_mem_handle);
64
65/** Get the physical PCI address of memory represented by LockedMemHandle.
66
67If handle is invalid *pPhysicalAddr is set to zero and return 1
68*/
69u16 hpios_locked_mem_get_phys_addr(struct consistent_dma_area
70	*locked_mem_handle, u32 *p_physical_addr);
71
72/** Get the CPU address of of memory represented by LockedMemHandle.
73
74If handle is NULL *ppvVirtualAddr is set to NULL and return 1
75*/
76u16 hpios_locked_mem_get_virt_addr(struct consistent_dma_area
77	*locked_mem_handle, void **ppv_virtual_addr);
78
79/** Check that handle is valid
80i.e it represents a valid memory area
81*/
82u16 hpios_locked_mem_valid(struct consistent_dma_area *locked_mem_handle);
83
84/* timing/delay */
85void hpios_delay_micro_seconds(u32 num_micro_sec);
86
87struct hpi_message;
88struct hpi_response;
89
90typedef void hpi_handler_func(struct hpi_message *, struct hpi_response *);
91
92/* If the assert fails, compiler complains
93   something like size of array `msg' is negative.
94   Unlike linux BUILD_BUG_ON, this works outside function scope.
95*/
96#define compile_time_assert(cond, msg) \
97    typedef char ASSERT_##msg[(cond) ? 1 : -1]
98
99/*/////////////////////////////////////////////////////////////////////////// */
100/* Private HPI Entity related definitions                                     */
101
102#define STR_SIZE_FIELD_MAX 65535U
103#define STR_TYPE_FIELD_MAX 255U
104#define STR_ROLE_FIELD_MAX 255U
105
106struct hpi_entity_str {
107	u16 size;
108	u8 type;
109	u8 role;
110};
111
112#if defined(_MSC_VER)
113#pragma warning(push)
114#pragma warning(disable : 4200)
115#endif
116
117struct hpi_entity {
118	struct hpi_entity_str header;
119#if !defined(HPI_OS_DSP_C6000) || (defined(HPI_OS_DSP_C6000) && \
120	(__TI_COMPILER_VERSION__ > 6000008))
121	/* DSP C6000 compiler v6.0.8 and lower
122	   do not support  flexible array member */
123	u8 value[];
124#else
125	/* NOTE! Using sizeof(struct hpi_entity) will give erroneous results */
126#define HPI_INTERNAL_WARN_ABOUT_ENTITY_VALUE
127	u8 value[1];
128#endif
129};
130
131#if defined(_MSC_VER)
132#pragma warning(pop)
133#endif
134
135/******************************************* bus types */
136enum HPI_BUSES {
137	HPI_BUS_ISAPNP = 1,
138	HPI_BUS_PCI = 2,
139	HPI_BUS_USB = 3,
140	HPI_BUS_NET = 4
141};
142
143/******************************************* CONTROL ATTRIBUTES ****/
144/* (in order of control type ID */
145
146/* This allows for 255 control types, 256 unique attributes each */
147#define HPI_CTL_ATTR(ctl, ai) (HPI_CONTROL_##ctl * 0x100 + ai)
148
149/* Get the sub-index of the attribute for a control type */
150#define HPI_CTL_ATTR_INDEX(i) (i&0xff)
151
152/* Extract the control from the control attribute */
153#define HPI_CTL_ATTR_CONTROL(i) (i>>8)
154
155/* Generic control attributes.  */
156
157/** Enable a control.
1580=disable, 1=enable
159\note generic to all mixer plugins?
160*/
161#define HPI_GENERIC_ENABLE HPI_CTL_ATTR(GENERIC, 1)
162
163/** Enable event generation for a control.
1640=disable, 1=enable
165\note generic to all controls that can generate events
166*/
167#define HPI_GENERIC_EVENT_ENABLE HPI_CTL_ATTR(GENERIC, 2)
168
169/* Volume Control attributes */
170#define HPI_VOLUME_GAIN                 HPI_CTL_ATTR(VOLUME, 1)
171#define HPI_VOLUME_AUTOFADE             HPI_CTL_ATTR(VOLUME, 2)
172
173/** For HPI_ControlQuery() to get the number of channels of a volume control*/
174#define HPI_VOLUME_NUM_CHANNELS         HPI_CTL_ATTR(VOLUME, 6)
175#define HPI_VOLUME_RANGE                HPI_CTL_ATTR(VOLUME, 10)
176
177/** Level Control attributes */
178#define HPI_LEVEL_GAIN                  HPI_CTL_ATTR(LEVEL, 1)
179#define HPI_LEVEL_RANGE                 HPI_CTL_ATTR(LEVEL, 10)
180
181/* Meter Control attributes */
182/** return RMS signal level */
183#define HPI_METER_RMS                   HPI_CTL_ATTR(METER, 1)
184/** return peak signal level */
185#define HPI_METER_PEAK                  HPI_CTL_ATTR(METER, 2)
186/** ballistics for ALL rms meters on adapter */
187#define HPI_METER_RMS_BALLISTICS        HPI_CTL_ATTR(METER, 3)
188/** ballistics for ALL peak meters on adapter */
189#define HPI_METER_PEAK_BALLISTICS       HPI_CTL_ATTR(METER, 4)
190
191/** For HPI_ControlQuery() to get the number of channels of a meter control*/
192#define HPI_METER_NUM_CHANNELS          HPI_CTL_ATTR(METER, 5)
193
194/* Multiplexer control attributes */
195#define HPI_MULTIPLEXER_SOURCE          HPI_CTL_ATTR(MULTIPLEXER, 1)
196#define HPI_MULTIPLEXER_QUERYSOURCE     HPI_CTL_ATTR(MULTIPLEXER, 2)
197
198/** AES/EBU transmitter control attributes */
199/** AESEBU or SPDIF */
200#define HPI_AESEBUTX_FORMAT             HPI_CTL_ATTR(AESEBUTX, 1)
201#define HPI_AESEBUTX_SAMPLERATE         HPI_CTL_ATTR(AESEBUTX, 3)
202#define HPI_AESEBUTX_CHANNELSTATUS      HPI_CTL_ATTR(AESEBUTX, 4)
203#define HPI_AESEBUTX_USERDATA           HPI_CTL_ATTR(AESEBUTX, 5)
204
205/** AES/EBU receiver control attributes */
206#define HPI_AESEBURX_FORMAT             HPI_CTL_ATTR(AESEBURX, 1)
207#define HPI_AESEBURX_ERRORSTATUS        HPI_CTL_ATTR(AESEBURX, 2)
208#define HPI_AESEBURX_SAMPLERATE         HPI_CTL_ATTR(AESEBURX, 3)
209#define HPI_AESEBURX_CHANNELSTATUS      HPI_CTL_ATTR(AESEBURX, 4)
210#define HPI_AESEBURX_USERDATA           HPI_CTL_ATTR(AESEBURX, 5)
211
212/** \defgroup tuner_defs Tuners
213\{
214*/
215/** \defgroup tuner_attrs Tuner control attributes
216\{
217*/
218#define HPI_TUNER_BAND                  HPI_CTL_ATTR(TUNER, 1)
219#define HPI_TUNER_FREQ                  HPI_CTL_ATTR(TUNER, 2)
220#define HPI_TUNER_LEVEL                 HPI_CTL_ATTR(TUNER, 3)
221#define HPI_TUNER_AUDIOMUTE             HPI_CTL_ATTR(TUNER, 4)
222/* use TUNER_STATUS instead */
223#define HPI_TUNER_VIDEO_STATUS          HPI_CTL_ATTR(TUNER, 5)
224#define HPI_TUNER_GAIN                  HPI_CTL_ATTR(TUNER, 6)
225#define HPI_TUNER_STATUS                HPI_CTL_ATTR(TUNER, 7)
226#define HPI_TUNER_MODE                  HPI_CTL_ATTR(TUNER, 8)
227/** RDS data. */
228#define HPI_TUNER_RDS                   HPI_CTL_ATTR(TUNER, 9)
229/** Audio pre-emphasis. */
230#define HPI_TUNER_DEEMPHASIS            HPI_CTL_ATTR(TUNER, 10)
231/** HD Radio tuner program control. */
232#define HPI_TUNER_PROGRAM               HPI_CTL_ATTR(TUNER, 11)
233/** HD Radio tuner digital signal quality. */
234#define HPI_TUNER_HDRADIO_SIGNAL_QUALITY        HPI_CTL_ATTR(TUNER, 12)
235/** HD Radio SDK firmware version. */
236#define HPI_TUNER_HDRADIO_SDK_VERSION   HPI_CTL_ATTR(TUNER, 13)
237/** HD Radio DSP firmware version. */
238#define HPI_TUNER_HDRADIO_DSP_VERSION   HPI_CTL_ATTR(TUNER, 14)
239/** HD Radio signal blend (force analog, or automatic). */
240#define HPI_TUNER_HDRADIO_BLEND         HPI_CTL_ATTR(TUNER, 15)
241
242/** \} */
243
244/** \defgroup pads_attrs Tuner PADs control attributes
245\{
246*/
247/** The text string containing the station/channel combination. */
248#define HPI_PAD_CHANNEL_NAME            HPI_CTL_ATTR(PAD, 1)
249/** The text string containing the artist. */
250#define HPI_PAD_ARTIST                  HPI_CTL_ATTR(PAD, 2)
251/** The text string containing the title. */
252#define HPI_PAD_TITLE                   HPI_CTL_ATTR(PAD, 3)
253/** The text string containing the comment. */
254#define HPI_PAD_COMMENT                 HPI_CTL_ATTR(PAD, 4)
255/** The integer containing the PTY code. */
256#define HPI_PAD_PROGRAM_TYPE            HPI_CTL_ATTR(PAD, 5)
257/** The integer containing the program identification. */
258#define HPI_PAD_PROGRAM_ID              HPI_CTL_ATTR(PAD, 6)
259/** The integer containing whether traffic information is supported.
260Contains either 1 or 0. */
261#define HPI_PAD_TA_SUPPORT              HPI_CTL_ATTR(PAD, 7)
262/** The integer containing whether traffic announcement is in progress.
263Contains either 1 or 0. */
264#define HPI_PAD_TA_ACTIVE               HPI_CTL_ATTR(PAD, 8)
265/** \} */
266/** \} */
267
268/* VOX control attributes */
269#define HPI_VOX_THRESHOLD               HPI_CTL_ATTR(VOX, 1)
270
271/*?? channel mode used hpi_multiplexer_source attribute == 1 */
272#define HPI_CHANNEL_MODE_MODE HPI_CTL_ATTR(CHANNEL_MODE, 1)
273
274/** \defgroup channel_modes Channel Modes
275Used for HPI_ChannelModeSet/Get()
276\{
277*/
278/** Left channel out = left channel in, Right channel out = right channel in. */
279#define HPI_CHANNEL_MODE_NORMAL                 1
280/** Left channel out = right channel in, Right channel out = left channel in. */
281#define HPI_CHANNEL_MODE_SWAP                   2
282/** Left channel out = left channel in, Right channel out = left channel in. */
283#define HPI_CHANNEL_MODE_LEFT_TO_STEREO         3
284/** Left channel out = right channel in, Right channel out = right channel in.*/
285#define HPI_CHANNEL_MODE_RIGHT_TO_STEREO        4
286/** Left channel out = (left channel in + right channel in)/2,
287    Right channel out = mute. */
288#define HPI_CHANNEL_MODE_STEREO_TO_LEFT         5
289/** Left channel out = mute,
290    Right channel out = (right channel in + left channel in)/2. */
291#define HPI_CHANNEL_MODE_STEREO_TO_RIGHT        6
292#define HPI_CHANNEL_MODE_LAST                   6
293/** \} */
294
295/* Bitstream control set attributes */
296#define HPI_BITSTREAM_DATA_POLARITY     HPI_CTL_ATTR(BITSTREAM, 1)
297#define HPI_BITSTREAM_CLOCK_EDGE        HPI_CTL_ATTR(BITSTREAM, 2)
298#define HPI_BITSTREAM_CLOCK_SOURCE      HPI_CTL_ATTR(BITSTREAM, 3)
299
300#define HPI_POLARITY_POSITIVE           0
301#define HPI_POLARITY_NEGATIVE           1
302
303/* Bitstream control get attributes */
304#define HPI_BITSTREAM_ACTIVITY          1
305
306/* SampleClock control attributes */
307#define HPI_SAMPLECLOCK_SOURCE                  HPI_CTL_ATTR(SAMPLECLOCK, 1)
308#define HPI_SAMPLECLOCK_SAMPLERATE              HPI_CTL_ATTR(SAMPLECLOCK, 2)
309#define HPI_SAMPLECLOCK_SOURCE_INDEX            HPI_CTL_ATTR(SAMPLECLOCK, 3)
310#define HPI_SAMPLECLOCK_LOCAL_SAMPLERATE\
311	HPI_CTL_ATTR(SAMPLECLOCK, 4)
312#define HPI_SAMPLECLOCK_AUTO                    HPI_CTL_ATTR(SAMPLECLOCK, 5)
313#define HPI_SAMPLECLOCK_LOCAL_LOCK                      HPI_CTL_ATTR(SAMPLECLOCK, 6)
314
315/* Microphone control attributes */
316#define HPI_MICROPHONE_PHANTOM_POWER HPI_CTL_ATTR(MICROPHONE, 1)
317
318/** Equalizer control attributes */
319/** Used to get number of filters in an EQ. (Can't set) */
320#define HPI_EQUALIZER_NUM_FILTERS HPI_CTL_ATTR(EQUALIZER, 1)
321/** Set/get the filter by type, freq, Q, gain */
322#define HPI_EQUALIZER_FILTER HPI_CTL_ATTR(EQUALIZER, 2)
323/** Get the biquad coefficients */
324#define HPI_EQUALIZER_COEFFICIENTS HPI_CTL_ATTR(EQUALIZER, 3)
325
326/* Note compander also uses HPI_GENERIC_ENABLE */
327#define HPI_COMPANDER_PARAMS     HPI_CTL_ATTR(COMPANDER, 1)
328#define HPI_COMPANDER_MAKEUPGAIN HPI_CTL_ATTR(COMPANDER, 2)
329#define HPI_COMPANDER_THRESHOLD  HPI_CTL_ATTR(COMPANDER, 3)
330#define HPI_COMPANDER_RATIO      HPI_CTL_ATTR(COMPANDER, 4)
331#define HPI_COMPANDER_ATTACK     HPI_CTL_ATTR(COMPANDER, 5)
332#define HPI_COMPANDER_DECAY      HPI_CTL_ATTR(COMPANDER, 6)
333
334/* Cobranet control attributes. */
335#define HPI_COBRANET_SET         HPI_CTL_ATTR(COBRANET, 1)
336#define HPI_COBRANET_GET         HPI_CTL_ATTR(COBRANET, 2)
337#define HPI_COBRANET_SET_DATA    HPI_CTL_ATTR(COBRANET, 3)
338#define HPI_COBRANET_GET_DATA    HPI_CTL_ATTR(COBRANET, 4)
339#define HPI_COBRANET_GET_STATUS  HPI_CTL_ATTR(COBRANET, 5)
340#define HPI_COBRANET_SEND_PACKET HPI_CTL_ATTR(COBRANET, 6)
341#define HPI_COBRANET_GET_PACKET  HPI_CTL_ATTR(COBRANET, 7)
342
343/*------------------------------------------------------------
344 Cobranet Chip Bridge - copied from HMI.H
345------------------------------------------------------------*/
346#define  HPI_COBRANET_HMI_cobra_bridge           0x20000
347#define  HPI_COBRANET_HMI_cobra_bridge_tx_pkt_buf \
348	(HPI_COBRANET_HMI_cobra_bridge + 0x1000)
349#define  HPI_COBRANET_HMI_cobra_bridge_rx_pkt_buf \
350	(HPI_COBRANET_HMI_cobra_bridge + 0x2000)
351#define  HPI_COBRANET_HMI_cobra_if_table1         0x110000
352#define  HPI_COBRANET_HMI_cobra_if_phy_address \
353	(HPI_COBRANET_HMI_cobra_if_table1 + 0xd)
354#define  HPI_COBRANET_HMI_cobra_protocolIP       0x72000
355#define  HPI_COBRANET_HMI_cobra_ip_mon_currentIP \
356	(HPI_COBRANET_HMI_cobra_protocolIP + 0x0)
357#define  HPI_COBRANET_HMI_cobra_ip_mon_staticIP \
358	(HPI_COBRANET_HMI_cobra_protocolIP + 0x2)
359#define  HPI_COBRANET_HMI_cobra_sys              0x100000
360#define  HPI_COBRANET_HMI_cobra_sys_desc \
361		(HPI_COBRANET_HMI_cobra_sys + 0x0)
362#define  HPI_COBRANET_HMI_cobra_sys_objectID \
363	(HPI_COBRANET_HMI_cobra_sys + 0x100)
364#define  HPI_COBRANET_HMI_cobra_sys_contact \
365	(HPI_COBRANET_HMI_cobra_sys + 0x200)
366#define  HPI_COBRANET_HMI_cobra_sys_name \
367		(HPI_COBRANET_HMI_cobra_sys + 0x300)
368#define  HPI_COBRANET_HMI_cobra_sys_location \
369	(HPI_COBRANET_HMI_cobra_sys + 0x400)
370
371/*------------------------------------------------------------
372 Cobranet Chip Status bits
373------------------------------------------------------------*/
374#define HPI_COBRANET_HMI_STATUS_RXPACKET 2
375#define HPI_COBRANET_HMI_STATUS_TXPACKET 3
376
377/*------------------------------------------------------------
378 Ethernet header size
379------------------------------------------------------------*/
380#define HPI_ETHERNET_HEADER_SIZE (16)
381
382/* These defines are used to fill in protocol information for an Ethernet packet
383    sent using HMI on CS18102 */
384/** ID supplied by Cirrius for ASI packets. */
385#define HPI_ETHERNET_PACKET_ID                  0x85
386/** Simple packet - no special routing required */
387#define HPI_ETHERNET_PACKET_V1                  0x01
388/** This packet must make its way to the host across the HPI interface */
389#define HPI_ETHERNET_PACKET_HOSTED_VIA_HMI      0x20
390/** This packet must make its way to the host across the HPI interface */
391#define HPI_ETHERNET_PACKET_HOSTED_VIA_HMI_V1   0x21
392/** This packet must make its way to the host across the HPI interface */
393#define HPI_ETHERNET_PACKET_HOSTED_VIA_HPI      0x40
394/** This packet must make its way to the host across the HPI interface */
395#define HPI_ETHERNET_PACKET_HOSTED_VIA_HPI_V1   0x41
396
397#define HPI_ETHERNET_UDP_PORT (44600)	/*!< UDP messaging port */
398
399/** Base network time out is set to 100 milli-seconds. */
400#define HPI_ETHERNET_TIMEOUT_MS      (100)
401
402/** \defgroup tonedet_attr Tonedetector attributes
403\{
404Used by HPI_ToneDetector_Set() and HPI_ToneDetector_Get()
405*/
406
407/** Set the threshold level of a tonedetector,
408Threshold is a -ve number in units of dB/100,
409*/
410#define HPI_TONEDETECTOR_THRESHOLD HPI_CTL_ATTR(TONEDETECTOR, 1)
411
412/** Get the current state of tonedetection
413The result is a bitmap of detected tones.  pairs of bits represent the left
414and right channels, with left channel in LSB.
415The lowest frequency detector state is in the LSB
416*/
417#define HPI_TONEDETECTOR_STATE HPI_CTL_ATTR(TONEDETECTOR, 2)
418
419/** Get the frequency of a tonedetector band.
420*/
421#define HPI_TONEDETECTOR_FREQUENCY HPI_CTL_ATTR(TONEDETECTOR, 3)
422
423/**\}*/
424
425/** \defgroup silencedet_attr SilenceDetector attributes
426\{
427*/
428
429/** Get the current state of tonedetection
430The result is a bitmap with 1s for silent channels. Left channel is in LSB
431*/
432#define HPI_SILENCEDETECTOR_STATE \
433  HPI_CTL_ATTR(SILENCEDETECTOR, 2)
434
435/** Set the threshold level of a SilenceDetector,
436Threshold is a -ve number in units of dB/100,
437*/
438#define HPI_SILENCEDETECTOR_THRESHOLD \
439  HPI_CTL_ATTR(SILENCEDETECTOR, 1)
440
441/** get/set the silence time before the detector triggers
442*/
443#define HPI_SILENCEDETECTOR_DELAY \
444       HPI_CTL_ATTR(SILENCEDETECTOR, 3)
445
446/**\}*/
447
448/* Locked memory buffer alloc/free phases */
449/** use one message to allocate or free physical memory */
450#define HPI_BUFFER_CMD_EXTERNAL                 0
451/** alloc physical memory */
452#define HPI_BUFFER_CMD_INTERNAL_ALLOC           1
453/** send physical memory address to adapter */
454#define HPI_BUFFER_CMD_INTERNAL_GRANTADAPTER    2
455/** notify adapter to stop using physical buffer */
456#define HPI_BUFFER_CMD_INTERNAL_REVOKEADAPTER   3
457/** free physical buffer */
458#define HPI_BUFFER_CMD_INTERNAL_FREE            4
459
460/******************************************* CONTROLX ATTRIBUTES ****/
461/* NOTE: All controlx attributes must be unique, unlike control attributes */
462
463/*****************************************************************************/
464/*****************************************************************************/
465/********               HPI LOW LEVEL MESSAGES                  *******/
466/*****************************************************************************/
467/*****************************************************************************/
468/** Pnp ids */
469/** "ASI"  - actual is "ASX" - need to change */
470#define HPI_ID_ISAPNP_AUDIOSCIENCE      0x0669
471/** PCI vendor ID that AudioScience uses */
472#define HPI_PCI_VENDOR_ID_AUDIOSCIENCE  0x175C
473/** PCI vendor ID that the DSP56301 has */
474#define HPI_PCI_VENDOR_ID_MOTOROLA      0x1057
475/** PCI vendor ID that TI uses */
476#define HPI_PCI_VENDOR_ID_TI            0x104C
477
478#define HPI_PCI_DEV_ID_PCI2040          0xAC60
479/** TI's C6205 PCI interface has this ID */
480#define HPI_PCI_DEV_ID_DSP6205          0xA106
481
482#define HPI_USB_VENDOR_ID_AUDIOSCIENCE  0x1257
483#define HPI_USB_W2K_TAG                 0x57495341	/* "ASIW"       */
484#define HPI_USB_LINUX_TAG               0x4C495341	/* "ASIL"       */
485
486/** First 2 hex digits define the adapter family */
487#define HPI_ADAPTER_FAMILY_MASK         0xff00
488#define HPI_MODULE_FAMILY_MASK          0xfff0
489
490#define HPI_ADAPTER_FAMILY_ASI(f)   (f & HPI_ADAPTER_FAMILY_MASK)
491#define HPI_MODULE_FAMILY_ASI(f)   (f & HPI_MODULE_FAMILY_MASK)
492#define HPI_ADAPTER_ASI(f)   (f)
493
494/******************************************* message types */
495#define HPI_TYPE_MESSAGE                        1
496#define HPI_TYPE_RESPONSE                       2
497#define HPI_TYPE_DATA                           3
498#define HPI_TYPE_SSX2BYPASS_MESSAGE             4
499
500/******************************************* object types */
501#define HPI_OBJ_SUBSYSTEM                       1
502#define HPI_OBJ_ADAPTER                         2
503#define HPI_OBJ_OSTREAM                         3
504#define HPI_OBJ_ISTREAM                         4
505#define HPI_OBJ_MIXER                           5
506#define HPI_OBJ_NODE                            6
507#define HPI_OBJ_CONTROL                         7
508#define HPI_OBJ_NVMEMORY                        8
509#define HPI_OBJ_GPIO                            9
510#define HPI_OBJ_WATCHDOG                        10
511#define HPI_OBJ_CLOCK                           11
512#define HPI_OBJ_PROFILE                         12
513#define HPI_OBJ_CONTROLEX                       13
514#define HPI_OBJ_ASYNCEVENT                      14
515
516#define HPI_OBJ_MAXINDEX                        14
517
518/******************************************* methods/functions */
519
520#define HPI_OBJ_FUNCTION_SPACING        0x100
521#define HPI_MAKE_INDEX(obj, index) (obj * HPI_OBJ_FUNCTION_SPACING + index)
522#define HPI_EXTRACT_INDEX(fn) (fn & 0xff)
523
524/* SUB-SYSTEM */
525#define HPI_SUBSYS_OPEN                 HPI_MAKE_INDEX(HPI_OBJ_SUBSYSTEM, 1)
526#define HPI_SUBSYS_GET_VERSION          HPI_MAKE_INDEX(HPI_OBJ_SUBSYSTEM, 2)
527#define HPI_SUBSYS_GET_INFO             HPI_MAKE_INDEX(HPI_OBJ_SUBSYSTEM, 3)
528#define HPI_SUBSYS_FIND_ADAPTERS        HPI_MAKE_INDEX(HPI_OBJ_SUBSYSTEM, 4)
529#define HPI_SUBSYS_CREATE_ADAPTER       HPI_MAKE_INDEX(HPI_OBJ_SUBSYSTEM, 5)
530#define HPI_SUBSYS_CLOSE                HPI_MAKE_INDEX(HPI_OBJ_SUBSYSTEM, 6)
531#define HPI_SUBSYS_DELETE_ADAPTER       HPI_MAKE_INDEX(HPI_OBJ_SUBSYSTEM, 7)
532#define HPI_SUBSYS_DRIVER_LOAD          HPI_MAKE_INDEX(HPI_OBJ_SUBSYSTEM, 8)
533#define HPI_SUBSYS_DRIVER_UNLOAD        HPI_MAKE_INDEX(HPI_OBJ_SUBSYSTEM, 9)
534#define HPI_SUBSYS_READ_PORT_8          HPI_MAKE_INDEX(HPI_OBJ_SUBSYSTEM, 10)
535#define HPI_SUBSYS_WRITE_PORT_8         HPI_MAKE_INDEX(HPI_OBJ_SUBSYSTEM, 11)
536#define HPI_SUBSYS_GET_NUM_ADAPTERS     HPI_MAKE_INDEX(HPI_OBJ_SUBSYSTEM, 12)
537#define HPI_SUBSYS_GET_ADAPTER          HPI_MAKE_INDEX(HPI_OBJ_SUBSYSTEM, 13)
538#define HPI_SUBSYS_SET_NETWORK_INTERFACE HPI_MAKE_INDEX(HPI_OBJ_SUBSYSTEM, 14)
539#define HPI_SUBSYS_FUNCTION_COUNT 14
540/* ADAPTER */
541#define HPI_ADAPTER_OPEN                HPI_MAKE_INDEX(HPI_OBJ_ADAPTER, 1)
542#define HPI_ADAPTER_CLOSE               HPI_MAKE_INDEX(HPI_OBJ_ADAPTER, 2)
543#define HPI_ADAPTER_GET_INFO            HPI_MAKE_INDEX(HPI_OBJ_ADAPTER, 3)
544#define HPI_ADAPTER_GET_ASSERT          HPI_MAKE_INDEX(HPI_OBJ_ADAPTER, 4)
545#define HPI_ADAPTER_TEST_ASSERT         HPI_MAKE_INDEX(HPI_OBJ_ADAPTER, 5)
546#define HPI_ADAPTER_SET_MODE            HPI_MAKE_INDEX(HPI_OBJ_ADAPTER, 6)
547#define HPI_ADAPTER_GET_MODE            HPI_MAKE_INDEX(HPI_OBJ_ADAPTER, 7)
548#define HPI_ADAPTER_ENABLE_CAPABILITY   HPI_MAKE_INDEX(HPI_OBJ_ADAPTER, 8)
549#define HPI_ADAPTER_SELFTEST            HPI_MAKE_INDEX(HPI_OBJ_ADAPTER, 9)
550#define HPI_ADAPTER_FIND_OBJECT         HPI_MAKE_INDEX(HPI_OBJ_ADAPTER, 10)
551#define HPI_ADAPTER_QUERY_FLASH         HPI_MAKE_INDEX(HPI_OBJ_ADAPTER, 11)
552#define HPI_ADAPTER_START_FLASH         HPI_MAKE_INDEX(HPI_OBJ_ADAPTER, 12)
553#define HPI_ADAPTER_PROGRAM_FLASH       HPI_MAKE_INDEX(HPI_OBJ_ADAPTER, 13)
554#define HPI_ADAPTER_SET_PROPERTY        HPI_MAKE_INDEX(HPI_OBJ_ADAPTER, 14)
555#define HPI_ADAPTER_GET_PROPERTY        HPI_MAKE_INDEX(HPI_OBJ_ADAPTER, 15)
556#define HPI_ADAPTER_ENUM_PROPERTY       HPI_MAKE_INDEX(HPI_OBJ_ADAPTER, 16)
557#define HPI_ADAPTER_MODULE_INFO         HPI_MAKE_INDEX(HPI_OBJ_ADAPTER, 17)
558#define HPI_ADAPTER_DEBUG_READ          HPI_MAKE_INDEX(HPI_OBJ_ADAPTER, 18)
559#define HPI_ADAPTER_FUNCTION_COUNT 18
560/* OUTPUT STREAM */
561#define HPI_OSTREAM_OPEN                HPI_MAKE_INDEX(HPI_OBJ_OSTREAM, 1)
562#define HPI_OSTREAM_CLOSE               HPI_MAKE_INDEX(HPI_OBJ_OSTREAM, 2)
563#define HPI_OSTREAM_WRITE               HPI_MAKE_INDEX(HPI_OBJ_OSTREAM, 3)
564#define HPI_OSTREAM_START               HPI_MAKE_INDEX(HPI_OBJ_OSTREAM, 4)
565#define HPI_OSTREAM_STOP                HPI_MAKE_INDEX(HPI_OBJ_OSTREAM, 5)
566#define HPI_OSTREAM_RESET               HPI_MAKE_INDEX(HPI_OBJ_OSTREAM, 6)
567#define HPI_OSTREAM_GET_INFO            HPI_MAKE_INDEX(HPI_OBJ_OSTREAM, 7)
568#define HPI_OSTREAM_QUERY_FORMAT        HPI_MAKE_INDEX(HPI_OBJ_OSTREAM, 8)
569#define HPI_OSTREAM_DATA                HPI_MAKE_INDEX(HPI_OBJ_OSTREAM, 9)
570#define HPI_OSTREAM_SET_VELOCITY        HPI_MAKE_INDEX(HPI_OBJ_OSTREAM, 10)
571#define HPI_OSTREAM_SET_PUNCHINOUT      HPI_MAKE_INDEX(HPI_OBJ_OSTREAM, 11)
572#define HPI_OSTREAM_SINEGEN             HPI_MAKE_INDEX(HPI_OBJ_OSTREAM, 12)
573#define HPI_OSTREAM_ANC_RESET           HPI_MAKE_INDEX(HPI_OBJ_OSTREAM, 13)
574#define HPI_OSTREAM_ANC_GET_INFO        HPI_MAKE_INDEX(HPI_OBJ_OSTREAM, 14)
575#define HPI_OSTREAM_ANC_READ            HPI_MAKE_INDEX(HPI_OBJ_OSTREAM, 15)
576#define HPI_OSTREAM_SET_TIMESCALE       HPI_MAKE_INDEX(HPI_OBJ_OSTREAM, 16)
577#define HPI_OSTREAM_SET_FORMAT          HPI_MAKE_INDEX(HPI_OBJ_OSTREAM, 17)
578#define HPI_OSTREAM_HOSTBUFFER_ALLOC    HPI_MAKE_INDEX(HPI_OBJ_OSTREAM, 18)
579#define HPI_OSTREAM_HOSTBUFFER_FREE     HPI_MAKE_INDEX(HPI_OBJ_OSTREAM, 19)
580#define HPI_OSTREAM_GROUP_ADD           HPI_MAKE_INDEX(HPI_OBJ_OSTREAM, 20)
581#define HPI_OSTREAM_GROUP_GETMAP        HPI_MAKE_INDEX(HPI_OBJ_OSTREAM, 21)
582#define HPI_OSTREAM_GROUP_RESET         HPI_MAKE_INDEX(HPI_OBJ_OSTREAM, 22)
583#define HPI_OSTREAM_HOSTBUFFER_GET_INFO HPI_MAKE_INDEX(HPI_OBJ_OSTREAM, 23)
584#define HPI_OSTREAM_WAIT_START          HPI_MAKE_INDEX(HPI_OBJ_OSTREAM, 24)
585#define HPI_OSTREAM_FUNCTION_COUNT              24
586/* INPUT STREAM */
587#define HPI_ISTREAM_OPEN                HPI_MAKE_INDEX(HPI_OBJ_ISTREAM, 1)
588#define HPI_ISTREAM_CLOSE               HPI_MAKE_INDEX(HPI_OBJ_ISTREAM, 2)
589#define HPI_ISTREAM_SET_FORMAT          HPI_MAKE_INDEX(HPI_OBJ_ISTREAM, 3)
590#define HPI_ISTREAM_READ                HPI_MAKE_INDEX(HPI_OBJ_ISTREAM, 4)
591#define HPI_ISTREAM_START               HPI_MAKE_INDEX(HPI_OBJ_ISTREAM, 5)
592#define HPI_ISTREAM_STOP                HPI_MAKE_INDEX(HPI_OBJ_ISTREAM, 6)
593#define HPI_ISTREAM_RESET               HPI_MAKE_INDEX(HPI_OBJ_ISTREAM, 7)
594#define HPI_ISTREAM_GET_INFO            HPI_MAKE_INDEX(HPI_OBJ_ISTREAM, 8)
595#define HPI_ISTREAM_QUERY_FORMAT        HPI_MAKE_INDEX(HPI_OBJ_ISTREAM, 9)
596#define HPI_ISTREAM_ANC_RESET           HPI_MAKE_INDEX(HPI_OBJ_ISTREAM, 10)
597#define HPI_ISTREAM_ANC_GET_INFO        HPI_MAKE_INDEX(HPI_OBJ_ISTREAM, 11)
598#define HPI_ISTREAM_ANC_WRITE           HPI_MAKE_INDEX(HPI_OBJ_ISTREAM, 12)
599#define HPI_ISTREAM_HOSTBUFFER_ALLOC    HPI_MAKE_INDEX(HPI_OBJ_ISTREAM, 13)
600#define HPI_ISTREAM_HOSTBUFFER_FREE     HPI_MAKE_INDEX(HPI_OBJ_ISTREAM, 14)
601#define HPI_ISTREAM_GROUP_ADD           HPI_MAKE_INDEX(HPI_OBJ_ISTREAM, 15)
602#define HPI_ISTREAM_GROUP_GETMAP        HPI_MAKE_INDEX(HPI_OBJ_ISTREAM, 16)
603#define HPI_ISTREAM_GROUP_RESET         HPI_MAKE_INDEX(HPI_OBJ_ISTREAM, 17)
604#define HPI_ISTREAM_HOSTBUFFER_GET_INFO HPI_MAKE_INDEX(HPI_OBJ_ISTREAM, 18)
605#define HPI_ISTREAM_WAIT_START          HPI_MAKE_INDEX(HPI_OBJ_ISTREAM, 19)
606#define HPI_ISTREAM_FUNCTION_COUNT              19
607/* MIXER */
608/* NOTE:
609   GET_NODE_INFO, SET_CONNECTION, GET_CONNECTIONS are not currently used */
610#define HPI_MIXER_OPEN                  HPI_MAKE_INDEX(HPI_OBJ_MIXER, 1)
611#define HPI_MIXER_CLOSE                 HPI_MAKE_INDEX(HPI_OBJ_MIXER, 2)
612#define HPI_MIXER_GET_INFO              HPI_MAKE_INDEX(HPI_OBJ_MIXER, 3)
613#define HPI_MIXER_GET_NODE_INFO         HPI_MAKE_INDEX(HPI_OBJ_MIXER, 4)
614#define HPI_MIXER_GET_CONTROL           HPI_MAKE_INDEX(HPI_OBJ_MIXER, 5)
615#define HPI_MIXER_SET_CONNECTION        HPI_MAKE_INDEX(HPI_OBJ_MIXER, 6)
616#define HPI_MIXER_GET_CONNECTIONS       HPI_MAKE_INDEX(HPI_OBJ_MIXER, 7)
617#define HPI_MIXER_GET_CONTROL_BY_INDEX  HPI_MAKE_INDEX(HPI_OBJ_MIXER, 8)
618#define HPI_MIXER_GET_CONTROL_ARRAY_BY_INDEX  HPI_MAKE_INDEX(HPI_OBJ_MIXER, 9)
619#define HPI_MIXER_GET_CONTROL_MULTIPLE_VALUES HPI_MAKE_INDEX(HPI_OBJ_MIXER, 10)
620#define HPI_MIXER_STORE                 HPI_MAKE_INDEX(HPI_OBJ_MIXER, 11)
621#define HPI_MIXER_FUNCTION_COUNT        11
622/* MIXER CONTROLS */
623#define HPI_CONTROL_GET_INFO            HPI_MAKE_INDEX(HPI_OBJ_CONTROL, 1)
624#define HPI_CONTROL_GET_STATE           HPI_MAKE_INDEX(HPI_OBJ_CONTROL, 2)
625#define HPI_CONTROL_SET_STATE           HPI_MAKE_INDEX(HPI_OBJ_CONTROL, 3)
626#define HPI_CONTROL_FUNCTION_COUNT 3
627/* NONVOL MEMORY */
628#define HPI_NVMEMORY_OPEN               HPI_MAKE_INDEX(HPI_OBJ_NVMEMORY, 1)
629#define HPI_NVMEMORY_READ_BYTE          HPI_MAKE_INDEX(HPI_OBJ_NVMEMORY, 2)
630#define HPI_NVMEMORY_WRITE_BYTE         HPI_MAKE_INDEX(HPI_OBJ_NVMEMORY, 3)
631#define HPI_NVMEMORY_FUNCTION_COUNT 3
632/* GPIO */
633#define HPI_GPIO_OPEN                   HPI_MAKE_INDEX(HPI_OBJ_GPIO, 1)
634#define HPI_GPIO_READ_BIT               HPI_MAKE_INDEX(HPI_OBJ_GPIO, 2)
635#define HPI_GPIO_WRITE_BIT              HPI_MAKE_INDEX(HPI_OBJ_GPIO, 3)
636#define HPI_GPIO_READ_ALL               HPI_MAKE_INDEX(HPI_OBJ_GPIO, 4)
637#define HPI_GPIO_WRITE_STATUS           HPI_MAKE_INDEX(HPI_OBJ_GPIO, 5)
638#define HPI_GPIO_FUNCTION_COUNT 5
639/* ASYNC EVENT */
640#define HPI_ASYNCEVENT_OPEN             HPI_MAKE_INDEX(HPI_OBJ_ASYNCEVENT, 1)
641#define HPI_ASYNCEVENT_CLOSE            HPI_MAKE_INDEX(HPI_OBJ_ASYNCEVENT, 2)
642#define HPI_ASYNCEVENT_WAIT             HPI_MAKE_INDEX(HPI_OBJ_ASYNCEVENT, 3)
643#define HPI_ASYNCEVENT_GETCOUNT         HPI_MAKE_INDEX(HPI_OBJ_ASYNCEVENT, 4)
644#define HPI_ASYNCEVENT_GET              HPI_MAKE_INDEX(HPI_OBJ_ASYNCEVENT, 5)
645#define HPI_ASYNCEVENT_SENDEVENTS       HPI_MAKE_INDEX(HPI_OBJ_ASYNCEVENT, 6)
646#define HPI_ASYNCEVENT_FUNCTION_COUNT 6
647/* WATCH-DOG */
648#define HPI_WATCHDOG_OPEN               HPI_MAKE_INDEX(HPI_OBJ_WATCHDOG, 1)
649#define HPI_WATCHDOG_SET_TIME           HPI_MAKE_INDEX(HPI_OBJ_WATCHDOG, 2)
650#define HPI_WATCHDOG_PING               HPI_MAKE_INDEX(HPI_OBJ_WATCHDOG, 3)
651/* CLOCK */
652#define HPI_CLOCK_OPEN                  HPI_MAKE_INDEX(HPI_OBJ_CLOCK, 1)
653#define HPI_CLOCK_SET_TIME              HPI_MAKE_INDEX(HPI_OBJ_CLOCK, 2)
654#define HPI_CLOCK_GET_TIME              HPI_MAKE_INDEX(HPI_OBJ_CLOCK, 3)
655/* PROFILE */
656#define HPI_PROFILE_OPEN_ALL            HPI_MAKE_INDEX(HPI_OBJ_PROFILE, 1)
657#define HPI_PROFILE_START_ALL           HPI_MAKE_INDEX(HPI_OBJ_PROFILE, 2)
658#define HPI_PROFILE_STOP_ALL            HPI_MAKE_INDEX(HPI_OBJ_PROFILE, 3)
659#define HPI_PROFILE_GET                 HPI_MAKE_INDEX(HPI_OBJ_PROFILE, 4)
660#define HPI_PROFILE_GET_IDLECOUNT       HPI_MAKE_INDEX(HPI_OBJ_PROFILE, 5)
661#define HPI_PROFILE_GET_NAME            HPI_MAKE_INDEX(HPI_OBJ_PROFILE, 6)
662#define HPI_PROFILE_GET_UTILIZATION     HPI_MAKE_INDEX(HPI_OBJ_PROFILE, 7)
663#define HPI_PROFILE_FUNCTION_COUNT 7
664/* ////////////////////////////////////////////////////////////////////// */
665/* PRIVATE ATTRIBUTES */
666
667/* ////////////////////////////////////////////////////////////////////// */
668/* STRUCTURES */
669#ifndef DISABLE_PRAGMA_PACK1
670#pragma pack(push, 1)
671#endif
672
673/** PCI bus resource */
674struct hpi_pci {
675	u32 __iomem *ap_mem_base[HPI_MAX_ADAPTER_MEM_SPACES];
676	struct pci_dev *p_os_data;
677
678#ifndef HPI64BIT		/* keep structure size constant */
679	u32 padding[HPI_MAX_ADAPTER_MEM_SPACES + 1];
680#endif
681	u16 vendor_id;
682	u16 device_id;
683	u16 subsys_vendor_id;
684	u16 subsys_device_id;
685	u16 bus_number;
686	u16 device_number;
687	u32 interrupt;
688};
689
690struct hpi_resource {
691	union {
692		const struct hpi_pci *pci;
693		const char *net_if;
694	} r;
695#ifndef HPI64BIT		/* keep structure size constant */
696	u32 pad_to64;
697#endif
698	u16 bus_type;		/* HPI_BUS_PNPISA, _PCI, _USB etc */
699	u16 padding;
700
701};
702
703/** Format info used inside struct hpi_message
704    Not the same as public API struct hpi_format */
705struct hpi_msg_format {
706	u32 sample_rate;
707				/**< 11025, 32000, 44100 ... */
708	u32 bit_rate;	      /**< for MPEG */
709	u32 attributes;
710				/**< Stereo/JointStereo/Mono */
711	u16 channels;	      /**< 1,2..., (or ancillary mode or idle bit */
712	u16 format; /**< HPI_FORMAT_PCM16, _MPEG etc. see \ref HPI_FORMATS. */
713};
714
715/**  Buffer+format structure.
716	 Must be kept 7 * 32 bits to match public struct hpi_datastruct */
717struct hpi_msg_data {
718	struct hpi_msg_format format;
719	u8 *pb_data;
720#ifndef HPI64BIT
721	u32 padding;
722#endif
723	u32 data_size;
724};
725
726/** struct hpi_datastructure used up to 3.04 driver */
727struct hpi_data_legacy32 {
728	struct hpi_format format;
729	u32 pb_data;
730	u32 data_size;
731};
732
733#ifdef HPI64BIT
734/* Compatibility version of struct hpi_data*/
735struct hpi_data_compat32 {
736	struct hpi_msg_format format;
737	u32 pb_data;
738	u32 padding;
739	u32 data_size;
740};
741#endif
742
743struct hpi_buffer {
744  /** placehoder for backward compatability (see dwBufferSize) */
745	struct hpi_msg_format reserved;
746	u32 command;	/**< HPI_BUFFER_CMD_xxx*/
747	u32 pci_address; /**< PCI physical address of buffer for DSP DMA */
748	u32 buffer_size; /**< must line up with data_size of HPI_DATA*/
749};
750
751/*/////////////////////////////////////////////////////////////////////////// */
752/* This is used for background buffer bus mastering stream buffers.           */
753struct hpi_hostbuffer_status {
754	u32 samples_processed;
755	u32 auxiliary_data_available;
756	u32 stream_state;
757	/* DSP index in to the host bus master buffer. */
758	u32 dSP_index;
759	/* Host index in to the host bus master buffer. */
760	u32 host_index;
761	u32 size_in_bytes;
762};
763
764struct hpi_streamid {
765	u16 object_type;
766		    /**< Type of object, HPI_OBJ_OSTREAM or HPI_OBJ_ISTREAM. */
767	u16 stream_index; /**< outstream or instream index. */
768};
769
770struct hpi_punchinout {
771	u32 punch_in_sample;
772	u32 punch_out_sample;
773};
774
775struct hpi_subsys_msg {
776	struct hpi_resource resource;
777};
778
779struct hpi_subsys_res {
780	u32 version;
781	u32 data;		/* used to return extended version */
782	u16 num_adapters;	/* number of adapters */
783	u16 adapter_index;
784	u16 aw_adapter_list[HPI_MAX_ADAPTERS];
785};
786
787struct hpi_adapter_msg {
788	u32 adapter_mode;	/* adapter mode */
789	u16 assert_id;		/* assert number for "test assert" call
790				   object_index for find object call
791				   query_or_set for hpi_adapter_set_mode_ex() */
792	u16 object_type;	/* for adapter find object call */
793};
794
795union hpi_adapterx_msg {
796	struct hpi_adapter_msg adapter;
797	struct {
798		u32 offset;
799	} query_flash;
800	struct {
801		u32 offset;
802		u32 length;
803		u32 key;
804	} start_flash;
805	struct {
806		u32 checksum;
807		u16 sequence;
808		u16 length;
809		u16 offset; /**< offset from start of msg to data */
810		u16 unused;
811	} program_flash;
812	struct {
813		u16 property;
814		u16 parameter1;
815		u16 parameter2;
816	} property_set;
817	struct {
818		u16 index;
819		u16 what;
820		u16 property_index;
821	} property_enum;
822	struct {
823		u16 index;
824	} module_info;
825	struct {
826		u32 dsp_address;
827		u32 count_bytes;
828	} debug_read;
829};
830
831struct hpi_adapter_res {
832	u32 serial_number;
833	u16 adapter_type;
834	u16 adapter_index;	/* is this needed? also used for dsp_index */
835	u16 num_instreams;
836	u16 num_outstreams;
837	u16 num_mixers;
838	u16 version;
839	u8 sz_adapter_assert[HPI_STRING_LEN];
840};
841
842union hpi_adapterx_res {
843	struct hpi_adapter_res adapter;
844	struct {
845		u32 checksum;
846		u32 length;
847		u32 version;
848	} query_flash;
849	struct {
850		u16 sequence;
851	} program_flash;
852	struct {
853		u16 parameter1;
854		u16 parameter2;
855	} property_get;
856};
857
858struct hpi_stream_msg {
859	union {
860		struct hpi_msg_data data;
861		struct hpi_data_legacy32 data32;
862		u16 velocity;
863		struct hpi_punchinout pio;
864		u32 time_scale;
865		struct hpi_buffer buffer;
866		struct hpi_streamid stream;
867	} u;
868};
869
870struct hpi_stream_res {
871	union {
872		struct {
873			/* size of hardware buffer */
874			u32 buffer_size;
875			/* OutStream - data to play,
876			   InStream - data recorded */
877			u32 data_available;
878			/* OutStream - samples played,
879			   InStream - samples recorded */
880			u32 samples_transferred;
881			/* Adapter - OutStream - data to play,
882			   InStream - data recorded */
883			u32 auxiliary_data_available;
884			u16 state;	/* HPI_STATE_PLAYING, _STATE_STOPPED */
885			u16 padding;
886		} stream_info;
887		struct {
888			u32 buffer_size;
889			u32 data_available;
890			u32 samples_transfered;
891			u16 state;
892			u16 outstream_index;
893			u16 instream_index;
894			u16 padding;
895			u32 auxiliary_data_available;
896		} legacy_stream_info;
897		struct {
898			/* bitmap of grouped OutStreams */
899			u32 outstream_group_map;
900			/* bitmap of grouped InStreams */
901			u32 instream_group_map;
902		} group_info;
903		struct {
904			/* pointer to the buffer */
905			u8 *p_buffer;
906			/* pointer to the hostbuffer status */
907			struct hpi_hostbuffer_status *p_status;
908		} hostbuffer_info;
909	} u;
910};
911
912struct hpi_mixer_msg {
913	u16 control_index;
914	u16 control_type;	/* = HPI_CONTROL_METER _VOLUME etc */
915	u16 padding1;		/* maintain alignment of subsequent fields */
916	u16 node_type1;		/* = HPI_SOURCENODE_LINEIN etc */
917	u16 node_index1;	/* = 0..N */
918	u16 node_type2;
919	u16 node_index2;
920	u16 padding2;		/* round to 4 bytes */
921};
922
923struct hpi_mixer_res {
924	u16 src_node_type;	/* = HPI_SOURCENODE_LINEIN etc */
925	u16 src_node_index;	/* = 0..N */
926	u16 dst_node_type;
927	u16 dst_node_index;
928	/* Also controlType for MixerGetControlByIndex */
929	u16 control_index;
930	/* may indicate which DSP the control is located on */
931	u16 dsp_index;
932};
933
934union hpi_mixerx_msg {
935	struct {
936		u16 starting_index;
937		u16 flags;
938		u32 length_in_bytes;	/* length in bytes of p_data */
939		u32 p_data;	/* pointer to a data array */
940	} gcabi;
941	struct {
942		u16 command;
943		u16 index;
944	} store;		/* for HPI_MIXER_STORE message */
945};
946
947union hpi_mixerx_res {
948	struct {
949		u32 bytes_returned;	/* size of items returned */
950		u32 p_data;	/* pointer to data array */
951		u16 more_to_do;	/* indicates if there is more to do */
952	} gcabi;
953};
954
955struct hpi_control_msg {
956	u16 attribute;		/* control attribute or property */
957	u16 saved_index;
958	u32 param1;		/* generic parameter 1 */
959	u32 param2;		/* generic parameter 2 */
960	short an_log_value[HPI_MAX_CHANNELS];
961};
962
963struct hpi_control_union_msg {
964	u16 attribute;		/* control attribute or property */
965	u16 saved_index;	/* only used in ctrl save/restore */
966	union {
967		struct {
968			u32 param1;	/* generic parameter 1 */
969			u32 param2;	/* generic parameter 2 */
970			short an_log_value[HPI_MAX_CHANNELS];
971		} old;
972		union {
973			u32 frequency;
974			u32 gain;
975			u32 band;
976			u32 deemphasis;
977			u32 program;
978			struct {
979				u32 mode;
980				u32 value;
981			} mode;
982			u32 blend;
983		} tuner;
984	} u;
985};
986
987struct hpi_control_res {
988	/* Could make union. dwParam, anLogValue never used in same response */
989	u32 param1;
990	u32 param2;
991	short an_log_value[HPI_MAX_CHANNELS];
992};
993
994union hpi_control_union_res {
995	struct {
996		u32 param1;
997		u32 param2;
998		short an_log_value[HPI_MAX_CHANNELS];
999	} old;
1000	union {
1001		u32 band;
1002		u32 frequency;
1003		u32 gain;
1004		u32 level;
1005		u32 deemphasis;
1006		struct {
1007			u32 data[2];
1008			u32 bLER;
1009		} rds;
1010	} tuner;
1011	struct {
1012		char sz_data[8];
1013		u32 remaining_chars;
1014	} chars8;
1015	char c_data12[12];
1016};
1017
1018/* HPI_CONTROLX_STRUCTURES */
1019
1020/* Message */
1021
1022/** Used for all HMI variables where max length <= 8 bytes
1023*/
1024struct hpi_controlx_msg_cobranet_data {
1025	u32 hmi_address;
1026	u32 byte_count;
1027	u32 data[2];
1028};
1029
1030/** Used for string data, and for packet bridge
1031*/
1032struct hpi_controlx_msg_cobranet_bigdata {
1033	u32 hmi_address;
1034	u32 byte_count;
1035	u8 *pb_data;
1036#ifndef HPI64BIT
1037	u32 padding;
1038#endif
1039};
1040
1041/** Used for PADS control reading of string fields.
1042*/
1043struct hpi_controlx_msg_pad_data {
1044	u32 field;
1045	u32 byte_count;
1046	u8 *pb_data;
1047#ifndef HPI64BIT
1048	u32 padding;
1049#endif
1050};
1051
1052/** Used for generic data
1053*/
1054
1055struct hpi_controlx_msg_generic {
1056	u32 param1;
1057	u32 param2;
1058};
1059
1060struct hpi_controlx_msg {
1061	u16 attribute;		/* control attribute or property */
1062	u16 saved_index;
1063	union {
1064		struct hpi_controlx_msg_cobranet_data cobranet_data;
1065		struct hpi_controlx_msg_cobranet_bigdata cobranet_bigdata;
1066		struct hpi_controlx_msg_generic generic;
1067		struct hpi_controlx_msg_pad_data pad_data;
1068		/*struct param_value universal_value; */
1069		/* nothing extra to send for status read */
1070	} u;
1071};
1072
1073/* Response */
1074/**
1075*/
1076struct hpi_controlx_res_cobranet_data {
1077	u32 byte_count;
1078	u32 data[2];
1079};
1080
1081struct hpi_controlx_res_cobranet_bigdata {
1082	u32 byte_count;
1083};
1084
1085struct hpi_controlx_res_cobranet_status {
1086	u32 status;
1087	u32 readable_size;
1088	u32 writeable_size;
1089};
1090
1091struct hpi_controlx_res_generic {
1092	u32 param1;
1093	u32 param2;
1094};
1095
1096struct hpi_controlx_res {
1097	union {
1098		struct hpi_controlx_res_cobranet_bigdata cobranet_bigdata;
1099		struct hpi_controlx_res_cobranet_data cobranet_data;
1100		struct hpi_controlx_res_cobranet_status cobranet_status;
1101		struct hpi_controlx_res_generic generic;
1102		/*struct param_info universal_info; */
1103		/*struct param_value universal_value; */
1104	} u;
1105};
1106
1107struct hpi_nvmemory_msg {
1108	u16 address;
1109	u16 data;
1110};
1111
1112struct hpi_nvmemory_res {
1113	u16 size_in_bytes;
1114	u16 data;
1115};
1116
1117struct hpi_gpio_msg {
1118	u16 bit_index;
1119	u16 bit_data;
1120};
1121
1122struct hpi_gpio_res {
1123	u16 number_input_bits;
1124	u16 number_output_bits;
1125	u16 bit_data[4];
1126};
1127
1128struct hpi_async_msg {
1129	u32 events;
1130	u16 maximum_events;
1131	u16 padding;
1132};
1133
1134struct hpi_async_res {
1135	union {
1136		struct {
1137			u16 count;
1138		} count;
1139		struct {
1140			u32 events;
1141			u16 number_returned;
1142			u16 padding;
1143		} get;
1144		struct hpi_async_event event;
1145	} u;
1146};
1147
1148struct hpi_watchdog_msg {
1149	u32 time_ms;
1150};
1151
1152struct hpi_watchdog_res {
1153	u32 time_ms;
1154};
1155
1156struct hpi_clock_msg {
1157	u16 hours;
1158	u16 minutes;
1159	u16 seconds;
1160	u16 milli_seconds;
1161};
1162
1163struct hpi_clock_res {
1164	u16 size_in_bytes;
1165	u16 hours;
1166	u16 minutes;
1167	u16 seconds;
1168	u16 milli_seconds;
1169	u16 padding;
1170};
1171
1172struct hpi_profile_msg {
1173	u16 bin_index;
1174	u16 padding;
1175};
1176
1177struct hpi_profile_res_open {
1178	u16 max_profiles;
1179};
1180
1181struct hpi_profile_res_time {
1182	u32 micro_seconds;
1183	u32 call_count;
1184	u32 max_micro_seconds;
1185	u32 min_micro_seconds;
1186	u16 seconds;
1187};
1188
1189struct hpi_profile_res_name {
1190	u8 sz_name[32];
1191};
1192
1193struct hpi_profile_res {
1194	union {
1195		struct hpi_profile_res_open o;
1196		struct hpi_profile_res_time t;
1197		struct hpi_profile_res_name n;
1198	} u;
1199};
1200
1201struct hpi_message_header {
1202	u16 size;		/* total size in bytes */
1203	u8 type;		/* HPI_TYPE_MESSAGE  */
1204	u8 version;		/* message version */
1205	u16 object;		/* HPI_OBJ_* */
1206	u16 function;		/* HPI_SUBSYS_xxx, HPI_ADAPTER_xxx */
1207	u16 adapter_index;	/* the adapter index */
1208	u16 obj_index;		/* */
1209};
1210
1211struct hpi_message {
1212	/* following fields must match HPI_MESSAGE_HEADER */
1213	u16 size;		/* total size in bytes */
1214	u8 type;		/* HPI_TYPE_MESSAGE  */
1215	u8 version;		/* message version */
1216	u16 object;		/* HPI_OBJ_* */
1217	u16 function;		/* HPI_SUBSYS_xxx, HPI_ADAPTER_xxx */
1218	u16 adapter_index;	/* the adapter index */
1219	u16 obj_index;		/*  */
1220	union {
1221		struct hpi_subsys_msg s;
1222		struct hpi_adapter_msg a;
1223		union hpi_adapterx_msg ax;
1224		struct hpi_stream_msg d;
1225		struct hpi_mixer_msg m;
1226		union hpi_mixerx_msg mx;	/* extended mixer; */
1227		struct hpi_control_msg c;	/* mixer control; */
1228		/* identical to struct hpi_control_msg,
1229		   but field naming is improved */
1230		struct hpi_control_union_msg cu;
1231		struct hpi_controlx_msg cx;	/* extended mixer control; */
1232		struct hpi_nvmemory_msg n;
1233		struct hpi_gpio_msg l;	/* digital i/o */
1234		struct hpi_watchdog_msg w;
1235		struct hpi_clock_msg t;	/* dsp time */
1236		struct hpi_profile_msg p;
1237		struct hpi_async_msg as;
1238		char fixed_size[32];
1239	} u;
1240};
1241
1242#define HPI_MESSAGE_SIZE_BY_OBJECT { \
1243	sizeof(struct hpi_message_header) ,   /* default, no object type 0 */ \
1244	sizeof(struct hpi_message_header) + sizeof(struct hpi_subsys_msg),\
1245	sizeof(struct hpi_message_header) + sizeof(union hpi_adapterx_msg),\
1246	sizeof(struct hpi_message_header) + sizeof(struct hpi_stream_msg),\
1247	sizeof(struct hpi_message_header) + sizeof(struct hpi_stream_msg),\
1248	sizeof(struct hpi_message_header) + sizeof(struct hpi_mixer_msg),\
1249	sizeof(struct hpi_message_header) ,   /* no node message */ \
1250	sizeof(struct hpi_message_header) + sizeof(struct hpi_control_msg),\
1251	sizeof(struct hpi_message_header) + sizeof(struct hpi_nvmemory_msg),\
1252	sizeof(struct hpi_message_header) + sizeof(struct hpi_gpio_msg),\
1253	sizeof(struct hpi_message_header) + sizeof(struct hpi_watchdog_msg),\
1254	sizeof(struct hpi_message_header) + sizeof(struct hpi_clock_msg),\
1255	sizeof(struct hpi_message_header) + sizeof(struct hpi_profile_msg),\
1256	sizeof(struct hpi_message_header) + sizeof(struct hpi_controlx_msg),\
1257	sizeof(struct hpi_message_header) + sizeof(struct hpi_async_msg) \
1258}
1259
1260struct hpi_response_header {
1261	u16 size;
1262	u8 type;		/* HPI_TYPE_RESPONSE  */
1263	u8 version;		/* response version */
1264	u16 object;		/* HPI_OBJ_* */
1265	u16 function;		/* HPI_SUBSYS_xxx, HPI_ADAPTER_xxx */
1266	u16 error;		/* HPI_ERROR_xxx */
1267	u16 specific_error;	/* adapter specific error */
1268};
1269
1270struct hpi_response {
1271/* following fields must match HPI_RESPONSE_HEADER */
1272	u16 size;
1273	u8 type;		/* HPI_TYPE_RESPONSE  */
1274	u8 version;		/* response version */
1275	u16 object;		/* HPI_OBJ_* */
1276	u16 function;		/* HPI_SUBSYS_xxx, HPI_ADAPTER_xxx */
1277	u16 error;		/* HPI_ERROR_xxx */
1278	u16 specific_error;	/* adapter specific error */
1279	union {
1280		struct hpi_subsys_res s;
1281		struct hpi_adapter_res a;
1282		union hpi_adapterx_res ax;
1283		struct hpi_stream_res d;
1284		struct hpi_mixer_res m;
1285		union hpi_mixerx_res mx;	/* extended mixer; */
1286		struct hpi_control_res c;	/* mixer control; */
1287		/* identical to hpi_control_res, but field naming is improved */
1288		union hpi_control_union_res cu;
1289		struct hpi_controlx_res cx;	/* extended mixer control; */
1290		struct hpi_nvmemory_res n;
1291		struct hpi_gpio_res l;	/* digital i/o */
1292		struct hpi_watchdog_res w;
1293		struct hpi_clock_res t;	/* dsp time */
1294		struct hpi_profile_res p;
1295		struct hpi_async_res as;
1296		u8 bytes[52];
1297	} u;
1298};
1299
1300#define HPI_RESPONSE_SIZE_BY_OBJECT { \
1301	sizeof(struct hpi_response_header) ,/* default, no object type 0 */ \
1302	sizeof(struct hpi_response_header) + sizeof(struct hpi_subsys_res),\
1303	sizeof(struct hpi_response_header) + sizeof(union  hpi_adapterx_res),\
1304	sizeof(struct hpi_response_header) + sizeof(struct hpi_stream_res),\
1305	sizeof(struct hpi_response_header) + sizeof(struct hpi_stream_res),\
1306	sizeof(struct hpi_response_header) + sizeof(struct hpi_mixer_res),\
1307	sizeof(struct hpi_response_header) , /* no node response */ \
1308	sizeof(struct hpi_response_header) + sizeof(struct hpi_control_res),\
1309	sizeof(struct hpi_response_header) + sizeof(struct hpi_nvmemory_res),\
1310	sizeof(struct hpi_response_header) + sizeof(struct hpi_gpio_res),\
1311	sizeof(struct hpi_response_header) + sizeof(struct hpi_watchdog_res),\
1312	sizeof(struct hpi_response_header) + sizeof(struct hpi_clock_res),\
1313	sizeof(struct hpi_response_header) + sizeof(struct hpi_profile_res),\
1314	sizeof(struct hpi_response_header) + sizeof(struct hpi_controlx_res),\
1315	sizeof(struct hpi_response_header) + sizeof(struct hpi_async_res) \
1316}
1317
1318/*********************** version 1 message/response *****************************/
1319#define HPINET_ETHERNET_DATA_SIZE (1500)
1320#define HPINET_IP_HDR_SIZE (20)
1321#define HPINET_IP_DATA_SIZE (HPINET_ETHERNET_DATA_SIZE - HPINET_IP_HDR_SIZE)
1322#define HPINET_UDP_HDR_SIZE (8)
1323#define HPINET_UDP_DATA_SIZE (HPINET_IP_DATA_SIZE - HPINET_UDP_HDR_SIZE)
1324#define HPINET_ASI_HDR_SIZE (2)
1325#define HPINET_ASI_DATA_SIZE (HPINET_UDP_DATA_SIZE - HPINET_ASI_HDR_SIZE)
1326
1327#define HPI_MAX_PAYLOAD_SIZE (HPINET_ASI_DATA_SIZE - 2)
1328
1329/* New style message/response, but still V0 compatible */
1330struct hpi_msg_adapter_get_info {
1331	struct hpi_message_header h;
1332};
1333
1334struct hpi_res_adapter_get_info {
1335	struct hpi_response_header h;	/*v0 */
1336	struct hpi_adapter_res p;
1337};
1338
1339/* padding is so these are same size as v0 hpi_message */
1340struct hpi_msg_adapter_query_flash {
1341	struct hpi_message_header h;
1342	u32 offset;
1343	u8 pad_to_version0_size[sizeof(struct hpi_message) -	/* V0 res */
1344		sizeof(struct hpi_message_header) - 1 * sizeof(u32)];
1345};
1346
1347/* padding is so these are same size as v0 hpi_response */
1348struct hpi_res_adapter_query_flash {
1349	struct hpi_response_header h;
1350	u32 checksum;
1351	u32 length;
1352	u32 version;
1353	u8 pad_to_version0_size[sizeof(struct hpi_response) -	/* V0 res */
1354		sizeof(struct hpi_response_header) - 3 * sizeof(u32)];
1355};
1356
1357struct hpi_msg_adapter_start_flash {
1358	struct hpi_message_header h;
1359	u32 offset;
1360	u32 length;
1361	u32 key;
1362	u8 pad_to_version0_size[sizeof(struct hpi_message) -	/* V0 res */
1363		sizeof(struct hpi_message_header) - 3 * sizeof(u32)];
1364};
1365
1366struct hpi_res_adapter_start_flash {
1367	struct hpi_response_header h;
1368	u8 pad_to_version0_size[sizeof(struct hpi_response) -	/* V0 res */
1369		sizeof(struct hpi_response_header)];
1370};
1371
1372struct hpi_msg_adapter_program_flash_payload {
1373	u32 checksum;
1374	u16 sequence;
1375	u16 length;
1376	u16 offset; /**< offset from start of msg to data */
1377	u16 unused;
1378	/* ensure sizeof(header + payload) == sizeof(hpi_message_V0)
1379	   because old firmware expects data after message of this size */
1380	u8 pad_to_version0_size[sizeof(struct hpi_message) -	/* V0 message */
1381		sizeof(struct hpi_message_header) - sizeof(u32) -
1382		4 * sizeof(u16)];
1383};
1384
1385struct hpi_msg_adapter_program_flash {
1386	struct hpi_message_header h;
1387	struct hpi_msg_adapter_program_flash_payload p;
1388	u32 data[256];
1389};
1390
1391struct hpi_res_adapter_program_flash {
1392	struct hpi_response_header h;
1393	u16 sequence;
1394	u8 pad_to_version0_size[sizeof(struct hpi_response) -	/* V0 res */
1395		sizeof(struct hpi_response_header) - sizeof(u16)];
1396};
1397
1398#define hpi_message_header_v1 hpi_message_header
1399#define hpi_response_header_v1 hpi_response_header
1400
1401/* STRV HPI Packet */
1402struct hpi_msg_strv {
1403	struct hpi_message_header h;
1404	struct hpi_entity strv;
1405};
1406
1407struct hpi_res_strv {
1408	struct hpi_response_header h;
1409	struct hpi_entity strv;
1410};
1411#define MIN_STRV_PACKET_SIZE sizeof(struct hpi_res_strv)
1412
1413struct hpi_msg_payload_v0 {
1414	struct hpi_message_header h;
1415	union {
1416		struct hpi_subsys_msg s;
1417		struct hpi_adapter_msg a;
1418		union hpi_adapterx_msg ax;
1419		struct hpi_stream_msg d;
1420		struct hpi_mixer_msg m;
1421		union hpi_mixerx_msg mx;
1422		struct hpi_control_msg c;
1423		struct hpi_control_union_msg cu;
1424		struct hpi_controlx_msg cx;
1425		struct hpi_nvmemory_msg n;
1426		struct hpi_gpio_msg l;
1427		struct hpi_watchdog_msg w;
1428		struct hpi_clock_msg t;
1429		struct hpi_profile_msg p;
1430		struct hpi_async_msg as;
1431	} u;
1432};
1433
1434struct hpi_res_payload_v0 {
1435	struct hpi_response_header h;
1436	union {
1437		struct hpi_subsys_res s;
1438		struct hpi_adapter_res a;
1439		union hpi_adapterx_res ax;
1440		struct hpi_stream_res d;
1441		struct hpi_mixer_res m;
1442		union hpi_mixerx_res mx;
1443		struct hpi_control_res c;
1444		union hpi_control_union_res cu;
1445		struct hpi_controlx_res cx;
1446		struct hpi_nvmemory_res n;
1447		struct hpi_gpio_res l;
1448		struct hpi_watchdog_res w;
1449		struct hpi_clock_res t;
1450		struct hpi_profile_res p;
1451		struct hpi_async_res as;
1452	} u;
1453};
1454
1455union hpi_message_buffer_v1 {
1456	struct hpi_message m0;	/* version 0 */
1457	struct hpi_message_header_v1 h;
1458	unsigned char buf[HPI_MAX_PAYLOAD_SIZE];
1459};
1460
1461union hpi_response_buffer_v1 {
1462	struct hpi_response r0;	/* version 0 */
1463	struct hpi_response_header_v1 h;
1464	unsigned char buf[HPI_MAX_PAYLOAD_SIZE];
1465};
1466
1467compile_time_assert((sizeof(union hpi_message_buffer_v1) <=
1468		HPI_MAX_PAYLOAD_SIZE), message_buffer_ok);
1469compile_time_assert((sizeof(union hpi_response_buffer_v1) <=
1470		HPI_MAX_PAYLOAD_SIZE), response_buffer_ok);
1471
1472/*////////////////////////////////////////////////////////////////////////// */
1473/* declarations for compact control calls  */
1474struct hpi_control_defn {
1475	u8 type;
1476	u8 channels;
1477	u8 src_node_type;
1478	u8 src_node_index;
1479	u8 dest_node_type;
1480	u8 dest_node_index;
1481};
1482
1483/*////////////////////////////////////////////////////////////////////////// */
1484/* declarations for control caching (internal to HPI<->DSP interaction)      */
1485
1486/** A compact representation of (part of) a controls state.
1487Used for efficient transfer of the control state
1488between DSP and host or across a network
1489*/
1490struct hpi_control_cache_info {
1491	/** one of HPI_CONTROL_* */
1492	u8 control_type;
1493	/** The total size of cached information in 32-bit words. */
1494	u8 size_in32bit_words;
1495	/** The original index of the control on the DSP */
1496	u16 control_index;
1497};
1498
1499struct hpi_control_cache_single {
1500	struct hpi_control_cache_info i;
1501	union {
1502		struct {	/* volume */
1503			short an_log[2];
1504		} v;
1505		struct {	/* peak meter */
1506			short an_log_peak[2];
1507			short an_logRMS[2];
1508		} p;
1509		struct {	/* channel mode */
1510			u16 mode;
1511		} m;
1512		struct {	/* multiplexer */
1513			u16 source_node_type;
1514			u16 source_node_index;
1515		} x;
1516		struct {	/* level/trim */
1517			short an_log[2];
1518		} l;
1519		struct {	/* tuner - partial caching.
1520				   some attributes go to the DSP. */
1521			u32 freq_ink_hz;
1522			u16 band;
1523			u16 level;
1524		} t;
1525		struct {	/* AESEBU rx status */
1526			u32 error_status;
1527			u32 source;
1528		} aes3rx;
1529		struct {	/* AESEBU tx */
1530			u32 format;
1531		} aes3tx;
1532		struct {	/* tone detector */
1533			u16 state;
1534		} tone;
1535		struct {	/* silence detector */
1536			u32 state;
1537			u32 count;
1538		} silence;
1539		struct {	/* sample clock */
1540			u16 source;
1541			u16 source_index;
1542			u32 sample_rate;
1543		} clk;
1544		struct {	/* microphone control */
1545			u16 state;
1546		} phantom_power;
1547		struct {	/* generic control */
1548			u32 dw1;
1549			u32 dw2;
1550		} g;
1551	} u;
1552};
1553
1554struct hpi_control_cache_pad {
1555	struct hpi_control_cache_info i;
1556	u32 field_valid_flags;
1557	u8 c_channel[8];
1558	u8 c_artist[40];
1559	u8 c_title[40];
1560	u8 c_comment[200];
1561	u32 pTY;
1562	u32 pI;
1563	u32 traffic_supported;
1564	u32 traffic_anouncement;
1565};
1566
1567/*/////////////////////////////////////////////////////////////////////////// */
1568/* declarations for 2^N sized FIFO buffer (internal to HPI<->DSP interaction) */
1569struct hpi_fifo_buffer {
1570	u32 size;
1571	u32 dSP_index;
1572	u32 host_index;
1573};
1574
1575#ifndef DISABLE_PRAGMA_PACK1
1576#pragma pack(pop)
1577#endif
1578
1579/* skip host side function declarations for DSP
1580   compile and documentation extraction */
1581
1582char hpi_handle_object(const u32 handle);
1583
1584void hpi_handle_to_indexes(const u32 handle, u16 *pw_adapter_index,
1585	u16 *pw_object_index);
1586
1587u32 hpi_indexes_to_handle(const char c_object, const u16 adapter_index,
1588	const u16 object_index);
1589
1590/*////////////////////////////////////////////////////////////////////////// */
1591
1592/* main HPI entry point */
1593hpi_handler_func hpi_send_recv;
1594
1595/* UDP message */
1596void hpi_send_recvUDP(struct hpi_message *phm, struct hpi_response *phr,
1597	const unsigned int timeout);
1598
1599/* used in PnP OS/driver */
1600u16 hpi_subsys_create_adapter(const struct hpi_hsubsys *ph_subsys,
1601	const struct hpi_resource *p_resource, u16 *pw_adapter_index);
1602
1603u16 hpi_subsys_delete_adapter(const struct hpi_hsubsys *ph_subsys,
1604	u16 adapter_index);
1605
1606u16 hpi_outstream_host_buffer_get_info(const struct hpi_hsubsys *ph_subsys,
1607	u32 h_outstream, u8 **pp_buffer,
1608	struct hpi_hostbuffer_status **pp_status);
1609
1610u16 hpi_instream_host_buffer_get_info(const struct hpi_hsubsys *ph_subsys,
1611	u32 h_instream, u8 **pp_buffer,
1612	struct hpi_hostbuffer_status **pp_status);
1613
1614u16 hpi_adapter_restart(u16 adapter_index);
1615
1616/*
1617The following 3 functions were last declared in header files for
1618driver 3.10. HPI_ControlQuery() used to be the recommended way
1619of getting a volume range. Declared here for binary asihpi32.dll
1620compatibility.
1621*/
1622
1623void hpi_format_to_msg(struct hpi_msg_format *pMF,
1624	const struct hpi_format *pF);
1625void hpi_stream_response_to_legacy(struct hpi_stream_res *pSR);
1626
1627/*////////////////////////////////////////////////////////////////////////// */
1628/* declarations for individual HPI entry points */
1629hpi_handler_func HPI_1000;
1630hpi_handler_func HPI_6000;
1631hpi_handler_func HPI_6205;
1632hpi_handler_func HPI_COMMON;
1633
1634#endif				/* _HPI_INTERNAL_H_ */
1635