blob: e06c5e08d74c3439f6c950c5f8bbf4dae9924852 [file] [log] [blame]
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001/******************************************************************************
2
3 AudioScience HPI driver
Eliot Blennerhassettb7f12482011-07-22 15:52:55 +12004 Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com>
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02005
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"
Eliot Blennerhassettd8aefae2011-12-22 13:38:40 +130028
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +020029/** maximum number of memory regions mapped to an adapter */
30#define HPI_MAX_ADAPTER_MEM_SPACES (2)
31
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +130032/* Each OS needs its own hpios.h */
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +020033#include "hpios.h"
34
35/* physical memory allocation */
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +020036
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*/
45u16 hpios_locked_mem_alloc(struct consistent_dma_area *p_locked_mem_handle,
46 /**< memory handle */
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +130047 u32 size, /**< Size in bytes to allocate */
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +020048 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
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +020094/******************************************* 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
Eliot Blennerhassettba944552011-02-10 17:26:04 +1300102enum 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
Eliot Blennerhassettfc3a3992011-02-10 17:26:11 +1300112/** 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
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200124/******************************************* CONTROL ATTRIBUTES ****/
125/* (in order of control type ID */
126
Eliot Blennerhassett108ccb32010-07-06 08:37:09 +1200127/* This allows for 255 control types, 256 unique attributes each */
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300128#define HPI_CTL_ATTR(ctl, ai) ((HPI_CONTROL_##ctl << 8) + ai)
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200129
130/* Get the sub-index of the attribute for a control type */
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300131#define HPI_CTL_ATTR_INDEX(i) (i & 0xff)
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200132
Eliot Blennerhassett108ccb32010-07-06 08:37:09 +1200133/* Extract the control from the control attribute */
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300134#define HPI_CTL_ATTR_CONTROL(i) (i >> 8)
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200135
136/** Enable event generation for a control.
1370=disable, 1=enable
138\note generic to all controls that can generate events
139*/
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200140
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300141/** Unique identifiers for every control attribute
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200142*/
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300143enum HPI_CONTROL_ATTRIBUTES {
144 HPI_GENERIC_ENABLE = HPI_CTL_ATTR(GENERIC, 1),
145 HPI_GENERIC_EVENT_ENABLE = HPI_CTL_ATTR(GENERIC, 2),
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200146
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300147 HPI_VOLUME_GAIN = HPI_CTL_ATTR(VOLUME, 1),
148 HPI_VOLUME_AUTOFADE = HPI_CTL_ATTR(VOLUME, 2),
Eliot Blennerhassettfc3a3992011-02-10 17:26:11 +1300149 HPI_VOLUME_MUTE = HPI_CTL_ATTR(VOLUME, 3),
150 HPI_VOLUME_GAIN_AND_FLAGS = HPI_CTL_ATTR(VOLUME, 4),
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300151 HPI_VOLUME_NUM_CHANNELS = HPI_CTL_ATTR(VOLUME, 6),
152 HPI_VOLUME_RANGE = HPI_CTL_ATTR(VOLUME, 10),
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200153
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300154 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),
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200159
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300160 HPI_MULTIPLEXER_SOURCE = HPI_CTL_ATTR(MULTIPLEXER, 1),
161 HPI_MULTIPLEXER_QUERYSOURCE = HPI_CTL_ATTR(MULTIPLEXER, 2),
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200162
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300163 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),
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200167
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300168 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),
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200173
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300174 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),
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300224 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),
243 HPI_PAD_TA_ACTIVE = HPI_CTL_ATTR(PAD, 8)
244};
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200245
246#define HPI_POLARITY_POSITIVE 0
247#define HPI_POLARITY_NEGATIVE 1
248
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200249/*------------------------------------------------------------
250 Cobranet Chip Bridge - copied from HMI.H
251------------------------------------------------------------*/
252#define HPI_COBRANET_HMI_cobra_bridge 0x20000
253#define HPI_COBRANET_HMI_cobra_bridge_tx_pkt_buf \
254 (HPI_COBRANET_HMI_cobra_bridge + 0x1000)
255#define HPI_COBRANET_HMI_cobra_bridge_rx_pkt_buf \
256 (HPI_COBRANET_HMI_cobra_bridge + 0x2000)
257#define HPI_COBRANET_HMI_cobra_if_table1 0x110000
258#define HPI_COBRANET_HMI_cobra_if_phy_address \
259 (HPI_COBRANET_HMI_cobra_if_table1 + 0xd)
260#define HPI_COBRANET_HMI_cobra_protocolIP 0x72000
261#define HPI_COBRANET_HMI_cobra_ip_mon_currentIP \
262 (HPI_COBRANET_HMI_cobra_protocolIP + 0x0)
263#define HPI_COBRANET_HMI_cobra_ip_mon_staticIP \
264 (HPI_COBRANET_HMI_cobra_protocolIP + 0x2)
265#define HPI_COBRANET_HMI_cobra_sys 0x100000
266#define HPI_COBRANET_HMI_cobra_sys_desc \
267 (HPI_COBRANET_HMI_cobra_sys + 0x0)
268#define HPI_COBRANET_HMI_cobra_sys_objectID \
269 (HPI_COBRANET_HMI_cobra_sys + 0x100)
270#define HPI_COBRANET_HMI_cobra_sys_contact \
271 (HPI_COBRANET_HMI_cobra_sys + 0x200)
272#define HPI_COBRANET_HMI_cobra_sys_name \
273 (HPI_COBRANET_HMI_cobra_sys + 0x300)
274#define HPI_COBRANET_HMI_cobra_sys_location \
275 (HPI_COBRANET_HMI_cobra_sys + 0x400)
276
277/*------------------------------------------------------------
278 Cobranet Chip Status bits
279------------------------------------------------------------*/
280#define HPI_COBRANET_HMI_STATUS_RXPACKET 2
281#define HPI_COBRANET_HMI_STATUS_TXPACKET 3
282
283/*------------------------------------------------------------
284 Ethernet header size
285------------------------------------------------------------*/
286#define HPI_ETHERNET_HEADER_SIZE (16)
287
288/* These defines are used to fill in protocol information for an Ethernet packet
289 sent using HMI on CS18102 */
Eliot Blennerhassett6d0b8982011-04-05 20:55:47 +1200290/** ID supplied by Cirrus for ASI packets. */
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200291#define HPI_ETHERNET_PACKET_ID 0x85
292/** Simple packet - no special routing required */
293#define HPI_ETHERNET_PACKET_V1 0x01
294/** This packet must make its way to the host across the HPI interface */
295#define HPI_ETHERNET_PACKET_HOSTED_VIA_HMI 0x20
296/** This packet must make its way to the host across the HPI interface */
297#define HPI_ETHERNET_PACKET_HOSTED_VIA_HMI_V1 0x21
298/** This packet must make its way to the host across the HPI interface */
299#define HPI_ETHERNET_PACKET_HOSTED_VIA_HPI 0x40
300/** This packet must make its way to the host across the HPI interface */
301#define HPI_ETHERNET_PACKET_HOSTED_VIA_HPI_V1 0x41
302
Eliot Blennerhassett6d0b8982011-04-05 20:55:47 +1200303#define HPI_ETHERNET_UDP_PORT 44600 /**< HPI UDP service */
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200304
Eliot Blennerhassetta287ca22011-02-10 17:26:17 +1300305/** Default network timeout in milli-seconds. */
306#define HPI_ETHERNET_TIMEOUT_MS 500
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200307
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300308/** Locked memory buffer alloc/free phases */
309enum HPI_BUFFER_CMDS {
310 /** use one message to allocate or free physical memory */
311 HPI_BUFFER_CMD_EXTERNAL = 0,
312 /** alloc physical memory */
313 HPI_BUFFER_CMD_INTERNAL_ALLOC = 1,
314 /** send physical memory address to adapter */
315 HPI_BUFFER_CMD_INTERNAL_GRANTADAPTER = 2,
316 /** notify adapter to stop using physical buffer */
317 HPI_BUFFER_CMD_INTERNAL_REVOKEADAPTER = 3,
318 /** free physical buffer */
319 HPI_BUFFER_CMD_INTERNAL_FREE = 4
320};
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200321
322/*****************************************************************************/
323/*****************************************************************************/
324/******** HPI LOW LEVEL MESSAGES *******/
325/*****************************************************************************/
326/*****************************************************************************/
327/** Pnp ids */
328/** "ASI" - actual is "ASX" - need to change */
329#define HPI_ID_ISAPNP_AUDIOSCIENCE 0x0669
330/** PCI vendor ID that AudioScience uses */
331#define HPI_PCI_VENDOR_ID_AUDIOSCIENCE 0x175C
332/** PCI vendor ID that the DSP56301 has */
333#define HPI_PCI_VENDOR_ID_MOTOROLA 0x1057
334/** PCI vendor ID that TI uses */
335#define HPI_PCI_VENDOR_ID_TI 0x104C
336
337#define HPI_PCI_DEV_ID_PCI2040 0xAC60
338/** TI's C6205 PCI interface has this ID */
339#define HPI_PCI_DEV_ID_DSP6205 0xA106
340
341#define HPI_USB_VENDOR_ID_AUDIOSCIENCE 0x1257
342#define HPI_USB_W2K_TAG 0x57495341 /* "ASIW" */
343#define HPI_USB_LINUX_TAG 0x4C495341 /* "ASIL" */
344
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300345/** Invalid Adapter index
346Used in HPI messages that are not addressed to a specific adapter
347Used in DLL to indicate device not present
348*/
349#define HPI_ADAPTER_INDEX_INVALID 0xFFFF
350
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200351/** First 2 hex digits define the adapter family */
352#define HPI_ADAPTER_FAMILY_MASK 0xff00
Eliot Blennerhassett5a498ef2010-05-27 17:53:52 +1200353#define HPI_MODULE_FAMILY_MASK 0xfff0
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200354
355#define HPI_ADAPTER_FAMILY_ASI(f) (f & HPI_ADAPTER_FAMILY_MASK)
Eliot Blennerhassett5a498ef2010-05-27 17:53:52 +1200356#define HPI_MODULE_FAMILY_ASI(f) (f & HPI_MODULE_FAMILY_MASK)
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200357#define HPI_ADAPTER_ASI(f) (f)
358
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300359enum HPI_MESSAGE_TYPES {
Eliot Blennerhassett82b57742011-07-22 15:52:36 +1200360 HPI_TYPE_REQUEST = 1,
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300361 HPI_TYPE_RESPONSE = 2,
362 HPI_TYPE_DATA = 3,
Eliot Blennerhassettb7f12482011-07-22 15:52:55 +1200363 HPI_TYPE_SSX2BYPASS_MESSAGE = 4,
364 HPI_TYPE_COMMAND = 5,
365 HPI_TYPE_NOTIFICATION = 6
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300366};
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200367
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300368enum HPI_OBJECT_TYPES {
369 HPI_OBJ_SUBSYSTEM = 1,
370 HPI_OBJ_ADAPTER = 2,
371 HPI_OBJ_OSTREAM = 3,
372 HPI_OBJ_ISTREAM = 4,
373 HPI_OBJ_MIXER = 5,
374 HPI_OBJ_NODE = 6,
375 HPI_OBJ_CONTROL = 7,
376 HPI_OBJ_NVMEMORY = 8,
377 HPI_OBJ_GPIO = 9,
378 HPI_OBJ_WATCHDOG = 10,
379 HPI_OBJ_CLOCK = 11,
380 HPI_OBJ_PROFILE = 12,
Eliot Blennerhassett58fbf772011-07-22 15:52:40 +1200381 /* HPI_ OBJ_ CONTROLEX = 13, */
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300382 HPI_OBJ_ASYNCEVENT = 14
383#define HPI_OBJ_MAXINDEX 14
384};
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200385
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300386#define HPI_OBJ_FUNCTION_SPACING 0x100
Eliot Blennerhassetta287ca22011-02-10 17:26:17 +1300387#define HPI_FUNC_ID(obj, i) (HPI_OBJ_##obj * HPI_OBJ_FUNCTION_SPACING + i)
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200388
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200389#define HPI_EXTRACT_INDEX(fn) (fn & 0xff)
390
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300391enum HPI_FUNCTION_IDS {
392 HPI_SUBSYS_OPEN = HPI_FUNC_ID(SUBSYSTEM, 1),
393 HPI_SUBSYS_GET_VERSION = HPI_FUNC_ID(SUBSYSTEM, 2),
394 HPI_SUBSYS_GET_INFO = HPI_FUNC_ID(SUBSYSTEM, 3),
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300395 HPI_SUBSYS_CREATE_ADAPTER = HPI_FUNC_ID(SUBSYSTEM, 5),
396 HPI_SUBSYS_CLOSE = HPI_FUNC_ID(SUBSYSTEM, 6),
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300397 HPI_SUBSYS_DRIVER_LOAD = HPI_FUNC_ID(SUBSYSTEM, 8),
398 HPI_SUBSYS_DRIVER_UNLOAD = HPI_FUNC_ID(SUBSYSTEM, 9),
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300399 HPI_SUBSYS_GET_NUM_ADAPTERS = HPI_FUNC_ID(SUBSYSTEM, 12),
400 HPI_SUBSYS_GET_ADAPTER = HPI_FUNC_ID(SUBSYSTEM, 13),
401 HPI_SUBSYS_SET_NETWORK_INTERFACE = HPI_FUNC_ID(SUBSYSTEM, 14),
402 HPI_SUBSYS_OPTION_INFO = HPI_FUNC_ID(SUBSYSTEM, 15),
403 HPI_SUBSYS_OPTION_GET = HPI_FUNC_ID(SUBSYSTEM, 16),
404 HPI_SUBSYS_OPTION_SET = HPI_FUNC_ID(SUBSYSTEM, 17),
405#define HPI_SUBSYS_FUNCTION_COUNT 17
406
407 HPI_ADAPTER_OPEN = HPI_FUNC_ID(ADAPTER, 1),
408 HPI_ADAPTER_CLOSE = HPI_FUNC_ID(ADAPTER, 2),
409 HPI_ADAPTER_GET_INFO = HPI_FUNC_ID(ADAPTER, 3),
410 HPI_ADAPTER_GET_ASSERT = HPI_FUNC_ID(ADAPTER, 4),
411 HPI_ADAPTER_TEST_ASSERT = HPI_FUNC_ID(ADAPTER, 5),
412 HPI_ADAPTER_SET_MODE = HPI_FUNC_ID(ADAPTER, 6),
413 HPI_ADAPTER_GET_MODE = HPI_FUNC_ID(ADAPTER, 7),
414 HPI_ADAPTER_ENABLE_CAPABILITY = HPI_FUNC_ID(ADAPTER, 8),
415 HPI_ADAPTER_SELFTEST = HPI_FUNC_ID(ADAPTER, 9),
416 HPI_ADAPTER_FIND_OBJECT = HPI_FUNC_ID(ADAPTER, 10),
417 HPI_ADAPTER_QUERY_FLASH = HPI_FUNC_ID(ADAPTER, 11),
418 HPI_ADAPTER_START_FLASH = HPI_FUNC_ID(ADAPTER, 12),
419 HPI_ADAPTER_PROGRAM_FLASH = HPI_FUNC_ID(ADAPTER, 13),
420 HPI_ADAPTER_SET_PROPERTY = HPI_FUNC_ID(ADAPTER, 14),
421 HPI_ADAPTER_GET_PROPERTY = HPI_FUNC_ID(ADAPTER, 15),
422 HPI_ADAPTER_ENUM_PROPERTY = HPI_FUNC_ID(ADAPTER, 16),
423 HPI_ADAPTER_MODULE_INFO = HPI_FUNC_ID(ADAPTER, 17),
424 HPI_ADAPTER_DEBUG_READ = HPI_FUNC_ID(ADAPTER, 18),
Eliot Blennerhassettbd33c1c2011-02-10 17:26:16 +1300425 HPI_ADAPTER_IRQ_QUERY_AND_CLEAR = HPI_FUNC_ID(ADAPTER, 19),
426 HPI_ADAPTER_IRQ_CALLBACK = HPI_FUNC_ID(ADAPTER, 20),
Eliot Blennerhassett6d0b8982011-04-05 20:55:47 +1200427 HPI_ADAPTER_DELETE = HPI_FUNC_ID(ADAPTER, 21),
428#define HPI_ADAPTER_FUNCTION_COUNT 21
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300429
430 HPI_OSTREAM_OPEN = HPI_FUNC_ID(OSTREAM, 1),
431 HPI_OSTREAM_CLOSE = HPI_FUNC_ID(OSTREAM, 2),
432 HPI_OSTREAM_WRITE = HPI_FUNC_ID(OSTREAM, 3),
433 HPI_OSTREAM_START = HPI_FUNC_ID(OSTREAM, 4),
434 HPI_OSTREAM_STOP = HPI_FUNC_ID(OSTREAM, 5),
435 HPI_OSTREAM_RESET = HPI_FUNC_ID(OSTREAM, 6),
436 HPI_OSTREAM_GET_INFO = HPI_FUNC_ID(OSTREAM, 7),
437 HPI_OSTREAM_QUERY_FORMAT = HPI_FUNC_ID(OSTREAM, 8),
438 HPI_OSTREAM_DATA = HPI_FUNC_ID(OSTREAM, 9),
439 HPI_OSTREAM_SET_VELOCITY = HPI_FUNC_ID(OSTREAM, 10),
440 HPI_OSTREAM_SET_PUNCHINOUT = HPI_FUNC_ID(OSTREAM, 11),
441 HPI_OSTREAM_SINEGEN = HPI_FUNC_ID(OSTREAM, 12),
442 HPI_OSTREAM_ANC_RESET = HPI_FUNC_ID(OSTREAM, 13),
443 HPI_OSTREAM_ANC_GET_INFO = HPI_FUNC_ID(OSTREAM, 14),
444 HPI_OSTREAM_ANC_READ = HPI_FUNC_ID(OSTREAM, 15),
445 HPI_OSTREAM_SET_TIMESCALE = HPI_FUNC_ID(OSTREAM, 16),
446 HPI_OSTREAM_SET_FORMAT = HPI_FUNC_ID(OSTREAM, 17),
447 HPI_OSTREAM_HOSTBUFFER_ALLOC = HPI_FUNC_ID(OSTREAM, 18),
448 HPI_OSTREAM_HOSTBUFFER_FREE = HPI_FUNC_ID(OSTREAM, 19),
449 HPI_OSTREAM_GROUP_ADD = HPI_FUNC_ID(OSTREAM, 20),
450 HPI_OSTREAM_GROUP_GETMAP = HPI_FUNC_ID(OSTREAM, 21),
451 HPI_OSTREAM_GROUP_RESET = HPI_FUNC_ID(OSTREAM, 22),
452 HPI_OSTREAM_HOSTBUFFER_GET_INFO = HPI_FUNC_ID(OSTREAM, 23),
453 HPI_OSTREAM_WAIT_START = HPI_FUNC_ID(OSTREAM, 24),
Eliot Blennerhassettbd33c1c2011-02-10 17:26:16 +1300454 HPI_OSTREAM_WAIT = HPI_FUNC_ID(OSTREAM, 25),
455#define HPI_OSTREAM_FUNCTION_COUNT 25
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300456
457 HPI_ISTREAM_OPEN = HPI_FUNC_ID(ISTREAM, 1),
458 HPI_ISTREAM_CLOSE = HPI_FUNC_ID(ISTREAM, 2),
459 HPI_ISTREAM_SET_FORMAT = HPI_FUNC_ID(ISTREAM, 3),
460 HPI_ISTREAM_READ = HPI_FUNC_ID(ISTREAM, 4),
461 HPI_ISTREAM_START = HPI_FUNC_ID(ISTREAM, 5),
462 HPI_ISTREAM_STOP = HPI_FUNC_ID(ISTREAM, 6),
463 HPI_ISTREAM_RESET = HPI_FUNC_ID(ISTREAM, 7),
464 HPI_ISTREAM_GET_INFO = HPI_FUNC_ID(ISTREAM, 8),
465 HPI_ISTREAM_QUERY_FORMAT = HPI_FUNC_ID(ISTREAM, 9),
466 HPI_ISTREAM_ANC_RESET = HPI_FUNC_ID(ISTREAM, 10),
467 HPI_ISTREAM_ANC_GET_INFO = HPI_FUNC_ID(ISTREAM, 11),
468 HPI_ISTREAM_ANC_WRITE = HPI_FUNC_ID(ISTREAM, 12),
469 HPI_ISTREAM_HOSTBUFFER_ALLOC = HPI_FUNC_ID(ISTREAM, 13),
470 HPI_ISTREAM_HOSTBUFFER_FREE = HPI_FUNC_ID(ISTREAM, 14),
471 HPI_ISTREAM_GROUP_ADD = HPI_FUNC_ID(ISTREAM, 15),
472 HPI_ISTREAM_GROUP_GETMAP = HPI_FUNC_ID(ISTREAM, 16),
473 HPI_ISTREAM_GROUP_RESET = HPI_FUNC_ID(ISTREAM, 17),
474 HPI_ISTREAM_HOSTBUFFER_GET_INFO = HPI_FUNC_ID(ISTREAM, 18),
475 HPI_ISTREAM_WAIT_START = HPI_FUNC_ID(ISTREAM, 19),
Eliot Blennerhassettbd33c1c2011-02-10 17:26:16 +1300476 HPI_ISTREAM_WAIT = HPI_FUNC_ID(ISTREAM, 20),
477#define HPI_ISTREAM_FUNCTION_COUNT 20
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300478
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200479/* NOTE:
480 GET_NODE_INFO, SET_CONNECTION, GET_CONNECTIONS are not currently used */
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300481 HPI_MIXER_OPEN = HPI_FUNC_ID(MIXER, 1),
482 HPI_MIXER_CLOSE = HPI_FUNC_ID(MIXER, 2),
483 HPI_MIXER_GET_INFO = HPI_FUNC_ID(MIXER, 3),
484 HPI_MIXER_GET_NODE_INFO = HPI_FUNC_ID(MIXER, 4),
485 HPI_MIXER_GET_CONTROL = HPI_FUNC_ID(MIXER, 5),
486 HPI_MIXER_SET_CONNECTION = HPI_FUNC_ID(MIXER, 6),
487 HPI_MIXER_GET_CONNECTIONS = HPI_FUNC_ID(MIXER, 7),
488 HPI_MIXER_GET_CONTROL_BY_INDEX = HPI_FUNC_ID(MIXER, 8),
489 HPI_MIXER_GET_CONTROL_ARRAY_BY_INDEX = HPI_FUNC_ID(MIXER, 9),
490 HPI_MIXER_GET_CONTROL_MULTIPLE_VALUES = HPI_FUNC_ID(MIXER, 10),
491 HPI_MIXER_STORE = HPI_FUNC_ID(MIXER, 11),
Eliot Blennerhassettbd33c1c2011-02-10 17:26:16 +1300492 HPI_MIXER_GET_CACHE_INFO = HPI_FUNC_ID(MIXER, 12),
493#define HPI_MIXER_FUNCTION_COUNT 12
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300494
495 HPI_CONTROL_GET_INFO = HPI_FUNC_ID(CONTROL, 1),
496 HPI_CONTROL_GET_STATE = HPI_FUNC_ID(CONTROL, 2),
497 HPI_CONTROL_SET_STATE = HPI_FUNC_ID(CONTROL, 3),
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200498#define HPI_CONTROL_FUNCTION_COUNT 3
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300499
500 HPI_NVMEMORY_OPEN = HPI_FUNC_ID(NVMEMORY, 1),
501 HPI_NVMEMORY_READ_BYTE = HPI_FUNC_ID(NVMEMORY, 2),
502 HPI_NVMEMORY_WRITE_BYTE = HPI_FUNC_ID(NVMEMORY, 3),
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200503#define HPI_NVMEMORY_FUNCTION_COUNT 3
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300504
505 HPI_GPIO_OPEN = HPI_FUNC_ID(GPIO, 1),
506 HPI_GPIO_READ_BIT = HPI_FUNC_ID(GPIO, 2),
507 HPI_GPIO_WRITE_BIT = HPI_FUNC_ID(GPIO, 3),
508 HPI_GPIO_READ_ALL = HPI_FUNC_ID(GPIO, 4),
509 HPI_GPIO_WRITE_STATUS = HPI_FUNC_ID(GPIO, 5),
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200510#define HPI_GPIO_FUNCTION_COUNT 5
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300511
512 HPI_ASYNCEVENT_OPEN = HPI_FUNC_ID(ASYNCEVENT, 1),
513 HPI_ASYNCEVENT_CLOSE = HPI_FUNC_ID(ASYNCEVENT, 2),
514 HPI_ASYNCEVENT_WAIT = HPI_FUNC_ID(ASYNCEVENT, 3),
515 HPI_ASYNCEVENT_GETCOUNT = HPI_FUNC_ID(ASYNCEVENT, 4),
516 HPI_ASYNCEVENT_GET = HPI_FUNC_ID(ASYNCEVENT, 5),
517 HPI_ASYNCEVENT_SENDEVENTS = HPI_FUNC_ID(ASYNCEVENT, 6),
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200518#define HPI_ASYNCEVENT_FUNCTION_COUNT 6
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300519
520 HPI_WATCHDOG_OPEN = HPI_FUNC_ID(WATCHDOG, 1),
521 HPI_WATCHDOG_SET_TIME = HPI_FUNC_ID(WATCHDOG, 2),
522 HPI_WATCHDOG_PING = HPI_FUNC_ID(WATCHDOG, 3),
523
524 HPI_CLOCK_OPEN = HPI_FUNC_ID(CLOCK, 1),
525 HPI_CLOCK_SET_TIME = HPI_FUNC_ID(CLOCK, 2),
526 HPI_CLOCK_GET_TIME = HPI_FUNC_ID(CLOCK, 3),
527
528 HPI_PROFILE_OPEN_ALL = HPI_FUNC_ID(PROFILE, 1),
529 HPI_PROFILE_START_ALL = HPI_FUNC_ID(PROFILE, 2),
530 HPI_PROFILE_STOP_ALL = HPI_FUNC_ID(PROFILE, 3),
531 HPI_PROFILE_GET = HPI_FUNC_ID(PROFILE, 4),
532 HPI_PROFILE_GET_IDLECOUNT = HPI_FUNC_ID(PROFILE, 5),
533 HPI_PROFILE_GET_NAME = HPI_FUNC_ID(PROFILE, 6),
534 HPI_PROFILE_GET_UTILIZATION = HPI_FUNC_ID(PROFILE, 7)
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200535#define HPI_PROFILE_FUNCTION_COUNT 7
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300536};
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200537
538/* ////////////////////////////////////////////////////////////////////// */
539/* STRUCTURES */
540#ifndef DISABLE_PRAGMA_PACK1
541#pragma pack(push, 1)
542#endif
543
544/** PCI bus resource */
545struct hpi_pci {
546 u32 __iomem *ap_mem_base[HPI_MAX_ADAPTER_MEM_SPACES];
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300547 struct pci_dev *pci_dev;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200548};
549
550struct hpi_resource {
551 union {
552 const struct hpi_pci *pci;
553 const char *net_if;
554 } r;
555#ifndef HPI64BIT /* keep structure size constant */
556 u32 pad_to64;
557#endif
558 u16 bus_type; /* HPI_BUS_PNPISA, _PCI, _USB etc */
559 u16 padding;
560
561};
562
563/** Format info used inside struct hpi_message
564 Not the same as public API struct hpi_format */
565struct hpi_msg_format {
Eliot Blennerhassett1d595d22011-02-10 17:26:08 +1300566 u32 sample_rate; /**< 11025, 32000, 44100 etc. */
567 u32 bit_rate; /**< for MPEG */
568 u32 attributes; /**< stereo/joint_stereo/mono */
569 u16 channels; /**< 1,2..., (or ancillary mode or idle bit */
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200570 u16 format; /**< HPI_FORMAT_PCM16, _MPEG etc. see \ref HPI_FORMATS. */
571};
572
573/** Buffer+format structure.
574 Must be kept 7 * 32 bits to match public struct hpi_datastruct */
575struct hpi_msg_data {
576 struct hpi_msg_format format;
577 u8 *pb_data;
578#ifndef HPI64BIT
579 u32 padding;
580#endif
581 u32 data_size;
582};
583
584/** struct hpi_datastructure used up to 3.04 driver */
585struct hpi_data_legacy32 {
586 struct hpi_format format;
587 u32 pb_data;
588 u32 data_size;
589};
590
591#ifdef HPI64BIT
592/* Compatibility version of struct hpi_data*/
593struct hpi_data_compat32 {
594 struct hpi_msg_format format;
595 u32 pb_data;
596 u32 padding;
597 u32 data_size;
598};
599#endif
600
601struct hpi_buffer {
Eliot Blennerhassett938c5652011-07-22 15:52:50 +1200602 /** placeholder for backward compatibility (see dwBufferSize) */
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200603 struct hpi_msg_format reserved;
Eliot Blennerhassett1d595d22011-02-10 17:26:08 +1300604 u32 command; /**< HPI_BUFFER_CMD_xxx*/
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200605 u32 pci_address; /**< PCI physical address of buffer for DSP DMA */
606 u32 buffer_size; /**< must line up with data_size of HPI_DATA*/
607};
608
609/*/////////////////////////////////////////////////////////////////////////// */
610/* This is used for background buffer bus mastering stream buffers. */
611struct hpi_hostbuffer_status {
612 u32 samples_processed;
613 u32 auxiliary_data_available;
614 u32 stream_state;
615 /* DSP index in to the host bus master buffer. */
Eliot Blennerhassett8e0874e2011-12-22 13:38:36 +1300616 u32 dsp_index;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200617 /* Host index in to the host bus master buffer. */
618 u32 host_index;
619 u32 size_in_bytes;
620};
621
622struct hpi_streamid {
623 u16 object_type;
624 /**< Type of object, HPI_OBJ_OSTREAM or HPI_OBJ_ISTREAM. */
625 u16 stream_index; /**< outstream or instream index. */
626};
627
628struct hpi_punchinout {
629 u32 punch_in_sample;
630 u32 punch_out_sample;
631};
632
633struct hpi_subsys_msg {
634 struct hpi_resource resource;
635};
636
637struct hpi_subsys_res {
638 u32 version;
Eliot Blennerhassett2f918a62011-02-10 17:26:09 +1300639 u32 data; /* extended version */
640 u16 num_adapters;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200641 u16 adapter_index;
Eliot Blennerhassett2f918a62011-02-10 17:26:09 +1300642 u16 adapter_type;
643 u16 pad16;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200644};
645
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200646union hpi_adapterx_msg {
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200647 struct {
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300648 u32 dsp_address;
649 u32 count_bytes;
650 } debug_read;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200651 struct {
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300652 u32 adapter_mode;
653 u16 query_or_set;
654 } mode;
655 struct {
656 u16 index;
657 } module_info;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200658 struct {
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200659 u16 index;
660 u16 what;
661 u16 property_index;
662 } property_enum;
663 struct {
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300664 u16 property;
665 u16 parameter1;
666 u16 parameter2;
667 } property_set;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200668 struct {
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300669 u32 pad32;
670 u16 key1;
671 u16 key2;
672 } restart;
673 struct {
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300674 u32 pad32;
675 u16 value;
676 } test_assert;
Eliot Blennerhassettbd33c1c2011-02-10 17:26:16 +1300677 struct {
678 u32 yes;
679 } irq_query;
Eliot Blennerhassettd8aefae2011-12-22 13:38:40 +1300680 u32 pad[3];
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200681};
682
683struct hpi_adapter_res {
684 u32 serial_number;
685 u16 adapter_type;
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300686 u16 adapter_index;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200687 u16 num_instreams;
688 u16 num_outstreams;
689 u16 num_mixers;
690 u16 version;
691 u8 sz_adapter_assert[HPI_STRING_LEN];
692};
693
694union hpi_adapterx_res {
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300695 struct hpi_adapter_res info;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200696 struct {
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300697 u32 p1;
698 u16 count;
699 u16 dsp_index;
700 u32 p2;
701 u32 dsp_msg_addr;
702 char sz_message[HPI_STRING_LEN];
703 } assert;
704 struct {
705 u32 adapter_mode;
706 } mode;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200707 struct {
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200708 u16 parameter1;
709 u16 parameter2;
710 } property_get;
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300711 struct {
Eliot Blennerhassettbd33c1c2011-02-10 17:26:16 +1300712 u32 yes;
713 } irq_query;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200714};
715
716struct hpi_stream_msg {
717 union {
718 struct hpi_msg_data data;
719 struct hpi_data_legacy32 data32;
720 u16 velocity;
721 struct hpi_punchinout pio;
722 u32 time_scale;
723 struct hpi_buffer buffer;
724 struct hpi_streamid stream;
Eliot Blennerhassettbd33c1c2011-02-10 17:26:16 +1300725 u32 threshold_bytes;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200726 } u;
727};
728
729struct hpi_stream_res {
730 union {
731 struct {
732 /* size of hardware buffer */
733 u32 buffer_size;
734 /* OutStream - data to play,
735 InStream - data recorded */
736 u32 data_available;
737 /* OutStream - samples played,
738 InStream - samples recorded */
739 u32 samples_transferred;
740 /* Adapter - OutStream - data to play,
741 InStream - data recorded */
742 u32 auxiliary_data_available;
743 u16 state; /* HPI_STATE_PLAYING, _STATE_STOPPED */
744 u16 padding;
745 } stream_info;
746 struct {
747 u32 buffer_size;
748 u32 data_available;
749 u32 samples_transfered;
750 u16 state;
751 u16 outstream_index;
752 u16 instream_index;
753 u16 padding;
754 u32 auxiliary_data_available;
755 } legacy_stream_info;
756 struct {
757 /* bitmap of grouped OutStreams */
758 u32 outstream_group_map;
759 /* bitmap of grouped InStreams */
760 u32 instream_group_map;
761 } group_info;
762 struct {
763 /* pointer to the buffer */
764 u8 *p_buffer;
765 /* pointer to the hostbuffer status */
766 struct hpi_hostbuffer_status *p_status;
767 } hostbuffer_info;
768 } u;
769};
770
771struct hpi_mixer_msg {
772 u16 control_index;
773 u16 control_type; /* = HPI_CONTROL_METER _VOLUME etc */
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300774 u16 padding1; /* Maintain alignment of subsequent fields */
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200775 u16 node_type1; /* = HPI_SOURCENODE_LINEIN etc */
776 u16 node_index1; /* = 0..N */
777 u16 node_type2;
778 u16 node_index2;
779 u16 padding2; /* round to 4 bytes */
780};
781
782struct hpi_mixer_res {
783 u16 src_node_type; /* = HPI_SOURCENODE_LINEIN etc */
784 u16 src_node_index; /* = 0..N */
785 u16 dst_node_type;
786 u16 dst_node_index;
787 /* Also controlType for MixerGetControlByIndex */
788 u16 control_index;
789 /* may indicate which DSP the control is located on */
790 u16 dsp_index;
791};
792
793union hpi_mixerx_msg {
794 struct {
795 u16 starting_index;
796 u16 flags;
797 u32 length_in_bytes; /* length in bytes of p_data */
798 u32 p_data; /* pointer to a data array */
799 } gcabi;
800 struct {
801 u16 command;
802 u16 index;
803 } store; /* for HPI_MIXER_STORE message */
804};
805
806union hpi_mixerx_res {
807 struct {
808 u32 bytes_returned; /* size of items returned */
809 u32 p_data; /* pointer to data array */
810 u16 more_to_do; /* indicates if there is more to do */
811 } gcabi;
Eliot Blennerhassettbd33c1c2011-02-10 17:26:16 +1300812 struct {
813 u32 total_controls; /* count of controls in the mixer */
814 u32 cache_controls; /* count of controls in the cac */
815 u32 cache_bytes; /* size of cache */
816 } cache_info;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200817};
818
819struct hpi_control_msg {
820 u16 attribute; /* control attribute or property */
821 u16 saved_index;
822 u32 param1; /* generic parameter 1 */
823 u32 param2; /* generic parameter 2 */
824 short an_log_value[HPI_MAX_CHANNELS];
825};
826
827struct hpi_control_union_msg {
828 u16 attribute; /* control attribute or property */
829 u16 saved_index; /* only used in ctrl save/restore */
830 union {
831 struct {
832 u32 param1; /* generic parameter 1 */
833 u32 param2; /* generic parameter 2 */
834 short an_log_value[HPI_MAX_CHANNELS];
835 } old;
836 union {
837 u32 frequency;
838 u32 gain;
839 u32 band;
840 u32 deemphasis;
841 u32 program;
842 struct {
843 u32 mode;
844 u32 value;
845 } mode;
Eliot Blennerhassett5a498ef2010-05-27 17:53:52 +1200846 u32 blend;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200847 } tuner;
848 } u;
849};
850
851struct hpi_control_res {
852 /* Could make union. dwParam, anLogValue never used in same response */
853 u32 param1;
854 u32 param2;
855 short an_log_value[HPI_MAX_CHANNELS];
856};
857
858union hpi_control_union_res {
859 struct {
860 u32 param1;
861 u32 param2;
862 short an_log_value[HPI_MAX_CHANNELS];
863 } old;
864 union {
865 u32 band;
866 u32 frequency;
867 u32 gain;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200868 u32 deemphasis;
869 struct {
870 u32 data[2];
871 u32 bLER;
872 } rds;
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300873 short s_level;
874 struct {
875 u16 value;
876 u16 mask;
877 } status;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200878 } tuner;
879 struct {
880 char sz_data[8];
881 u32 remaining_chars;
882 } chars8;
883 char c_data12[12];
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200884 union {
Eliot Blennerhassett58fbf772011-07-22 15:52:40 +1200885 struct {
886 u32 status;
887 u32 readable_size;
888 u32 writeable_size;
889 } status;
890 } cobranet;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200891};
892
893struct hpi_nvmemory_msg {
894 u16 address;
895 u16 data;
896};
897
898struct hpi_nvmemory_res {
899 u16 size_in_bytes;
900 u16 data;
901};
902
903struct hpi_gpio_msg {
904 u16 bit_index;
905 u16 bit_data;
906};
907
908struct hpi_gpio_res {
909 u16 number_input_bits;
910 u16 number_output_bits;
911 u16 bit_data[4];
912};
913
914struct hpi_async_msg {
915 u32 events;
916 u16 maximum_events;
917 u16 padding;
918};
919
920struct hpi_async_res {
921 union {
922 struct {
923 u16 count;
924 } count;
925 struct {
926 u32 events;
927 u16 number_returned;
928 u16 padding;
929 } get;
930 struct hpi_async_event event;
931 } u;
932};
933
934struct hpi_watchdog_msg {
935 u32 time_ms;
936};
937
938struct hpi_watchdog_res {
939 u32 time_ms;
940};
941
942struct hpi_clock_msg {
943 u16 hours;
944 u16 minutes;
945 u16 seconds;
946 u16 milli_seconds;
947};
948
949struct hpi_clock_res {
950 u16 size_in_bytes;
951 u16 hours;
952 u16 minutes;
953 u16 seconds;
954 u16 milli_seconds;
955 u16 padding;
956};
957
958struct hpi_profile_msg {
959 u16 bin_index;
960 u16 padding;
961};
962
963struct hpi_profile_res_open {
964 u16 max_profiles;
965};
966
967struct hpi_profile_res_time {
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300968 u32 total_tick_count;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200969 u32 call_count;
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300970 u32 max_tick_count;
971 u32 ticks_per_millisecond;
972 u16 profile_interval;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200973};
974
975struct hpi_profile_res_name {
976 u8 sz_name[32];
977};
978
979struct hpi_profile_res {
980 union {
981 struct hpi_profile_res_open o;
982 struct hpi_profile_res_time t;
983 struct hpi_profile_res_name n;
984 } u;
985};
986
987struct hpi_message_header {
988 u16 size; /* total size in bytes */
989 u8 type; /* HPI_TYPE_MESSAGE */
990 u8 version; /* message version */
991 u16 object; /* HPI_OBJ_* */
992 u16 function; /* HPI_SUBSYS_xxx, HPI_ADAPTER_xxx */
993 u16 adapter_index; /* the adapter index */
994 u16 obj_index; /* */
995};
996
997struct hpi_message {
998 /* following fields must match 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 union {
1007 struct hpi_subsys_msg s;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001008 union hpi_adapterx_msg ax;
1009 struct hpi_stream_msg d;
1010 struct hpi_mixer_msg m;
1011 union hpi_mixerx_msg mx; /* extended mixer; */
1012 struct hpi_control_msg c; /* mixer control; */
1013 /* identical to struct hpi_control_msg,
1014 but field naming is improved */
1015 struct hpi_control_union_msg cu;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001016 struct hpi_nvmemory_msg n;
1017 struct hpi_gpio_msg l; /* digital i/o */
1018 struct hpi_watchdog_msg w;
1019 struct hpi_clock_msg t; /* dsp time */
1020 struct hpi_profile_msg p;
1021 struct hpi_async_msg as;
1022 char fixed_size[32];
1023 } u;
1024};
1025
1026#define HPI_MESSAGE_SIZE_BY_OBJECT { \
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +13001027 sizeof(struct hpi_message_header) , /* Default, no object type 0 */ \
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001028 sizeof(struct hpi_message_header) + sizeof(struct hpi_subsys_msg),\
1029 sizeof(struct hpi_message_header) + sizeof(union hpi_adapterx_msg),\
1030 sizeof(struct hpi_message_header) + sizeof(struct hpi_stream_msg),\
1031 sizeof(struct hpi_message_header) + sizeof(struct hpi_stream_msg),\
1032 sizeof(struct hpi_message_header) + sizeof(struct hpi_mixer_msg),\
1033 sizeof(struct hpi_message_header) , /* no node message */ \
1034 sizeof(struct hpi_message_header) + sizeof(struct hpi_control_msg),\
1035 sizeof(struct hpi_message_header) + sizeof(struct hpi_nvmemory_msg),\
1036 sizeof(struct hpi_message_header) + sizeof(struct hpi_gpio_msg),\
1037 sizeof(struct hpi_message_header) + sizeof(struct hpi_watchdog_msg),\
1038 sizeof(struct hpi_message_header) + sizeof(struct hpi_clock_msg),\
1039 sizeof(struct hpi_message_header) + sizeof(struct hpi_profile_msg),\
Eliot Blennerhassett58fbf772011-07-22 15:52:40 +12001040 sizeof(struct hpi_message_header), /* controlx obj removed */ \
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001041 sizeof(struct hpi_message_header) + sizeof(struct hpi_async_msg) \
1042}
1043
Eliot Blennerhassett1d595d22011-02-10 17:26:08 +13001044/*
1045Note that the wSpecificError error field should be inspected and potentially
1046reported whenever HPI_ERROR_DSP_COMMUNICATION or HPI_ERROR_DSP_BOOTLOAD is
1047returned in wError.
1048*/
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001049struct hpi_response_header {
1050 u16 size;
1051 u8 type; /* HPI_TYPE_RESPONSE */
1052 u8 version; /* response version */
1053 u16 object; /* HPI_OBJ_* */
1054 u16 function; /* HPI_SUBSYS_xxx, HPI_ADAPTER_xxx */
1055 u16 error; /* HPI_ERROR_xxx */
1056 u16 specific_error; /* adapter specific error */
1057};
1058
1059struct hpi_response {
1060/* following fields must match 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 union {
1069 struct hpi_subsys_res s;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001070 union hpi_adapterx_res ax;
1071 struct hpi_stream_res d;
1072 struct hpi_mixer_res m;
1073 union hpi_mixerx_res mx; /* extended mixer; */
1074 struct hpi_control_res c; /* mixer control; */
1075 /* identical to hpi_control_res, but field naming is improved */
1076 union hpi_control_union_res cu;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001077 struct hpi_nvmemory_res n;
1078 struct hpi_gpio_res l; /* digital i/o */
1079 struct hpi_watchdog_res w;
1080 struct hpi_clock_res t; /* dsp time */
1081 struct hpi_profile_res p;
1082 struct hpi_async_res as;
1083 u8 bytes[52];
1084 } u;
1085};
1086
1087#define HPI_RESPONSE_SIZE_BY_OBJECT { \
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +13001088 sizeof(struct hpi_response_header) ,/* Default, no object type 0 */ \
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001089 sizeof(struct hpi_response_header) + sizeof(struct hpi_subsys_res),\
1090 sizeof(struct hpi_response_header) + sizeof(union hpi_adapterx_res),\
1091 sizeof(struct hpi_response_header) + sizeof(struct hpi_stream_res),\
1092 sizeof(struct hpi_response_header) + sizeof(struct hpi_stream_res),\
1093 sizeof(struct hpi_response_header) + sizeof(struct hpi_mixer_res),\
1094 sizeof(struct hpi_response_header) , /* no node response */ \
1095 sizeof(struct hpi_response_header) + sizeof(struct hpi_control_res),\
1096 sizeof(struct hpi_response_header) + sizeof(struct hpi_nvmemory_res),\
1097 sizeof(struct hpi_response_header) + sizeof(struct hpi_gpio_res),\
1098 sizeof(struct hpi_response_header) + sizeof(struct hpi_watchdog_res),\
1099 sizeof(struct hpi_response_header) + sizeof(struct hpi_clock_res),\
1100 sizeof(struct hpi_response_header) + sizeof(struct hpi_profile_res),\
Eliot Blennerhassett58fbf772011-07-22 15:52:40 +12001101 sizeof(struct hpi_response_header), /* controlx obj removed */ \
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001102 sizeof(struct hpi_response_header) + sizeof(struct hpi_async_res) \
1103}
1104
Eliot Blennerhassettba944552011-02-10 17:26:04 +13001105/*********************** version 1 message/response **************************/
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001106#define HPINET_ETHERNET_DATA_SIZE (1500)
1107#define HPINET_IP_HDR_SIZE (20)
1108#define HPINET_IP_DATA_SIZE (HPINET_ETHERNET_DATA_SIZE - HPINET_IP_HDR_SIZE)
1109#define HPINET_UDP_HDR_SIZE (8)
1110#define HPINET_UDP_DATA_SIZE (HPINET_IP_DATA_SIZE - HPINET_UDP_HDR_SIZE)
1111#define HPINET_ASI_HDR_SIZE (2)
1112#define HPINET_ASI_DATA_SIZE (HPINET_UDP_DATA_SIZE - HPINET_ASI_HDR_SIZE)
1113
1114#define HPI_MAX_PAYLOAD_SIZE (HPINET_ASI_DATA_SIZE - 2)
1115
1116/* New style message/response, but still V0 compatible */
1117struct hpi_msg_adapter_get_info {
1118 struct hpi_message_header h;
1119};
1120
1121struct hpi_res_adapter_get_info {
1122 struct hpi_response_header h; /*v0 */
1123 struct hpi_adapter_res p;
1124};
1125
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +13001126struct hpi_res_adapter_debug_read {
1127 struct hpi_response_header h;
1128 u8 bytes[256];
1129};
1130
Eliot Blennerhassett58fbf772011-07-22 15:52:40 +12001131struct hpi_msg_cobranet_hmi {
1132 u16 attribute;
1133 u16 padding;
1134 u32 hmi_address;
1135 u32 byte_count;
1136};
1137
1138struct hpi_msg_cobranet_hmiwrite {
1139 struct hpi_message_header h;
1140 struct hpi_msg_cobranet_hmi p;
1141 u8 bytes[256];
1142};
1143
1144struct hpi_msg_cobranet_hmiread {
1145 struct hpi_message_header h;
1146 struct hpi_msg_cobranet_hmi p;
1147};
1148
1149struct hpi_res_cobranet_hmiread {
1150 struct hpi_response_header h;
1151 u32 byte_count;
1152 u8 bytes[256];
1153};
1154
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001155#if 1
1156#define hpi_message_header_v1 hpi_message_header
1157#define hpi_response_header_v1 hpi_response_header
1158#else
1159/* V1 headers in Addition to v0 headers */
1160struct hpi_message_header_v1 {
1161 struct hpi_message_header h0;
1162/* struct {
1163} h1; */
1164};
1165
1166struct hpi_response_header_v1 {
1167 struct hpi_response_header h0;
1168 struct {
1169 u16 adapter_index; /* the adapter index */
1170 u16 obj_index; /* object index */
1171 } h1;
1172};
1173#endif
1174
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001175struct hpi_msg_payload_v0 {
1176 struct hpi_message_header h;
1177 union {
1178 struct hpi_subsys_msg s;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001179 union hpi_adapterx_msg ax;
1180 struct hpi_stream_msg d;
1181 struct hpi_mixer_msg m;
1182 union hpi_mixerx_msg mx;
1183 struct hpi_control_msg c;
1184 struct hpi_control_union_msg cu;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001185 struct hpi_nvmemory_msg n;
1186 struct hpi_gpio_msg l;
1187 struct hpi_watchdog_msg w;
1188 struct hpi_clock_msg t;
1189 struct hpi_profile_msg p;
1190 struct hpi_async_msg as;
1191 } u;
1192};
1193
1194struct hpi_res_payload_v0 {
1195 struct hpi_response_header h;
1196 union {
1197 struct hpi_subsys_res s;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001198 union hpi_adapterx_res ax;
1199 struct hpi_stream_res d;
1200 struct hpi_mixer_res m;
1201 union hpi_mixerx_res mx;
1202 struct hpi_control_res c;
1203 union hpi_control_union_res cu;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001204 struct hpi_nvmemory_res n;
1205 struct hpi_gpio_res l;
1206 struct hpi_watchdog_res w;
1207 struct hpi_clock_res t;
1208 struct hpi_profile_res p;
1209 struct hpi_async_res as;
1210 } u;
1211};
1212
1213union hpi_message_buffer_v1 {
1214 struct hpi_message m0; /* version 0 */
1215 struct hpi_message_header_v1 h;
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +13001216 u8 buf[HPI_MAX_PAYLOAD_SIZE];
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001217};
1218
1219union hpi_response_buffer_v1 {
1220 struct hpi_response r0; /* version 0 */
1221 struct hpi_response_header_v1 h;
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +13001222 u8 buf[HPI_MAX_PAYLOAD_SIZE];
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001223};
1224
1225compile_time_assert((sizeof(union hpi_message_buffer_v1) <=
1226 HPI_MAX_PAYLOAD_SIZE), message_buffer_ok);
1227compile_time_assert((sizeof(union hpi_response_buffer_v1) <=
1228 HPI_MAX_PAYLOAD_SIZE), response_buffer_ok);
1229
1230/*////////////////////////////////////////////////////////////////////////// */
1231/* declarations for compact control calls */
1232struct hpi_control_defn {
1233 u8 type;
1234 u8 channels;
1235 u8 src_node_type;
1236 u8 src_node_index;
1237 u8 dest_node_type;
1238 u8 dest_node_index;
1239};
1240
1241/*////////////////////////////////////////////////////////////////////////// */
1242/* declarations for control caching (internal to HPI<->DSP interaction) */
1243
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +13001244/** indicates a cached u16 value is invalid. */
1245#define HPI_CACHE_INVALID_UINT16 0xFFFF
1246/** indicates a cached short value is invalid. */
1247#define HPI_CACHE_INVALID_SHORT -32768
1248
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001249/** A compact representation of (part of) a controls state.
1250Used for efficient transfer of the control state
1251between DSP and host or across a network
1252*/
1253struct hpi_control_cache_info {
1254 /** one of HPI_CONTROL_* */
1255 u8 control_type;
1256 /** The total size of cached information in 32-bit words. */
1257 u8 size_in32bit_words;
1258 /** The original index of the control on the DSP */
1259 u16 control_index;
1260};
1261
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +13001262struct hpi_control_cache_vol {
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001263 struct hpi_control_cache_info i;
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +13001264 short an_log[2];
Eliot Blennerhassettfc3a3992011-02-10 17:26:11 +13001265 unsigned short flags;
1266 char padding[2];
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +13001267};
1268
1269struct hpi_control_cache_meter {
1270 struct hpi_control_cache_info i;
1271 short an_log_peak[2];
1272 short an_logRMS[2];
1273};
1274
1275struct hpi_control_cache_channelmode {
1276 struct hpi_control_cache_info i;
1277 u16 mode;
1278 char temp_padding[6];
1279};
1280
1281struct hpi_control_cache_mux {
1282 struct hpi_control_cache_info i;
1283 u16 source_node_type;
1284 u16 source_node_index;
1285 char temp_padding[4];
1286};
1287
1288struct hpi_control_cache_level {
1289 struct hpi_control_cache_info i;
1290 short an_log[2];
1291 char temp_padding[4];
1292};
1293
1294struct hpi_control_cache_tuner {
1295 struct hpi_control_cache_info i;
1296 u32 freq_ink_hz;
1297 u16 band;
1298 short s_level_avg;
1299};
1300
1301struct hpi_control_cache_aes3rx {
1302 struct hpi_control_cache_info i;
1303 u32 error_status;
1304 u32 format;
1305};
1306
1307struct hpi_control_cache_aes3tx {
1308 struct hpi_control_cache_info i;
1309 u32 format;
1310 char temp_padding[4];
1311};
1312
1313struct hpi_control_cache_tonedetector {
1314 struct hpi_control_cache_info i;
1315 u16 state;
1316 char temp_padding[6];
1317};
1318
1319struct hpi_control_cache_silencedetector {
1320 struct hpi_control_cache_info i;
1321 u32 state;
1322 char temp_padding[4];
1323};
1324
1325struct hpi_control_cache_sampleclock {
1326 struct hpi_control_cache_info i;
1327 u16 source;
1328 u16 source_index;
1329 u32 sample_rate;
1330};
1331
1332struct hpi_control_cache_microphone {
1333 struct hpi_control_cache_info i;
1334 u16 phantom_state;
1335 char temp_padding[6];
1336};
1337
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +13001338struct hpi_control_cache_single {
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001339 union {
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +13001340 struct hpi_control_cache_info i;
1341 struct hpi_control_cache_vol vol;
1342 struct hpi_control_cache_meter meter;
1343 struct hpi_control_cache_channelmode mode;
1344 struct hpi_control_cache_mux mux;
1345 struct hpi_control_cache_level level;
1346 struct hpi_control_cache_tuner tuner;
1347 struct hpi_control_cache_aes3rx aes3rx;
1348 struct hpi_control_cache_aes3tx aes3tx;
1349 struct hpi_control_cache_tonedetector tone;
1350 struct hpi_control_cache_silencedetector silence;
1351 struct hpi_control_cache_sampleclock clk;
1352 struct hpi_control_cache_microphone microphone;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001353 } u;
1354};
1355
1356struct hpi_control_cache_pad {
1357 struct hpi_control_cache_info i;
1358 u32 field_valid_flags;
1359 u8 c_channel[8];
1360 u8 c_artist[40];
1361 u8 c_title[40];
1362 u8 c_comment[200];
1363 u32 pTY;
1364 u32 pI;
1365 u32 traffic_supported;
1366 u32 traffic_anouncement;
1367};
1368
Eliot Blennerhassettba944552011-02-10 17:26:04 +13001369/* 2^N sized FIFO buffer (internal to HPI<->DSP interaction) */
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001370struct hpi_fifo_buffer {
1371 u32 size;
Eliot Blennerhassett8e0874e2011-12-22 13:38:36 +13001372 u32 dsp_index;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001373 u32 host_index;
1374};
1375
1376#ifndef DISABLE_PRAGMA_PACK1
1377#pragma pack(pop)
1378#endif
1379
1380/* skip host side function declarations for DSP
1381 compile and documentation extraction */
1382
1383char hpi_handle_object(const u32 handle);
1384
1385void hpi_handle_to_indexes(const u32 handle, u16 *pw_adapter_index,
1386 u16 *pw_object_index);
1387
1388u32 hpi_indexes_to_handle(const char c_object, const u16 adapter_index,
1389 const u16 object_index);
1390
1391/*////////////////////////////////////////////////////////////////////////// */
1392
1393/* main HPI entry point */
Eliot Blennerhassettba944552011-02-10 17:26:04 +13001394void hpi_send_recv(struct hpi_message *phm, struct hpi_response *phr);
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001395
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001396/* used in PnP OS/driver */
Eliot Blennerhassettba944552011-02-10 17:26:04 +13001397u16 hpi_subsys_create_adapter(const struct hpi_resource *p_resource,
1398 u16 *pw_adapter_index);
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001399
Eliot Blennerhassettba944552011-02-10 17:26:04 +13001400u16 hpi_outstream_host_buffer_get_info(u32 h_outstream, u8 **pp_buffer,
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001401 struct hpi_hostbuffer_status **pp_status);
1402
Eliot Blennerhassettba944552011-02-10 17:26:04 +13001403u16 hpi_instream_host_buffer_get_info(u32 h_instream, u8 **pp_buffer,
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001404 struct hpi_hostbuffer_status **pp_status);
1405
1406u16 hpi_adapter_restart(u16 adapter_index);
1407
1408/*
1409The following 3 functions were last declared in header files for
1410driver 3.10. HPI_ControlQuery() used to be the recommended way
1411of getting a volume range. Declared here for binary asihpi32.dll
1412compatibility.
1413*/
1414
1415void hpi_format_to_msg(struct hpi_msg_format *pMF,
1416 const struct hpi_format *pF);
1417void hpi_stream_response_to_legacy(struct hpi_stream_res *pSR);
1418
1419/*////////////////////////////////////////////////////////////////////////// */
1420/* declarations for individual HPI entry points */
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001421hpi_handler_func HPI_6000;
1422hpi_handler_func HPI_6205;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001423
1424#endif /* _HPI_INTERNAL_H_ */