blob: 0d500841f1a57bb42683d727bcaf2c9c00575f5f [file] [log] [blame]
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001/******************************************************************************
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
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +130031/* Each OS needs its own hpios.h */
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +020032#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 */
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +130052 u32 size, /**< Size in bytes to allocate */
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +020053 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
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +020099/******************************************* bus types */
100enum HPI_BUSES {
101 HPI_BUS_ISAPNP = 1,
102 HPI_BUS_PCI = 2,
103 HPI_BUS_USB = 3,
104 HPI_BUS_NET = 4
105};
106
107/******************************************* CONTROL ATTRIBUTES ****/
108/* (in order of control type ID */
109
Eliot Blennerhassett108ccb32010-07-06 08:37:09 +1200110/* This allows for 255 control types, 256 unique attributes each */
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300111#define HPI_CTL_ATTR(ctl, ai) ((HPI_CONTROL_##ctl << 8) + ai)
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200112
113/* Get the sub-index of the attribute for a control type */
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300114#define HPI_CTL_ATTR_INDEX(i) (i & 0xff)
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200115
Eliot Blennerhassett108ccb32010-07-06 08:37:09 +1200116/* Extract the control from the control attribute */
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300117#define HPI_CTL_ATTR_CONTROL(i) (i >> 8)
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200118
119/** Enable event generation for a control.
1200=disable, 1=enable
121\note generic to all controls that can generate events
122*/
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200123
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300124/** Unique identifiers for every control attribute
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200125*/
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300126enum HPI_CONTROL_ATTRIBUTES {
127 HPI_GENERIC_ENABLE = HPI_CTL_ATTR(GENERIC, 1),
128 HPI_GENERIC_EVENT_ENABLE = HPI_CTL_ATTR(GENERIC, 2),
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200129
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300130 HPI_VOLUME_GAIN = HPI_CTL_ATTR(VOLUME, 1),
131 HPI_VOLUME_AUTOFADE = HPI_CTL_ATTR(VOLUME, 2),
132 HPI_VOLUME_NUM_CHANNELS = HPI_CTL_ATTR(VOLUME, 6),
133 HPI_VOLUME_RANGE = HPI_CTL_ATTR(VOLUME, 10),
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200134
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300135 HPI_METER_RMS = HPI_CTL_ATTR(METER, 1),
136 HPI_METER_PEAK = HPI_CTL_ATTR(METER, 2),
137 HPI_METER_RMS_BALLISTICS = HPI_CTL_ATTR(METER, 3),
138 HPI_METER_PEAK_BALLISTICS = HPI_CTL_ATTR(METER, 4),
139 HPI_METER_NUM_CHANNELS = HPI_CTL_ATTR(METER, 5),
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200140
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300141 HPI_MULTIPLEXER_SOURCE = HPI_CTL_ATTR(MULTIPLEXER, 1),
142 HPI_MULTIPLEXER_QUERYSOURCE = HPI_CTL_ATTR(MULTIPLEXER, 2),
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200143
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300144 HPI_AESEBUTX_FORMAT = HPI_CTL_ATTR(AESEBUTX, 1),
145 HPI_AESEBUTX_SAMPLERATE = HPI_CTL_ATTR(AESEBUTX, 3),
146 HPI_AESEBUTX_CHANNELSTATUS = HPI_CTL_ATTR(AESEBUTX, 4),
147 HPI_AESEBUTX_USERDATA = HPI_CTL_ATTR(AESEBUTX, 5),
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200148
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300149 HPI_AESEBURX_FORMAT = HPI_CTL_ATTR(AESEBURX, 1),
150 HPI_AESEBURX_ERRORSTATUS = HPI_CTL_ATTR(AESEBURX, 2),
151 HPI_AESEBURX_SAMPLERATE = HPI_CTL_ATTR(AESEBURX, 3),
152 HPI_AESEBURX_CHANNELSTATUS = HPI_CTL_ATTR(AESEBURX, 4),
153 HPI_AESEBURX_USERDATA = HPI_CTL_ATTR(AESEBURX, 5),
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200154
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300155 HPI_LEVEL_GAIN = HPI_CTL_ATTR(LEVEL, 1),
156 HPI_LEVEL_RANGE = HPI_CTL_ATTR(LEVEL, 10),
157
158 HPI_TUNER_BAND = HPI_CTL_ATTR(TUNER, 1),
159 HPI_TUNER_FREQ = HPI_CTL_ATTR(TUNER, 2),
160 HPI_TUNER_LEVEL_AVG = HPI_CTL_ATTR(TUNER, 3),
161 HPI_TUNER_LEVEL_RAW = HPI_CTL_ATTR(TUNER, 4),
162 HPI_TUNER_SNR = HPI_CTL_ATTR(TUNER, 5),
163 HPI_TUNER_GAIN = HPI_CTL_ATTR(TUNER, 6),
164 HPI_TUNER_STATUS = HPI_CTL_ATTR(TUNER, 7),
165 HPI_TUNER_MODE = HPI_CTL_ATTR(TUNER, 8),
166 HPI_TUNER_RDS = HPI_CTL_ATTR(TUNER, 9),
167 HPI_TUNER_DEEMPHASIS = HPI_CTL_ATTR(TUNER, 10),
168 HPI_TUNER_PROGRAM = HPI_CTL_ATTR(TUNER, 11),
169 HPI_TUNER_HDRADIO_SIGNAL_QUALITY = HPI_CTL_ATTR(TUNER, 12),
170 HPI_TUNER_HDRADIO_SDK_VERSION = HPI_CTL_ATTR(TUNER, 13),
171 HPI_TUNER_HDRADIO_DSP_VERSION = HPI_CTL_ATTR(TUNER, 14),
172 HPI_TUNER_HDRADIO_BLEND = HPI_CTL_ATTR(TUNER, 15),
173
174 HPI_VOX_THRESHOLD = HPI_CTL_ATTR(VOX, 1),
175
176 HPI_CHANNEL_MODE_MODE = HPI_CTL_ATTR(CHANNEL_MODE, 1),
177
178 HPI_BITSTREAM_DATA_POLARITY = HPI_CTL_ATTR(BITSTREAM, 1),
179 HPI_BITSTREAM_CLOCK_EDGE = HPI_CTL_ATTR(BITSTREAM, 2),
180 HPI_BITSTREAM_CLOCK_SOURCE = HPI_CTL_ATTR(BITSTREAM, 3),
181 HPI_BITSTREAM_ACTIVITY = HPI_CTL_ATTR(BITSTREAM, 4),
182
183 HPI_SAMPLECLOCK_SOURCE = HPI_CTL_ATTR(SAMPLECLOCK, 1),
184 HPI_SAMPLECLOCK_SAMPLERATE = HPI_CTL_ATTR(SAMPLECLOCK, 2),
185 HPI_SAMPLECLOCK_SOURCE_INDEX = HPI_CTL_ATTR(SAMPLECLOCK, 3),
186 HPI_SAMPLECLOCK_LOCAL_SAMPLERATE = HPI_CTL_ATTR(SAMPLECLOCK, 4),
187 HPI_SAMPLECLOCK_AUTO = HPI_CTL_ATTR(SAMPLECLOCK, 5),
188 HPI_SAMPLECLOCK_LOCAL_LOCK = HPI_CTL_ATTR(SAMPLECLOCK, 6),
189
190 HPI_MICROPHONE_PHANTOM_POWER = HPI_CTL_ATTR(MICROPHONE, 1),
191
192 HPI_EQUALIZER_NUM_FILTERS = HPI_CTL_ATTR(EQUALIZER, 1),
193 HPI_EQUALIZER_FILTER = HPI_CTL_ATTR(EQUALIZER, 2),
194 HPI_EQUALIZER_COEFFICIENTS = HPI_CTL_ATTR(EQUALIZER, 3),
195
196 HPI_COMPANDER_PARAMS = HPI_CTL_ATTR(COMPANDER, 1),
197 HPI_COMPANDER_MAKEUPGAIN = HPI_CTL_ATTR(COMPANDER, 2),
198 HPI_COMPANDER_THRESHOLD = HPI_CTL_ATTR(COMPANDER, 3),
199 HPI_COMPANDER_RATIO = HPI_CTL_ATTR(COMPANDER, 4),
200 HPI_COMPANDER_ATTACK = HPI_CTL_ATTR(COMPANDER, 5),
201 HPI_COMPANDER_DECAY = HPI_CTL_ATTR(COMPANDER, 6),
202
203 HPI_COBRANET_SET = HPI_CTL_ATTR(COBRANET, 1),
204 HPI_COBRANET_GET = HPI_CTL_ATTR(COBRANET, 2),
205 HPI_COBRANET_SET_DATA = HPI_CTL_ATTR(COBRANET, 3),
206 HPI_COBRANET_GET_DATA = HPI_CTL_ATTR(COBRANET, 4),
207 HPI_COBRANET_GET_STATUS = HPI_CTL_ATTR(COBRANET, 5),
208 HPI_COBRANET_SEND_PACKET = HPI_CTL_ATTR(COBRANET, 6),
209 HPI_COBRANET_GET_PACKET = HPI_CTL_ATTR(COBRANET, 7),
210
211 HPI_TONEDETECTOR_THRESHOLD = HPI_CTL_ATTR(TONEDETECTOR, 1),
212 HPI_TONEDETECTOR_STATE = HPI_CTL_ATTR(TONEDETECTOR, 2),
213 HPI_TONEDETECTOR_FREQUENCY = HPI_CTL_ATTR(TONEDETECTOR, 3),
214
215 HPI_SILENCEDETECTOR_THRESHOLD = HPI_CTL_ATTR(SILENCEDETECTOR, 1),
216 HPI_SILENCEDETECTOR_STATE = HPI_CTL_ATTR(SILENCEDETECTOR, 2),
217 HPI_SILENCEDETECTOR_DELAY = HPI_CTL_ATTR(SILENCEDETECTOR, 3),
218
219 HPI_PAD_CHANNEL_NAME = HPI_CTL_ATTR(PAD, 1),
220 HPI_PAD_ARTIST = HPI_CTL_ATTR(PAD, 2),
221 HPI_PAD_TITLE = HPI_CTL_ATTR(PAD, 3),
222 HPI_PAD_COMMENT = HPI_CTL_ATTR(PAD, 4),
223 HPI_PAD_PROGRAM_TYPE = HPI_CTL_ATTR(PAD, 5),
224 HPI_PAD_PROGRAM_ID = HPI_CTL_ATTR(PAD, 6),
225 HPI_PAD_TA_SUPPORT = HPI_CTL_ATTR(PAD, 7),
226 HPI_PAD_TA_ACTIVE = HPI_CTL_ATTR(PAD, 8)
227};
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200228
229#define HPI_POLARITY_POSITIVE 0
230#define HPI_POLARITY_NEGATIVE 1
231
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200232/*------------------------------------------------------------
233 Cobranet Chip Bridge - copied from HMI.H
234------------------------------------------------------------*/
235#define HPI_COBRANET_HMI_cobra_bridge 0x20000
236#define HPI_COBRANET_HMI_cobra_bridge_tx_pkt_buf \
237 (HPI_COBRANET_HMI_cobra_bridge + 0x1000)
238#define HPI_COBRANET_HMI_cobra_bridge_rx_pkt_buf \
239 (HPI_COBRANET_HMI_cobra_bridge + 0x2000)
240#define HPI_COBRANET_HMI_cobra_if_table1 0x110000
241#define HPI_COBRANET_HMI_cobra_if_phy_address \
242 (HPI_COBRANET_HMI_cobra_if_table1 + 0xd)
243#define HPI_COBRANET_HMI_cobra_protocolIP 0x72000
244#define HPI_COBRANET_HMI_cobra_ip_mon_currentIP \
245 (HPI_COBRANET_HMI_cobra_protocolIP + 0x0)
246#define HPI_COBRANET_HMI_cobra_ip_mon_staticIP \
247 (HPI_COBRANET_HMI_cobra_protocolIP + 0x2)
248#define HPI_COBRANET_HMI_cobra_sys 0x100000
249#define HPI_COBRANET_HMI_cobra_sys_desc \
250 (HPI_COBRANET_HMI_cobra_sys + 0x0)
251#define HPI_COBRANET_HMI_cobra_sys_objectID \
252 (HPI_COBRANET_HMI_cobra_sys + 0x100)
253#define HPI_COBRANET_HMI_cobra_sys_contact \
254 (HPI_COBRANET_HMI_cobra_sys + 0x200)
255#define HPI_COBRANET_HMI_cobra_sys_name \
256 (HPI_COBRANET_HMI_cobra_sys + 0x300)
257#define HPI_COBRANET_HMI_cobra_sys_location \
258 (HPI_COBRANET_HMI_cobra_sys + 0x400)
259
260/*------------------------------------------------------------
261 Cobranet Chip Status bits
262------------------------------------------------------------*/
263#define HPI_COBRANET_HMI_STATUS_RXPACKET 2
264#define HPI_COBRANET_HMI_STATUS_TXPACKET 3
265
266/*------------------------------------------------------------
267 Ethernet header size
268------------------------------------------------------------*/
269#define HPI_ETHERNET_HEADER_SIZE (16)
270
271/* These defines are used to fill in protocol information for an Ethernet packet
272 sent using HMI on CS18102 */
273/** ID supplied by Cirrius for ASI packets. */
274#define HPI_ETHERNET_PACKET_ID 0x85
275/** Simple packet - no special routing required */
276#define HPI_ETHERNET_PACKET_V1 0x01
277/** This packet must make its way to the host across the HPI interface */
278#define HPI_ETHERNET_PACKET_HOSTED_VIA_HMI 0x20
279/** This packet must make its way to the host across the HPI interface */
280#define HPI_ETHERNET_PACKET_HOSTED_VIA_HMI_V1 0x21
281/** This packet must make its way to the host across the HPI interface */
282#define HPI_ETHERNET_PACKET_HOSTED_VIA_HPI 0x40
283/** This packet must make its way to the host across the HPI interface */
284#define HPI_ETHERNET_PACKET_HOSTED_VIA_HPI_V1 0x41
285
286#define HPI_ETHERNET_UDP_PORT (44600) /*!< UDP messaging port */
287
288/** Base network time out is set to 100 milli-seconds. */
289#define HPI_ETHERNET_TIMEOUT_MS (100)
290
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300291/** Locked memory buffer alloc/free phases */
292enum HPI_BUFFER_CMDS {
293 /** use one message to allocate or free physical memory */
294 HPI_BUFFER_CMD_EXTERNAL = 0,
295 /** alloc physical memory */
296 HPI_BUFFER_CMD_INTERNAL_ALLOC = 1,
297 /** send physical memory address to adapter */
298 HPI_BUFFER_CMD_INTERNAL_GRANTADAPTER = 2,
299 /** notify adapter to stop using physical buffer */
300 HPI_BUFFER_CMD_INTERNAL_REVOKEADAPTER = 3,
301 /** free physical buffer */
302 HPI_BUFFER_CMD_INTERNAL_FREE = 4
303};
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200304
305/*****************************************************************************/
306/*****************************************************************************/
307/******** HPI LOW LEVEL MESSAGES *******/
308/*****************************************************************************/
309/*****************************************************************************/
310/** Pnp ids */
311/** "ASI" - actual is "ASX" - need to change */
312#define HPI_ID_ISAPNP_AUDIOSCIENCE 0x0669
313/** PCI vendor ID that AudioScience uses */
314#define HPI_PCI_VENDOR_ID_AUDIOSCIENCE 0x175C
315/** PCI vendor ID that the DSP56301 has */
316#define HPI_PCI_VENDOR_ID_MOTOROLA 0x1057
317/** PCI vendor ID that TI uses */
318#define HPI_PCI_VENDOR_ID_TI 0x104C
319
320#define HPI_PCI_DEV_ID_PCI2040 0xAC60
321/** TI's C6205 PCI interface has this ID */
322#define HPI_PCI_DEV_ID_DSP6205 0xA106
323
324#define HPI_USB_VENDOR_ID_AUDIOSCIENCE 0x1257
325#define HPI_USB_W2K_TAG 0x57495341 /* "ASIW" */
326#define HPI_USB_LINUX_TAG 0x4C495341 /* "ASIL" */
327
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300328/** Invalid Adapter index
329Used in HPI messages that are not addressed to a specific adapter
330Used in DLL to indicate device not present
331*/
332#define HPI_ADAPTER_INDEX_INVALID 0xFFFF
333
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200334/** First 2 hex digits define the adapter family */
335#define HPI_ADAPTER_FAMILY_MASK 0xff00
Eliot Blennerhassett5a498ef2010-05-27 17:53:52 +1200336#define HPI_MODULE_FAMILY_MASK 0xfff0
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200337
338#define HPI_ADAPTER_FAMILY_ASI(f) (f & HPI_ADAPTER_FAMILY_MASK)
Eliot Blennerhassett5a498ef2010-05-27 17:53:52 +1200339#define HPI_MODULE_FAMILY_ASI(f) (f & HPI_MODULE_FAMILY_MASK)
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200340#define HPI_ADAPTER_ASI(f) (f)
341
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300342enum HPI_MESSAGE_TYPES {
343 HPI_TYPE_MESSAGE = 1,
344 HPI_TYPE_RESPONSE = 2,
345 HPI_TYPE_DATA = 3,
346 HPI_TYPE_SSX2BYPASS_MESSAGE = 4
347};
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200348
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300349enum HPI_OBJECT_TYPES {
350 HPI_OBJ_SUBSYSTEM = 1,
351 HPI_OBJ_ADAPTER = 2,
352 HPI_OBJ_OSTREAM = 3,
353 HPI_OBJ_ISTREAM = 4,
354 HPI_OBJ_MIXER = 5,
355 HPI_OBJ_NODE = 6,
356 HPI_OBJ_CONTROL = 7,
357 HPI_OBJ_NVMEMORY = 8,
358 HPI_OBJ_GPIO = 9,
359 HPI_OBJ_WATCHDOG = 10,
360 HPI_OBJ_CLOCK = 11,
361 HPI_OBJ_PROFILE = 12,
362 HPI_OBJ_CONTROLEX = 13,
363 HPI_OBJ_ASYNCEVENT = 14
364#define HPI_OBJ_MAXINDEX 14
365};
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200366
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300367#define HPI_OBJ_FUNCTION_SPACING 0x100
368#define HPI_FUNC_ID(obj, index) (HPI_OBJ_##obj * HPI_OBJ_FUNCTION_SPACING + index)
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200369
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200370#define HPI_EXTRACT_INDEX(fn) (fn & 0xff)
371
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300372enum HPI_FUNCTION_IDS {
373 HPI_SUBSYS_OPEN = HPI_FUNC_ID(SUBSYSTEM, 1),
374 HPI_SUBSYS_GET_VERSION = HPI_FUNC_ID(SUBSYSTEM, 2),
375 HPI_SUBSYS_GET_INFO = HPI_FUNC_ID(SUBSYSTEM, 3),
376 HPI_SUBSYS_FIND_ADAPTERS = HPI_FUNC_ID(SUBSYSTEM, 4),
377 HPI_SUBSYS_CREATE_ADAPTER = HPI_FUNC_ID(SUBSYSTEM, 5),
378 HPI_SUBSYS_CLOSE = HPI_FUNC_ID(SUBSYSTEM, 6),
379 HPI_SUBSYS_DELETE_ADAPTER = HPI_FUNC_ID(SUBSYSTEM, 7),
380 HPI_SUBSYS_DRIVER_LOAD = HPI_FUNC_ID(SUBSYSTEM, 8),
381 HPI_SUBSYS_DRIVER_UNLOAD = HPI_FUNC_ID(SUBSYSTEM, 9),
382 HPI_SUBSYS_READ_PORT_8 = HPI_FUNC_ID(SUBSYSTEM, 10),
383 HPI_SUBSYS_WRITE_PORT_8 = HPI_FUNC_ID(SUBSYSTEM, 11),
384 HPI_SUBSYS_GET_NUM_ADAPTERS = HPI_FUNC_ID(SUBSYSTEM, 12),
385 HPI_SUBSYS_GET_ADAPTER = HPI_FUNC_ID(SUBSYSTEM, 13),
386 HPI_SUBSYS_SET_NETWORK_INTERFACE = HPI_FUNC_ID(SUBSYSTEM, 14),
387 HPI_SUBSYS_OPTION_INFO = HPI_FUNC_ID(SUBSYSTEM, 15),
388 HPI_SUBSYS_OPTION_GET = HPI_FUNC_ID(SUBSYSTEM, 16),
389 HPI_SUBSYS_OPTION_SET = HPI_FUNC_ID(SUBSYSTEM, 17),
390#define HPI_SUBSYS_FUNCTION_COUNT 17
391
392 HPI_ADAPTER_OPEN = HPI_FUNC_ID(ADAPTER, 1),
393 HPI_ADAPTER_CLOSE = HPI_FUNC_ID(ADAPTER, 2),
394 HPI_ADAPTER_GET_INFO = HPI_FUNC_ID(ADAPTER, 3),
395 HPI_ADAPTER_GET_ASSERT = HPI_FUNC_ID(ADAPTER, 4),
396 HPI_ADAPTER_TEST_ASSERT = HPI_FUNC_ID(ADAPTER, 5),
397 HPI_ADAPTER_SET_MODE = HPI_FUNC_ID(ADAPTER, 6),
398 HPI_ADAPTER_GET_MODE = HPI_FUNC_ID(ADAPTER, 7),
399 HPI_ADAPTER_ENABLE_CAPABILITY = HPI_FUNC_ID(ADAPTER, 8),
400 HPI_ADAPTER_SELFTEST = HPI_FUNC_ID(ADAPTER, 9),
401 HPI_ADAPTER_FIND_OBJECT = HPI_FUNC_ID(ADAPTER, 10),
402 HPI_ADAPTER_QUERY_FLASH = HPI_FUNC_ID(ADAPTER, 11),
403 HPI_ADAPTER_START_FLASH = HPI_FUNC_ID(ADAPTER, 12),
404 HPI_ADAPTER_PROGRAM_FLASH = HPI_FUNC_ID(ADAPTER, 13),
405 HPI_ADAPTER_SET_PROPERTY = HPI_FUNC_ID(ADAPTER, 14),
406 HPI_ADAPTER_GET_PROPERTY = HPI_FUNC_ID(ADAPTER, 15),
407 HPI_ADAPTER_ENUM_PROPERTY = HPI_FUNC_ID(ADAPTER, 16),
408 HPI_ADAPTER_MODULE_INFO = HPI_FUNC_ID(ADAPTER, 17),
409 HPI_ADAPTER_DEBUG_READ = HPI_FUNC_ID(ADAPTER, 18),
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200410#define HPI_ADAPTER_FUNCTION_COUNT 18
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300411
412 HPI_OSTREAM_OPEN = HPI_FUNC_ID(OSTREAM, 1),
413 HPI_OSTREAM_CLOSE = HPI_FUNC_ID(OSTREAM, 2),
414 HPI_OSTREAM_WRITE = HPI_FUNC_ID(OSTREAM, 3),
415 HPI_OSTREAM_START = HPI_FUNC_ID(OSTREAM, 4),
416 HPI_OSTREAM_STOP = HPI_FUNC_ID(OSTREAM, 5),
417 HPI_OSTREAM_RESET = HPI_FUNC_ID(OSTREAM, 6),
418 HPI_OSTREAM_GET_INFO = HPI_FUNC_ID(OSTREAM, 7),
419 HPI_OSTREAM_QUERY_FORMAT = HPI_FUNC_ID(OSTREAM, 8),
420 HPI_OSTREAM_DATA = HPI_FUNC_ID(OSTREAM, 9),
421 HPI_OSTREAM_SET_VELOCITY = HPI_FUNC_ID(OSTREAM, 10),
422 HPI_OSTREAM_SET_PUNCHINOUT = HPI_FUNC_ID(OSTREAM, 11),
423 HPI_OSTREAM_SINEGEN = HPI_FUNC_ID(OSTREAM, 12),
424 HPI_OSTREAM_ANC_RESET = HPI_FUNC_ID(OSTREAM, 13),
425 HPI_OSTREAM_ANC_GET_INFO = HPI_FUNC_ID(OSTREAM, 14),
426 HPI_OSTREAM_ANC_READ = HPI_FUNC_ID(OSTREAM, 15),
427 HPI_OSTREAM_SET_TIMESCALE = HPI_FUNC_ID(OSTREAM, 16),
428 HPI_OSTREAM_SET_FORMAT = HPI_FUNC_ID(OSTREAM, 17),
429 HPI_OSTREAM_HOSTBUFFER_ALLOC = HPI_FUNC_ID(OSTREAM, 18),
430 HPI_OSTREAM_HOSTBUFFER_FREE = HPI_FUNC_ID(OSTREAM, 19),
431 HPI_OSTREAM_GROUP_ADD = HPI_FUNC_ID(OSTREAM, 20),
432 HPI_OSTREAM_GROUP_GETMAP = HPI_FUNC_ID(OSTREAM, 21),
433 HPI_OSTREAM_GROUP_RESET = HPI_FUNC_ID(OSTREAM, 22),
434 HPI_OSTREAM_HOSTBUFFER_GET_INFO = HPI_FUNC_ID(OSTREAM, 23),
435 HPI_OSTREAM_WAIT_START = HPI_FUNC_ID(OSTREAM, 24),
436#define HPI_OSTREAM_FUNCTION_COUNT 24
437
438 HPI_ISTREAM_OPEN = HPI_FUNC_ID(ISTREAM, 1),
439 HPI_ISTREAM_CLOSE = HPI_FUNC_ID(ISTREAM, 2),
440 HPI_ISTREAM_SET_FORMAT = HPI_FUNC_ID(ISTREAM, 3),
441 HPI_ISTREAM_READ = HPI_FUNC_ID(ISTREAM, 4),
442 HPI_ISTREAM_START = HPI_FUNC_ID(ISTREAM, 5),
443 HPI_ISTREAM_STOP = HPI_FUNC_ID(ISTREAM, 6),
444 HPI_ISTREAM_RESET = HPI_FUNC_ID(ISTREAM, 7),
445 HPI_ISTREAM_GET_INFO = HPI_FUNC_ID(ISTREAM, 8),
446 HPI_ISTREAM_QUERY_FORMAT = HPI_FUNC_ID(ISTREAM, 9),
447 HPI_ISTREAM_ANC_RESET = HPI_FUNC_ID(ISTREAM, 10),
448 HPI_ISTREAM_ANC_GET_INFO = HPI_FUNC_ID(ISTREAM, 11),
449 HPI_ISTREAM_ANC_WRITE = HPI_FUNC_ID(ISTREAM, 12),
450 HPI_ISTREAM_HOSTBUFFER_ALLOC = HPI_FUNC_ID(ISTREAM, 13),
451 HPI_ISTREAM_HOSTBUFFER_FREE = HPI_FUNC_ID(ISTREAM, 14),
452 HPI_ISTREAM_GROUP_ADD = HPI_FUNC_ID(ISTREAM, 15),
453 HPI_ISTREAM_GROUP_GETMAP = HPI_FUNC_ID(ISTREAM, 16),
454 HPI_ISTREAM_GROUP_RESET = HPI_FUNC_ID(ISTREAM, 17),
455 HPI_ISTREAM_HOSTBUFFER_GET_INFO = HPI_FUNC_ID(ISTREAM, 18),
456 HPI_ISTREAM_WAIT_START = HPI_FUNC_ID(ISTREAM, 19),
457#define HPI_ISTREAM_FUNCTION_COUNT 19
458
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200459/* NOTE:
460 GET_NODE_INFO, SET_CONNECTION, GET_CONNECTIONS are not currently used */
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300461 HPI_MIXER_OPEN = HPI_FUNC_ID(MIXER, 1),
462 HPI_MIXER_CLOSE = HPI_FUNC_ID(MIXER, 2),
463 HPI_MIXER_GET_INFO = HPI_FUNC_ID(MIXER, 3),
464 HPI_MIXER_GET_NODE_INFO = HPI_FUNC_ID(MIXER, 4),
465 HPI_MIXER_GET_CONTROL = HPI_FUNC_ID(MIXER, 5),
466 HPI_MIXER_SET_CONNECTION = HPI_FUNC_ID(MIXER, 6),
467 HPI_MIXER_GET_CONNECTIONS = HPI_FUNC_ID(MIXER, 7),
468 HPI_MIXER_GET_CONTROL_BY_INDEX = HPI_FUNC_ID(MIXER, 8),
469 HPI_MIXER_GET_CONTROL_ARRAY_BY_INDEX = HPI_FUNC_ID(MIXER, 9),
470 HPI_MIXER_GET_CONTROL_MULTIPLE_VALUES = HPI_FUNC_ID(MIXER, 10),
471 HPI_MIXER_STORE = HPI_FUNC_ID(MIXER, 11),
472#define HPI_MIXER_FUNCTION_COUNT 11
473
474 HPI_CONTROL_GET_INFO = HPI_FUNC_ID(CONTROL, 1),
475 HPI_CONTROL_GET_STATE = HPI_FUNC_ID(CONTROL, 2),
476 HPI_CONTROL_SET_STATE = HPI_FUNC_ID(CONTROL, 3),
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200477#define HPI_CONTROL_FUNCTION_COUNT 3
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300478
479 HPI_NVMEMORY_OPEN = HPI_FUNC_ID(NVMEMORY, 1),
480 HPI_NVMEMORY_READ_BYTE = HPI_FUNC_ID(NVMEMORY, 2),
481 HPI_NVMEMORY_WRITE_BYTE = HPI_FUNC_ID(NVMEMORY, 3),
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200482#define HPI_NVMEMORY_FUNCTION_COUNT 3
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300483
484 HPI_GPIO_OPEN = HPI_FUNC_ID(GPIO, 1),
485 HPI_GPIO_READ_BIT = HPI_FUNC_ID(GPIO, 2),
486 HPI_GPIO_WRITE_BIT = HPI_FUNC_ID(GPIO, 3),
487 HPI_GPIO_READ_ALL = HPI_FUNC_ID(GPIO, 4),
488 HPI_GPIO_WRITE_STATUS = HPI_FUNC_ID(GPIO, 5),
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200489#define HPI_GPIO_FUNCTION_COUNT 5
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300490
491 HPI_ASYNCEVENT_OPEN = HPI_FUNC_ID(ASYNCEVENT, 1),
492 HPI_ASYNCEVENT_CLOSE = HPI_FUNC_ID(ASYNCEVENT, 2),
493 HPI_ASYNCEVENT_WAIT = HPI_FUNC_ID(ASYNCEVENT, 3),
494 HPI_ASYNCEVENT_GETCOUNT = HPI_FUNC_ID(ASYNCEVENT, 4),
495 HPI_ASYNCEVENT_GET = HPI_FUNC_ID(ASYNCEVENT, 5),
496 HPI_ASYNCEVENT_SENDEVENTS = HPI_FUNC_ID(ASYNCEVENT, 6),
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200497#define HPI_ASYNCEVENT_FUNCTION_COUNT 6
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300498
499 HPI_WATCHDOG_OPEN = HPI_FUNC_ID(WATCHDOG, 1),
500 HPI_WATCHDOG_SET_TIME = HPI_FUNC_ID(WATCHDOG, 2),
501 HPI_WATCHDOG_PING = HPI_FUNC_ID(WATCHDOG, 3),
502
503 HPI_CLOCK_OPEN = HPI_FUNC_ID(CLOCK, 1),
504 HPI_CLOCK_SET_TIME = HPI_FUNC_ID(CLOCK, 2),
505 HPI_CLOCK_GET_TIME = HPI_FUNC_ID(CLOCK, 3),
506
507 HPI_PROFILE_OPEN_ALL = HPI_FUNC_ID(PROFILE, 1),
508 HPI_PROFILE_START_ALL = HPI_FUNC_ID(PROFILE, 2),
509 HPI_PROFILE_STOP_ALL = HPI_FUNC_ID(PROFILE, 3),
510 HPI_PROFILE_GET = HPI_FUNC_ID(PROFILE, 4),
511 HPI_PROFILE_GET_IDLECOUNT = HPI_FUNC_ID(PROFILE, 5),
512 HPI_PROFILE_GET_NAME = HPI_FUNC_ID(PROFILE, 6),
513 HPI_PROFILE_GET_UTILIZATION = HPI_FUNC_ID(PROFILE, 7)
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200514#define HPI_PROFILE_FUNCTION_COUNT 7
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300515};
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200516
517/* ////////////////////////////////////////////////////////////////////// */
518/* STRUCTURES */
519#ifndef DISABLE_PRAGMA_PACK1
520#pragma pack(push, 1)
521#endif
522
523/** PCI bus resource */
524struct hpi_pci {
525 u32 __iomem *ap_mem_base[HPI_MAX_ADAPTER_MEM_SPACES];
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300526 struct pci_dev *pci_dev;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200527};
528
529struct hpi_resource {
530 union {
531 const struct hpi_pci *pci;
532 const char *net_if;
533 } r;
534#ifndef HPI64BIT /* keep structure size constant */
535 u32 pad_to64;
536#endif
537 u16 bus_type; /* HPI_BUS_PNPISA, _PCI, _USB etc */
538 u16 padding;
539
540};
541
542/** Format info used inside struct hpi_message
543 Not the same as public API struct hpi_format */
544struct hpi_msg_format {
545 u32 sample_rate;
546 /**< 11025, 32000, 44100 ... */
547 u32 bit_rate; /**< for MPEG */
548 u32 attributes;
549 /**< Stereo/JointStereo/Mono */
550 u16 channels; /**< 1,2..., (or ancillary mode or idle bit */
551 u16 format; /**< HPI_FORMAT_PCM16, _MPEG etc. see \ref HPI_FORMATS. */
552};
553
554/** Buffer+format structure.
555 Must be kept 7 * 32 bits to match public struct hpi_datastruct */
556struct hpi_msg_data {
557 struct hpi_msg_format format;
558 u8 *pb_data;
559#ifndef HPI64BIT
560 u32 padding;
561#endif
562 u32 data_size;
563};
564
565/** struct hpi_datastructure used up to 3.04 driver */
566struct hpi_data_legacy32 {
567 struct hpi_format format;
568 u32 pb_data;
569 u32 data_size;
570};
571
572#ifdef HPI64BIT
573/* Compatibility version of struct hpi_data*/
574struct hpi_data_compat32 {
575 struct hpi_msg_format format;
576 u32 pb_data;
577 u32 padding;
578 u32 data_size;
579};
580#endif
581
582struct hpi_buffer {
583 /** placehoder for backward compatability (see dwBufferSize) */
584 struct hpi_msg_format reserved;
585 u32 command; /**< HPI_BUFFER_CMD_xxx*/
586 u32 pci_address; /**< PCI physical address of buffer for DSP DMA */
587 u32 buffer_size; /**< must line up with data_size of HPI_DATA*/
588};
589
590/*/////////////////////////////////////////////////////////////////////////// */
591/* This is used for background buffer bus mastering stream buffers. */
592struct hpi_hostbuffer_status {
593 u32 samples_processed;
594 u32 auxiliary_data_available;
595 u32 stream_state;
596 /* DSP index in to the host bus master buffer. */
597 u32 dSP_index;
598 /* Host index in to the host bus master buffer. */
599 u32 host_index;
600 u32 size_in_bytes;
601};
602
603struct hpi_streamid {
604 u16 object_type;
605 /**< Type of object, HPI_OBJ_OSTREAM or HPI_OBJ_ISTREAM. */
606 u16 stream_index; /**< outstream or instream index. */
607};
608
609struct hpi_punchinout {
610 u32 punch_in_sample;
611 u32 punch_out_sample;
612};
613
614struct hpi_subsys_msg {
615 struct hpi_resource resource;
616};
617
618struct hpi_subsys_res {
619 u32 version;
620 u32 data; /* used to return extended version */
621 u16 num_adapters; /* number of adapters */
622 u16 adapter_index;
623 u16 aw_adapter_list[HPI_MAX_ADAPTERS];
624};
625
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200626union hpi_adapterx_msg {
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200627 struct {
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300628 u32 dsp_address;
629 u32 count_bytes;
630 } debug_read;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200631 struct {
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300632 u32 adapter_mode;
633 u16 query_or_set;
634 } mode;
635 struct {
636 u16 index;
637 } module_info;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200638 struct {
639 u32 checksum;
640 u16 sequence;
641 u16 length;
642 u16 offset; /**< offset from start of msg to data */
643 u16 unused;
644 } program_flash;
645 struct {
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200646 u16 index;
647 u16 what;
648 u16 property_index;
649 } property_enum;
650 struct {
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300651 u16 property;
652 u16 parameter1;
653 u16 parameter2;
654 } property_set;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200655 struct {
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300656 u32 offset;
657 } query_flash;
658 struct {
659 u32 pad32;
660 u16 key1;
661 u16 key2;
662 } restart;
663 struct {
664 u32 offset;
665 u32 length;
666 u32 key;
667 } start_flash;
668 struct {
669 u32 pad32;
670 u16 value;
671 } test_assert;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200672};
673
674struct hpi_adapter_res {
675 u32 serial_number;
676 u16 adapter_type;
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300677 u16 adapter_index;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200678 u16 num_instreams;
679 u16 num_outstreams;
680 u16 num_mixers;
681 u16 version;
682 u8 sz_adapter_assert[HPI_STRING_LEN];
683};
684
685union hpi_adapterx_res {
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300686 struct hpi_adapter_res info;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200687 struct {
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300688 u32 p1;
689 u16 count;
690 u16 dsp_index;
691 u32 p2;
692 u32 dsp_msg_addr;
693 char sz_message[HPI_STRING_LEN];
694 } assert;
695 struct {
696 u32 adapter_mode;
697 } mode;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200698 struct {
699 u16 sequence;
700 } program_flash;
701 struct {
702 u16 parameter1;
703 u16 parameter2;
704 } property_get;
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300705 struct {
706 u32 checksum;
707 u32 length;
708 u32 version;
709 } query_flash;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200710};
711
712struct hpi_stream_msg {
713 union {
714 struct hpi_msg_data data;
715 struct hpi_data_legacy32 data32;
716 u16 velocity;
717 struct hpi_punchinout pio;
718 u32 time_scale;
719 struct hpi_buffer buffer;
720 struct hpi_streamid stream;
721 } u;
722};
723
724struct hpi_stream_res {
725 union {
726 struct {
727 /* size of hardware buffer */
728 u32 buffer_size;
729 /* OutStream - data to play,
730 InStream - data recorded */
731 u32 data_available;
732 /* OutStream - samples played,
733 InStream - samples recorded */
734 u32 samples_transferred;
735 /* Adapter - OutStream - data to play,
736 InStream - data recorded */
737 u32 auxiliary_data_available;
738 u16 state; /* HPI_STATE_PLAYING, _STATE_STOPPED */
739 u16 padding;
740 } stream_info;
741 struct {
742 u32 buffer_size;
743 u32 data_available;
744 u32 samples_transfered;
745 u16 state;
746 u16 outstream_index;
747 u16 instream_index;
748 u16 padding;
749 u32 auxiliary_data_available;
750 } legacy_stream_info;
751 struct {
752 /* bitmap of grouped OutStreams */
753 u32 outstream_group_map;
754 /* bitmap of grouped InStreams */
755 u32 instream_group_map;
756 } group_info;
757 struct {
758 /* pointer to the buffer */
759 u8 *p_buffer;
760 /* pointer to the hostbuffer status */
761 struct hpi_hostbuffer_status *p_status;
762 } hostbuffer_info;
763 } u;
764};
765
766struct hpi_mixer_msg {
767 u16 control_index;
768 u16 control_type; /* = HPI_CONTROL_METER _VOLUME etc */
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300769 u16 padding1; /* Maintain alignment of subsequent fields */
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200770 u16 node_type1; /* = HPI_SOURCENODE_LINEIN etc */
771 u16 node_index1; /* = 0..N */
772 u16 node_type2;
773 u16 node_index2;
774 u16 padding2; /* round to 4 bytes */
775};
776
777struct hpi_mixer_res {
778 u16 src_node_type; /* = HPI_SOURCENODE_LINEIN etc */
779 u16 src_node_index; /* = 0..N */
780 u16 dst_node_type;
781 u16 dst_node_index;
782 /* Also controlType for MixerGetControlByIndex */
783 u16 control_index;
784 /* may indicate which DSP the control is located on */
785 u16 dsp_index;
786};
787
788union hpi_mixerx_msg {
789 struct {
790 u16 starting_index;
791 u16 flags;
792 u32 length_in_bytes; /* length in bytes of p_data */
793 u32 p_data; /* pointer to a data array */
794 } gcabi;
795 struct {
796 u16 command;
797 u16 index;
798 } store; /* for HPI_MIXER_STORE message */
799};
800
801union hpi_mixerx_res {
802 struct {
803 u32 bytes_returned; /* size of items returned */
804 u32 p_data; /* pointer to data array */
805 u16 more_to_do; /* indicates if there is more to do */
806 } gcabi;
807};
808
809struct hpi_control_msg {
810 u16 attribute; /* control attribute or property */
811 u16 saved_index;
812 u32 param1; /* generic parameter 1 */
813 u32 param2; /* generic parameter 2 */
814 short an_log_value[HPI_MAX_CHANNELS];
815};
816
817struct hpi_control_union_msg {
818 u16 attribute; /* control attribute or property */
819 u16 saved_index; /* only used in ctrl save/restore */
820 union {
821 struct {
822 u32 param1; /* generic parameter 1 */
823 u32 param2; /* generic parameter 2 */
824 short an_log_value[HPI_MAX_CHANNELS];
825 } old;
826 union {
827 u32 frequency;
828 u32 gain;
829 u32 band;
830 u32 deemphasis;
831 u32 program;
832 struct {
833 u32 mode;
834 u32 value;
835 } mode;
Eliot Blennerhassett5a498ef2010-05-27 17:53:52 +1200836 u32 blend;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200837 } tuner;
838 } u;
839};
840
841struct hpi_control_res {
842 /* Could make union. dwParam, anLogValue never used in same response */
843 u32 param1;
844 u32 param2;
845 short an_log_value[HPI_MAX_CHANNELS];
846};
847
848union hpi_control_union_res {
849 struct {
850 u32 param1;
851 u32 param2;
852 short an_log_value[HPI_MAX_CHANNELS];
853 } old;
854 union {
855 u32 band;
856 u32 frequency;
857 u32 gain;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200858 u32 deemphasis;
859 struct {
860 u32 data[2];
861 u32 bLER;
862 } rds;
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300863 short s_level;
864 struct {
865 u16 value;
866 u16 mask;
867 } status;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200868 } tuner;
869 struct {
870 char sz_data[8];
871 u32 remaining_chars;
872 } chars8;
873 char c_data12[12];
874};
875
876/* HPI_CONTROLX_STRUCTURES */
877
878/* Message */
879
880/** Used for all HMI variables where max length <= 8 bytes
881*/
882struct hpi_controlx_msg_cobranet_data {
883 u32 hmi_address;
884 u32 byte_count;
885 u32 data[2];
886};
887
888/** Used for string data, and for packet bridge
889*/
890struct hpi_controlx_msg_cobranet_bigdata {
891 u32 hmi_address;
892 u32 byte_count;
893 u8 *pb_data;
894#ifndef HPI64BIT
895 u32 padding;
896#endif
897};
898
899/** Used for PADS control reading of string fields.
900*/
901struct hpi_controlx_msg_pad_data {
902 u32 field;
903 u32 byte_count;
904 u8 *pb_data;
905#ifndef HPI64BIT
906 u32 padding;
907#endif
908};
909
910/** Used for generic data
911*/
912
913struct hpi_controlx_msg_generic {
914 u32 param1;
915 u32 param2;
916};
917
918struct hpi_controlx_msg {
919 u16 attribute; /* control attribute or property */
920 u16 saved_index;
921 union {
922 struct hpi_controlx_msg_cobranet_data cobranet_data;
923 struct hpi_controlx_msg_cobranet_bigdata cobranet_bigdata;
924 struct hpi_controlx_msg_generic generic;
925 struct hpi_controlx_msg_pad_data pad_data;
926 /*struct param_value universal_value; */
927 /* nothing extra to send for status read */
928 } u;
929};
930
931/* Response */
932/**
933*/
934struct hpi_controlx_res_cobranet_data {
935 u32 byte_count;
936 u32 data[2];
937};
938
939struct hpi_controlx_res_cobranet_bigdata {
940 u32 byte_count;
941};
942
943struct hpi_controlx_res_cobranet_status {
944 u32 status;
945 u32 readable_size;
946 u32 writeable_size;
947};
948
949struct hpi_controlx_res_generic {
950 u32 param1;
951 u32 param2;
952};
953
954struct hpi_controlx_res {
955 union {
956 struct hpi_controlx_res_cobranet_bigdata cobranet_bigdata;
957 struct hpi_controlx_res_cobranet_data cobranet_data;
958 struct hpi_controlx_res_cobranet_status cobranet_status;
959 struct hpi_controlx_res_generic generic;
960 /*struct param_info universal_info; */
961 /*struct param_value universal_value; */
962 } u;
963};
964
965struct hpi_nvmemory_msg {
966 u16 address;
967 u16 data;
968};
969
970struct hpi_nvmemory_res {
971 u16 size_in_bytes;
972 u16 data;
973};
974
975struct hpi_gpio_msg {
976 u16 bit_index;
977 u16 bit_data;
978};
979
980struct hpi_gpio_res {
981 u16 number_input_bits;
982 u16 number_output_bits;
983 u16 bit_data[4];
984};
985
986struct hpi_async_msg {
987 u32 events;
988 u16 maximum_events;
989 u16 padding;
990};
991
992struct hpi_async_res {
993 union {
994 struct {
995 u16 count;
996 } count;
997 struct {
998 u32 events;
999 u16 number_returned;
1000 u16 padding;
1001 } get;
1002 struct hpi_async_event event;
1003 } u;
1004};
1005
1006struct hpi_watchdog_msg {
1007 u32 time_ms;
1008};
1009
1010struct hpi_watchdog_res {
1011 u32 time_ms;
1012};
1013
1014struct hpi_clock_msg {
1015 u16 hours;
1016 u16 minutes;
1017 u16 seconds;
1018 u16 milli_seconds;
1019};
1020
1021struct hpi_clock_res {
1022 u16 size_in_bytes;
1023 u16 hours;
1024 u16 minutes;
1025 u16 seconds;
1026 u16 milli_seconds;
1027 u16 padding;
1028};
1029
1030struct hpi_profile_msg {
1031 u16 bin_index;
1032 u16 padding;
1033};
1034
1035struct hpi_profile_res_open {
1036 u16 max_profiles;
1037};
1038
1039struct hpi_profile_res_time {
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +13001040 u32 total_tick_count;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001041 u32 call_count;
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +13001042 u32 max_tick_count;
1043 u32 ticks_per_millisecond;
1044 u16 profile_interval;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001045};
1046
1047struct hpi_profile_res_name {
1048 u8 sz_name[32];
1049};
1050
1051struct hpi_profile_res {
1052 union {
1053 struct hpi_profile_res_open o;
1054 struct hpi_profile_res_time t;
1055 struct hpi_profile_res_name n;
1056 } u;
1057};
1058
1059struct hpi_message_header {
1060 u16 size; /* total size in bytes */
1061 u8 type; /* HPI_TYPE_MESSAGE */
1062 u8 version; /* message version */
1063 u16 object; /* HPI_OBJ_* */
1064 u16 function; /* HPI_SUBSYS_xxx, HPI_ADAPTER_xxx */
1065 u16 adapter_index; /* the adapter index */
1066 u16 obj_index; /* */
1067};
1068
1069struct hpi_message {
1070 /* following fields must match HPI_MESSAGE_HEADER */
1071 u16 size; /* total size in bytes */
1072 u8 type; /* HPI_TYPE_MESSAGE */
1073 u8 version; /* message version */
1074 u16 object; /* HPI_OBJ_* */
1075 u16 function; /* HPI_SUBSYS_xxx, HPI_ADAPTER_xxx */
1076 u16 adapter_index; /* the adapter index */
1077 u16 obj_index; /* */
1078 union {
1079 struct hpi_subsys_msg s;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001080 union hpi_adapterx_msg ax;
1081 struct hpi_stream_msg d;
1082 struct hpi_mixer_msg m;
1083 union hpi_mixerx_msg mx; /* extended mixer; */
1084 struct hpi_control_msg c; /* mixer control; */
1085 /* identical to struct hpi_control_msg,
1086 but field naming is improved */
1087 struct hpi_control_union_msg cu;
1088 struct hpi_controlx_msg cx; /* extended mixer control; */
1089 struct hpi_nvmemory_msg n;
1090 struct hpi_gpio_msg l; /* digital i/o */
1091 struct hpi_watchdog_msg w;
1092 struct hpi_clock_msg t; /* dsp time */
1093 struct hpi_profile_msg p;
1094 struct hpi_async_msg as;
1095 char fixed_size[32];
1096 } u;
1097};
1098
1099#define HPI_MESSAGE_SIZE_BY_OBJECT { \
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +13001100 sizeof(struct hpi_message_header) , /* Default, no object type 0 */ \
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001101 sizeof(struct hpi_message_header) + sizeof(struct hpi_subsys_msg),\
1102 sizeof(struct hpi_message_header) + sizeof(union hpi_adapterx_msg),\
1103 sizeof(struct hpi_message_header) + sizeof(struct hpi_stream_msg),\
1104 sizeof(struct hpi_message_header) + sizeof(struct hpi_stream_msg),\
1105 sizeof(struct hpi_message_header) + sizeof(struct hpi_mixer_msg),\
1106 sizeof(struct hpi_message_header) , /* no node message */ \
1107 sizeof(struct hpi_message_header) + sizeof(struct hpi_control_msg),\
1108 sizeof(struct hpi_message_header) + sizeof(struct hpi_nvmemory_msg),\
1109 sizeof(struct hpi_message_header) + sizeof(struct hpi_gpio_msg),\
1110 sizeof(struct hpi_message_header) + sizeof(struct hpi_watchdog_msg),\
1111 sizeof(struct hpi_message_header) + sizeof(struct hpi_clock_msg),\
1112 sizeof(struct hpi_message_header) + sizeof(struct hpi_profile_msg),\
1113 sizeof(struct hpi_message_header) + sizeof(struct hpi_controlx_msg),\
1114 sizeof(struct hpi_message_header) + sizeof(struct hpi_async_msg) \
1115}
1116
1117struct hpi_response_header {
1118 u16 size;
1119 u8 type; /* HPI_TYPE_RESPONSE */
1120 u8 version; /* response version */
1121 u16 object; /* HPI_OBJ_* */
1122 u16 function; /* HPI_SUBSYS_xxx, HPI_ADAPTER_xxx */
1123 u16 error; /* HPI_ERROR_xxx */
1124 u16 specific_error; /* adapter specific error */
1125};
1126
1127struct hpi_response {
1128/* following fields must match HPI_RESPONSE_HEADER */
1129 u16 size;
1130 u8 type; /* HPI_TYPE_RESPONSE */
1131 u8 version; /* response version */
1132 u16 object; /* HPI_OBJ_* */
1133 u16 function; /* HPI_SUBSYS_xxx, HPI_ADAPTER_xxx */
1134 u16 error; /* HPI_ERROR_xxx */
1135 u16 specific_error; /* adapter specific error */
1136 union {
1137 struct hpi_subsys_res s;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001138 union hpi_adapterx_res ax;
1139 struct hpi_stream_res d;
1140 struct hpi_mixer_res m;
1141 union hpi_mixerx_res mx; /* extended mixer; */
1142 struct hpi_control_res c; /* mixer control; */
1143 /* identical to hpi_control_res, but field naming is improved */
1144 union hpi_control_union_res cu;
1145 struct hpi_controlx_res cx; /* extended mixer control; */
1146 struct hpi_nvmemory_res n;
1147 struct hpi_gpio_res l; /* digital i/o */
1148 struct hpi_watchdog_res w;
1149 struct hpi_clock_res t; /* dsp time */
1150 struct hpi_profile_res p;
1151 struct hpi_async_res as;
1152 u8 bytes[52];
1153 } u;
1154};
1155
1156#define HPI_RESPONSE_SIZE_BY_OBJECT { \
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +13001157 sizeof(struct hpi_response_header) ,/* Default, no object type 0 */ \
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001158 sizeof(struct hpi_response_header) + sizeof(struct hpi_subsys_res),\
1159 sizeof(struct hpi_response_header) + sizeof(union hpi_adapterx_res),\
1160 sizeof(struct hpi_response_header) + sizeof(struct hpi_stream_res),\
1161 sizeof(struct hpi_response_header) + sizeof(struct hpi_stream_res),\
1162 sizeof(struct hpi_response_header) + sizeof(struct hpi_mixer_res),\
1163 sizeof(struct hpi_response_header) , /* no node response */ \
1164 sizeof(struct hpi_response_header) + sizeof(struct hpi_control_res),\
1165 sizeof(struct hpi_response_header) + sizeof(struct hpi_nvmemory_res),\
1166 sizeof(struct hpi_response_header) + sizeof(struct hpi_gpio_res),\
1167 sizeof(struct hpi_response_header) + sizeof(struct hpi_watchdog_res),\
1168 sizeof(struct hpi_response_header) + sizeof(struct hpi_clock_res),\
1169 sizeof(struct hpi_response_header) + sizeof(struct hpi_profile_res),\
1170 sizeof(struct hpi_response_header) + sizeof(struct hpi_controlx_res),\
1171 sizeof(struct hpi_response_header) + sizeof(struct hpi_async_res) \
1172}
1173
1174/*********************** version 1 message/response *****************************/
1175#define HPINET_ETHERNET_DATA_SIZE (1500)
1176#define HPINET_IP_HDR_SIZE (20)
1177#define HPINET_IP_DATA_SIZE (HPINET_ETHERNET_DATA_SIZE - HPINET_IP_HDR_SIZE)
1178#define HPINET_UDP_HDR_SIZE (8)
1179#define HPINET_UDP_DATA_SIZE (HPINET_IP_DATA_SIZE - HPINET_UDP_HDR_SIZE)
1180#define HPINET_ASI_HDR_SIZE (2)
1181#define HPINET_ASI_DATA_SIZE (HPINET_UDP_DATA_SIZE - HPINET_ASI_HDR_SIZE)
1182
1183#define HPI_MAX_PAYLOAD_SIZE (HPINET_ASI_DATA_SIZE - 2)
1184
1185/* New style message/response, but still V0 compatible */
1186struct hpi_msg_adapter_get_info {
1187 struct hpi_message_header h;
1188};
1189
1190struct hpi_res_adapter_get_info {
1191 struct hpi_response_header h; /*v0 */
1192 struct hpi_adapter_res p;
1193};
1194
1195/* padding is so these are same size as v0 hpi_message */
1196struct hpi_msg_adapter_query_flash {
1197 struct hpi_message_header h;
1198 u32 offset;
1199 u8 pad_to_version0_size[sizeof(struct hpi_message) - /* V0 res */
1200 sizeof(struct hpi_message_header) - 1 * sizeof(u32)];
1201};
1202
1203/* padding is so these are same size as v0 hpi_response */
1204struct hpi_res_adapter_query_flash {
1205 struct hpi_response_header h;
1206 u32 checksum;
1207 u32 length;
1208 u32 version;
1209 u8 pad_to_version0_size[sizeof(struct hpi_response) - /* V0 res */
1210 sizeof(struct hpi_response_header) - 3 * sizeof(u32)];
1211};
1212
1213struct hpi_msg_adapter_start_flash {
1214 struct hpi_message_header h;
1215 u32 offset;
1216 u32 length;
1217 u32 key;
1218 u8 pad_to_version0_size[sizeof(struct hpi_message) - /* V0 res */
1219 sizeof(struct hpi_message_header) - 3 * sizeof(u32)];
1220};
1221
1222struct hpi_res_adapter_start_flash {
1223 struct hpi_response_header h;
1224 u8 pad_to_version0_size[sizeof(struct hpi_response) - /* V0 res */
1225 sizeof(struct hpi_response_header)];
1226};
1227
1228struct hpi_msg_adapter_program_flash_payload {
1229 u32 checksum;
1230 u16 sequence;
1231 u16 length;
1232 u16 offset; /**< offset from start of msg to data */
1233 u16 unused;
1234 /* ensure sizeof(header + payload) == sizeof(hpi_message_V0)
1235 because old firmware expects data after message of this size */
1236 u8 pad_to_version0_size[sizeof(struct hpi_message) - /* V0 message */
1237 sizeof(struct hpi_message_header) - sizeof(u32) -
1238 4 * sizeof(u16)];
1239};
1240
1241struct hpi_msg_adapter_program_flash {
1242 struct hpi_message_header h;
1243 struct hpi_msg_adapter_program_flash_payload p;
1244 u32 data[256];
1245};
1246
1247struct hpi_res_adapter_program_flash {
1248 struct hpi_response_header h;
1249 u16 sequence;
1250 u8 pad_to_version0_size[sizeof(struct hpi_response) - /* V0 res */
1251 sizeof(struct hpi_response_header) - sizeof(u16)];
1252};
1253
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +13001254struct hpi_msg_adapter_debug_read {
1255 struct hpi_message_header h;
1256 u32 dsp_address;
1257 u32 count_bytes;
1258};
1259
1260struct hpi_res_adapter_debug_read {
1261 struct hpi_response_header h;
1262 u8 bytes[256];
1263};
1264
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001265#if 1
1266#define hpi_message_header_v1 hpi_message_header
1267#define hpi_response_header_v1 hpi_response_header
1268#else
1269/* V1 headers in Addition to v0 headers */
1270struct hpi_message_header_v1 {
1271 struct hpi_message_header h0;
1272/* struct {
1273} h1; */
1274};
1275
1276struct hpi_response_header_v1 {
1277 struct hpi_response_header h0;
1278 struct {
1279 u16 adapter_index; /* the adapter index */
1280 u16 obj_index; /* object index */
1281 } h1;
1282};
1283#endif
1284
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001285struct hpi_msg_payload_v0 {
1286 struct hpi_message_header h;
1287 union {
1288 struct hpi_subsys_msg s;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001289 union hpi_adapterx_msg ax;
1290 struct hpi_stream_msg d;
1291 struct hpi_mixer_msg m;
1292 union hpi_mixerx_msg mx;
1293 struct hpi_control_msg c;
1294 struct hpi_control_union_msg cu;
1295 struct hpi_controlx_msg cx;
1296 struct hpi_nvmemory_msg n;
1297 struct hpi_gpio_msg l;
1298 struct hpi_watchdog_msg w;
1299 struct hpi_clock_msg t;
1300 struct hpi_profile_msg p;
1301 struct hpi_async_msg as;
1302 } u;
1303};
1304
1305struct hpi_res_payload_v0 {
1306 struct hpi_response_header h;
1307 union {
1308 struct hpi_subsys_res s;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001309 union hpi_adapterx_res ax;
1310 struct hpi_stream_res d;
1311 struct hpi_mixer_res m;
1312 union hpi_mixerx_res mx;
1313 struct hpi_control_res c;
1314 union hpi_control_union_res cu;
1315 struct hpi_controlx_res cx;
1316 struct hpi_nvmemory_res n;
1317 struct hpi_gpio_res l;
1318 struct hpi_watchdog_res w;
1319 struct hpi_clock_res t;
1320 struct hpi_profile_res p;
1321 struct hpi_async_res as;
1322 } u;
1323};
1324
1325union hpi_message_buffer_v1 {
1326 struct hpi_message m0; /* version 0 */
1327 struct hpi_message_header_v1 h;
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +13001328 u8 buf[HPI_MAX_PAYLOAD_SIZE];
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001329};
1330
1331union hpi_response_buffer_v1 {
1332 struct hpi_response r0; /* version 0 */
1333 struct hpi_response_header_v1 h;
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +13001334 u8 buf[HPI_MAX_PAYLOAD_SIZE];
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001335};
1336
1337compile_time_assert((sizeof(union hpi_message_buffer_v1) <=
1338 HPI_MAX_PAYLOAD_SIZE), message_buffer_ok);
1339compile_time_assert((sizeof(union hpi_response_buffer_v1) <=
1340 HPI_MAX_PAYLOAD_SIZE), response_buffer_ok);
1341
1342/*////////////////////////////////////////////////////////////////////////// */
1343/* declarations for compact control calls */
1344struct hpi_control_defn {
1345 u8 type;
1346 u8 channels;
1347 u8 src_node_type;
1348 u8 src_node_index;
1349 u8 dest_node_type;
1350 u8 dest_node_index;
1351};
1352
1353/*////////////////////////////////////////////////////////////////////////// */
1354/* declarations for control caching (internal to HPI<->DSP interaction) */
1355
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +13001356/** indicates a cached u16 value is invalid. */
1357#define HPI_CACHE_INVALID_UINT16 0xFFFF
1358/** indicates a cached short value is invalid. */
1359#define HPI_CACHE_INVALID_SHORT -32768
1360
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001361/** A compact representation of (part of) a controls state.
1362Used for efficient transfer of the control state
1363between DSP and host or across a network
1364*/
1365struct hpi_control_cache_info {
1366 /** one of HPI_CONTROL_* */
1367 u8 control_type;
1368 /** The total size of cached information in 32-bit words. */
1369 u8 size_in32bit_words;
1370 /** The original index of the control on the DSP */
1371 u16 control_index;
1372};
1373
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +13001374struct hpi_control_cache_vol {
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001375 struct hpi_control_cache_info i;
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +13001376 short an_log[2];
1377 char temp_padding[4];
1378};
1379
1380struct hpi_control_cache_meter {
1381 struct hpi_control_cache_info i;
1382 short an_log_peak[2];
1383 short an_logRMS[2];
1384};
1385
1386struct hpi_control_cache_channelmode {
1387 struct hpi_control_cache_info i;
1388 u16 mode;
1389 char temp_padding[6];
1390};
1391
1392struct hpi_control_cache_mux {
1393 struct hpi_control_cache_info i;
1394 u16 source_node_type;
1395 u16 source_node_index;
1396 char temp_padding[4];
1397};
1398
1399struct hpi_control_cache_level {
1400 struct hpi_control_cache_info i;
1401 short an_log[2];
1402 char temp_padding[4];
1403};
1404
1405struct hpi_control_cache_tuner {
1406 struct hpi_control_cache_info i;
1407 u32 freq_ink_hz;
1408 u16 band;
1409 short s_level_avg;
1410};
1411
1412struct hpi_control_cache_aes3rx {
1413 struct hpi_control_cache_info i;
1414 u32 error_status;
1415 u32 format;
1416};
1417
1418struct hpi_control_cache_aes3tx {
1419 struct hpi_control_cache_info i;
1420 u32 format;
1421 char temp_padding[4];
1422};
1423
1424struct hpi_control_cache_tonedetector {
1425 struct hpi_control_cache_info i;
1426 u16 state;
1427 char temp_padding[6];
1428};
1429
1430struct hpi_control_cache_silencedetector {
1431 struct hpi_control_cache_info i;
1432 u32 state;
1433 char temp_padding[4];
1434};
1435
1436struct hpi_control_cache_sampleclock {
1437 struct hpi_control_cache_info i;
1438 u16 source;
1439 u16 source_index;
1440 u32 sample_rate;
1441};
1442
1443struct hpi_control_cache_microphone {
1444 struct hpi_control_cache_info i;
1445 u16 phantom_state;
1446 char temp_padding[6];
1447};
1448
1449struct hpi_control_cache_generic {
1450 struct hpi_control_cache_info i;
1451 u32 dw1;
1452 u32 dw2;
1453};
1454
1455struct hpi_control_cache_single {
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001456 union {
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +13001457 struct hpi_control_cache_info i;
1458 struct hpi_control_cache_vol vol;
1459 struct hpi_control_cache_meter meter;
1460 struct hpi_control_cache_channelmode mode;
1461 struct hpi_control_cache_mux mux;
1462 struct hpi_control_cache_level level;
1463 struct hpi_control_cache_tuner tuner;
1464 struct hpi_control_cache_aes3rx aes3rx;
1465 struct hpi_control_cache_aes3tx aes3tx;
1466 struct hpi_control_cache_tonedetector tone;
1467 struct hpi_control_cache_silencedetector silence;
1468 struct hpi_control_cache_sampleclock clk;
1469 struct hpi_control_cache_microphone microphone;
1470 struct hpi_control_cache_generic generic;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001471 } u;
1472};
1473
1474struct hpi_control_cache_pad {
1475 struct hpi_control_cache_info i;
1476 u32 field_valid_flags;
1477 u8 c_channel[8];
1478 u8 c_artist[40];
1479 u8 c_title[40];
1480 u8 c_comment[200];
1481 u32 pTY;
1482 u32 pI;
1483 u32 traffic_supported;
1484 u32 traffic_anouncement;
1485};
1486
1487/*/////////////////////////////////////////////////////////////////////////// */
1488/* declarations for 2^N sized FIFO buffer (internal to HPI<->DSP interaction) */
1489struct hpi_fifo_buffer {
1490 u32 size;
1491 u32 dSP_index;
1492 u32 host_index;
1493};
1494
1495#ifndef DISABLE_PRAGMA_PACK1
1496#pragma pack(pop)
1497#endif
1498
1499/* skip host side function declarations for DSP
1500 compile and documentation extraction */
1501
1502char hpi_handle_object(const u32 handle);
1503
1504void hpi_handle_to_indexes(const u32 handle, u16 *pw_adapter_index,
1505 u16 *pw_object_index);
1506
1507u32 hpi_indexes_to_handle(const char c_object, const u16 adapter_index,
1508 const u16 object_index);
1509
1510/*////////////////////////////////////////////////////////////////////////// */
1511
1512/* main HPI entry point */
1513hpi_handler_func hpi_send_recv;
1514
1515/* UDP message */
1516void hpi_send_recvUDP(struct hpi_message *phm, struct hpi_response *phr,
1517 const unsigned int timeout);
1518
1519/* used in PnP OS/driver */
1520u16 hpi_subsys_create_adapter(const struct hpi_hsubsys *ph_subsys,
1521 const struct hpi_resource *p_resource, u16 *pw_adapter_index);
1522
1523u16 hpi_subsys_delete_adapter(const struct hpi_hsubsys *ph_subsys,
1524 u16 adapter_index);
1525
1526u16 hpi_outstream_host_buffer_get_info(const struct hpi_hsubsys *ph_subsys,
1527 u32 h_outstream, u8 **pp_buffer,
1528 struct hpi_hostbuffer_status **pp_status);
1529
1530u16 hpi_instream_host_buffer_get_info(const struct hpi_hsubsys *ph_subsys,
1531 u32 h_instream, u8 **pp_buffer,
1532 struct hpi_hostbuffer_status **pp_status);
1533
1534u16 hpi_adapter_restart(u16 adapter_index);
1535
1536/*
1537The following 3 functions were last declared in header files for
1538driver 3.10. HPI_ControlQuery() used to be the recommended way
1539of getting a volume range. Declared here for binary asihpi32.dll
1540compatibility.
1541*/
1542
1543void hpi_format_to_msg(struct hpi_msg_format *pMF,
1544 const struct hpi_format *pF);
1545void hpi_stream_response_to_legacy(struct hpi_stream_res *pSR);
1546
1547/*////////////////////////////////////////////////////////////////////////// */
1548/* declarations for individual HPI entry points */
1549hpi_handler_func HPI_1000;
1550hpi_handler_func HPI_6000;
1551hpi_handler_func HPI_6205;
1552hpi_handler_func HPI_COMMON;
1553
1554#endif /* _HPI_INTERNAL_H_ */