Merge remote-tracking branch 'asoc/fix/dapm' into asoc-linus
[deliverable/linux.git] / sound / pci / asihpi / hpi_internal.h
CommitLineData
719f82d3
EB
1/******************************************************************************
2
3 AudioScience HPI driver
92fd918c 4 Copyright (C) 1997-2012 AudioScience Inc. <support@audioscience.com>
719f82d3
EB
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"
d8aefaef 28
719f82d3
EB
29/** maximum number of memory regions mapped to an adapter */
30#define HPI_MAX_ADAPTER_MEM_SPACES (2)
31
3285ea10 32/* Each OS needs its own hpios.h */
719f82d3
EB
33#include "hpios.h"
34
35/* physical memory allocation */
719f82d3
EB
36
37/** Allocate and map an area of locked memory for bus master DMA operations.
38
39On success, *pLockedMemeHandle is a valid handle, and 0 is returned
40On error *pLockedMemHandle marked invalid, non-zero returned.
41
42If this function succeeds, then HpiOs_LockedMem_GetVirtAddr() and
43HpiOs_LockedMem_GetPyhsAddr() will always succed on the returned handle.
44*/
92fd918c 45u16 hpios_locked_mem_alloc(struct consistent_dma_area *p_locked_mem_handle,
719f82d3 46 /**< memory handle */
3285ea10 47 u32 size, /**< Size in bytes to allocate */
719f82d3
EB
48 struct pci_dev *p_os_reference
49 /**< OS specific data required for memory allocation */
50 );
51
52/** Free mapping and memory represented by LockedMemHandle
53
54Frees any resources, then invalidates the handle.
55Returns 0 on success, 1 if handle is invalid.
56
57*/
58u16 hpios_locked_mem_free(struct consistent_dma_area *locked_mem_handle);
59
60/** Get the physical PCI address of memory represented by LockedMemHandle.
61
62If handle is invalid *pPhysicalAddr is set to zero and return 1
63*/
64u16 hpios_locked_mem_get_phys_addr(struct consistent_dma_area
65 *locked_mem_handle, u32 *p_physical_addr);
66
67/** Get the CPU address of of memory represented by LockedMemHandle.
68
69If handle is NULL *ppvVirtualAddr is set to NULL and return 1
70*/
71u16 hpios_locked_mem_get_virt_addr(struct consistent_dma_area
72 *locked_mem_handle, void **ppv_virtual_addr);
73
74/** Check that handle is valid
75i.e it represents a valid memory area
76*/
77u16 hpios_locked_mem_valid(struct consistent_dma_area *locked_mem_handle);
78
79/* timing/delay */
80void hpios_delay_micro_seconds(u32 num_micro_sec);
81
82struct hpi_message;
83struct hpi_response;
84
85typedef void hpi_handler_func(struct hpi_message *, struct hpi_response *);
86
87/* If the assert fails, compiler complains
88 something like size of array `msg' is negative.
89 Unlike linux BUILD_BUG_ON, this works outside function scope.
90*/
91#define compile_time_assert(cond, msg) \
92 typedef char ASSERT_##msg[(cond) ? 1 : -1]
93
719f82d3
EB
94/******************************************* bus types */
95enum HPI_BUSES {
96 HPI_BUS_ISAPNP = 1,
97 HPI_BUS_PCI = 2,
98 HPI_BUS_USB = 3,
99 HPI_BUS_NET = 4
100};
101
ba94455c
EB
102enum HPI_SUBSYS_OPTIONS {
103 /* 0, 256 are invalid, 1..255 reserved for global options */
104 HPI_SUBSYS_OPT_NET_ENABLE = 257,
105 HPI_SUBSYS_OPT_NET_BROADCAST = 258,
106 HPI_SUBSYS_OPT_NET_UNICAST = 259,
107 HPI_SUBSYS_OPT_NET_ADDR = 260,
108 HPI_SUBSYS_OPT_NET_MASK = 261,
109 HPI_SUBSYS_OPT_NET_ADAPTER_ADDRESS_ADD = 262
110};
111
fc3a3990
EB
112/** Volume flags
113*/
114enum HPI_VOLUME_FLAGS {
115 /** Set if the volume control is muted */
116 HPI_VOLUME_FLAG_MUTED = (1 << 0),
117 /** Set if the volume control has a mute function */
118 HPI_VOLUME_FLAG_HAS_MUTE = (1 << 1),
119 /** Set if volume control can do autofading */
120 HPI_VOLUME_FLAG_HAS_AUTOFADE = (1 << 2)
121 /* Note Flags >= (1<<8) are for DSP internal use only */
122};
123
719f82d3
EB
124/******************************************* CONTROL ATTRIBUTES ****/
125/* (in order of control type ID */
126
108ccb3f 127/* This allows for 255 control types, 256 unique attributes each */
3285ea10 128#define HPI_CTL_ATTR(ctl, ai) ((HPI_CONTROL_##ctl << 8) + ai)
719f82d3
EB
129
130/* Get the sub-index of the attribute for a control type */
3285ea10 131#define HPI_CTL_ATTR_INDEX(i) (i & 0xff)
719f82d3 132
108ccb3f 133/* Extract the control from the control attribute */
3285ea10 134#define HPI_CTL_ATTR_CONTROL(i) (i >> 8)
719f82d3
EB
135
136/** Enable event generation for a control.
1370=disable, 1=enable
138\note generic to all controls that can generate events
139*/
3285ea10
EB
140
141/** Unique identifiers for every control attribute
719f82d3 142*/
3285ea10
EB
143enum HPI_CONTROL_ATTRIBUTES {
144 HPI_GENERIC_ENABLE = HPI_CTL_ATTR(GENERIC, 1),
145 HPI_GENERIC_EVENT_ENABLE = HPI_CTL_ATTR(GENERIC, 2),
146
147 HPI_VOLUME_GAIN = HPI_CTL_ATTR(VOLUME, 1),
148 HPI_VOLUME_AUTOFADE = HPI_CTL_ATTR(VOLUME, 2),
fc3a3990
EB
149 HPI_VOLUME_MUTE = HPI_CTL_ATTR(VOLUME, 3),
150 HPI_VOLUME_GAIN_AND_FLAGS = HPI_CTL_ATTR(VOLUME, 4),
3285ea10
EB
151 HPI_VOLUME_NUM_CHANNELS = HPI_CTL_ATTR(VOLUME, 6),
152 HPI_VOLUME_RANGE = HPI_CTL_ATTR(VOLUME, 10),
153
154 HPI_METER_RMS = HPI_CTL_ATTR(METER, 1),
155 HPI_METER_PEAK = HPI_CTL_ATTR(METER, 2),
156 HPI_METER_RMS_BALLISTICS = HPI_CTL_ATTR(METER, 3),
157 HPI_METER_PEAK_BALLISTICS = HPI_CTL_ATTR(METER, 4),
158 HPI_METER_NUM_CHANNELS = HPI_CTL_ATTR(METER, 5),
159
160 HPI_MULTIPLEXER_SOURCE = HPI_CTL_ATTR(MULTIPLEXER, 1),
161 HPI_MULTIPLEXER_QUERYSOURCE = HPI_CTL_ATTR(MULTIPLEXER, 2),
162
163 HPI_AESEBUTX_FORMAT = HPI_CTL_ATTR(AESEBUTX, 1),
164 HPI_AESEBUTX_SAMPLERATE = HPI_CTL_ATTR(AESEBUTX, 3),
165 HPI_AESEBUTX_CHANNELSTATUS = HPI_CTL_ATTR(AESEBUTX, 4),
166 HPI_AESEBUTX_USERDATA = HPI_CTL_ATTR(AESEBUTX, 5),
167
168 HPI_AESEBURX_FORMAT = HPI_CTL_ATTR(AESEBURX, 1),
169 HPI_AESEBURX_ERRORSTATUS = HPI_CTL_ATTR(AESEBURX, 2),
170 HPI_AESEBURX_SAMPLERATE = HPI_CTL_ATTR(AESEBURX, 3),
171 HPI_AESEBURX_CHANNELSTATUS = HPI_CTL_ATTR(AESEBURX, 4),
172 HPI_AESEBURX_USERDATA = HPI_CTL_ATTR(AESEBURX, 5),
173
174 HPI_LEVEL_GAIN = HPI_CTL_ATTR(LEVEL, 1),
175 HPI_LEVEL_RANGE = HPI_CTL_ATTR(LEVEL, 10),
176
177 HPI_TUNER_BAND = HPI_CTL_ATTR(TUNER, 1),
178 HPI_TUNER_FREQ = HPI_CTL_ATTR(TUNER, 2),
179 HPI_TUNER_LEVEL_AVG = HPI_CTL_ATTR(TUNER, 3),
180 HPI_TUNER_LEVEL_RAW = HPI_CTL_ATTR(TUNER, 4),
181 HPI_TUNER_SNR = HPI_CTL_ATTR(TUNER, 5),
182 HPI_TUNER_GAIN = HPI_CTL_ATTR(TUNER, 6),
183 HPI_TUNER_STATUS = HPI_CTL_ATTR(TUNER, 7),
184 HPI_TUNER_MODE = HPI_CTL_ATTR(TUNER, 8),
185 HPI_TUNER_RDS = HPI_CTL_ATTR(TUNER, 9),
186 HPI_TUNER_DEEMPHASIS = HPI_CTL_ATTR(TUNER, 10),
187 HPI_TUNER_PROGRAM = HPI_CTL_ATTR(TUNER, 11),
188 HPI_TUNER_HDRADIO_SIGNAL_QUALITY = HPI_CTL_ATTR(TUNER, 12),
189 HPI_TUNER_HDRADIO_SDK_VERSION = HPI_CTL_ATTR(TUNER, 13),
190 HPI_TUNER_HDRADIO_DSP_VERSION = HPI_CTL_ATTR(TUNER, 14),
191 HPI_TUNER_HDRADIO_BLEND = HPI_CTL_ATTR(TUNER, 15),
192
193 HPI_VOX_THRESHOLD = HPI_CTL_ATTR(VOX, 1),
194
195 HPI_CHANNEL_MODE_MODE = HPI_CTL_ATTR(CHANNEL_MODE, 1),
196
197 HPI_BITSTREAM_DATA_POLARITY = HPI_CTL_ATTR(BITSTREAM, 1),
198 HPI_BITSTREAM_CLOCK_EDGE = HPI_CTL_ATTR(BITSTREAM, 2),
199 HPI_BITSTREAM_CLOCK_SOURCE = HPI_CTL_ATTR(BITSTREAM, 3),
200 HPI_BITSTREAM_ACTIVITY = HPI_CTL_ATTR(BITSTREAM, 4),
201
202 HPI_SAMPLECLOCK_SOURCE = HPI_CTL_ATTR(SAMPLECLOCK, 1),
203 HPI_SAMPLECLOCK_SAMPLERATE = HPI_CTL_ATTR(SAMPLECLOCK, 2),
204 HPI_SAMPLECLOCK_SOURCE_INDEX = HPI_CTL_ATTR(SAMPLECLOCK, 3),
205 HPI_SAMPLECLOCK_LOCAL_SAMPLERATE = HPI_CTL_ATTR(SAMPLECLOCK, 4),
206 HPI_SAMPLECLOCK_AUTO = HPI_CTL_ATTR(SAMPLECLOCK, 5),
207 HPI_SAMPLECLOCK_LOCAL_LOCK = HPI_CTL_ATTR(SAMPLECLOCK, 6),
208
209 HPI_MICROPHONE_PHANTOM_POWER = HPI_CTL_ATTR(MICROPHONE, 1),
210
211 HPI_EQUALIZER_NUM_FILTERS = HPI_CTL_ATTR(EQUALIZER, 1),
212 HPI_EQUALIZER_FILTER = HPI_CTL_ATTR(EQUALIZER, 2),
213 HPI_EQUALIZER_COEFFICIENTS = HPI_CTL_ATTR(EQUALIZER, 3),
214
215 HPI_COMPANDER_PARAMS = HPI_CTL_ATTR(COMPANDER, 1),
216 HPI_COMPANDER_MAKEUPGAIN = HPI_CTL_ATTR(COMPANDER, 2),
217 HPI_COMPANDER_THRESHOLD = HPI_CTL_ATTR(COMPANDER, 3),
218 HPI_COMPANDER_RATIO = HPI_CTL_ATTR(COMPANDER, 4),
219 HPI_COMPANDER_ATTACK = HPI_CTL_ATTR(COMPANDER, 5),
220 HPI_COMPANDER_DECAY = HPI_CTL_ATTR(COMPANDER, 6),
221
222 HPI_COBRANET_SET = HPI_CTL_ATTR(COBRANET, 1),
223 HPI_COBRANET_GET = HPI_CTL_ATTR(COBRANET, 2),
3285ea10
EB
224 HPI_COBRANET_GET_STATUS = HPI_CTL_ATTR(COBRANET, 5),
225 HPI_COBRANET_SEND_PACKET = HPI_CTL_ATTR(COBRANET, 6),
226 HPI_COBRANET_GET_PACKET = HPI_CTL_ATTR(COBRANET, 7),
227
228 HPI_TONEDETECTOR_THRESHOLD = HPI_CTL_ATTR(TONEDETECTOR, 1),
229 HPI_TONEDETECTOR_STATE = HPI_CTL_ATTR(TONEDETECTOR, 2),
230 HPI_TONEDETECTOR_FREQUENCY = HPI_CTL_ATTR(TONEDETECTOR, 3),
231
232 HPI_SILENCEDETECTOR_THRESHOLD = HPI_CTL_ATTR(SILENCEDETECTOR, 1),
233 HPI_SILENCEDETECTOR_STATE = HPI_CTL_ATTR(SILENCEDETECTOR, 2),
234 HPI_SILENCEDETECTOR_DELAY = HPI_CTL_ATTR(SILENCEDETECTOR, 3),
235
236 HPI_PAD_CHANNEL_NAME = HPI_CTL_ATTR(PAD, 1),
237 HPI_PAD_ARTIST = HPI_CTL_ATTR(PAD, 2),
238 HPI_PAD_TITLE = HPI_CTL_ATTR(PAD, 3),
239 HPI_PAD_COMMENT = HPI_CTL_ATTR(PAD, 4),
240 HPI_PAD_PROGRAM_TYPE = HPI_CTL_ATTR(PAD, 5),
241 HPI_PAD_PROGRAM_ID = HPI_CTL_ATTR(PAD, 6),
242 HPI_PAD_TA_SUPPORT = HPI_CTL_ATTR(PAD, 7),
72868339
EB
243 HPI_PAD_TA_ACTIVE = HPI_CTL_ATTR(PAD, 8),
244
245 HPI_UNIVERSAL_ENTITY = HPI_CTL_ATTR(UNIVERSAL, 1)
3285ea10 246};
719f82d3
EB
247
248#define HPI_POLARITY_POSITIVE 0
249#define HPI_POLARITY_NEGATIVE 1
250
719f82d3
EB
251/*------------------------------------------------------------
252 Cobranet Chip Bridge - copied from HMI.H
253------------------------------------------------------------*/
254#define HPI_COBRANET_HMI_cobra_bridge 0x20000
255#define HPI_COBRANET_HMI_cobra_bridge_tx_pkt_buf \
256 (HPI_COBRANET_HMI_cobra_bridge + 0x1000)
257#define HPI_COBRANET_HMI_cobra_bridge_rx_pkt_buf \
258 (HPI_COBRANET_HMI_cobra_bridge + 0x2000)
259#define HPI_COBRANET_HMI_cobra_if_table1 0x110000
260#define HPI_COBRANET_HMI_cobra_if_phy_address \
261 (HPI_COBRANET_HMI_cobra_if_table1 + 0xd)
262#define HPI_COBRANET_HMI_cobra_protocolIP 0x72000
263#define HPI_COBRANET_HMI_cobra_ip_mon_currentIP \
264 (HPI_COBRANET_HMI_cobra_protocolIP + 0x0)
265#define HPI_COBRANET_HMI_cobra_ip_mon_staticIP \
266 (HPI_COBRANET_HMI_cobra_protocolIP + 0x2)
267#define HPI_COBRANET_HMI_cobra_sys 0x100000
268#define HPI_COBRANET_HMI_cobra_sys_desc \
269 (HPI_COBRANET_HMI_cobra_sys + 0x0)
270#define HPI_COBRANET_HMI_cobra_sys_objectID \
271 (HPI_COBRANET_HMI_cobra_sys + 0x100)
272#define HPI_COBRANET_HMI_cobra_sys_contact \
273 (HPI_COBRANET_HMI_cobra_sys + 0x200)
274#define HPI_COBRANET_HMI_cobra_sys_name \
275 (HPI_COBRANET_HMI_cobra_sys + 0x300)
276#define HPI_COBRANET_HMI_cobra_sys_location \
277 (HPI_COBRANET_HMI_cobra_sys + 0x400)
278
279/*------------------------------------------------------------
280 Cobranet Chip Status bits
281------------------------------------------------------------*/
282#define HPI_COBRANET_HMI_STATUS_RXPACKET 2
283#define HPI_COBRANET_HMI_STATUS_TXPACKET 3
284
285/*------------------------------------------------------------
286 Ethernet header size
287------------------------------------------------------------*/
288#define HPI_ETHERNET_HEADER_SIZE (16)
289
290/* These defines are used to fill in protocol information for an Ethernet packet
291 sent using HMI on CS18102 */
6d0b898e 292/** ID supplied by Cirrus for ASI packets. */
719f82d3
EB
293#define HPI_ETHERNET_PACKET_ID 0x85
294/** Simple packet - no special routing required */
295#define HPI_ETHERNET_PACKET_V1 0x01
296/** This packet must make its way to the host across the HPI interface */
297#define HPI_ETHERNET_PACKET_HOSTED_VIA_HMI 0x20
298/** This packet must make its way to the host across the HPI interface */
299#define HPI_ETHERNET_PACKET_HOSTED_VIA_HMI_V1 0x21
300/** This packet must make its way to the host across the HPI interface */
301#define HPI_ETHERNET_PACKET_HOSTED_VIA_HPI 0x40
302/** This packet must make its way to the host across the HPI interface */
303#define HPI_ETHERNET_PACKET_HOSTED_VIA_HPI_V1 0x41
304
6d0b898e 305#define HPI_ETHERNET_UDP_PORT 44600 /**< HPI UDP service */
719f82d3 306
a287ca2a
EB
307/** Default network timeout in milli-seconds. */
308#define HPI_ETHERNET_TIMEOUT_MS 500
719f82d3 309
3285ea10
EB
310/** Locked memory buffer alloc/free phases */
311enum HPI_BUFFER_CMDS {
312 /** use one message to allocate or free physical memory */
313 HPI_BUFFER_CMD_EXTERNAL = 0,
314 /** alloc physical memory */
315 HPI_BUFFER_CMD_INTERNAL_ALLOC = 1,
316 /** send physical memory address to adapter */
317 HPI_BUFFER_CMD_INTERNAL_GRANTADAPTER = 2,
318 /** notify adapter to stop using physical buffer */
319 HPI_BUFFER_CMD_INTERNAL_REVOKEADAPTER = 3,
320 /** free physical buffer */
321 HPI_BUFFER_CMD_INTERNAL_FREE = 4
322};
719f82d3
EB
323
324/*****************************************************************************/
325/*****************************************************************************/
326/******** HPI LOW LEVEL MESSAGES *******/
327/*****************************************************************************/
328/*****************************************************************************/
329/** Pnp ids */
330/** "ASI" - actual is "ASX" - need to change */
331#define HPI_ID_ISAPNP_AUDIOSCIENCE 0x0669
332/** PCI vendor ID that AudioScience uses */
333#define HPI_PCI_VENDOR_ID_AUDIOSCIENCE 0x175C
334/** PCI vendor ID that the DSP56301 has */
335#define HPI_PCI_VENDOR_ID_MOTOROLA 0x1057
336/** PCI vendor ID that TI uses */
337#define HPI_PCI_VENDOR_ID_TI 0x104C
338
339#define HPI_PCI_DEV_ID_PCI2040 0xAC60
340/** TI's C6205 PCI interface has this ID */
341#define HPI_PCI_DEV_ID_DSP6205 0xA106
342
343#define HPI_USB_VENDOR_ID_AUDIOSCIENCE 0x1257
344#define HPI_USB_W2K_TAG 0x57495341 /* "ASIW" */
345#define HPI_USB_LINUX_TAG 0x4C495341 /* "ASIL" */
346
3285ea10
EB
347/** Invalid Adapter index
348Used in HPI messages that are not addressed to a specific adapter
349Used in DLL to indicate device not present
350*/
351#define HPI_ADAPTER_INDEX_INVALID 0xFFFF
352
719f82d3
EB
353/** First 2 hex digits define the adapter family */
354#define HPI_ADAPTER_FAMILY_MASK 0xff00
5a498ef1 355#define HPI_MODULE_FAMILY_MASK 0xfff0
719f82d3
EB
356
357#define HPI_ADAPTER_FAMILY_ASI(f) (f & HPI_ADAPTER_FAMILY_MASK)
5a498ef1 358#define HPI_MODULE_FAMILY_ASI(f) (f & HPI_MODULE_FAMILY_MASK)
719f82d3
EB
359#define HPI_ADAPTER_ASI(f) (f)
360
3285ea10 361enum HPI_MESSAGE_TYPES {
82b5774f 362 HPI_TYPE_REQUEST = 1,
3285ea10
EB
363 HPI_TYPE_RESPONSE = 2,
364 HPI_TYPE_DATA = 3,
b7f12482
EB
365 HPI_TYPE_SSX2BYPASS_MESSAGE = 4,
366 HPI_TYPE_COMMAND = 5,
367 HPI_TYPE_NOTIFICATION = 6
3285ea10
EB
368};
369
370enum HPI_OBJECT_TYPES {
371 HPI_OBJ_SUBSYSTEM = 1,
372 HPI_OBJ_ADAPTER = 2,
373 HPI_OBJ_OSTREAM = 3,
374 HPI_OBJ_ISTREAM = 4,
375 HPI_OBJ_MIXER = 5,
376 HPI_OBJ_NODE = 6,
377 HPI_OBJ_CONTROL = 7,
378 HPI_OBJ_NVMEMORY = 8,
379 HPI_OBJ_GPIO = 9,
380 HPI_OBJ_WATCHDOG = 10,
381 HPI_OBJ_CLOCK = 11,
382 HPI_OBJ_PROFILE = 12,
58fbf77f 383 /* HPI_ OBJ_ CONTROLEX = 13, */
3285ea10
EB
384 HPI_OBJ_ASYNCEVENT = 14
385#define HPI_OBJ_MAXINDEX 14
386};
387
388#define HPI_OBJ_FUNCTION_SPACING 0x100
a287ca2a 389#define HPI_FUNC_ID(obj, i) (HPI_OBJ_##obj * HPI_OBJ_FUNCTION_SPACING + i)
3285ea10 390
719f82d3
EB
391#define HPI_EXTRACT_INDEX(fn) (fn & 0xff)
392
3285ea10
EB
393enum HPI_FUNCTION_IDS {
394 HPI_SUBSYS_OPEN = HPI_FUNC_ID(SUBSYSTEM, 1),
395 HPI_SUBSYS_GET_VERSION = HPI_FUNC_ID(SUBSYSTEM, 2),
396 HPI_SUBSYS_GET_INFO = HPI_FUNC_ID(SUBSYSTEM, 3),
3285ea10
EB
397 HPI_SUBSYS_CREATE_ADAPTER = HPI_FUNC_ID(SUBSYSTEM, 5),
398 HPI_SUBSYS_CLOSE = HPI_FUNC_ID(SUBSYSTEM, 6),
3285ea10
EB
399 HPI_SUBSYS_DRIVER_LOAD = HPI_FUNC_ID(SUBSYSTEM, 8),
400 HPI_SUBSYS_DRIVER_UNLOAD = HPI_FUNC_ID(SUBSYSTEM, 9),
3285ea10
EB
401 HPI_SUBSYS_GET_NUM_ADAPTERS = HPI_FUNC_ID(SUBSYSTEM, 12),
402 HPI_SUBSYS_GET_ADAPTER = HPI_FUNC_ID(SUBSYSTEM, 13),
403 HPI_SUBSYS_SET_NETWORK_INTERFACE = HPI_FUNC_ID(SUBSYSTEM, 14),
404 HPI_SUBSYS_OPTION_INFO = HPI_FUNC_ID(SUBSYSTEM, 15),
405 HPI_SUBSYS_OPTION_GET = HPI_FUNC_ID(SUBSYSTEM, 16),
406 HPI_SUBSYS_OPTION_SET = HPI_FUNC_ID(SUBSYSTEM, 17),
407#define HPI_SUBSYS_FUNCTION_COUNT 17
408
409 HPI_ADAPTER_OPEN = HPI_FUNC_ID(ADAPTER, 1),
410 HPI_ADAPTER_CLOSE = HPI_FUNC_ID(ADAPTER, 2),
411 HPI_ADAPTER_GET_INFO = HPI_FUNC_ID(ADAPTER, 3),
412 HPI_ADAPTER_GET_ASSERT = HPI_FUNC_ID(ADAPTER, 4),
413 HPI_ADAPTER_TEST_ASSERT = HPI_FUNC_ID(ADAPTER, 5),
414 HPI_ADAPTER_SET_MODE = HPI_FUNC_ID(ADAPTER, 6),
415 HPI_ADAPTER_GET_MODE = HPI_FUNC_ID(ADAPTER, 7),
416 HPI_ADAPTER_ENABLE_CAPABILITY = HPI_FUNC_ID(ADAPTER, 8),
417 HPI_ADAPTER_SELFTEST = HPI_FUNC_ID(ADAPTER, 9),
418 HPI_ADAPTER_FIND_OBJECT = HPI_FUNC_ID(ADAPTER, 10),
419 HPI_ADAPTER_QUERY_FLASH = HPI_FUNC_ID(ADAPTER, 11),
420 HPI_ADAPTER_START_FLASH = HPI_FUNC_ID(ADAPTER, 12),
421 HPI_ADAPTER_PROGRAM_FLASH = HPI_FUNC_ID(ADAPTER, 13),
422 HPI_ADAPTER_SET_PROPERTY = HPI_FUNC_ID(ADAPTER, 14),
423 HPI_ADAPTER_GET_PROPERTY = HPI_FUNC_ID(ADAPTER, 15),
424 HPI_ADAPTER_ENUM_PROPERTY = HPI_FUNC_ID(ADAPTER, 16),
425 HPI_ADAPTER_MODULE_INFO = HPI_FUNC_ID(ADAPTER, 17),
426 HPI_ADAPTER_DEBUG_READ = HPI_FUNC_ID(ADAPTER, 18),
bd33c1ca
EB
427 HPI_ADAPTER_IRQ_QUERY_AND_CLEAR = HPI_FUNC_ID(ADAPTER, 19),
428 HPI_ADAPTER_IRQ_CALLBACK = HPI_FUNC_ID(ADAPTER, 20),
6d0b898e 429 HPI_ADAPTER_DELETE = HPI_FUNC_ID(ADAPTER, 21),
72868339
EB
430 HPI_ADAPTER_READ_FLASH = HPI_FUNC_ID(ADAPTER, 22),
431 HPI_ADAPTER_END_FLASH = HPI_FUNC_ID(ADAPTER, 23),
432 HPI_ADAPTER_FILESTORE_DELETE_ALL = HPI_FUNC_ID(ADAPTER, 24),
433#define HPI_ADAPTER_FUNCTION_COUNT 24
3285ea10
EB
434
435 HPI_OSTREAM_OPEN = HPI_FUNC_ID(OSTREAM, 1),
436 HPI_OSTREAM_CLOSE = HPI_FUNC_ID(OSTREAM, 2),
437 HPI_OSTREAM_WRITE = HPI_FUNC_ID(OSTREAM, 3),
438 HPI_OSTREAM_START = HPI_FUNC_ID(OSTREAM, 4),
439 HPI_OSTREAM_STOP = HPI_FUNC_ID(OSTREAM, 5),
440 HPI_OSTREAM_RESET = HPI_FUNC_ID(OSTREAM, 6),
441 HPI_OSTREAM_GET_INFO = HPI_FUNC_ID(OSTREAM, 7),
442 HPI_OSTREAM_QUERY_FORMAT = HPI_FUNC_ID(OSTREAM, 8),
443 HPI_OSTREAM_DATA = HPI_FUNC_ID(OSTREAM, 9),
444 HPI_OSTREAM_SET_VELOCITY = HPI_FUNC_ID(OSTREAM, 10),
445 HPI_OSTREAM_SET_PUNCHINOUT = HPI_FUNC_ID(OSTREAM, 11),
446 HPI_OSTREAM_SINEGEN = HPI_FUNC_ID(OSTREAM, 12),
447 HPI_OSTREAM_ANC_RESET = HPI_FUNC_ID(OSTREAM, 13),
448 HPI_OSTREAM_ANC_GET_INFO = HPI_FUNC_ID(OSTREAM, 14),
449 HPI_OSTREAM_ANC_READ = HPI_FUNC_ID(OSTREAM, 15),
450 HPI_OSTREAM_SET_TIMESCALE = HPI_FUNC_ID(OSTREAM, 16),
451 HPI_OSTREAM_SET_FORMAT = HPI_FUNC_ID(OSTREAM, 17),
452 HPI_OSTREAM_HOSTBUFFER_ALLOC = HPI_FUNC_ID(OSTREAM, 18),
453 HPI_OSTREAM_HOSTBUFFER_FREE = HPI_FUNC_ID(OSTREAM, 19),
454 HPI_OSTREAM_GROUP_ADD = HPI_FUNC_ID(OSTREAM, 20),
455 HPI_OSTREAM_GROUP_GETMAP = HPI_FUNC_ID(OSTREAM, 21),
456 HPI_OSTREAM_GROUP_RESET = HPI_FUNC_ID(OSTREAM, 22),
457 HPI_OSTREAM_HOSTBUFFER_GET_INFO = HPI_FUNC_ID(OSTREAM, 23),
458 HPI_OSTREAM_WAIT_START = HPI_FUNC_ID(OSTREAM, 24),
bd33c1ca
EB
459 HPI_OSTREAM_WAIT = HPI_FUNC_ID(OSTREAM, 25),
460#define HPI_OSTREAM_FUNCTION_COUNT 25
3285ea10
EB
461
462 HPI_ISTREAM_OPEN = HPI_FUNC_ID(ISTREAM, 1),
463 HPI_ISTREAM_CLOSE = HPI_FUNC_ID(ISTREAM, 2),
464 HPI_ISTREAM_SET_FORMAT = HPI_FUNC_ID(ISTREAM, 3),
465 HPI_ISTREAM_READ = HPI_FUNC_ID(ISTREAM, 4),
466 HPI_ISTREAM_START = HPI_FUNC_ID(ISTREAM, 5),
467 HPI_ISTREAM_STOP = HPI_FUNC_ID(ISTREAM, 6),
468 HPI_ISTREAM_RESET = HPI_FUNC_ID(ISTREAM, 7),
469 HPI_ISTREAM_GET_INFO = HPI_FUNC_ID(ISTREAM, 8),
470 HPI_ISTREAM_QUERY_FORMAT = HPI_FUNC_ID(ISTREAM, 9),
471 HPI_ISTREAM_ANC_RESET = HPI_FUNC_ID(ISTREAM, 10),
472 HPI_ISTREAM_ANC_GET_INFO = HPI_FUNC_ID(ISTREAM, 11),
473 HPI_ISTREAM_ANC_WRITE = HPI_FUNC_ID(ISTREAM, 12),
474 HPI_ISTREAM_HOSTBUFFER_ALLOC = HPI_FUNC_ID(ISTREAM, 13),
475 HPI_ISTREAM_HOSTBUFFER_FREE = HPI_FUNC_ID(ISTREAM, 14),
476 HPI_ISTREAM_GROUP_ADD = HPI_FUNC_ID(ISTREAM, 15),
477 HPI_ISTREAM_GROUP_GETMAP = HPI_FUNC_ID(ISTREAM, 16),
478 HPI_ISTREAM_GROUP_RESET = HPI_FUNC_ID(ISTREAM, 17),
479 HPI_ISTREAM_HOSTBUFFER_GET_INFO = HPI_FUNC_ID(ISTREAM, 18),
480 HPI_ISTREAM_WAIT_START = HPI_FUNC_ID(ISTREAM, 19),
bd33c1ca
EB
481 HPI_ISTREAM_WAIT = HPI_FUNC_ID(ISTREAM, 20),
482#define HPI_ISTREAM_FUNCTION_COUNT 20
3285ea10 483
719f82d3
EB
484/* NOTE:
485 GET_NODE_INFO, SET_CONNECTION, GET_CONNECTIONS are not currently used */
3285ea10
EB
486 HPI_MIXER_OPEN = HPI_FUNC_ID(MIXER, 1),
487 HPI_MIXER_CLOSE = HPI_FUNC_ID(MIXER, 2),
488 HPI_MIXER_GET_INFO = HPI_FUNC_ID(MIXER, 3),
489 HPI_MIXER_GET_NODE_INFO = HPI_FUNC_ID(MIXER, 4),
490 HPI_MIXER_GET_CONTROL = HPI_FUNC_ID(MIXER, 5),
491 HPI_MIXER_SET_CONNECTION = HPI_FUNC_ID(MIXER, 6),
492 HPI_MIXER_GET_CONNECTIONS = HPI_FUNC_ID(MIXER, 7),
493 HPI_MIXER_GET_CONTROL_BY_INDEX = HPI_FUNC_ID(MIXER, 8),
494 HPI_MIXER_GET_CONTROL_ARRAY_BY_INDEX = HPI_FUNC_ID(MIXER, 9),
495 HPI_MIXER_GET_CONTROL_MULTIPLE_VALUES = HPI_FUNC_ID(MIXER, 10),
496 HPI_MIXER_STORE = HPI_FUNC_ID(MIXER, 11),
bd33c1ca 497 HPI_MIXER_GET_CACHE_INFO = HPI_FUNC_ID(MIXER, 12),
72868339
EB
498 HPI_MIXER_GET_BLOCK_HANDLE = HPI_FUNC_ID(MIXER, 13),
499 HPI_MIXER_GET_PARAMETER_HANDLE = HPI_FUNC_ID(MIXER, 14),
500#define HPI_MIXER_FUNCTION_COUNT 14
3285ea10
EB
501
502 HPI_CONTROL_GET_INFO = HPI_FUNC_ID(CONTROL, 1),
503 HPI_CONTROL_GET_STATE = HPI_FUNC_ID(CONTROL, 2),
504 HPI_CONTROL_SET_STATE = HPI_FUNC_ID(CONTROL, 3),
719f82d3 505#define HPI_CONTROL_FUNCTION_COUNT 3
3285ea10
EB
506
507 HPI_NVMEMORY_OPEN = HPI_FUNC_ID(NVMEMORY, 1),
508 HPI_NVMEMORY_READ_BYTE = HPI_FUNC_ID(NVMEMORY, 2),
509 HPI_NVMEMORY_WRITE_BYTE = HPI_FUNC_ID(NVMEMORY, 3),
719f82d3 510#define HPI_NVMEMORY_FUNCTION_COUNT 3
3285ea10
EB
511
512 HPI_GPIO_OPEN = HPI_FUNC_ID(GPIO, 1),
513 HPI_GPIO_READ_BIT = HPI_FUNC_ID(GPIO, 2),
514 HPI_GPIO_WRITE_BIT = HPI_FUNC_ID(GPIO, 3),
515 HPI_GPIO_READ_ALL = HPI_FUNC_ID(GPIO, 4),
516 HPI_GPIO_WRITE_STATUS = HPI_FUNC_ID(GPIO, 5),
719f82d3 517#define HPI_GPIO_FUNCTION_COUNT 5
3285ea10
EB
518
519 HPI_ASYNCEVENT_OPEN = HPI_FUNC_ID(ASYNCEVENT, 1),
520 HPI_ASYNCEVENT_CLOSE = HPI_FUNC_ID(ASYNCEVENT, 2),
521 HPI_ASYNCEVENT_WAIT = HPI_FUNC_ID(ASYNCEVENT, 3),
522 HPI_ASYNCEVENT_GETCOUNT = HPI_FUNC_ID(ASYNCEVENT, 4),
523 HPI_ASYNCEVENT_GET = HPI_FUNC_ID(ASYNCEVENT, 5),
524 HPI_ASYNCEVENT_SENDEVENTS = HPI_FUNC_ID(ASYNCEVENT, 6),
719f82d3 525#define HPI_ASYNCEVENT_FUNCTION_COUNT 6
3285ea10
EB
526
527 HPI_WATCHDOG_OPEN = HPI_FUNC_ID(WATCHDOG, 1),
528 HPI_WATCHDOG_SET_TIME = HPI_FUNC_ID(WATCHDOG, 2),
529 HPI_WATCHDOG_PING = HPI_FUNC_ID(WATCHDOG, 3),
530
531 HPI_CLOCK_OPEN = HPI_FUNC_ID(CLOCK, 1),
532 HPI_CLOCK_SET_TIME = HPI_FUNC_ID(CLOCK, 2),
533 HPI_CLOCK_GET_TIME = HPI_FUNC_ID(CLOCK, 3),
534
535 HPI_PROFILE_OPEN_ALL = HPI_FUNC_ID(PROFILE, 1),
536 HPI_PROFILE_START_ALL = HPI_FUNC_ID(PROFILE, 2),
537 HPI_PROFILE_STOP_ALL = HPI_FUNC_ID(PROFILE, 3),
538 HPI_PROFILE_GET = HPI_FUNC_ID(PROFILE, 4),
539 HPI_PROFILE_GET_IDLECOUNT = HPI_FUNC_ID(PROFILE, 5),
540 HPI_PROFILE_GET_NAME = HPI_FUNC_ID(PROFILE, 6),
541 HPI_PROFILE_GET_UTILIZATION = HPI_FUNC_ID(PROFILE, 7)
719f82d3 542#define HPI_PROFILE_FUNCTION_COUNT 7
3285ea10 543};
719f82d3
EB
544
545/* ////////////////////////////////////////////////////////////////////// */
546/* STRUCTURES */
547#ifndef DISABLE_PRAGMA_PACK1
548#pragma pack(push, 1)
549#endif
550
551/** PCI bus resource */
552struct hpi_pci {
553 u32 __iomem *ap_mem_base[HPI_MAX_ADAPTER_MEM_SPACES];
3285ea10 554 struct pci_dev *pci_dev;
719f82d3
EB
555};
556
e51c58c9
EB
557/** Adapter specification resource */
558struct hpi_adapter_specification {
559 u32 type;
560 u8 modules[4];
561};
562
719f82d3
EB
563struct hpi_resource {
564 union {
565 const struct hpi_pci *pci;
566 const char *net_if;
e51c58c9
EB
567 struct hpi_adapter_specification adapter_spec;
568 const void *sw_if;
719f82d3 569 } r;
719f82d3
EB
570 u16 bus_type; /* HPI_BUS_PNPISA, _PCI, _USB etc */
571 u16 padding;
719f82d3
EB
572};
573
574/** Format info used inside struct hpi_message
575 Not the same as public API struct hpi_format */
576struct hpi_msg_format {
1d595d2a
EB
577 u32 sample_rate; /**< 11025, 32000, 44100 etc. */
578 u32 bit_rate; /**< for MPEG */
579 u32 attributes; /**< stereo/joint_stereo/mono */
580 u16 channels; /**< 1,2..., (or ancillary mode or idle bit */
719f82d3
EB
581 u16 format; /**< HPI_FORMAT_PCM16, _MPEG etc. see \ref HPI_FORMATS. */
582};
583
584/** Buffer+format structure.
585 Must be kept 7 * 32 bits to match public struct hpi_datastruct */
586struct hpi_msg_data {
587 struct hpi_msg_format format;
588 u8 *pb_data;
e51c58c9 589#ifndef CONFIG_64BIT
719f82d3
EB
590 u32 padding;
591#endif
592 u32 data_size;
593};
594
595/** struct hpi_datastructure used up to 3.04 driver */
596struct hpi_data_legacy32 {
597 struct hpi_format format;
598 u32 pb_data;
599 u32 data_size;
600};
601
e51c58c9 602#ifdef CONFIG_64BIT
719f82d3
EB
603/* Compatibility version of struct hpi_data*/
604struct hpi_data_compat32 {
605 struct hpi_msg_format format;
606 u32 pb_data;
607 u32 padding;
608 u32 data_size;
609};
610#endif
611
612struct hpi_buffer {
938c565a 613 /** placeholder for backward compatibility (see dwBufferSize) */
719f82d3 614 struct hpi_msg_format reserved;
1d595d2a 615 u32 command; /**< HPI_BUFFER_CMD_xxx*/
719f82d3
EB
616 u32 pci_address; /**< PCI physical address of buffer for DSP DMA */
617 u32 buffer_size; /**< must line up with data_size of HPI_DATA*/
618};
619
620/*/////////////////////////////////////////////////////////////////////////// */
621/* This is used for background buffer bus mastering stream buffers. */
622struct hpi_hostbuffer_status {
623 u32 samples_processed;
624 u32 auxiliary_data_available;
625 u32 stream_state;
626 /* DSP index in to the host bus master buffer. */
8e0874ea 627 u32 dsp_index;
719f82d3
EB
628 /* Host index in to the host bus master buffer. */
629 u32 host_index;
630 u32 size_in_bytes;
631};
632
633struct hpi_streamid {
634 u16 object_type;
635 /**< Type of object, HPI_OBJ_OSTREAM or HPI_OBJ_ISTREAM. */
636 u16 stream_index; /**< outstream or instream index. */
637};
638
639struct hpi_punchinout {
640 u32 punch_in_sample;
641 u32 punch_out_sample;
642};
643
644struct hpi_subsys_msg {
645 struct hpi_resource resource;
646};
647
648struct hpi_subsys_res {
649 u32 version;
2f918a64
EB
650 u32 data; /* extended version */
651 u16 num_adapters;
719f82d3 652 u16 adapter_index;
2f918a64
EB
653 u16 adapter_type;
654 u16 pad16;
719f82d3
EB
655};
656
719f82d3 657union hpi_adapterx_msg {
719f82d3 658 struct {
3285ea10
EB
659 u32 dsp_address;
660 u32 count_bytes;
661 } debug_read;
719f82d3 662 struct {
3285ea10
EB
663 u32 adapter_mode;
664 u16 query_or_set;
665 } mode;
666 struct {
667 u16 index;
668 } module_info;
3285ea10
EB
669 struct {
670 u16 index;
671 u16 what;
672 u16 property_index;
673 } property_enum;
719f82d3
EB
674 struct {
675 u16 property;
676 u16 parameter1;
677 u16 parameter2;
678 } property_set;
719f82d3 679 struct {
3285ea10
EB
680 u32 pad32;
681 u16 key1;
682 u16 key2;
683 } restart;
3285ea10
EB
684 struct {
685 u32 pad32;
686 u16 value;
687 } test_assert;
bd33c1ca 688 struct {
f9a376c3
EB
689 u32 message;
690 } irq;
d8aefaef 691 u32 pad[3];
719f82d3
EB
692};
693
694struct hpi_adapter_res {
695 u32 serial_number;
696 u16 adapter_type;
3285ea10 697 u16 adapter_index;
719f82d3
EB
698 u16 num_instreams;
699 u16 num_outstreams;
700 u16 num_mixers;
701 u16 version;
702 u8 sz_adapter_assert[HPI_STRING_LEN];
703};
704
705union hpi_adapterx_res {
3285ea10 706 struct hpi_adapter_res info;
719f82d3 707 struct {
3285ea10
EB
708 u32 p1;
709 u16 count;
710 u16 dsp_index;
711 u32 p2;
712 u32 dsp_msg_addr;
713 char sz_message[HPI_STRING_LEN];
714 } assert;
715 struct {
716 u32 adapter_mode;
717 } mode;
719f82d3
EB
718 struct {
719 u16 parameter1;
720 u16 parameter2;
721 } property_get;
bd33c1ca
EB
722 struct {
723 u32 yes;
724 } irq_query;
719f82d3
EB
725};
726
727struct hpi_stream_msg {
728 union {
729 struct hpi_msg_data data;
730 struct hpi_data_legacy32 data32;
731 u16 velocity;
732 struct hpi_punchinout pio;
733 u32 time_scale;
734 struct hpi_buffer buffer;
735 struct hpi_streamid stream;
bd33c1ca 736 u32 threshold_bytes;
719f82d3
EB
737 } u;
738};
739
740struct hpi_stream_res {
741 union {
742 struct {
743 /* size of hardware buffer */
744 u32 buffer_size;
745 /* OutStream - data to play,
746 InStream - data recorded */
747 u32 data_available;
748 /* OutStream - samples played,
749 InStream - samples recorded */
750 u32 samples_transferred;
751 /* Adapter - OutStream - data to play,
752 InStream - data recorded */
753 u32 auxiliary_data_available;
754 u16 state; /* HPI_STATE_PLAYING, _STATE_STOPPED */
755 u16 padding;
756 } stream_info;
757 struct {
758 u32 buffer_size;
759 u32 data_available;
760 u32 samples_transfered;
761 u16 state;
762 u16 outstream_index;
763 u16 instream_index;
764 u16 padding;
765 u32 auxiliary_data_available;
766 } legacy_stream_info;
767 struct {
768 /* bitmap of grouped OutStreams */
769 u32 outstream_group_map;
770 /* bitmap of grouped InStreams */
771 u32 instream_group_map;
772 } group_info;
773 struct {
774 /* pointer to the buffer */
775 u8 *p_buffer;
776 /* pointer to the hostbuffer status */
777 struct hpi_hostbuffer_status *p_status;
778 } hostbuffer_info;
779 } u;
780};
781
782struct hpi_mixer_msg {
783 u16 control_index;
784 u16 control_type; /* = HPI_CONTROL_METER _VOLUME etc */
3285ea10 785 u16 padding1; /* Maintain alignment of subsequent fields */
719f82d3
EB
786 u16 node_type1; /* = HPI_SOURCENODE_LINEIN etc */
787 u16 node_index1; /* = 0..N */
788 u16 node_type2;
789 u16 node_index2;
790 u16 padding2; /* round to 4 bytes */
791};
792
793struct hpi_mixer_res {
794 u16 src_node_type; /* = HPI_SOURCENODE_LINEIN etc */
795 u16 src_node_index; /* = 0..N */
796 u16 dst_node_type;
797 u16 dst_node_index;
798 /* Also controlType for MixerGetControlByIndex */
799 u16 control_index;
800 /* may indicate which DSP the control is located on */
801 u16 dsp_index;
802};
803
804union hpi_mixerx_msg {
805 struct {
806 u16 starting_index;
807 u16 flags;
808 u32 length_in_bytes; /* length in bytes of p_data */
809 u32 p_data; /* pointer to a data array */
810 } gcabi;
811 struct {
812 u16 command;
813 u16 index;
814 } store; /* for HPI_MIXER_STORE message */
815};
816
817union hpi_mixerx_res {
818 struct {
819 u32 bytes_returned; /* size of items returned */
820 u32 p_data; /* pointer to data array */
821 u16 more_to_do; /* indicates if there is more to do */
822 } gcabi;
bd33c1ca
EB
823 struct {
824 u32 total_controls; /* count of controls in the mixer */
825 u32 cache_controls; /* count of controls in the cac */
826 u32 cache_bytes; /* size of cache */
827 } cache_info;
719f82d3
EB
828};
829
830struct hpi_control_msg {
831 u16 attribute; /* control attribute or property */
832 u16 saved_index;
833 u32 param1; /* generic parameter 1 */
834 u32 param2; /* generic parameter 2 */
835 short an_log_value[HPI_MAX_CHANNELS];
836};
837
838struct hpi_control_union_msg {
839 u16 attribute; /* control attribute or property */
840 u16 saved_index; /* only used in ctrl save/restore */
841 union {
842 struct {
843 u32 param1; /* generic parameter 1 */
844 u32 param2; /* generic parameter 2 */
845 short an_log_value[HPI_MAX_CHANNELS];
846 } old;
847 union {
848 u32 frequency;
849 u32 gain;
850 u32 band;
851 u32 deemphasis;
852 u32 program;
853 struct {
854 u32 mode;
855 u32 value;
856 } mode;
5a498ef1 857 u32 blend;
719f82d3
EB
858 } tuner;
859 } u;
860};
861
862struct hpi_control_res {
863 /* Could make union. dwParam, anLogValue never used in same response */
864 u32 param1;
865 u32 param2;
866 short an_log_value[HPI_MAX_CHANNELS];
867};
868
869union hpi_control_union_res {
870 struct {
871 u32 param1;
872 u32 param2;
873 short an_log_value[HPI_MAX_CHANNELS];
874 } old;
875 union {
876 u32 band;
877 u32 frequency;
878 u32 gain;
719f82d3
EB
879 u32 deemphasis;
880 struct {
881 u32 data[2];
882 u32 bLER;
883 } rds;
3285ea10
EB
884 short s_level;
885 struct {
886 u16 value;
887 u16 mask;
888 } status;
719f82d3
EB
889 } tuner;
890 struct {
891 char sz_data[8];
892 u32 remaining_chars;
893 } chars8;
894 char c_data12[12];
719f82d3 895 union {
58fbf77f
EB
896 struct {
897 u32 status;
898 u32 readable_size;
899 u32 writeable_size;
900 } status;
901 } cobranet;
719f82d3
EB
902};
903
904struct hpi_nvmemory_msg {
905 u16 address;
906 u16 data;
907};
908
909struct hpi_nvmemory_res {
910 u16 size_in_bytes;
911 u16 data;
912};
913
914struct hpi_gpio_msg {
915 u16 bit_index;
916 u16 bit_data;
917};
918
919struct hpi_gpio_res {
920 u16 number_input_bits;
921 u16 number_output_bits;
922 u16 bit_data[4];
923};
924
925struct hpi_async_msg {
926 u32 events;
927 u16 maximum_events;
928 u16 padding;
929};
930
931struct hpi_async_res {
932 union {
933 struct {
934 u16 count;
935 } count;
936 struct {
937 u32 events;
938 u16 number_returned;
939 u16 padding;
940 } get;
941 struct hpi_async_event event;
942 } u;
943};
944
945struct hpi_watchdog_msg {
946 u32 time_ms;
947};
948
949struct hpi_watchdog_res {
950 u32 time_ms;
951};
952
953struct hpi_clock_msg {
954 u16 hours;
955 u16 minutes;
956 u16 seconds;
957 u16 milli_seconds;
958};
959
960struct hpi_clock_res {
961 u16 size_in_bytes;
962 u16 hours;
963 u16 minutes;
964 u16 seconds;
965 u16 milli_seconds;
966 u16 padding;
967};
968
969struct hpi_profile_msg {
970 u16 bin_index;
971 u16 padding;
972};
973
974struct hpi_profile_res_open {
975 u16 max_profiles;
976};
977
978struct hpi_profile_res_time {
3285ea10 979 u32 total_tick_count;
719f82d3 980 u32 call_count;
3285ea10
EB
981 u32 max_tick_count;
982 u32 ticks_per_millisecond;
983 u16 profile_interval;
719f82d3
EB
984};
985
986struct hpi_profile_res_name {
987 u8 sz_name[32];
988};
989
990struct hpi_profile_res {
991 union {
992 struct hpi_profile_res_open o;
993 struct hpi_profile_res_time t;
994 struct hpi_profile_res_name n;
995 } u;
996};
997
998struct hpi_message_header {
999 u16 size; /* total size in bytes */
1000 u8 type; /* HPI_TYPE_MESSAGE */
1001 u8 version; /* message version */
1002 u16 object; /* HPI_OBJ_* */
1003 u16 function; /* HPI_SUBSYS_xxx, HPI_ADAPTER_xxx */
1004 u16 adapter_index; /* the adapter index */
1005 u16 obj_index; /* */
1006};
1007
1008struct hpi_message {
1009 /* following fields must match HPI_MESSAGE_HEADER */
1010 u16 size; /* total size in bytes */
1011 u8 type; /* HPI_TYPE_MESSAGE */
1012 u8 version; /* message version */
1013 u16 object; /* HPI_OBJ_* */
1014 u16 function; /* HPI_SUBSYS_xxx, HPI_ADAPTER_xxx */
1015 u16 adapter_index; /* the adapter index */
1016 u16 obj_index; /* */
1017 union {
1018 struct hpi_subsys_msg s;
719f82d3
EB
1019 union hpi_adapterx_msg ax;
1020 struct hpi_stream_msg d;
1021 struct hpi_mixer_msg m;
1022 union hpi_mixerx_msg mx; /* extended mixer; */
1023 struct hpi_control_msg c; /* mixer control; */
1024 /* identical to struct hpi_control_msg,
1025 but field naming is improved */
1026 struct hpi_control_union_msg cu;
719f82d3
EB
1027 struct hpi_nvmemory_msg n;
1028 struct hpi_gpio_msg l; /* digital i/o */
1029 struct hpi_watchdog_msg w;
1030 struct hpi_clock_msg t; /* dsp time */
1031 struct hpi_profile_msg p;
1032 struct hpi_async_msg as;
1033 char fixed_size[32];
1034 } u;
1035};
1036
1037#define HPI_MESSAGE_SIZE_BY_OBJECT { \
3285ea10 1038 sizeof(struct hpi_message_header) , /* Default, no object type 0 */ \
719f82d3
EB
1039 sizeof(struct hpi_message_header) + sizeof(struct hpi_subsys_msg),\
1040 sizeof(struct hpi_message_header) + sizeof(union hpi_adapterx_msg),\
1041 sizeof(struct hpi_message_header) + sizeof(struct hpi_stream_msg),\
1042 sizeof(struct hpi_message_header) + sizeof(struct hpi_stream_msg),\
1043 sizeof(struct hpi_message_header) + sizeof(struct hpi_mixer_msg),\
1044 sizeof(struct hpi_message_header) , /* no node message */ \
1045 sizeof(struct hpi_message_header) + sizeof(struct hpi_control_msg),\
1046 sizeof(struct hpi_message_header) + sizeof(struct hpi_nvmemory_msg),\
1047 sizeof(struct hpi_message_header) + sizeof(struct hpi_gpio_msg),\
1048 sizeof(struct hpi_message_header) + sizeof(struct hpi_watchdog_msg),\
1049 sizeof(struct hpi_message_header) + sizeof(struct hpi_clock_msg),\
1050 sizeof(struct hpi_message_header) + sizeof(struct hpi_profile_msg),\
58fbf77f 1051 sizeof(struct hpi_message_header), /* controlx obj removed */ \
719f82d3
EB
1052 sizeof(struct hpi_message_header) + sizeof(struct hpi_async_msg) \
1053}
1054
1d595d2a
EB
1055/*
1056Note that the wSpecificError error field should be inspected and potentially
1057reported whenever HPI_ERROR_DSP_COMMUNICATION or HPI_ERROR_DSP_BOOTLOAD is
1058returned in wError.
1059*/
719f82d3
EB
1060struct hpi_response_header {
1061 u16 size;
1062 u8 type; /* HPI_TYPE_RESPONSE */
1063 u8 version; /* response version */
1064 u16 object; /* HPI_OBJ_* */
1065 u16 function; /* HPI_SUBSYS_xxx, HPI_ADAPTER_xxx */
1066 u16 error; /* HPI_ERROR_xxx */
1067 u16 specific_error; /* adapter specific error */
1068};
1069
1070struct hpi_response {
1071/* following fields must match HPI_RESPONSE_HEADER */
1072 u16 size;
1073 u8 type; /* HPI_TYPE_RESPONSE */
1074 u8 version; /* response version */
1075 u16 object; /* HPI_OBJ_* */
1076 u16 function; /* HPI_SUBSYS_xxx, HPI_ADAPTER_xxx */
1077 u16 error; /* HPI_ERROR_xxx */
1078 u16 specific_error; /* adapter specific error */
1079 union {
1080 struct hpi_subsys_res s;
719f82d3
EB
1081 union hpi_adapterx_res ax;
1082 struct hpi_stream_res d;
1083 struct hpi_mixer_res m;
1084 union hpi_mixerx_res mx; /* extended mixer; */
1085 struct hpi_control_res c; /* mixer control; */
1086 /* identical to hpi_control_res, but field naming is improved */
1087 union hpi_control_union_res cu;
719f82d3
EB
1088 struct hpi_nvmemory_res n;
1089 struct hpi_gpio_res l; /* digital i/o */
1090 struct hpi_watchdog_res w;
1091 struct hpi_clock_res t; /* dsp time */
1092 struct hpi_profile_res p;
1093 struct hpi_async_res as;
1094 u8 bytes[52];
1095 } u;
1096};
1097
1098#define HPI_RESPONSE_SIZE_BY_OBJECT { \
3285ea10 1099 sizeof(struct hpi_response_header) ,/* Default, no object type 0 */ \
719f82d3
EB
1100 sizeof(struct hpi_response_header) + sizeof(struct hpi_subsys_res),\
1101 sizeof(struct hpi_response_header) + sizeof(union hpi_adapterx_res),\
1102 sizeof(struct hpi_response_header) + sizeof(struct hpi_stream_res),\
1103 sizeof(struct hpi_response_header) + sizeof(struct hpi_stream_res),\
1104 sizeof(struct hpi_response_header) + sizeof(struct hpi_mixer_res),\
1105 sizeof(struct hpi_response_header) , /* no node response */ \
1106 sizeof(struct hpi_response_header) + sizeof(struct hpi_control_res),\
1107 sizeof(struct hpi_response_header) + sizeof(struct hpi_nvmemory_res),\
1108 sizeof(struct hpi_response_header) + sizeof(struct hpi_gpio_res),\
1109 sizeof(struct hpi_response_header) + sizeof(struct hpi_watchdog_res),\
1110 sizeof(struct hpi_response_header) + sizeof(struct hpi_clock_res),\
1111 sizeof(struct hpi_response_header) + sizeof(struct hpi_profile_res),\
58fbf77f 1112 sizeof(struct hpi_response_header), /* controlx obj removed */ \
719f82d3
EB
1113 sizeof(struct hpi_response_header) + sizeof(struct hpi_async_res) \
1114}
1115
ba94455c 1116/*********************** version 1 message/response **************************/
719f82d3
EB
1117#define HPINET_ETHERNET_DATA_SIZE (1500)
1118#define HPINET_IP_HDR_SIZE (20)
1119#define HPINET_IP_DATA_SIZE (HPINET_ETHERNET_DATA_SIZE - HPINET_IP_HDR_SIZE)
1120#define HPINET_UDP_HDR_SIZE (8)
1121#define HPINET_UDP_DATA_SIZE (HPINET_IP_DATA_SIZE - HPINET_UDP_HDR_SIZE)
1122#define HPINET_ASI_HDR_SIZE (2)
1123#define HPINET_ASI_DATA_SIZE (HPINET_UDP_DATA_SIZE - HPINET_ASI_HDR_SIZE)
1124
1125#define HPI_MAX_PAYLOAD_SIZE (HPINET_ASI_DATA_SIZE - 2)
1126
1127/* New style message/response, but still V0 compatible */
1128struct hpi_msg_adapter_get_info {
1129 struct hpi_message_header h;
1130};
1131
1132struct hpi_res_adapter_get_info {
1133 struct hpi_response_header h; /*v0 */
1134 struct hpi_adapter_res p;
1135};
1136
3285ea10
EB
1137struct hpi_res_adapter_debug_read {
1138 struct hpi_response_header h;
3dad06ac 1139 u8 bytes[1024];
3285ea10
EB
1140};
1141
58fbf77f
EB
1142struct hpi_msg_cobranet_hmi {
1143 u16 attribute;
1144 u16 padding;
1145 u32 hmi_address;
1146 u32 byte_count;
1147};
1148
1149struct hpi_msg_cobranet_hmiwrite {
1150 struct hpi_message_header h;
1151 struct hpi_msg_cobranet_hmi p;
1152 u8 bytes[256];
1153};
1154
1155struct hpi_msg_cobranet_hmiread {
1156 struct hpi_message_header h;
1157 struct hpi_msg_cobranet_hmi p;
1158};
1159
1160struct hpi_res_cobranet_hmiread {
1161 struct hpi_response_header h;
1162 u32 byte_count;
1163 u8 bytes[256];
1164};
1165
719f82d3
EB
1166#if 1
1167#define hpi_message_header_v1 hpi_message_header
1168#define hpi_response_header_v1 hpi_response_header
1169#else
1170/* V1 headers in Addition to v0 headers */
1171struct hpi_message_header_v1 {
1172 struct hpi_message_header h0;
1173/* struct {
1174} h1; */
1175};
1176
1177struct hpi_response_header_v1 {
1178 struct hpi_response_header h0;
1179 struct {
1180 u16 adapter_index; /* the adapter index */
1181 u16 obj_index; /* object index */
1182 } h1;
1183};
1184#endif
1185
719f82d3
EB
1186struct hpi_msg_payload_v0 {
1187 struct hpi_message_header h;
1188 union {
1189 struct hpi_subsys_msg s;
719f82d3
EB
1190 union hpi_adapterx_msg ax;
1191 struct hpi_stream_msg d;
1192 struct hpi_mixer_msg m;
1193 union hpi_mixerx_msg mx;
1194 struct hpi_control_msg c;
1195 struct hpi_control_union_msg cu;
719f82d3
EB
1196 struct hpi_nvmemory_msg n;
1197 struct hpi_gpio_msg l;
1198 struct hpi_watchdog_msg w;
1199 struct hpi_clock_msg t;
1200 struct hpi_profile_msg p;
1201 struct hpi_async_msg as;
1202 } u;
1203};
1204
1205struct hpi_res_payload_v0 {
1206 struct hpi_response_header h;
1207 union {
1208 struct hpi_subsys_res s;
719f82d3
EB
1209 union hpi_adapterx_res ax;
1210 struct hpi_stream_res d;
1211 struct hpi_mixer_res m;
1212 union hpi_mixerx_res mx;
1213 struct hpi_control_res c;
1214 union hpi_control_union_res cu;
719f82d3
EB
1215 struct hpi_nvmemory_res n;
1216 struct hpi_gpio_res l;
1217 struct hpi_watchdog_res w;
1218 struct hpi_clock_res t;
1219 struct hpi_profile_res p;
1220 struct hpi_async_res as;
1221 } u;
1222};
1223
1224union hpi_message_buffer_v1 {
1225 struct hpi_message m0; /* version 0 */
1226 struct hpi_message_header_v1 h;
3285ea10 1227 u8 buf[HPI_MAX_PAYLOAD_SIZE];
719f82d3
EB
1228};
1229
1230union hpi_response_buffer_v1 {
1231 struct hpi_response r0; /* version 0 */
1232 struct hpi_response_header_v1 h;
3285ea10 1233 u8 buf[HPI_MAX_PAYLOAD_SIZE];
719f82d3
EB
1234};
1235
1236compile_time_assert((sizeof(union hpi_message_buffer_v1) <=
1237 HPI_MAX_PAYLOAD_SIZE), message_buffer_ok);
1238compile_time_assert((sizeof(union hpi_response_buffer_v1) <=
1239 HPI_MAX_PAYLOAD_SIZE), response_buffer_ok);
1240
1241/*////////////////////////////////////////////////////////////////////////// */
1242/* declarations for compact control calls */
1243struct hpi_control_defn {
1244 u8 type;
1245 u8 channels;
1246 u8 src_node_type;
1247 u8 src_node_index;
1248 u8 dest_node_type;
1249 u8 dest_node_index;
1250};
1251
1252/*////////////////////////////////////////////////////////////////////////// */
1253/* declarations for control caching (internal to HPI<->DSP interaction) */
1254
3285ea10
EB
1255/** indicates a cached u16 value is invalid. */
1256#define HPI_CACHE_INVALID_UINT16 0xFFFF
1257/** indicates a cached short value is invalid. */
1258#define HPI_CACHE_INVALID_SHORT -32768
1259
719f82d3
EB
1260/** A compact representation of (part of) a controls state.
1261Used for efficient transfer of the control state
1262between DSP and host or across a network
1263*/
1264struct hpi_control_cache_info {
1265 /** one of HPI_CONTROL_* */
1266 u8 control_type;
1267 /** The total size of cached information in 32-bit words. */
1268 u8 size_in32bit_words;
1269 /** The original index of the control on the DSP */
1270 u16 control_index;
1271};
1272
3285ea10
EB
1273struct hpi_control_cache_vol {
1274 struct hpi_control_cache_info i;
1275 short an_log[2];
fc3a3990
EB
1276 unsigned short flags;
1277 char padding[2];
3285ea10
EB
1278};
1279
1280struct hpi_control_cache_meter {
1281 struct hpi_control_cache_info i;
1282 short an_log_peak[2];
1283 short an_logRMS[2];
1284};
1285
1286struct hpi_control_cache_channelmode {
1287 struct hpi_control_cache_info i;
1288 u16 mode;
1289 char temp_padding[6];
1290};
1291
1292struct hpi_control_cache_mux {
1293 struct hpi_control_cache_info i;
1294 u16 source_node_type;
1295 u16 source_node_index;
1296 char temp_padding[4];
1297};
1298
1299struct hpi_control_cache_level {
1300 struct hpi_control_cache_info i;
1301 short an_log[2];
1302 char temp_padding[4];
1303};
1304
1305struct hpi_control_cache_tuner {
1306 struct hpi_control_cache_info i;
1307 u32 freq_ink_hz;
1308 u16 band;
1309 short s_level_avg;
1310};
1311
1312struct hpi_control_cache_aes3rx {
1313 struct hpi_control_cache_info i;
1314 u32 error_status;
1315 u32 format;
1316};
1317
1318struct hpi_control_cache_aes3tx {
1319 struct hpi_control_cache_info i;
1320 u32 format;
1321 char temp_padding[4];
1322};
1323
1324struct hpi_control_cache_tonedetector {
1325 struct hpi_control_cache_info i;
1326 u16 state;
1327 char temp_padding[6];
1328};
1329
1330struct hpi_control_cache_silencedetector {
1331 struct hpi_control_cache_info i;
1332 u32 state;
1333 char temp_padding[4];
1334};
1335
1336struct hpi_control_cache_sampleclock {
1337 struct hpi_control_cache_info i;
1338 u16 source;
1339 u16 source_index;
1340 u32 sample_rate;
1341};
1342
1343struct hpi_control_cache_microphone {
1344 struct hpi_control_cache_info i;
1345 u16 phantom_state;
1346 char temp_padding[6];
1347};
1348
3285ea10 1349struct hpi_control_cache_single {
719f82d3 1350 union {
3285ea10
EB
1351 struct hpi_control_cache_info i;
1352 struct hpi_control_cache_vol vol;
1353 struct hpi_control_cache_meter meter;
1354 struct hpi_control_cache_channelmode mode;
1355 struct hpi_control_cache_mux mux;
1356 struct hpi_control_cache_level level;
1357 struct hpi_control_cache_tuner tuner;
1358 struct hpi_control_cache_aes3rx aes3rx;
1359 struct hpi_control_cache_aes3tx aes3tx;
1360 struct hpi_control_cache_tonedetector tone;
1361 struct hpi_control_cache_silencedetector silence;
1362 struct hpi_control_cache_sampleclock clk;
1363 struct hpi_control_cache_microphone microphone;
719f82d3
EB
1364 } u;
1365};
1366
1367struct hpi_control_cache_pad {
1368 struct hpi_control_cache_info i;
1369 u32 field_valid_flags;
17d4de4c
EB
1370 u8 c_channel[40];
1371 u8 c_artist[100];
1372 u8 c_title[100];
719f82d3
EB
1373 u8 c_comment[200];
1374 u32 pTY;
1375 u32 pI;
1376 u32 traffic_supported;
1377 u32 traffic_anouncement;
1378};
1379
ba94455c 1380/* 2^N sized FIFO buffer (internal to HPI<->DSP interaction) */
719f82d3
EB
1381struct hpi_fifo_buffer {
1382 u32 size;
8e0874ea 1383 u32 dsp_index;
719f82d3
EB
1384 u32 host_index;
1385};
1386
1387#ifndef DISABLE_PRAGMA_PACK1
1388#pragma pack(pop)
1389#endif
1390
1391/* skip host side function declarations for DSP
1392 compile and documentation extraction */
1393
1394char hpi_handle_object(const u32 handle);
1395
1396void hpi_handle_to_indexes(const u32 handle, u16 *pw_adapter_index,
1397 u16 *pw_object_index);
1398
1399u32 hpi_indexes_to_handle(const char c_object, const u16 adapter_index,
1400 const u16 object_index);
1401
1402/*////////////////////////////////////////////////////////////////////////// */
1403
1404/* main HPI entry point */
ba94455c 1405void hpi_send_recv(struct hpi_message *phm, struct hpi_response *phr);
719f82d3 1406
719f82d3 1407/* used in PnP OS/driver */
ba94455c
EB
1408u16 hpi_subsys_create_adapter(const struct hpi_resource *p_resource,
1409 u16 *pw_adapter_index);
719f82d3 1410
ba94455c 1411u16 hpi_outstream_host_buffer_get_info(u32 h_outstream, u8 **pp_buffer,
719f82d3
EB
1412 struct hpi_hostbuffer_status **pp_status);
1413
ba94455c 1414u16 hpi_instream_host_buffer_get_info(u32 h_instream, u8 **pp_buffer,
719f82d3
EB
1415 struct hpi_hostbuffer_status **pp_status);
1416
1417u16 hpi_adapter_restart(u16 adapter_index);
1418
1419/*
1420The following 3 functions were last declared in header files for
1421driver 3.10. HPI_ControlQuery() used to be the recommended way
1422of getting a volume range. Declared here for binary asihpi32.dll
1423compatibility.
1424*/
1425
1426void hpi_format_to_msg(struct hpi_msg_format *pMF,
1427 const struct hpi_format *pF);
1428void hpi_stream_response_to_legacy(struct hpi_stream_res *pSR);
1429
1430/*////////////////////////////////////////////////////////////////////////// */
1431/* declarations for individual HPI entry points */
719f82d3
EB
1432hpi_handler_func HPI_6000;
1433hpi_handler_func HPI_6205;
719f82d3
EB
1434
1435#endif /* _HPI_INTERNAL_H_ */
This page took 0.30621 seconds and 5 git commands to generate.