blob: 848fb7596ae4376f93cf996fffb8284d17898f59 [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),
Eliot Blennerhassett58fbf772011-07-22 15:52:40 +1200229 /*HPI_COBRANET_SET_DATA = HPI_CTL_ATTR(COBRANET, 3), */
230 /*HPI_COBRANET_GET_DATA = HPI_CTL_ATTR(COBRANET, 4), */
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300231 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 */
Eliot Blennerhassett6d0b8982011-04-05 20:55:47 +1200297/** ID supplied by Cirrus for ASI packets. */
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200298#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
Eliot Blennerhassett6d0b8982011-04-05 20:55:47 +1200310#define HPI_ETHERNET_UDP_PORT 44600 /**< HPI UDP service */
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200311
Eliot Blennerhassetta287ca22011-02-10 17:26:17 +1300312/** Default network timeout in milli-seconds. */
313#define HPI_ETHERNET_TIMEOUT_MS 500
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200314
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 {
Eliot Blennerhassett82b57742011-07-22 15:52:36 +1200367 HPI_TYPE_REQUEST = 1,
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300368 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,
Eliot Blennerhassett58fbf772011-07-22 15:52:40 +1200386 /* HPI_ OBJ_ CONTROLEX = 13, */
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300387 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 Blennerhassetta287ca22011-02-10 17:26:17 +1300392#define HPI_FUNC_ID(obj, i) (HPI_OBJ_##obj * HPI_OBJ_FUNCTION_SPACING + i)
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200393
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200394#define HPI_EXTRACT_INDEX(fn) (fn & 0xff)
395
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300396enum HPI_FUNCTION_IDS {
397 HPI_SUBSYS_OPEN = HPI_FUNC_ID(SUBSYSTEM, 1),
398 HPI_SUBSYS_GET_VERSION = HPI_FUNC_ID(SUBSYSTEM, 2),
399 HPI_SUBSYS_GET_INFO = HPI_FUNC_ID(SUBSYSTEM, 3),
Eliot Blennerhassett6d0b8982011-04-05 20:55:47 +1200400 /* HPI_SUBSYS_FIND_ADAPTERS = HPI_FUNC_ID(SUBSYSTEM, 4), */
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300401 HPI_SUBSYS_CREATE_ADAPTER = HPI_FUNC_ID(SUBSYSTEM, 5),
402 HPI_SUBSYS_CLOSE = HPI_FUNC_ID(SUBSYSTEM, 6),
Eliot Blennerhassett6d0b8982011-04-05 20:55:47 +1200403 /* HPI_SUBSYS_DELETE_ADAPTER = HPI_FUNC_ID(SUBSYSTEM, 7), */
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300404 HPI_SUBSYS_DRIVER_LOAD = HPI_FUNC_ID(SUBSYSTEM, 8),
405 HPI_SUBSYS_DRIVER_UNLOAD = HPI_FUNC_ID(SUBSYSTEM, 9),
Eliot Blennerhassett6d0b8982011-04-05 20:55:47 +1200406 /* HPI_SUBSYS_READ_PORT_8 = HPI_FUNC_ID(SUBSYSTEM, 10), */
407 /* HPI_SUBSYS_WRITE_PORT_8 = HPI_FUNC_ID(SUBSYSTEM, 11), */
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300408 HPI_SUBSYS_GET_NUM_ADAPTERS = HPI_FUNC_ID(SUBSYSTEM, 12),
409 HPI_SUBSYS_GET_ADAPTER = HPI_FUNC_ID(SUBSYSTEM, 13),
410 HPI_SUBSYS_SET_NETWORK_INTERFACE = HPI_FUNC_ID(SUBSYSTEM, 14),
411 HPI_SUBSYS_OPTION_INFO = HPI_FUNC_ID(SUBSYSTEM, 15),
412 HPI_SUBSYS_OPTION_GET = HPI_FUNC_ID(SUBSYSTEM, 16),
413 HPI_SUBSYS_OPTION_SET = HPI_FUNC_ID(SUBSYSTEM, 17),
414#define HPI_SUBSYS_FUNCTION_COUNT 17
415
416 HPI_ADAPTER_OPEN = HPI_FUNC_ID(ADAPTER, 1),
417 HPI_ADAPTER_CLOSE = HPI_FUNC_ID(ADAPTER, 2),
418 HPI_ADAPTER_GET_INFO = HPI_FUNC_ID(ADAPTER, 3),
419 HPI_ADAPTER_GET_ASSERT = HPI_FUNC_ID(ADAPTER, 4),
420 HPI_ADAPTER_TEST_ASSERT = HPI_FUNC_ID(ADAPTER, 5),
421 HPI_ADAPTER_SET_MODE = HPI_FUNC_ID(ADAPTER, 6),
422 HPI_ADAPTER_GET_MODE = HPI_FUNC_ID(ADAPTER, 7),
423 HPI_ADAPTER_ENABLE_CAPABILITY = HPI_FUNC_ID(ADAPTER, 8),
424 HPI_ADAPTER_SELFTEST = HPI_FUNC_ID(ADAPTER, 9),
425 HPI_ADAPTER_FIND_OBJECT = HPI_FUNC_ID(ADAPTER, 10),
426 HPI_ADAPTER_QUERY_FLASH = HPI_FUNC_ID(ADAPTER, 11),
427 HPI_ADAPTER_START_FLASH = HPI_FUNC_ID(ADAPTER, 12),
428 HPI_ADAPTER_PROGRAM_FLASH = HPI_FUNC_ID(ADAPTER, 13),
429 HPI_ADAPTER_SET_PROPERTY = HPI_FUNC_ID(ADAPTER, 14),
430 HPI_ADAPTER_GET_PROPERTY = HPI_FUNC_ID(ADAPTER, 15),
431 HPI_ADAPTER_ENUM_PROPERTY = HPI_FUNC_ID(ADAPTER, 16),
432 HPI_ADAPTER_MODULE_INFO = HPI_FUNC_ID(ADAPTER, 17),
433 HPI_ADAPTER_DEBUG_READ = HPI_FUNC_ID(ADAPTER, 18),
Eliot Blennerhassettbd33c1c2011-02-10 17:26:16 +1300434 HPI_ADAPTER_IRQ_QUERY_AND_CLEAR = HPI_FUNC_ID(ADAPTER, 19),
435 HPI_ADAPTER_IRQ_CALLBACK = HPI_FUNC_ID(ADAPTER, 20),
Eliot Blennerhassett6d0b8982011-04-05 20:55:47 +1200436 HPI_ADAPTER_DELETE = HPI_FUNC_ID(ADAPTER, 21),
437#define HPI_ADAPTER_FUNCTION_COUNT 21
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300438
439 HPI_OSTREAM_OPEN = HPI_FUNC_ID(OSTREAM, 1),
440 HPI_OSTREAM_CLOSE = HPI_FUNC_ID(OSTREAM, 2),
441 HPI_OSTREAM_WRITE = HPI_FUNC_ID(OSTREAM, 3),
442 HPI_OSTREAM_START = HPI_FUNC_ID(OSTREAM, 4),
443 HPI_OSTREAM_STOP = HPI_FUNC_ID(OSTREAM, 5),
444 HPI_OSTREAM_RESET = HPI_FUNC_ID(OSTREAM, 6),
445 HPI_OSTREAM_GET_INFO = HPI_FUNC_ID(OSTREAM, 7),
446 HPI_OSTREAM_QUERY_FORMAT = HPI_FUNC_ID(OSTREAM, 8),
447 HPI_OSTREAM_DATA = HPI_FUNC_ID(OSTREAM, 9),
448 HPI_OSTREAM_SET_VELOCITY = HPI_FUNC_ID(OSTREAM, 10),
449 HPI_OSTREAM_SET_PUNCHINOUT = HPI_FUNC_ID(OSTREAM, 11),
450 HPI_OSTREAM_SINEGEN = HPI_FUNC_ID(OSTREAM, 12),
451 HPI_OSTREAM_ANC_RESET = HPI_FUNC_ID(OSTREAM, 13),
452 HPI_OSTREAM_ANC_GET_INFO = HPI_FUNC_ID(OSTREAM, 14),
453 HPI_OSTREAM_ANC_READ = HPI_FUNC_ID(OSTREAM, 15),
454 HPI_OSTREAM_SET_TIMESCALE = HPI_FUNC_ID(OSTREAM, 16),
455 HPI_OSTREAM_SET_FORMAT = HPI_FUNC_ID(OSTREAM, 17),
456 HPI_OSTREAM_HOSTBUFFER_ALLOC = HPI_FUNC_ID(OSTREAM, 18),
457 HPI_OSTREAM_HOSTBUFFER_FREE = HPI_FUNC_ID(OSTREAM, 19),
458 HPI_OSTREAM_GROUP_ADD = HPI_FUNC_ID(OSTREAM, 20),
459 HPI_OSTREAM_GROUP_GETMAP = HPI_FUNC_ID(OSTREAM, 21),
460 HPI_OSTREAM_GROUP_RESET = HPI_FUNC_ID(OSTREAM, 22),
461 HPI_OSTREAM_HOSTBUFFER_GET_INFO = HPI_FUNC_ID(OSTREAM, 23),
462 HPI_OSTREAM_WAIT_START = HPI_FUNC_ID(OSTREAM, 24),
Eliot Blennerhassettbd33c1c2011-02-10 17:26:16 +1300463 HPI_OSTREAM_WAIT = HPI_FUNC_ID(OSTREAM, 25),
464#define HPI_OSTREAM_FUNCTION_COUNT 25
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300465
466 HPI_ISTREAM_OPEN = HPI_FUNC_ID(ISTREAM, 1),
467 HPI_ISTREAM_CLOSE = HPI_FUNC_ID(ISTREAM, 2),
468 HPI_ISTREAM_SET_FORMAT = HPI_FUNC_ID(ISTREAM, 3),
469 HPI_ISTREAM_READ = HPI_FUNC_ID(ISTREAM, 4),
470 HPI_ISTREAM_START = HPI_FUNC_ID(ISTREAM, 5),
471 HPI_ISTREAM_STOP = HPI_FUNC_ID(ISTREAM, 6),
472 HPI_ISTREAM_RESET = HPI_FUNC_ID(ISTREAM, 7),
473 HPI_ISTREAM_GET_INFO = HPI_FUNC_ID(ISTREAM, 8),
474 HPI_ISTREAM_QUERY_FORMAT = HPI_FUNC_ID(ISTREAM, 9),
475 HPI_ISTREAM_ANC_RESET = HPI_FUNC_ID(ISTREAM, 10),
476 HPI_ISTREAM_ANC_GET_INFO = HPI_FUNC_ID(ISTREAM, 11),
477 HPI_ISTREAM_ANC_WRITE = HPI_FUNC_ID(ISTREAM, 12),
478 HPI_ISTREAM_HOSTBUFFER_ALLOC = HPI_FUNC_ID(ISTREAM, 13),
479 HPI_ISTREAM_HOSTBUFFER_FREE = HPI_FUNC_ID(ISTREAM, 14),
480 HPI_ISTREAM_GROUP_ADD = HPI_FUNC_ID(ISTREAM, 15),
481 HPI_ISTREAM_GROUP_GETMAP = HPI_FUNC_ID(ISTREAM, 16),
482 HPI_ISTREAM_GROUP_RESET = HPI_FUNC_ID(ISTREAM, 17),
483 HPI_ISTREAM_HOSTBUFFER_GET_INFO = HPI_FUNC_ID(ISTREAM, 18),
484 HPI_ISTREAM_WAIT_START = HPI_FUNC_ID(ISTREAM, 19),
Eliot Blennerhassettbd33c1c2011-02-10 17:26:16 +1300485 HPI_ISTREAM_WAIT = HPI_FUNC_ID(ISTREAM, 20),
486#define HPI_ISTREAM_FUNCTION_COUNT 20
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300487
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200488/* NOTE:
489 GET_NODE_INFO, SET_CONNECTION, GET_CONNECTIONS are not currently used */
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300490 HPI_MIXER_OPEN = HPI_FUNC_ID(MIXER, 1),
491 HPI_MIXER_CLOSE = HPI_FUNC_ID(MIXER, 2),
492 HPI_MIXER_GET_INFO = HPI_FUNC_ID(MIXER, 3),
493 HPI_MIXER_GET_NODE_INFO = HPI_FUNC_ID(MIXER, 4),
494 HPI_MIXER_GET_CONTROL = HPI_FUNC_ID(MIXER, 5),
495 HPI_MIXER_SET_CONNECTION = HPI_FUNC_ID(MIXER, 6),
496 HPI_MIXER_GET_CONNECTIONS = HPI_FUNC_ID(MIXER, 7),
497 HPI_MIXER_GET_CONTROL_BY_INDEX = HPI_FUNC_ID(MIXER, 8),
498 HPI_MIXER_GET_CONTROL_ARRAY_BY_INDEX = HPI_FUNC_ID(MIXER, 9),
499 HPI_MIXER_GET_CONTROL_MULTIPLE_VALUES = HPI_FUNC_ID(MIXER, 10),
500 HPI_MIXER_STORE = HPI_FUNC_ID(MIXER, 11),
Eliot Blennerhassettbd33c1c2011-02-10 17:26:16 +1300501 HPI_MIXER_GET_CACHE_INFO = HPI_FUNC_ID(MIXER, 12),
502#define HPI_MIXER_FUNCTION_COUNT 12
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300503
504 HPI_CONTROL_GET_INFO = HPI_FUNC_ID(CONTROL, 1),
505 HPI_CONTROL_GET_STATE = HPI_FUNC_ID(CONTROL, 2),
506 HPI_CONTROL_SET_STATE = HPI_FUNC_ID(CONTROL, 3),
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200507#define HPI_CONTROL_FUNCTION_COUNT 3
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300508
509 HPI_NVMEMORY_OPEN = HPI_FUNC_ID(NVMEMORY, 1),
510 HPI_NVMEMORY_READ_BYTE = HPI_FUNC_ID(NVMEMORY, 2),
511 HPI_NVMEMORY_WRITE_BYTE = HPI_FUNC_ID(NVMEMORY, 3),
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200512#define HPI_NVMEMORY_FUNCTION_COUNT 3
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300513
514 HPI_GPIO_OPEN = HPI_FUNC_ID(GPIO, 1),
515 HPI_GPIO_READ_BIT = HPI_FUNC_ID(GPIO, 2),
516 HPI_GPIO_WRITE_BIT = HPI_FUNC_ID(GPIO, 3),
517 HPI_GPIO_READ_ALL = HPI_FUNC_ID(GPIO, 4),
518 HPI_GPIO_WRITE_STATUS = HPI_FUNC_ID(GPIO, 5),
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200519#define HPI_GPIO_FUNCTION_COUNT 5
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300520
521 HPI_ASYNCEVENT_OPEN = HPI_FUNC_ID(ASYNCEVENT, 1),
522 HPI_ASYNCEVENT_CLOSE = HPI_FUNC_ID(ASYNCEVENT, 2),
523 HPI_ASYNCEVENT_WAIT = HPI_FUNC_ID(ASYNCEVENT, 3),
524 HPI_ASYNCEVENT_GETCOUNT = HPI_FUNC_ID(ASYNCEVENT, 4),
525 HPI_ASYNCEVENT_GET = HPI_FUNC_ID(ASYNCEVENT, 5),
526 HPI_ASYNCEVENT_SENDEVENTS = HPI_FUNC_ID(ASYNCEVENT, 6),
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200527#define HPI_ASYNCEVENT_FUNCTION_COUNT 6
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300528
529 HPI_WATCHDOG_OPEN = HPI_FUNC_ID(WATCHDOG, 1),
530 HPI_WATCHDOG_SET_TIME = HPI_FUNC_ID(WATCHDOG, 2),
531 HPI_WATCHDOG_PING = HPI_FUNC_ID(WATCHDOG, 3),
532
533 HPI_CLOCK_OPEN = HPI_FUNC_ID(CLOCK, 1),
534 HPI_CLOCK_SET_TIME = HPI_FUNC_ID(CLOCK, 2),
535 HPI_CLOCK_GET_TIME = HPI_FUNC_ID(CLOCK, 3),
536
537 HPI_PROFILE_OPEN_ALL = HPI_FUNC_ID(PROFILE, 1),
538 HPI_PROFILE_START_ALL = HPI_FUNC_ID(PROFILE, 2),
539 HPI_PROFILE_STOP_ALL = HPI_FUNC_ID(PROFILE, 3),
540 HPI_PROFILE_GET = HPI_FUNC_ID(PROFILE, 4),
541 HPI_PROFILE_GET_IDLECOUNT = HPI_FUNC_ID(PROFILE, 5),
542 HPI_PROFILE_GET_NAME = HPI_FUNC_ID(PROFILE, 6),
543 HPI_PROFILE_GET_UTILIZATION = HPI_FUNC_ID(PROFILE, 7)
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200544#define HPI_PROFILE_FUNCTION_COUNT 7
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300545};
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200546
547/* ////////////////////////////////////////////////////////////////////// */
548/* STRUCTURES */
549#ifndef DISABLE_PRAGMA_PACK1
550#pragma pack(push, 1)
551#endif
552
553/** PCI bus resource */
554struct hpi_pci {
555 u32 __iomem *ap_mem_base[HPI_MAX_ADAPTER_MEM_SPACES];
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300556 struct pci_dev *pci_dev;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200557};
558
559struct hpi_resource {
560 union {
561 const struct hpi_pci *pci;
562 const char *net_if;
563 } r;
564#ifndef HPI64BIT /* keep structure size constant */
565 u32 pad_to64;
566#endif
567 u16 bus_type; /* HPI_BUS_PNPISA, _PCI, _USB etc */
568 u16 padding;
569
570};
571
572/** Format info used inside struct hpi_message
573 Not the same as public API struct hpi_format */
574struct hpi_msg_format {
Eliot Blennerhassett1d595d22011-02-10 17:26:08 +1300575 u32 sample_rate; /**< 11025, 32000, 44100 etc. */
576 u32 bit_rate; /**< for MPEG */
577 u32 attributes; /**< stereo/joint_stereo/mono */
578 u16 channels; /**< 1,2..., (or ancillary mode or idle bit */
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200579 u16 format; /**< HPI_FORMAT_PCM16, _MPEG etc. see \ref HPI_FORMATS. */
580};
581
582/** Buffer+format structure.
583 Must be kept 7 * 32 bits to match public struct hpi_datastruct */
584struct hpi_msg_data {
585 struct hpi_msg_format format;
586 u8 *pb_data;
587#ifndef HPI64BIT
588 u32 padding;
589#endif
590 u32 data_size;
591};
592
593/** struct hpi_datastructure used up to 3.04 driver */
594struct hpi_data_legacy32 {
595 struct hpi_format format;
596 u32 pb_data;
597 u32 data_size;
598};
599
600#ifdef HPI64BIT
601/* Compatibility version of struct hpi_data*/
602struct hpi_data_compat32 {
603 struct hpi_msg_format format;
604 u32 pb_data;
605 u32 padding;
606 u32 data_size;
607};
608#endif
609
610struct hpi_buffer {
Lucas De Marchi25985ed2011-03-30 22:57:33 -0300611 /** placehoder for backward compatibility (see dwBufferSize) */
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200612 struct hpi_msg_format reserved;
Eliot Blennerhassett1d595d22011-02-10 17:26:08 +1300613 u32 command; /**< HPI_BUFFER_CMD_xxx*/
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200614 u32 pci_address; /**< PCI physical address of buffer for DSP DMA */
615 u32 buffer_size; /**< must line up with data_size of HPI_DATA*/
616};
617
618/*/////////////////////////////////////////////////////////////////////////// */
619/* This is used for background buffer bus mastering stream buffers. */
620struct hpi_hostbuffer_status {
621 u32 samples_processed;
622 u32 auxiliary_data_available;
623 u32 stream_state;
624 /* DSP index in to the host bus master buffer. */
625 u32 dSP_index;
626 /* Host index in to the host bus master buffer. */
627 u32 host_index;
628 u32 size_in_bytes;
629};
630
631struct hpi_streamid {
632 u16 object_type;
633 /**< Type of object, HPI_OBJ_OSTREAM or HPI_OBJ_ISTREAM. */
634 u16 stream_index; /**< outstream or instream index. */
635};
636
637struct hpi_punchinout {
638 u32 punch_in_sample;
639 u32 punch_out_sample;
640};
641
642struct hpi_subsys_msg {
643 struct hpi_resource resource;
644};
645
646struct hpi_subsys_res {
647 u32 version;
Eliot Blennerhassett2f918a62011-02-10 17:26:09 +1300648 u32 data; /* extended version */
649 u16 num_adapters;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200650 u16 adapter_index;
Eliot Blennerhassett2f918a62011-02-10 17:26:09 +1300651 u16 adapter_type;
652 u16 pad16;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200653};
654
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200655union hpi_adapterx_msg {
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200656 struct {
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300657 u32 dsp_address;
658 u32 count_bytes;
659 } debug_read;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200660 struct {
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300661 u32 adapter_mode;
662 u16 query_or_set;
663 } mode;
664 struct {
665 u16 index;
666 } module_info;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200667 struct {
668 u32 checksum;
669 u16 sequence;
670 u16 length;
671 u16 offset; /**< offset from start of msg to data */
672 u16 unused;
673 } program_flash;
674 struct {
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200675 u16 index;
676 u16 what;
677 u16 property_index;
678 } property_enum;
679 struct {
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300680 u16 property;
681 u16 parameter1;
682 u16 parameter2;
683 } property_set;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200684 struct {
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300685 u32 offset;
686 } query_flash;
687 struct {
688 u32 pad32;
689 u16 key1;
690 u16 key2;
691 } restart;
692 struct {
693 u32 offset;
694 u32 length;
695 u32 key;
696 } start_flash;
697 struct {
698 u32 pad32;
699 u16 value;
700 } test_assert;
Eliot Blennerhassettbd33c1c2011-02-10 17:26:16 +1300701 struct {
702 u32 yes;
703 } irq_query;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200704};
705
706struct hpi_adapter_res {
707 u32 serial_number;
708 u16 adapter_type;
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300709 u16 adapter_index;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200710 u16 num_instreams;
711 u16 num_outstreams;
712 u16 num_mixers;
713 u16 version;
714 u8 sz_adapter_assert[HPI_STRING_LEN];
715};
716
717union hpi_adapterx_res {
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300718 struct hpi_adapter_res info;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200719 struct {
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300720 u32 p1;
721 u16 count;
722 u16 dsp_index;
723 u32 p2;
724 u32 dsp_msg_addr;
725 char sz_message[HPI_STRING_LEN];
726 } assert;
727 struct {
728 u32 adapter_mode;
729 } mode;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200730 struct {
731 u16 sequence;
732 } program_flash;
733 struct {
734 u16 parameter1;
735 u16 parameter2;
736 } property_get;
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300737 struct {
738 u32 checksum;
739 u32 length;
740 u32 version;
741 } query_flash;
Eliot Blennerhassettbd33c1c2011-02-10 17:26:16 +1300742 struct {
743 u32 yes;
744 } irq_query;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200745};
746
747struct hpi_stream_msg {
748 union {
749 struct hpi_msg_data data;
750 struct hpi_data_legacy32 data32;
751 u16 velocity;
752 struct hpi_punchinout pio;
753 u32 time_scale;
754 struct hpi_buffer buffer;
755 struct hpi_streamid stream;
Eliot Blennerhassettbd33c1c2011-02-10 17:26:16 +1300756 u32 threshold_bytes;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200757 } u;
758};
759
760struct hpi_stream_res {
761 union {
762 struct {
763 /* size of hardware buffer */
764 u32 buffer_size;
765 /* OutStream - data to play,
766 InStream - data recorded */
767 u32 data_available;
768 /* OutStream - samples played,
769 InStream - samples recorded */
770 u32 samples_transferred;
771 /* Adapter - OutStream - data to play,
772 InStream - data recorded */
773 u32 auxiliary_data_available;
774 u16 state; /* HPI_STATE_PLAYING, _STATE_STOPPED */
775 u16 padding;
776 } stream_info;
777 struct {
778 u32 buffer_size;
779 u32 data_available;
780 u32 samples_transfered;
781 u16 state;
782 u16 outstream_index;
783 u16 instream_index;
784 u16 padding;
785 u32 auxiliary_data_available;
786 } legacy_stream_info;
787 struct {
788 /* bitmap of grouped OutStreams */
789 u32 outstream_group_map;
790 /* bitmap of grouped InStreams */
791 u32 instream_group_map;
792 } group_info;
793 struct {
794 /* pointer to the buffer */
795 u8 *p_buffer;
796 /* pointer to the hostbuffer status */
797 struct hpi_hostbuffer_status *p_status;
798 } hostbuffer_info;
799 } u;
800};
801
802struct hpi_mixer_msg {
803 u16 control_index;
804 u16 control_type; /* = HPI_CONTROL_METER _VOLUME etc */
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300805 u16 padding1; /* Maintain alignment of subsequent fields */
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200806 u16 node_type1; /* = HPI_SOURCENODE_LINEIN etc */
807 u16 node_index1; /* = 0..N */
808 u16 node_type2;
809 u16 node_index2;
810 u16 padding2; /* round to 4 bytes */
811};
812
813struct hpi_mixer_res {
814 u16 src_node_type; /* = HPI_SOURCENODE_LINEIN etc */
815 u16 src_node_index; /* = 0..N */
816 u16 dst_node_type;
817 u16 dst_node_index;
818 /* Also controlType for MixerGetControlByIndex */
819 u16 control_index;
820 /* may indicate which DSP the control is located on */
821 u16 dsp_index;
822};
823
824union hpi_mixerx_msg {
825 struct {
826 u16 starting_index;
827 u16 flags;
828 u32 length_in_bytes; /* length in bytes of p_data */
829 u32 p_data; /* pointer to a data array */
830 } gcabi;
831 struct {
832 u16 command;
833 u16 index;
834 } store; /* for HPI_MIXER_STORE message */
835};
836
837union hpi_mixerx_res {
838 struct {
839 u32 bytes_returned; /* size of items returned */
840 u32 p_data; /* pointer to data array */
841 u16 more_to_do; /* indicates if there is more to do */
842 } gcabi;
Eliot Blennerhassettbd33c1c2011-02-10 17:26:16 +1300843 struct {
844 u32 total_controls; /* count of controls in the mixer */
845 u32 cache_controls; /* count of controls in the cac */
846 u32 cache_bytes; /* size of cache */
847 } cache_info;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200848};
849
850struct hpi_control_msg {
851 u16 attribute; /* control attribute or property */
852 u16 saved_index;
853 u32 param1; /* generic parameter 1 */
854 u32 param2; /* generic parameter 2 */
855 short an_log_value[HPI_MAX_CHANNELS];
856};
857
858struct hpi_control_union_msg {
859 u16 attribute; /* control attribute or property */
860 u16 saved_index; /* only used in ctrl save/restore */
861 union {
862 struct {
863 u32 param1; /* generic parameter 1 */
864 u32 param2; /* generic parameter 2 */
865 short an_log_value[HPI_MAX_CHANNELS];
866 } old;
867 union {
868 u32 frequency;
869 u32 gain;
870 u32 band;
871 u32 deemphasis;
872 u32 program;
873 struct {
874 u32 mode;
875 u32 value;
876 } mode;
Eliot Blennerhassett5a498ef2010-05-27 17:53:52 +1200877 u32 blend;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200878 } tuner;
879 } u;
880};
881
882struct hpi_control_res {
883 /* Could make union. dwParam, anLogValue never used in same response */
884 u32 param1;
885 u32 param2;
886 short an_log_value[HPI_MAX_CHANNELS];
887};
888
889union hpi_control_union_res {
890 struct {
891 u32 param1;
892 u32 param2;
893 short an_log_value[HPI_MAX_CHANNELS];
894 } old;
895 union {
896 u32 band;
897 u32 frequency;
898 u32 gain;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200899 u32 deemphasis;
900 struct {
901 u32 data[2];
902 u32 bLER;
903 } rds;
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300904 short s_level;
905 struct {
906 u16 value;
907 u16 mask;
908 } status;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200909 } tuner;
910 struct {
911 char sz_data[8];
912 u32 remaining_chars;
913 } chars8;
914 char c_data12[12];
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200915 union {
Eliot Blennerhassett58fbf772011-07-22 15:52:40 +1200916 struct {
917 u32 status;
918 u32 readable_size;
919 u32 writeable_size;
920 } status;
921 } cobranet;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +0200922};
923
924struct hpi_nvmemory_msg {
925 u16 address;
926 u16 data;
927};
928
929struct hpi_nvmemory_res {
930 u16 size_in_bytes;
931 u16 data;
932};
933
934struct hpi_gpio_msg {
935 u16 bit_index;
936 u16 bit_data;
937};
938
939struct hpi_gpio_res {
940 u16 number_input_bits;
941 u16 number_output_bits;
942 u16 bit_data[4];
943};
944
945struct hpi_async_msg {
946 u32 events;
947 u16 maximum_events;
948 u16 padding;
949};
950
951struct hpi_async_res {
952 union {
953 struct {
954 u16 count;
955 } count;
956 struct {
957 u32 events;
958 u16 number_returned;
959 u16 padding;
960 } get;
961 struct hpi_async_event event;
962 } u;
963};
964
965struct hpi_watchdog_msg {
966 u32 time_ms;
967};
968
969struct hpi_watchdog_res {
970 u32 time_ms;
971};
972
973struct hpi_clock_msg {
974 u16 hours;
975 u16 minutes;
976 u16 seconds;
977 u16 milli_seconds;
978};
979
980struct hpi_clock_res {
981 u16 size_in_bytes;
982 u16 hours;
983 u16 minutes;
984 u16 seconds;
985 u16 milli_seconds;
986 u16 padding;
987};
988
989struct hpi_profile_msg {
990 u16 bin_index;
991 u16 padding;
992};
993
994struct hpi_profile_res_open {
995 u16 max_profiles;
996};
997
998struct hpi_profile_res_time {
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +1300999 u32 total_tick_count;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001000 u32 call_count;
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +13001001 u32 max_tick_count;
1002 u32 ticks_per_millisecond;
1003 u16 profile_interval;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001004};
1005
1006struct hpi_profile_res_name {
1007 u8 sz_name[32];
1008};
1009
1010struct hpi_profile_res {
1011 union {
1012 struct hpi_profile_res_open o;
1013 struct hpi_profile_res_time t;
1014 struct hpi_profile_res_name n;
1015 } u;
1016};
1017
1018struct hpi_message_header {
1019 u16 size; /* total size in bytes */
1020 u8 type; /* HPI_TYPE_MESSAGE */
1021 u8 version; /* message version */
1022 u16 object; /* HPI_OBJ_* */
1023 u16 function; /* HPI_SUBSYS_xxx, HPI_ADAPTER_xxx */
1024 u16 adapter_index; /* the adapter index */
1025 u16 obj_index; /* */
1026};
1027
1028struct hpi_message {
1029 /* following fields must match HPI_MESSAGE_HEADER */
1030 u16 size; /* total size in bytes */
1031 u8 type; /* HPI_TYPE_MESSAGE */
1032 u8 version; /* message version */
1033 u16 object; /* HPI_OBJ_* */
1034 u16 function; /* HPI_SUBSYS_xxx, HPI_ADAPTER_xxx */
1035 u16 adapter_index; /* the adapter index */
1036 u16 obj_index; /* */
1037 union {
1038 struct hpi_subsys_msg s;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001039 union hpi_adapterx_msg ax;
1040 struct hpi_stream_msg d;
1041 struct hpi_mixer_msg m;
1042 union hpi_mixerx_msg mx; /* extended mixer; */
1043 struct hpi_control_msg c; /* mixer control; */
1044 /* identical to struct hpi_control_msg,
1045 but field naming is improved */
1046 struct hpi_control_union_msg cu;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001047 struct hpi_nvmemory_msg n;
1048 struct hpi_gpio_msg l; /* digital i/o */
1049 struct hpi_watchdog_msg w;
1050 struct hpi_clock_msg t; /* dsp time */
1051 struct hpi_profile_msg p;
1052 struct hpi_async_msg as;
1053 char fixed_size[32];
1054 } u;
1055};
1056
1057#define HPI_MESSAGE_SIZE_BY_OBJECT { \
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +13001058 sizeof(struct hpi_message_header) , /* Default, no object type 0 */ \
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001059 sizeof(struct hpi_message_header) + sizeof(struct hpi_subsys_msg),\
1060 sizeof(struct hpi_message_header) + sizeof(union hpi_adapterx_msg),\
1061 sizeof(struct hpi_message_header) + sizeof(struct hpi_stream_msg),\
1062 sizeof(struct hpi_message_header) + sizeof(struct hpi_stream_msg),\
1063 sizeof(struct hpi_message_header) + sizeof(struct hpi_mixer_msg),\
1064 sizeof(struct hpi_message_header) , /* no node message */ \
1065 sizeof(struct hpi_message_header) + sizeof(struct hpi_control_msg),\
1066 sizeof(struct hpi_message_header) + sizeof(struct hpi_nvmemory_msg),\
1067 sizeof(struct hpi_message_header) + sizeof(struct hpi_gpio_msg),\
1068 sizeof(struct hpi_message_header) + sizeof(struct hpi_watchdog_msg),\
1069 sizeof(struct hpi_message_header) + sizeof(struct hpi_clock_msg),\
1070 sizeof(struct hpi_message_header) + sizeof(struct hpi_profile_msg),\
Eliot Blennerhassett58fbf772011-07-22 15:52:40 +12001071 sizeof(struct hpi_message_header), /* controlx obj removed */ \
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001072 sizeof(struct hpi_message_header) + sizeof(struct hpi_async_msg) \
1073}
1074
Eliot Blennerhassett1d595d22011-02-10 17:26:08 +13001075/*
1076Note that the wSpecificError error field should be inspected and potentially
1077reported whenever HPI_ERROR_DSP_COMMUNICATION or HPI_ERROR_DSP_BOOTLOAD is
1078returned in wError.
1079*/
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001080struct hpi_response_header {
1081 u16 size;
1082 u8 type; /* HPI_TYPE_RESPONSE */
1083 u8 version; /* response version */
1084 u16 object; /* HPI_OBJ_* */
1085 u16 function; /* HPI_SUBSYS_xxx, HPI_ADAPTER_xxx */
1086 u16 error; /* HPI_ERROR_xxx */
1087 u16 specific_error; /* adapter specific error */
1088};
1089
1090struct hpi_response {
1091/* following fields must match HPI_RESPONSE_HEADER */
1092 u16 size;
1093 u8 type; /* HPI_TYPE_RESPONSE */
1094 u8 version; /* response version */
1095 u16 object; /* HPI_OBJ_* */
1096 u16 function; /* HPI_SUBSYS_xxx, HPI_ADAPTER_xxx */
1097 u16 error; /* HPI_ERROR_xxx */
1098 u16 specific_error; /* adapter specific error */
1099 union {
1100 struct hpi_subsys_res s;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001101 union hpi_adapterx_res ax;
1102 struct hpi_stream_res d;
1103 struct hpi_mixer_res m;
1104 union hpi_mixerx_res mx; /* extended mixer; */
1105 struct hpi_control_res c; /* mixer control; */
1106 /* identical to hpi_control_res, but field naming is improved */
1107 union hpi_control_union_res cu;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001108 struct hpi_nvmemory_res n;
1109 struct hpi_gpio_res l; /* digital i/o */
1110 struct hpi_watchdog_res w;
1111 struct hpi_clock_res t; /* dsp time */
1112 struct hpi_profile_res p;
1113 struct hpi_async_res as;
1114 u8 bytes[52];
1115 } u;
1116};
1117
1118#define HPI_RESPONSE_SIZE_BY_OBJECT { \
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +13001119 sizeof(struct hpi_response_header) ,/* Default, no object type 0 */ \
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001120 sizeof(struct hpi_response_header) + sizeof(struct hpi_subsys_res),\
1121 sizeof(struct hpi_response_header) + sizeof(union hpi_adapterx_res),\
1122 sizeof(struct hpi_response_header) + sizeof(struct hpi_stream_res),\
1123 sizeof(struct hpi_response_header) + sizeof(struct hpi_stream_res),\
1124 sizeof(struct hpi_response_header) + sizeof(struct hpi_mixer_res),\
1125 sizeof(struct hpi_response_header) , /* no node response */ \
1126 sizeof(struct hpi_response_header) + sizeof(struct hpi_control_res),\
1127 sizeof(struct hpi_response_header) + sizeof(struct hpi_nvmemory_res),\
1128 sizeof(struct hpi_response_header) + sizeof(struct hpi_gpio_res),\
1129 sizeof(struct hpi_response_header) + sizeof(struct hpi_watchdog_res),\
1130 sizeof(struct hpi_response_header) + sizeof(struct hpi_clock_res),\
1131 sizeof(struct hpi_response_header) + sizeof(struct hpi_profile_res),\
Eliot Blennerhassett58fbf772011-07-22 15:52:40 +12001132 sizeof(struct hpi_response_header), /* controlx obj removed */ \
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001133 sizeof(struct hpi_response_header) + sizeof(struct hpi_async_res) \
1134}
1135
Eliot Blennerhassettba944552011-02-10 17:26:04 +13001136/*********************** version 1 message/response **************************/
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001137#define HPINET_ETHERNET_DATA_SIZE (1500)
1138#define HPINET_IP_HDR_SIZE (20)
1139#define HPINET_IP_DATA_SIZE (HPINET_ETHERNET_DATA_SIZE - HPINET_IP_HDR_SIZE)
1140#define HPINET_UDP_HDR_SIZE (8)
1141#define HPINET_UDP_DATA_SIZE (HPINET_IP_DATA_SIZE - HPINET_UDP_HDR_SIZE)
1142#define HPINET_ASI_HDR_SIZE (2)
1143#define HPINET_ASI_DATA_SIZE (HPINET_UDP_DATA_SIZE - HPINET_ASI_HDR_SIZE)
1144
1145#define HPI_MAX_PAYLOAD_SIZE (HPINET_ASI_DATA_SIZE - 2)
1146
1147/* New style message/response, but still V0 compatible */
1148struct hpi_msg_adapter_get_info {
1149 struct hpi_message_header h;
1150};
1151
1152struct hpi_res_adapter_get_info {
1153 struct hpi_response_header h; /*v0 */
1154 struct hpi_adapter_res p;
1155};
1156
1157/* padding is so these are same size as v0 hpi_message */
1158struct hpi_msg_adapter_query_flash {
1159 struct hpi_message_header h;
1160 u32 offset;
1161 u8 pad_to_version0_size[sizeof(struct hpi_message) - /* V0 res */
1162 sizeof(struct hpi_message_header) - 1 * sizeof(u32)];
1163};
1164
1165/* padding is so these are same size as v0 hpi_response */
1166struct hpi_res_adapter_query_flash {
1167 struct hpi_response_header h;
1168 u32 checksum;
1169 u32 length;
1170 u32 version;
1171 u8 pad_to_version0_size[sizeof(struct hpi_response) - /* V0 res */
1172 sizeof(struct hpi_response_header) - 3 * sizeof(u32)];
1173};
1174
1175struct hpi_msg_adapter_start_flash {
1176 struct hpi_message_header h;
1177 u32 offset;
1178 u32 length;
1179 u32 key;
1180 u8 pad_to_version0_size[sizeof(struct hpi_message) - /* V0 res */
1181 sizeof(struct hpi_message_header) - 3 * sizeof(u32)];
1182};
1183
1184struct hpi_res_adapter_start_flash {
1185 struct hpi_response_header h;
1186 u8 pad_to_version0_size[sizeof(struct hpi_response) - /* V0 res */
1187 sizeof(struct hpi_response_header)];
1188};
1189
1190struct hpi_msg_adapter_program_flash_payload {
1191 u32 checksum;
1192 u16 sequence;
1193 u16 length;
1194 u16 offset; /**< offset from start of msg to data */
1195 u16 unused;
1196 /* ensure sizeof(header + payload) == sizeof(hpi_message_V0)
1197 because old firmware expects data after message of this size */
1198 u8 pad_to_version0_size[sizeof(struct hpi_message) - /* V0 message */
1199 sizeof(struct hpi_message_header) - sizeof(u32) -
1200 4 * sizeof(u16)];
1201};
1202
1203struct hpi_msg_adapter_program_flash {
1204 struct hpi_message_header h;
1205 struct hpi_msg_adapter_program_flash_payload p;
1206 u32 data[256];
1207};
1208
1209struct hpi_res_adapter_program_flash {
1210 struct hpi_response_header h;
1211 u16 sequence;
1212 u8 pad_to_version0_size[sizeof(struct hpi_response) - /* V0 res */
1213 sizeof(struct hpi_response_header) - sizeof(u16)];
1214};
1215
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +13001216struct hpi_msg_adapter_debug_read {
1217 struct hpi_message_header h;
1218 u32 dsp_address;
1219 u32 count_bytes;
1220};
1221
1222struct hpi_res_adapter_debug_read {
1223 struct hpi_response_header h;
1224 u8 bytes[256];
1225};
1226
Eliot Blennerhassett58fbf772011-07-22 15:52:40 +12001227struct hpi_msg_cobranet_hmi {
1228 u16 attribute;
1229 u16 padding;
1230 u32 hmi_address;
1231 u32 byte_count;
1232};
1233
1234struct hpi_msg_cobranet_hmiwrite {
1235 struct hpi_message_header h;
1236 struct hpi_msg_cobranet_hmi p;
1237 u8 bytes[256];
1238};
1239
1240struct hpi_msg_cobranet_hmiread {
1241 struct hpi_message_header h;
1242 struct hpi_msg_cobranet_hmi p;
1243};
1244
1245struct hpi_res_cobranet_hmiread {
1246 struct hpi_response_header h;
1247 u32 byte_count;
1248 u8 bytes[256];
1249};
1250
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001251#if 1
1252#define hpi_message_header_v1 hpi_message_header
1253#define hpi_response_header_v1 hpi_response_header
1254#else
1255/* V1 headers in Addition to v0 headers */
1256struct hpi_message_header_v1 {
1257 struct hpi_message_header h0;
1258/* struct {
1259} h1; */
1260};
1261
1262struct hpi_response_header_v1 {
1263 struct hpi_response_header h0;
1264 struct {
1265 u16 adapter_index; /* the adapter index */
1266 u16 obj_index; /* object index */
1267 } h1;
1268};
1269#endif
1270
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001271struct hpi_msg_payload_v0 {
1272 struct hpi_message_header h;
1273 union {
1274 struct hpi_subsys_msg s;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001275 union hpi_adapterx_msg ax;
1276 struct hpi_stream_msg d;
1277 struct hpi_mixer_msg m;
1278 union hpi_mixerx_msg mx;
1279 struct hpi_control_msg c;
1280 struct hpi_control_union_msg cu;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001281 struct hpi_nvmemory_msg n;
1282 struct hpi_gpio_msg l;
1283 struct hpi_watchdog_msg w;
1284 struct hpi_clock_msg t;
1285 struct hpi_profile_msg p;
1286 struct hpi_async_msg as;
1287 } u;
1288};
1289
1290struct hpi_res_payload_v0 {
1291 struct hpi_response_header h;
1292 union {
1293 struct hpi_subsys_res s;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001294 union hpi_adapterx_res ax;
1295 struct hpi_stream_res d;
1296 struct hpi_mixer_res m;
1297 union hpi_mixerx_res mx;
1298 struct hpi_control_res c;
1299 union hpi_control_union_res cu;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001300 struct hpi_nvmemory_res n;
1301 struct hpi_gpio_res l;
1302 struct hpi_watchdog_res w;
1303 struct hpi_clock_res t;
1304 struct hpi_profile_res p;
1305 struct hpi_async_res as;
1306 } u;
1307};
1308
1309union hpi_message_buffer_v1 {
1310 struct hpi_message m0; /* version 0 */
1311 struct hpi_message_header_v1 h;
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +13001312 u8 buf[HPI_MAX_PAYLOAD_SIZE];
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001313};
1314
1315union hpi_response_buffer_v1 {
1316 struct hpi_response r0; /* version 0 */
1317 struct hpi_response_header_v1 h;
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +13001318 u8 buf[HPI_MAX_PAYLOAD_SIZE];
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001319};
1320
1321compile_time_assert((sizeof(union hpi_message_buffer_v1) <=
1322 HPI_MAX_PAYLOAD_SIZE), message_buffer_ok);
1323compile_time_assert((sizeof(union hpi_response_buffer_v1) <=
1324 HPI_MAX_PAYLOAD_SIZE), response_buffer_ok);
1325
1326/*////////////////////////////////////////////////////////////////////////// */
1327/* declarations for compact control calls */
1328struct hpi_control_defn {
1329 u8 type;
1330 u8 channels;
1331 u8 src_node_type;
1332 u8 src_node_index;
1333 u8 dest_node_type;
1334 u8 dest_node_index;
1335};
1336
1337/*////////////////////////////////////////////////////////////////////////// */
1338/* declarations for control caching (internal to HPI<->DSP interaction) */
1339
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +13001340/** indicates a cached u16 value is invalid. */
1341#define HPI_CACHE_INVALID_UINT16 0xFFFF
1342/** indicates a cached short value is invalid. */
1343#define HPI_CACHE_INVALID_SHORT -32768
1344
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001345/** A compact representation of (part of) a controls state.
1346Used for efficient transfer of the control state
1347between DSP and host or across a network
1348*/
1349struct hpi_control_cache_info {
1350 /** one of HPI_CONTROL_* */
1351 u8 control_type;
1352 /** The total size of cached information in 32-bit words. */
1353 u8 size_in32bit_words;
1354 /** The original index of the control on the DSP */
1355 u16 control_index;
1356};
1357
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +13001358struct hpi_control_cache_vol {
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001359 struct hpi_control_cache_info i;
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +13001360 short an_log[2];
Eliot Blennerhassettfc3a3992011-02-10 17:26:11 +13001361 unsigned short flags;
1362 char padding[2];
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +13001363};
1364
1365struct hpi_control_cache_meter {
1366 struct hpi_control_cache_info i;
1367 short an_log_peak[2];
1368 short an_logRMS[2];
1369};
1370
1371struct hpi_control_cache_channelmode {
1372 struct hpi_control_cache_info i;
1373 u16 mode;
1374 char temp_padding[6];
1375};
1376
1377struct hpi_control_cache_mux {
1378 struct hpi_control_cache_info i;
1379 u16 source_node_type;
1380 u16 source_node_index;
1381 char temp_padding[4];
1382};
1383
1384struct hpi_control_cache_level {
1385 struct hpi_control_cache_info i;
1386 short an_log[2];
1387 char temp_padding[4];
1388};
1389
1390struct hpi_control_cache_tuner {
1391 struct hpi_control_cache_info i;
1392 u32 freq_ink_hz;
1393 u16 band;
1394 short s_level_avg;
1395};
1396
1397struct hpi_control_cache_aes3rx {
1398 struct hpi_control_cache_info i;
1399 u32 error_status;
1400 u32 format;
1401};
1402
1403struct hpi_control_cache_aes3tx {
1404 struct hpi_control_cache_info i;
1405 u32 format;
1406 char temp_padding[4];
1407};
1408
1409struct hpi_control_cache_tonedetector {
1410 struct hpi_control_cache_info i;
1411 u16 state;
1412 char temp_padding[6];
1413};
1414
1415struct hpi_control_cache_silencedetector {
1416 struct hpi_control_cache_info i;
1417 u32 state;
1418 char temp_padding[4];
1419};
1420
1421struct hpi_control_cache_sampleclock {
1422 struct hpi_control_cache_info i;
1423 u16 source;
1424 u16 source_index;
1425 u32 sample_rate;
1426};
1427
1428struct hpi_control_cache_microphone {
1429 struct hpi_control_cache_info i;
1430 u16 phantom_state;
1431 char temp_padding[6];
1432};
1433
1434struct hpi_control_cache_generic {
1435 struct hpi_control_cache_info i;
1436 u32 dw1;
1437 u32 dw2;
1438};
1439
1440struct hpi_control_cache_single {
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001441 union {
Eliot Blennerhassett3285ea12011-02-10 17:25:58 +13001442 struct hpi_control_cache_info i;
1443 struct hpi_control_cache_vol vol;
1444 struct hpi_control_cache_meter meter;
1445 struct hpi_control_cache_channelmode mode;
1446 struct hpi_control_cache_mux mux;
1447 struct hpi_control_cache_level level;
1448 struct hpi_control_cache_tuner tuner;
1449 struct hpi_control_cache_aes3rx aes3rx;
1450 struct hpi_control_cache_aes3tx aes3tx;
1451 struct hpi_control_cache_tonedetector tone;
1452 struct hpi_control_cache_silencedetector silence;
1453 struct hpi_control_cache_sampleclock clk;
1454 struct hpi_control_cache_microphone microphone;
1455 struct hpi_control_cache_generic generic;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001456 } u;
1457};
1458
1459struct hpi_control_cache_pad {
1460 struct hpi_control_cache_info i;
1461 u32 field_valid_flags;
1462 u8 c_channel[8];
1463 u8 c_artist[40];
1464 u8 c_title[40];
1465 u8 c_comment[200];
1466 u32 pTY;
1467 u32 pI;
1468 u32 traffic_supported;
1469 u32 traffic_anouncement;
1470};
1471
Eliot Blennerhassettba944552011-02-10 17:26:04 +13001472/* 2^N sized FIFO buffer (internal to HPI<->DSP interaction) */
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001473struct hpi_fifo_buffer {
1474 u32 size;
1475 u32 dSP_index;
1476 u32 host_index;
1477};
1478
1479#ifndef DISABLE_PRAGMA_PACK1
1480#pragma pack(pop)
1481#endif
1482
1483/* skip host side function declarations for DSP
1484 compile and documentation extraction */
1485
1486char hpi_handle_object(const u32 handle);
1487
1488void hpi_handle_to_indexes(const u32 handle, u16 *pw_adapter_index,
1489 u16 *pw_object_index);
1490
1491u32 hpi_indexes_to_handle(const char c_object, const u16 adapter_index,
1492 const u16 object_index);
1493
1494/*////////////////////////////////////////////////////////////////////////// */
1495
1496/* main HPI entry point */
Eliot Blennerhassettba944552011-02-10 17:26:04 +13001497void hpi_send_recv(struct hpi_message *phm, struct hpi_response *phr);
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001498
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001499/* used in PnP OS/driver */
Eliot Blennerhassettba944552011-02-10 17:26:04 +13001500u16 hpi_subsys_create_adapter(const struct hpi_resource *p_resource,
1501 u16 *pw_adapter_index);
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001502
Eliot Blennerhassettba944552011-02-10 17:26:04 +13001503u16 hpi_outstream_host_buffer_get_info(u32 h_outstream, u8 **pp_buffer,
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001504 struct hpi_hostbuffer_status **pp_status);
1505
Eliot Blennerhassettba944552011-02-10 17:26:04 +13001506u16 hpi_instream_host_buffer_get_info(u32 h_instream, u8 **pp_buffer,
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001507 struct hpi_hostbuffer_status **pp_status);
1508
1509u16 hpi_adapter_restart(u16 adapter_index);
1510
1511/*
1512The following 3 functions were last declared in header files for
1513driver 3.10. HPI_ControlQuery() used to be the recommended way
1514of getting a volume range. Declared here for binary asihpi32.dll
1515compatibility.
1516*/
1517
1518void hpi_format_to_msg(struct hpi_msg_format *pMF,
1519 const struct hpi_format *pF);
1520void hpi_stream_response_to_legacy(struct hpi_stream_res *pSR);
1521
1522/*////////////////////////////////////////////////////////////////////////// */
1523/* declarations for individual HPI entry points */
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001524hpi_handler_func HPI_6000;
1525hpi_handler_func HPI_6205;
Eliot Blennerhassett719f82d2010-04-21 18:17:39 +02001526
1527#endif /* _HPI_INTERNAL_H_ */