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