1 /******************************************************************************
3 AudioScience HPI driver
4 Copyright (C) 1997-2010 AudioScience Inc. <support@audioscience.com>
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;
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.
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
19 HPI internal definitions
21 (C) Copyright AudioScience Inc. 1996-2009
22 ******************************************************************************/
24 #ifndef _HPI_INTERNAL_H_
25 #define _HPI_INTERNAL_H_
28 /** maximum number of memory regions mapped to an adapter */
29 #define HPI_MAX_ADAPTER_MEM_SPACES (2)
31 /* Each OS needs its own hpios.h */
34 /* physical memory allocation */
35 void hpios_locked_mem_init(void
37 void hpios_locked_mem_free_all(void
39 #define hpios_locked_mem_prepare(a, b, c, d);
40 #define hpios_locked_mem_unprepare(a)
42 /** Allocate and map an area of locked memory for bus master DMA operations.
44 On success, *pLockedMemeHandle is a valid handle, and 0 is returned
45 On error *pLockedMemHandle marked invalid, non-zero returned.
47 If this function succeeds, then HpiOs_LockedMem_GetVirtAddr() and
48 HpiOs_LockedMem_GetPyhsAddr() will always succed on the returned handle.
50 u16
hpios_locked_mem_alloc(struct consistent_dma_area
*p_locked_mem_handle
,
52 u32 size
, /**< Size in bytes to allocate */
53 struct pci_dev
*p_os_reference
54 /**< OS specific data required for memory allocation */
57 /** Free mapping and memory represented by LockedMemHandle
59 Frees any resources, then invalidates the handle.
60 Returns 0 on success, 1 if handle is invalid.
63 u16
hpios_locked_mem_free(struct consistent_dma_area
*locked_mem_handle
);
65 /** Get the physical PCI address of memory represented by LockedMemHandle.
67 If handle is invalid *pPhysicalAddr is set to zero and return 1
69 u16
hpios_locked_mem_get_phys_addr(struct consistent_dma_area
70 *locked_mem_handle
, u32
*p_physical_addr
);
72 /** Get the CPU address of of memory represented by LockedMemHandle.
74 If handle is NULL *ppvVirtualAddr is set to NULL and return 1
76 u16
hpios_locked_mem_get_virt_addr(struct consistent_dma_area
77 *locked_mem_handle
, void **ppv_virtual_addr
);
79 /** Check that handle is valid
80 i.e it represents a valid memory area
82 u16
hpios_locked_mem_valid(struct consistent_dma_area
*locked_mem_handle
);
85 void hpios_delay_micro_seconds(u32 num_micro_sec
);
90 typedef void hpi_handler_func(struct hpi_message
*, struct hpi_response
*);
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.
96 #define compile_time_assert(cond, msg) \
97 typedef char ASSERT_##msg[(cond) ? 1 : -1]
99 /******************************************* bus types */
107 enum 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
117 /******************************************* CONTROL ATTRIBUTES ****/
118 /* (in order of control type ID */
120 /* This allows for 255 control types, 256 unique attributes each */
121 #define HPI_CTL_ATTR(ctl, ai) ((HPI_CONTROL_##ctl << 8) + ai)
123 /* Get the sub-index of the attribute for a control type */
124 #define HPI_CTL_ATTR_INDEX(i) (i & 0xff)
126 /* Extract the control from the control attribute */
127 #define HPI_CTL_ATTR_CONTROL(i) (i >> 8)
129 /** Enable event generation for a control.
131 \note generic to all controls that can generate events
134 /** Unique identifiers for every control attribute
136 enum HPI_CONTROL_ATTRIBUTES
{
137 HPI_GENERIC_ENABLE
= HPI_CTL_ATTR(GENERIC
, 1),
138 HPI_GENERIC_EVENT_ENABLE
= HPI_CTL_ATTR(GENERIC
, 2),
140 HPI_VOLUME_GAIN
= HPI_CTL_ATTR(VOLUME
, 1),
141 HPI_VOLUME_AUTOFADE
= HPI_CTL_ATTR(VOLUME
, 2),
142 HPI_VOLUME_NUM_CHANNELS
= HPI_CTL_ATTR(VOLUME
, 6),
143 HPI_VOLUME_RANGE
= HPI_CTL_ATTR(VOLUME
, 10),
145 HPI_METER_RMS
= HPI_CTL_ATTR(METER
, 1),
146 HPI_METER_PEAK
= HPI_CTL_ATTR(METER
, 2),
147 HPI_METER_RMS_BALLISTICS
= HPI_CTL_ATTR(METER
, 3),
148 HPI_METER_PEAK_BALLISTICS
= HPI_CTL_ATTR(METER
, 4),
149 HPI_METER_NUM_CHANNELS
= HPI_CTL_ATTR(METER
, 5),
151 HPI_MULTIPLEXER_SOURCE
= HPI_CTL_ATTR(MULTIPLEXER
, 1),
152 HPI_MULTIPLEXER_QUERYSOURCE
= HPI_CTL_ATTR(MULTIPLEXER
, 2),
154 HPI_AESEBUTX_FORMAT
= HPI_CTL_ATTR(AESEBUTX
, 1),
155 HPI_AESEBUTX_SAMPLERATE
= HPI_CTL_ATTR(AESEBUTX
, 3),
156 HPI_AESEBUTX_CHANNELSTATUS
= HPI_CTL_ATTR(AESEBUTX
, 4),
157 HPI_AESEBUTX_USERDATA
= HPI_CTL_ATTR(AESEBUTX
, 5),
159 HPI_AESEBURX_FORMAT
= HPI_CTL_ATTR(AESEBURX
, 1),
160 HPI_AESEBURX_ERRORSTATUS
= HPI_CTL_ATTR(AESEBURX
, 2),
161 HPI_AESEBURX_SAMPLERATE
= HPI_CTL_ATTR(AESEBURX
, 3),
162 HPI_AESEBURX_CHANNELSTATUS
= HPI_CTL_ATTR(AESEBURX
, 4),
163 HPI_AESEBURX_USERDATA
= HPI_CTL_ATTR(AESEBURX
, 5),
165 HPI_LEVEL_GAIN
= HPI_CTL_ATTR(LEVEL
, 1),
166 HPI_LEVEL_RANGE
= HPI_CTL_ATTR(LEVEL
, 10),
168 HPI_TUNER_BAND
= HPI_CTL_ATTR(TUNER
, 1),
169 HPI_TUNER_FREQ
= HPI_CTL_ATTR(TUNER
, 2),
170 HPI_TUNER_LEVEL_AVG
= HPI_CTL_ATTR(TUNER
, 3),
171 HPI_TUNER_LEVEL_RAW
= HPI_CTL_ATTR(TUNER
, 4),
172 HPI_TUNER_SNR
= HPI_CTL_ATTR(TUNER
, 5),
173 HPI_TUNER_GAIN
= HPI_CTL_ATTR(TUNER
, 6),
174 HPI_TUNER_STATUS
= HPI_CTL_ATTR(TUNER
, 7),
175 HPI_TUNER_MODE
= HPI_CTL_ATTR(TUNER
, 8),
176 HPI_TUNER_RDS
= HPI_CTL_ATTR(TUNER
, 9),
177 HPI_TUNER_DEEMPHASIS
= HPI_CTL_ATTR(TUNER
, 10),
178 HPI_TUNER_PROGRAM
= HPI_CTL_ATTR(TUNER
, 11),
179 HPI_TUNER_HDRADIO_SIGNAL_QUALITY
= HPI_CTL_ATTR(TUNER
, 12),
180 HPI_TUNER_HDRADIO_SDK_VERSION
= HPI_CTL_ATTR(TUNER
, 13),
181 HPI_TUNER_HDRADIO_DSP_VERSION
= HPI_CTL_ATTR(TUNER
, 14),
182 HPI_TUNER_HDRADIO_BLEND
= HPI_CTL_ATTR(TUNER
, 15),
184 HPI_VOX_THRESHOLD
= HPI_CTL_ATTR(VOX
, 1),
186 HPI_CHANNEL_MODE_MODE
= HPI_CTL_ATTR(CHANNEL_MODE
, 1),
188 HPI_BITSTREAM_DATA_POLARITY
= HPI_CTL_ATTR(BITSTREAM
, 1),
189 HPI_BITSTREAM_CLOCK_EDGE
= HPI_CTL_ATTR(BITSTREAM
, 2),
190 HPI_BITSTREAM_CLOCK_SOURCE
= HPI_CTL_ATTR(BITSTREAM
, 3),
191 HPI_BITSTREAM_ACTIVITY
= HPI_CTL_ATTR(BITSTREAM
, 4),
193 HPI_SAMPLECLOCK_SOURCE
= HPI_CTL_ATTR(SAMPLECLOCK
, 1),
194 HPI_SAMPLECLOCK_SAMPLERATE
= HPI_CTL_ATTR(SAMPLECLOCK
, 2),
195 HPI_SAMPLECLOCK_SOURCE_INDEX
= HPI_CTL_ATTR(SAMPLECLOCK
, 3),
196 HPI_SAMPLECLOCK_LOCAL_SAMPLERATE
= HPI_CTL_ATTR(SAMPLECLOCK
, 4),
197 HPI_SAMPLECLOCK_AUTO
= HPI_CTL_ATTR(SAMPLECLOCK
, 5),
198 HPI_SAMPLECLOCK_LOCAL_LOCK
= HPI_CTL_ATTR(SAMPLECLOCK
, 6),
200 HPI_MICROPHONE_PHANTOM_POWER
= HPI_CTL_ATTR(MICROPHONE
, 1),
202 HPI_EQUALIZER_NUM_FILTERS
= HPI_CTL_ATTR(EQUALIZER
, 1),
203 HPI_EQUALIZER_FILTER
= HPI_CTL_ATTR(EQUALIZER
, 2),
204 HPI_EQUALIZER_COEFFICIENTS
= HPI_CTL_ATTR(EQUALIZER
, 3),
206 HPI_COMPANDER_PARAMS
= HPI_CTL_ATTR(COMPANDER
, 1),
207 HPI_COMPANDER_MAKEUPGAIN
= HPI_CTL_ATTR(COMPANDER
, 2),
208 HPI_COMPANDER_THRESHOLD
= HPI_CTL_ATTR(COMPANDER
, 3),
209 HPI_COMPANDER_RATIO
= HPI_CTL_ATTR(COMPANDER
, 4),
210 HPI_COMPANDER_ATTACK
= HPI_CTL_ATTR(COMPANDER
, 5),
211 HPI_COMPANDER_DECAY
= HPI_CTL_ATTR(COMPANDER
, 6),
213 HPI_COBRANET_SET
= HPI_CTL_ATTR(COBRANET
, 1),
214 HPI_COBRANET_GET
= HPI_CTL_ATTR(COBRANET
, 2),
215 HPI_COBRANET_SET_DATA
= HPI_CTL_ATTR(COBRANET
, 3),
216 HPI_COBRANET_GET_DATA
= HPI_CTL_ATTR(COBRANET
, 4),
217 HPI_COBRANET_GET_STATUS
= HPI_CTL_ATTR(COBRANET
, 5),
218 HPI_COBRANET_SEND_PACKET
= HPI_CTL_ATTR(COBRANET
, 6),
219 HPI_COBRANET_GET_PACKET
= HPI_CTL_ATTR(COBRANET
, 7),
221 HPI_TONEDETECTOR_THRESHOLD
= HPI_CTL_ATTR(TONEDETECTOR
, 1),
222 HPI_TONEDETECTOR_STATE
= HPI_CTL_ATTR(TONEDETECTOR
, 2),
223 HPI_TONEDETECTOR_FREQUENCY
= HPI_CTL_ATTR(TONEDETECTOR
, 3),
225 HPI_SILENCEDETECTOR_THRESHOLD
= HPI_CTL_ATTR(SILENCEDETECTOR
, 1),
226 HPI_SILENCEDETECTOR_STATE
= HPI_CTL_ATTR(SILENCEDETECTOR
, 2),
227 HPI_SILENCEDETECTOR_DELAY
= HPI_CTL_ATTR(SILENCEDETECTOR
, 3),
229 HPI_PAD_CHANNEL_NAME
= HPI_CTL_ATTR(PAD
, 1),
230 HPI_PAD_ARTIST
= HPI_CTL_ATTR(PAD
, 2),
231 HPI_PAD_TITLE
= HPI_CTL_ATTR(PAD
, 3),
232 HPI_PAD_COMMENT
= HPI_CTL_ATTR(PAD
, 4),
233 HPI_PAD_PROGRAM_TYPE
= HPI_CTL_ATTR(PAD
, 5),
234 HPI_PAD_PROGRAM_ID
= HPI_CTL_ATTR(PAD
, 6),
235 HPI_PAD_TA_SUPPORT
= HPI_CTL_ATTR(PAD
, 7),
236 HPI_PAD_TA_ACTIVE
= HPI_CTL_ATTR(PAD
, 8)
239 #define HPI_POLARITY_POSITIVE 0
240 #define HPI_POLARITY_NEGATIVE 1
242 /*------------------------------------------------------------
243 Cobranet Chip Bridge - copied from HMI.H
244 ------------------------------------------------------------*/
245 #define HPI_COBRANET_HMI_cobra_bridge 0x20000
246 #define HPI_COBRANET_HMI_cobra_bridge_tx_pkt_buf \
247 (HPI_COBRANET_HMI_cobra_bridge + 0x1000)
248 #define HPI_COBRANET_HMI_cobra_bridge_rx_pkt_buf \
249 (HPI_COBRANET_HMI_cobra_bridge + 0x2000)
250 #define HPI_COBRANET_HMI_cobra_if_table1 0x110000
251 #define HPI_COBRANET_HMI_cobra_if_phy_address \
252 (HPI_COBRANET_HMI_cobra_if_table1 + 0xd)
253 #define HPI_COBRANET_HMI_cobra_protocolIP 0x72000
254 #define HPI_COBRANET_HMI_cobra_ip_mon_currentIP \
255 (HPI_COBRANET_HMI_cobra_protocolIP + 0x0)
256 #define HPI_COBRANET_HMI_cobra_ip_mon_staticIP \
257 (HPI_COBRANET_HMI_cobra_protocolIP + 0x2)
258 #define HPI_COBRANET_HMI_cobra_sys 0x100000
259 #define HPI_COBRANET_HMI_cobra_sys_desc \
260 (HPI_COBRANET_HMI_cobra_sys + 0x0)
261 #define HPI_COBRANET_HMI_cobra_sys_objectID \
262 (HPI_COBRANET_HMI_cobra_sys + 0x100)
263 #define HPI_COBRANET_HMI_cobra_sys_contact \
264 (HPI_COBRANET_HMI_cobra_sys + 0x200)
265 #define HPI_COBRANET_HMI_cobra_sys_name \
266 (HPI_COBRANET_HMI_cobra_sys + 0x300)
267 #define HPI_COBRANET_HMI_cobra_sys_location \
268 (HPI_COBRANET_HMI_cobra_sys + 0x400)
270 /*------------------------------------------------------------
271 Cobranet Chip Status bits
272 ------------------------------------------------------------*/
273 #define HPI_COBRANET_HMI_STATUS_RXPACKET 2
274 #define HPI_COBRANET_HMI_STATUS_TXPACKET 3
276 /*------------------------------------------------------------
278 ------------------------------------------------------------*/
279 #define HPI_ETHERNET_HEADER_SIZE (16)
281 /* These defines are used to fill in protocol information for an Ethernet packet
282 sent using HMI on CS18102 */
283 /** ID supplied by Cirrius for ASI packets. */
284 #define HPI_ETHERNET_PACKET_ID 0x85
285 /** Simple packet - no special routing required */
286 #define HPI_ETHERNET_PACKET_V1 0x01
287 /** This packet must make its way to the host across the HPI interface */
288 #define HPI_ETHERNET_PACKET_HOSTED_VIA_HMI 0x20
289 /** This packet must make its way to the host across the HPI interface */
290 #define HPI_ETHERNET_PACKET_HOSTED_VIA_HMI_V1 0x21
291 /** This packet must make its way to the host across the HPI interface */
292 #define HPI_ETHERNET_PACKET_HOSTED_VIA_HPI 0x40
293 /** This packet must make its way to the host across the HPI interface */
294 #define HPI_ETHERNET_PACKET_HOSTED_VIA_HPI_V1 0x41
296 #define HPI_ETHERNET_UDP_PORT (44600) /*!< UDP messaging port */
298 /** Base network time out is set to 100 milli-seconds. */
299 #define HPI_ETHERNET_TIMEOUT_MS (100)
301 /** Locked memory buffer alloc/free phases */
302 enum HPI_BUFFER_CMDS
{
303 /** use one message to allocate or free physical memory */
304 HPI_BUFFER_CMD_EXTERNAL
= 0,
305 /** alloc physical memory */
306 HPI_BUFFER_CMD_INTERNAL_ALLOC
= 1,
307 /** send physical memory address to adapter */
308 HPI_BUFFER_CMD_INTERNAL_GRANTADAPTER
= 2,
309 /** notify adapter to stop using physical buffer */
310 HPI_BUFFER_CMD_INTERNAL_REVOKEADAPTER
= 3,
311 /** free physical buffer */
312 HPI_BUFFER_CMD_INTERNAL_FREE
= 4
315 /*****************************************************************************/
316 /*****************************************************************************/
317 /******** HPI LOW LEVEL MESSAGES *******/
318 /*****************************************************************************/
319 /*****************************************************************************/
321 /** "ASI" - actual is "ASX" - need to change */
322 #define HPI_ID_ISAPNP_AUDIOSCIENCE 0x0669
323 /** PCI vendor ID that AudioScience uses */
324 #define HPI_PCI_VENDOR_ID_AUDIOSCIENCE 0x175C
325 /** PCI vendor ID that the DSP56301 has */
326 #define HPI_PCI_VENDOR_ID_MOTOROLA 0x1057
327 /** PCI vendor ID that TI uses */
328 #define HPI_PCI_VENDOR_ID_TI 0x104C
330 #define HPI_PCI_DEV_ID_PCI2040 0xAC60
331 /** TI's C6205 PCI interface has this ID */
332 #define HPI_PCI_DEV_ID_DSP6205 0xA106
334 #define HPI_USB_VENDOR_ID_AUDIOSCIENCE 0x1257
335 #define HPI_USB_W2K_TAG 0x57495341 /* "ASIW" */
336 #define HPI_USB_LINUX_TAG 0x4C495341 /* "ASIL" */
338 /** Invalid Adapter index
339 Used in HPI messages that are not addressed to a specific adapter
340 Used in DLL to indicate device not present
342 #define HPI_ADAPTER_INDEX_INVALID 0xFFFF
344 /** First 2 hex digits define the adapter family */
345 #define HPI_ADAPTER_FAMILY_MASK 0xff00
346 #define HPI_MODULE_FAMILY_MASK 0xfff0
348 #define HPI_ADAPTER_FAMILY_ASI(f) (f & HPI_ADAPTER_FAMILY_MASK)
349 #define HPI_MODULE_FAMILY_ASI(f) (f & HPI_MODULE_FAMILY_MASK)
350 #define HPI_ADAPTER_ASI(f) (f)
352 enum HPI_MESSAGE_TYPES
{
353 HPI_TYPE_MESSAGE
= 1,
354 HPI_TYPE_RESPONSE
= 2,
356 HPI_TYPE_SSX2BYPASS_MESSAGE
= 4
359 enum HPI_OBJECT_TYPES
{
360 HPI_OBJ_SUBSYSTEM
= 1,
367 HPI_OBJ_NVMEMORY
= 8,
369 HPI_OBJ_WATCHDOG
= 10,
371 HPI_OBJ_PROFILE
= 12,
372 HPI_OBJ_CONTROLEX
= 13,
373 HPI_OBJ_ASYNCEVENT
= 14
374 #define HPI_OBJ_MAXINDEX 14
377 #define HPI_OBJ_FUNCTION_SPACING 0x100
378 #define HPI_FUNC_ID(obj, index) \
379 (HPI_OBJ_##obj * HPI_OBJ_FUNCTION_SPACING + index)
381 #define HPI_EXTRACT_INDEX(fn) (fn & 0xff)
383 enum HPI_FUNCTION_IDS
{
384 HPI_SUBSYS_OPEN
= HPI_FUNC_ID(SUBSYSTEM
, 1),
385 HPI_SUBSYS_GET_VERSION
= HPI_FUNC_ID(SUBSYSTEM
, 2),
386 HPI_SUBSYS_GET_INFO
= HPI_FUNC_ID(SUBSYSTEM
, 3),
387 HPI_SUBSYS_FIND_ADAPTERS
= HPI_FUNC_ID(SUBSYSTEM
, 4),
388 HPI_SUBSYS_CREATE_ADAPTER
= HPI_FUNC_ID(SUBSYSTEM
, 5),
389 HPI_SUBSYS_CLOSE
= HPI_FUNC_ID(SUBSYSTEM
, 6),
390 HPI_SUBSYS_DELETE_ADAPTER
= HPI_FUNC_ID(SUBSYSTEM
, 7),
391 HPI_SUBSYS_DRIVER_LOAD
= HPI_FUNC_ID(SUBSYSTEM
, 8),
392 HPI_SUBSYS_DRIVER_UNLOAD
= HPI_FUNC_ID(SUBSYSTEM
, 9),
393 HPI_SUBSYS_READ_PORT_8
= HPI_FUNC_ID(SUBSYSTEM
, 10),
394 HPI_SUBSYS_WRITE_PORT_8
= HPI_FUNC_ID(SUBSYSTEM
, 11),
395 HPI_SUBSYS_GET_NUM_ADAPTERS
= HPI_FUNC_ID(SUBSYSTEM
, 12),
396 HPI_SUBSYS_GET_ADAPTER
= HPI_FUNC_ID(SUBSYSTEM
, 13),
397 HPI_SUBSYS_SET_NETWORK_INTERFACE
= HPI_FUNC_ID(SUBSYSTEM
, 14),
398 HPI_SUBSYS_OPTION_INFO
= HPI_FUNC_ID(SUBSYSTEM
, 15),
399 HPI_SUBSYS_OPTION_GET
= HPI_FUNC_ID(SUBSYSTEM
, 16),
400 HPI_SUBSYS_OPTION_SET
= HPI_FUNC_ID(SUBSYSTEM
, 17),
401 #define HPI_SUBSYS_FUNCTION_COUNT 17
403 HPI_ADAPTER_OPEN
= HPI_FUNC_ID(ADAPTER
, 1),
404 HPI_ADAPTER_CLOSE
= HPI_FUNC_ID(ADAPTER
, 2),
405 HPI_ADAPTER_GET_INFO
= HPI_FUNC_ID(ADAPTER
, 3),
406 HPI_ADAPTER_GET_ASSERT
= HPI_FUNC_ID(ADAPTER
, 4),
407 HPI_ADAPTER_TEST_ASSERT
= HPI_FUNC_ID(ADAPTER
, 5),
408 HPI_ADAPTER_SET_MODE
= HPI_FUNC_ID(ADAPTER
, 6),
409 HPI_ADAPTER_GET_MODE
= HPI_FUNC_ID(ADAPTER
, 7),
410 HPI_ADAPTER_ENABLE_CAPABILITY
= HPI_FUNC_ID(ADAPTER
, 8),
411 HPI_ADAPTER_SELFTEST
= HPI_FUNC_ID(ADAPTER
, 9),
412 HPI_ADAPTER_FIND_OBJECT
= HPI_FUNC_ID(ADAPTER
, 10),
413 HPI_ADAPTER_QUERY_FLASH
= HPI_FUNC_ID(ADAPTER
, 11),
414 HPI_ADAPTER_START_FLASH
= HPI_FUNC_ID(ADAPTER
, 12),
415 HPI_ADAPTER_PROGRAM_FLASH
= HPI_FUNC_ID(ADAPTER
, 13),
416 HPI_ADAPTER_SET_PROPERTY
= HPI_FUNC_ID(ADAPTER
, 14),
417 HPI_ADAPTER_GET_PROPERTY
= HPI_FUNC_ID(ADAPTER
, 15),
418 HPI_ADAPTER_ENUM_PROPERTY
= HPI_FUNC_ID(ADAPTER
, 16),
419 HPI_ADAPTER_MODULE_INFO
= HPI_FUNC_ID(ADAPTER
, 17),
420 HPI_ADAPTER_DEBUG_READ
= HPI_FUNC_ID(ADAPTER
, 18),
421 #define HPI_ADAPTER_FUNCTION_COUNT 18
423 HPI_OSTREAM_OPEN
= HPI_FUNC_ID(OSTREAM
, 1),
424 HPI_OSTREAM_CLOSE
= HPI_FUNC_ID(OSTREAM
, 2),
425 HPI_OSTREAM_WRITE
= HPI_FUNC_ID(OSTREAM
, 3),
426 HPI_OSTREAM_START
= HPI_FUNC_ID(OSTREAM
, 4),
427 HPI_OSTREAM_STOP
= HPI_FUNC_ID(OSTREAM
, 5),
428 HPI_OSTREAM_RESET
= HPI_FUNC_ID(OSTREAM
, 6),
429 HPI_OSTREAM_GET_INFO
= HPI_FUNC_ID(OSTREAM
, 7),
430 HPI_OSTREAM_QUERY_FORMAT
= HPI_FUNC_ID(OSTREAM
, 8),
431 HPI_OSTREAM_DATA
= HPI_FUNC_ID(OSTREAM
, 9),
432 HPI_OSTREAM_SET_VELOCITY
= HPI_FUNC_ID(OSTREAM
, 10),
433 HPI_OSTREAM_SET_PUNCHINOUT
= HPI_FUNC_ID(OSTREAM
, 11),
434 HPI_OSTREAM_SINEGEN
= HPI_FUNC_ID(OSTREAM
, 12),
435 HPI_OSTREAM_ANC_RESET
= HPI_FUNC_ID(OSTREAM
, 13),
436 HPI_OSTREAM_ANC_GET_INFO
= HPI_FUNC_ID(OSTREAM
, 14),
437 HPI_OSTREAM_ANC_READ
= HPI_FUNC_ID(OSTREAM
, 15),
438 HPI_OSTREAM_SET_TIMESCALE
= HPI_FUNC_ID(OSTREAM
, 16),
439 HPI_OSTREAM_SET_FORMAT
= HPI_FUNC_ID(OSTREAM
, 17),
440 HPI_OSTREAM_HOSTBUFFER_ALLOC
= HPI_FUNC_ID(OSTREAM
, 18),
441 HPI_OSTREAM_HOSTBUFFER_FREE
= HPI_FUNC_ID(OSTREAM
, 19),
442 HPI_OSTREAM_GROUP_ADD
= HPI_FUNC_ID(OSTREAM
, 20),
443 HPI_OSTREAM_GROUP_GETMAP
= HPI_FUNC_ID(OSTREAM
, 21),
444 HPI_OSTREAM_GROUP_RESET
= HPI_FUNC_ID(OSTREAM
, 22),
445 HPI_OSTREAM_HOSTBUFFER_GET_INFO
= HPI_FUNC_ID(OSTREAM
, 23),
446 HPI_OSTREAM_WAIT_START
= HPI_FUNC_ID(OSTREAM
, 24),
447 #define HPI_OSTREAM_FUNCTION_COUNT 24
449 HPI_ISTREAM_OPEN
= HPI_FUNC_ID(ISTREAM
, 1),
450 HPI_ISTREAM_CLOSE
= HPI_FUNC_ID(ISTREAM
, 2),
451 HPI_ISTREAM_SET_FORMAT
= HPI_FUNC_ID(ISTREAM
, 3),
452 HPI_ISTREAM_READ
= HPI_FUNC_ID(ISTREAM
, 4),
453 HPI_ISTREAM_START
= HPI_FUNC_ID(ISTREAM
, 5),
454 HPI_ISTREAM_STOP
= HPI_FUNC_ID(ISTREAM
, 6),
455 HPI_ISTREAM_RESET
= HPI_FUNC_ID(ISTREAM
, 7),
456 HPI_ISTREAM_GET_INFO
= HPI_FUNC_ID(ISTREAM
, 8),
457 HPI_ISTREAM_QUERY_FORMAT
= HPI_FUNC_ID(ISTREAM
, 9),
458 HPI_ISTREAM_ANC_RESET
= HPI_FUNC_ID(ISTREAM
, 10),
459 HPI_ISTREAM_ANC_GET_INFO
= HPI_FUNC_ID(ISTREAM
, 11),
460 HPI_ISTREAM_ANC_WRITE
= HPI_FUNC_ID(ISTREAM
, 12),
461 HPI_ISTREAM_HOSTBUFFER_ALLOC
= HPI_FUNC_ID(ISTREAM
, 13),
462 HPI_ISTREAM_HOSTBUFFER_FREE
= HPI_FUNC_ID(ISTREAM
, 14),
463 HPI_ISTREAM_GROUP_ADD
= HPI_FUNC_ID(ISTREAM
, 15),
464 HPI_ISTREAM_GROUP_GETMAP
= HPI_FUNC_ID(ISTREAM
, 16),
465 HPI_ISTREAM_GROUP_RESET
= HPI_FUNC_ID(ISTREAM
, 17),
466 HPI_ISTREAM_HOSTBUFFER_GET_INFO
= HPI_FUNC_ID(ISTREAM
, 18),
467 HPI_ISTREAM_WAIT_START
= HPI_FUNC_ID(ISTREAM
, 19),
468 #define HPI_ISTREAM_FUNCTION_COUNT 19
471 GET_NODE_INFO, SET_CONNECTION, GET_CONNECTIONS are not currently used */
472 HPI_MIXER_OPEN
= HPI_FUNC_ID(MIXER
, 1),
473 HPI_MIXER_CLOSE
= HPI_FUNC_ID(MIXER
, 2),
474 HPI_MIXER_GET_INFO
= HPI_FUNC_ID(MIXER
, 3),
475 HPI_MIXER_GET_NODE_INFO
= HPI_FUNC_ID(MIXER
, 4),
476 HPI_MIXER_GET_CONTROL
= HPI_FUNC_ID(MIXER
, 5),
477 HPI_MIXER_SET_CONNECTION
= HPI_FUNC_ID(MIXER
, 6),
478 HPI_MIXER_GET_CONNECTIONS
= HPI_FUNC_ID(MIXER
, 7),
479 HPI_MIXER_GET_CONTROL_BY_INDEX
= HPI_FUNC_ID(MIXER
, 8),
480 HPI_MIXER_GET_CONTROL_ARRAY_BY_INDEX
= HPI_FUNC_ID(MIXER
, 9),
481 HPI_MIXER_GET_CONTROL_MULTIPLE_VALUES
= HPI_FUNC_ID(MIXER
, 10),
482 HPI_MIXER_STORE
= HPI_FUNC_ID(MIXER
, 11),
483 #define HPI_MIXER_FUNCTION_COUNT 11
485 HPI_CONTROL_GET_INFO
= HPI_FUNC_ID(CONTROL
, 1),
486 HPI_CONTROL_GET_STATE
= HPI_FUNC_ID(CONTROL
, 2),
487 HPI_CONTROL_SET_STATE
= HPI_FUNC_ID(CONTROL
, 3),
488 #define HPI_CONTROL_FUNCTION_COUNT 3
490 HPI_NVMEMORY_OPEN
= HPI_FUNC_ID(NVMEMORY
, 1),
491 HPI_NVMEMORY_READ_BYTE
= HPI_FUNC_ID(NVMEMORY
, 2),
492 HPI_NVMEMORY_WRITE_BYTE
= HPI_FUNC_ID(NVMEMORY
, 3),
493 #define HPI_NVMEMORY_FUNCTION_COUNT 3
495 HPI_GPIO_OPEN
= HPI_FUNC_ID(GPIO
, 1),
496 HPI_GPIO_READ_BIT
= HPI_FUNC_ID(GPIO
, 2),
497 HPI_GPIO_WRITE_BIT
= HPI_FUNC_ID(GPIO
, 3),
498 HPI_GPIO_READ_ALL
= HPI_FUNC_ID(GPIO
, 4),
499 HPI_GPIO_WRITE_STATUS
= HPI_FUNC_ID(GPIO
, 5),
500 #define HPI_GPIO_FUNCTION_COUNT 5
502 HPI_ASYNCEVENT_OPEN
= HPI_FUNC_ID(ASYNCEVENT
, 1),
503 HPI_ASYNCEVENT_CLOSE
= HPI_FUNC_ID(ASYNCEVENT
, 2),
504 HPI_ASYNCEVENT_WAIT
= HPI_FUNC_ID(ASYNCEVENT
, 3),
505 HPI_ASYNCEVENT_GETCOUNT
= HPI_FUNC_ID(ASYNCEVENT
, 4),
506 HPI_ASYNCEVENT_GET
= HPI_FUNC_ID(ASYNCEVENT
, 5),
507 HPI_ASYNCEVENT_SENDEVENTS
= HPI_FUNC_ID(ASYNCEVENT
, 6),
508 #define HPI_ASYNCEVENT_FUNCTION_COUNT 6
510 HPI_WATCHDOG_OPEN
= HPI_FUNC_ID(WATCHDOG
, 1),
511 HPI_WATCHDOG_SET_TIME
= HPI_FUNC_ID(WATCHDOG
, 2),
512 HPI_WATCHDOG_PING
= HPI_FUNC_ID(WATCHDOG
, 3),
514 HPI_CLOCK_OPEN
= HPI_FUNC_ID(CLOCK
, 1),
515 HPI_CLOCK_SET_TIME
= HPI_FUNC_ID(CLOCK
, 2),
516 HPI_CLOCK_GET_TIME
= HPI_FUNC_ID(CLOCK
, 3),
518 HPI_PROFILE_OPEN_ALL
= HPI_FUNC_ID(PROFILE
, 1),
519 HPI_PROFILE_START_ALL
= HPI_FUNC_ID(PROFILE
, 2),
520 HPI_PROFILE_STOP_ALL
= HPI_FUNC_ID(PROFILE
, 3),
521 HPI_PROFILE_GET
= HPI_FUNC_ID(PROFILE
, 4),
522 HPI_PROFILE_GET_IDLECOUNT
= HPI_FUNC_ID(PROFILE
, 5),
523 HPI_PROFILE_GET_NAME
= HPI_FUNC_ID(PROFILE
, 6),
524 HPI_PROFILE_GET_UTILIZATION
= HPI_FUNC_ID(PROFILE
, 7)
525 #define HPI_PROFILE_FUNCTION_COUNT 7
528 /* ////////////////////////////////////////////////////////////////////// */
530 #ifndef DISABLE_PRAGMA_PACK1
531 #pragma pack(push, 1)
534 /** PCI bus resource */
536 u32 __iomem
*ap_mem_base
[HPI_MAX_ADAPTER_MEM_SPACES
];
537 struct pci_dev
*pci_dev
;
540 struct hpi_resource
{
542 const struct hpi_pci
*pci
;
545 #ifndef HPI64BIT /* keep structure size constant */
548 u16 bus_type
; /* HPI_BUS_PNPISA, _PCI, _USB etc */
553 /** Format info used inside struct hpi_message
554 Not the same as public API struct hpi_format */
555 struct hpi_msg_format
{
557 /**< 11025, 32000, 44100 ... */
558 u32 bit_rate
; /**< for MPEG */
560 /**< Stereo/JointStereo/Mono */
561 u16 channels
; /**< 1,2..., (or ancillary mode or idle bit */
562 u16 format
; /**< HPI_FORMAT_PCM16, _MPEG etc. see \ref HPI_FORMATS. */
565 /** Buffer+format structure.
566 Must be kept 7 * 32 bits to match public struct hpi_datastruct */
567 struct hpi_msg_data
{
568 struct hpi_msg_format format
;
576 /** struct hpi_datastructure used up to 3.04 driver */
577 struct hpi_data_legacy32
{
578 struct hpi_format format
;
584 /* Compatibility version of struct hpi_data*/
585 struct hpi_data_compat32
{
586 struct hpi_msg_format format
;
594 /** placehoder for backward compatability (see dwBufferSize) */
595 struct hpi_msg_format reserved
;
596 u32 command
; /**< HPI_BUFFER_CMD_xxx*/
597 u32 pci_address
; /**< PCI physical address of buffer for DSP DMA */
598 u32 buffer_size
; /**< must line up with data_size of HPI_DATA*/
601 /*/////////////////////////////////////////////////////////////////////////// */
602 /* This is used for background buffer bus mastering stream buffers. */
603 struct hpi_hostbuffer_status
{
604 u32 samples_processed
;
605 u32 auxiliary_data_available
;
607 /* DSP index in to the host bus master buffer. */
609 /* Host index in to the host bus master buffer. */
614 struct hpi_streamid
{
616 /**< Type of object, HPI_OBJ_OSTREAM or HPI_OBJ_ISTREAM. */
617 u16 stream_index
; /**< outstream or instream index. */
620 struct hpi_punchinout
{
622 u32 punch_out_sample
;
625 struct hpi_subsys_msg
{
626 struct hpi_resource resource
;
629 struct hpi_subsys_res
{
631 u32 data
; /* used to return extended version */
632 u16 num_adapters
; /* number of adapters */
634 u16 aw_adapter_list
[HPI_MAX_ADAPTERS
];
637 union hpi_adapterx_msg
{
653 u16 offset
; /**< offset from start of msg to data */
685 struct hpi_adapter_res
{
693 u8 sz_adapter_assert
[HPI_STRING_LEN
];
696 union hpi_adapterx_res
{
697 struct hpi_adapter_res info
;
704 char sz_message
[HPI_STRING_LEN
];
723 struct hpi_stream_msg
{
725 struct hpi_msg_data data
;
726 struct hpi_data_legacy32 data32
;
728 struct hpi_punchinout pio
;
730 struct hpi_buffer buffer
;
731 struct hpi_streamid stream
;
735 struct hpi_stream_res
{
738 /* size of hardware buffer */
740 /* OutStream - data to play,
741 InStream - data recorded */
743 /* OutStream - samples played,
744 InStream - samples recorded */
745 u32 samples_transferred
;
746 /* Adapter - OutStream - data to play,
747 InStream - data recorded */
748 u32 auxiliary_data_available
;
749 u16 state
; /* HPI_STATE_PLAYING, _STATE_STOPPED */
755 u32 samples_transfered
;
760 u32 auxiliary_data_available
;
761 } legacy_stream_info
;
763 /* bitmap of grouped OutStreams */
764 u32 outstream_group_map
;
765 /* bitmap of grouped InStreams */
766 u32 instream_group_map
;
769 /* pointer to the buffer */
771 /* pointer to the hostbuffer status */
772 struct hpi_hostbuffer_status
*p_status
;
777 struct hpi_mixer_msg
{
779 u16 control_type
; /* = HPI_CONTROL_METER _VOLUME etc */
780 u16 padding1
; /* Maintain alignment of subsequent fields */
781 u16 node_type1
; /* = HPI_SOURCENODE_LINEIN etc */
782 u16 node_index1
; /* = 0..N */
785 u16 padding2
; /* round to 4 bytes */
788 struct hpi_mixer_res
{
789 u16 src_node_type
; /* = HPI_SOURCENODE_LINEIN etc */
790 u16 src_node_index
; /* = 0..N */
793 /* Also controlType for MixerGetControlByIndex */
795 /* may indicate which DSP the control is located on */
799 union hpi_mixerx_msg
{
803 u32 length_in_bytes
; /* length in bytes of p_data */
804 u32 p_data
; /* pointer to a data array */
809 } store
; /* for HPI_MIXER_STORE message */
812 union hpi_mixerx_res
{
814 u32 bytes_returned
; /* size of items returned */
815 u32 p_data
; /* pointer to data array */
816 u16 more_to_do
; /* indicates if there is more to do */
820 struct hpi_control_msg
{
821 u16 attribute
; /* control attribute or property */
823 u32 param1
; /* generic parameter 1 */
824 u32 param2
; /* generic parameter 2 */
825 short an_log_value
[HPI_MAX_CHANNELS
];
828 struct hpi_control_union_msg
{
829 u16 attribute
; /* control attribute or property */
830 u16 saved_index
; /* only used in ctrl save/restore */
833 u32 param1
; /* generic parameter 1 */
834 u32 param2
; /* generic parameter 2 */
835 short an_log_value
[HPI_MAX_CHANNELS
];
852 struct hpi_control_res
{
853 /* Could make union. dwParam, anLogValue never used in same response */
856 short an_log_value
[HPI_MAX_CHANNELS
];
859 union hpi_control_union_res
{
863 short an_log_value
[HPI_MAX_CHANNELS
];
887 /* HPI_CONTROLX_STRUCTURES */
891 /** Used for all HMI variables where max length <= 8 bytes
893 struct hpi_controlx_msg_cobranet_data
{
899 /** Used for string data, and for packet bridge
901 struct hpi_controlx_msg_cobranet_bigdata
{
910 /** Used for PADS control reading of string fields.
912 struct hpi_controlx_msg_pad_data
{
921 /** Used for generic data
924 struct hpi_controlx_msg_generic
{
929 struct hpi_controlx_msg
{
930 u16 attribute
; /* control attribute or property */
933 struct hpi_controlx_msg_cobranet_data cobranet_data
;
934 struct hpi_controlx_msg_cobranet_bigdata cobranet_bigdata
;
935 struct hpi_controlx_msg_generic generic
;
936 struct hpi_controlx_msg_pad_data pad_data
;
937 /*struct param_value universal_value; */
938 /* nothing extra to send for status read */
945 struct hpi_controlx_res_cobranet_data
{
950 struct hpi_controlx_res_cobranet_bigdata
{
954 struct hpi_controlx_res_cobranet_status
{
960 struct hpi_controlx_res_generic
{
965 struct hpi_controlx_res
{
967 struct hpi_controlx_res_cobranet_bigdata cobranet_bigdata
;
968 struct hpi_controlx_res_cobranet_data cobranet_data
;
969 struct hpi_controlx_res_cobranet_status cobranet_status
;
970 struct hpi_controlx_res_generic generic
;
971 /*struct param_info universal_info; */
972 /*struct param_value universal_value; */
976 struct hpi_nvmemory_msg
{
981 struct hpi_nvmemory_res
{
986 struct hpi_gpio_msg
{
991 struct hpi_gpio_res
{
992 u16 number_input_bits
;
993 u16 number_output_bits
;
997 struct hpi_async_msg
{
1003 struct hpi_async_res
{
1010 u16 number_returned
;
1013 struct hpi_async_event event
;
1017 struct hpi_watchdog_msg
{
1021 struct hpi_watchdog_res
{
1025 struct hpi_clock_msg
{
1032 struct hpi_clock_res
{
1041 struct hpi_profile_msg
{
1046 struct hpi_profile_res_open
{
1050 struct hpi_profile_res_time
{
1051 u32 total_tick_count
;
1054 u32 ticks_per_millisecond
;
1055 u16 profile_interval
;
1058 struct hpi_profile_res_name
{
1062 struct hpi_profile_res
{
1064 struct hpi_profile_res_open o
;
1065 struct hpi_profile_res_time t
;
1066 struct hpi_profile_res_name n
;
1070 struct hpi_message_header
{
1071 u16 size
; /* total size in bytes */
1072 u8 type
; /* HPI_TYPE_MESSAGE */
1073 u8 version
; /* message version */
1074 u16 object
; /* HPI_OBJ_* */
1075 u16 function
; /* HPI_SUBSYS_xxx, HPI_ADAPTER_xxx */
1076 u16 adapter_index
; /* the adapter index */
1077 u16 obj_index
; /* */
1080 struct hpi_message
{
1081 /* following fields must match HPI_MESSAGE_HEADER */
1082 u16 size
; /* total size in bytes */
1083 u8 type
; /* HPI_TYPE_MESSAGE */
1084 u8 version
; /* message version */
1085 u16 object
; /* HPI_OBJ_* */
1086 u16 function
; /* HPI_SUBSYS_xxx, HPI_ADAPTER_xxx */
1087 u16 adapter_index
; /* the adapter index */
1088 u16 obj_index
; /* */
1090 struct hpi_subsys_msg s
;
1091 union hpi_adapterx_msg ax
;
1092 struct hpi_stream_msg d
;
1093 struct hpi_mixer_msg m
;
1094 union hpi_mixerx_msg mx
; /* extended mixer; */
1095 struct hpi_control_msg c
; /* mixer control; */
1096 /* identical to struct hpi_control_msg,
1097 but field naming is improved */
1098 struct hpi_control_union_msg cu
;
1099 struct hpi_controlx_msg cx
; /* extended mixer control; */
1100 struct hpi_nvmemory_msg n
;
1101 struct hpi_gpio_msg l
; /* digital i/o */
1102 struct hpi_watchdog_msg w
;
1103 struct hpi_clock_msg t
; /* dsp time */
1104 struct hpi_profile_msg p
;
1105 struct hpi_async_msg as
;
1106 char fixed_size
[32];
1110 #define HPI_MESSAGE_SIZE_BY_OBJECT { \
1111 sizeof(struct hpi_message_header) , /* Default, no object type 0 */ \
1112 sizeof(struct hpi_message_header) + sizeof(struct hpi_subsys_msg),\
1113 sizeof(struct hpi_message_header) + sizeof(union hpi_adapterx_msg),\
1114 sizeof(struct hpi_message_header) + sizeof(struct hpi_stream_msg),\
1115 sizeof(struct hpi_message_header) + sizeof(struct hpi_stream_msg),\
1116 sizeof(struct hpi_message_header) + sizeof(struct hpi_mixer_msg),\
1117 sizeof(struct hpi_message_header) , /* no node message */ \
1118 sizeof(struct hpi_message_header) + sizeof(struct hpi_control_msg),\
1119 sizeof(struct hpi_message_header) + sizeof(struct hpi_nvmemory_msg),\
1120 sizeof(struct hpi_message_header) + sizeof(struct hpi_gpio_msg),\
1121 sizeof(struct hpi_message_header) + sizeof(struct hpi_watchdog_msg),\
1122 sizeof(struct hpi_message_header) + sizeof(struct hpi_clock_msg),\
1123 sizeof(struct hpi_message_header) + sizeof(struct hpi_profile_msg),\
1124 sizeof(struct hpi_message_header) + sizeof(struct hpi_controlx_msg),\
1125 sizeof(struct hpi_message_header) + sizeof(struct hpi_async_msg) \
1128 struct hpi_response_header
{
1130 u8 type
; /* HPI_TYPE_RESPONSE */
1131 u8 version
; /* response version */
1132 u16 object
; /* HPI_OBJ_* */
1133 u16 function
; /* HPI_SUBSYS_xxx, HPI_ADAPTER_xxx */
1134 u16 error
; /* HPI_ERROR_xxx */
1135 u16 specific_error
; /* adapter specific error */
1138 struct hpi_response
{
1139 /* following fields must match HPI_RESPONSE_HEADER */
1141 u8 type
; /* HPI_TYPE_RESPONSE */
1142 u8 version
; /* response version */
1143 u16 object
; /* HPI_OBJ_* */
1144 u16 function
; /* HPI_SUBSYS_xxx, HPI_ADAPTER_xxx */
1145 u16 error
; /* HPI_ERROR_xxx */
1146 u16 specific_error
; /* adapter specific error */
1148 struct hpi_subsys_res s
;
1149 union hpi_adapterx_res ax
;
1150 struct hpi_stream_res d
;
1151 struct hpi_mixer_res m
;
1152 union hpi_mixerx_res mx
; /* extended mixer; */
1153 struct hpi_control_res c
; /* mixer control; */
1154 /* identical to hpi_control_res, but field naming is improved */
1155 union hpi_control_union_res cu
;
1156 struct hpi_controlx_res cx
; /* extended mixer control; */
1157 struct hpi_nvmemory_res n
;
1158 struct hpi_gpio_res l
; /* digital i/o */
1159 struct hpi_watchdog_res w
;
1160 struct hpi_clock_res t
; /* dsp time */
1161 struct hpi_profile_res p
;
1162 struct hpi_async_res as
;
1167 #define HPI_RESPONSE_SIZE_BY_OBJECT { \
1168 sizeof(struct hpi_response_header) ,/* Default, no object type 0 */ \
1169 sizeof(struct hpi_response_header) + sizeof(struct hpi_subsys_res),\
1170 sizeof(struct hpi_response_header) + sizeof(union hpi_adapterx_res),\
1171 sizeof(struct hpi_response_header) + sizeof(struct hpi_stream_res),\
1172 sizeof(struct hpi_response_header) + sizeof(struct hpi_stream_res),\
1173 sizeof(struct hpi_response_header) + sizeof(struct hpi_mixer_res),\
1174 sizeof(struct hpi_response_header) , /* no node response */ \
1175 sizeof(struct hpi_response_header) + sizeof(struct hpi_control_res),\
1176 sizeof(struct hpi_response_header) + sizeof(struct hpi_nvmemory_res),\
1177 sizeof(struct hpi_response_header) + sizeof(struct hpi_gpio_res),\
1178 sizeof(struct hpi_response_header) + sizeof(struct hpi_watchdog_res),\
1179 sizeof(struct hpi_response_header) + sizeof(struct hpi_clock_res),\
1180 sizeof(struct hpi_response_header) + sizeof(struct hpi_profile_res),\
1181 sizeof(struct hpi_response_header) + sizeof(struct hpi_controlx_res),\
1182 sizeof(struct hpi_response_header) + sizeof(struct hpi_async_res) \
1185 /*********************** version 1 message/response **************************/
1186 #define HPINET_ETHERNET_DATA_SIZE (1500)
1187 #define HPINET_IP_HDR_SIZE (20)
1188 #define HPINET_IP_DATA_SIZE (HPINET_ETHERNET_DATA_SIZE - HPINET_IP_HDR_SIZE)
1189 #define HPINET_UDP_HDR_SIZE (8)
1190 #define HPINET_UDP_DATA_SIZE (HPINET_IP_DATA_SIZE - HPINET_UDP_HDR_SIZE)
1191 #define HPINET_ASI_HDR_SIZE (2)
1192 #define HPINET_ASI_DATA_SIZE (HPINET_UDP_DATA_SIZE - HPINET_ASI_HDR_SIZE)
1194 #define HPI_MAX_PAYLOAD_SIZE (HPINET_ASI_DATA_SIZE - 2)
1196 /* New style message/response, but still V0 compatible */
1197 struct hpi_msg_adapter_get_info
{
1198 struct hpi_message_header h
;
1201 struct hpi_res_adapter_get_info
{
1202 struct hpi_response_header h
; /*v0 */
1203 struct hpi_adapter_res p
;
1206 /* padding is so these are same size as v0 hpi_message */
1207 struct hpi_msg_adapter_query_flash
{
1208 struct hpi_message_header h
;
1210 u8 pad_to_version0_size
[sizeof(struct hpi_message
) - /* V0 res */
1211 sizeof(struct hpi_message_header
) - 1 * sizeof(u32
)];
1214 /* padding is so these are same size as v0 hpi_response */
1215 struct hpi_res_adapter_query_flash
{
1216 struct hpi_response_header h
;
1220 u8 pad_to_version0_size
[sizeof(struct hpi_response
) - /* V0 res */
1221 sizeof(struct hpi_response_header
) - 3 * sizeof(u32
)];
1224 struct hpi_msg_adapter_start_flash
{
1225 struct hpi_message_header h
;
1229 u8 pad_to_version0_size
[sizeof(struct hpi_message
) - /* V0 res */
1230 sizeof(struct hpi_message_header
) - 3 * sizeof(u32
)];
1233 struct hpi_res_adapter_start_flash
{
1234 struct hpi_response_header h
;
1235 u8 pad_to_version0_size
[sizeof(struct hpi_response
) - /* V0 res */
1236 sizeof(struct hpi_response_header
)];
1239 struct hpi_msg_adapter_program_flash_payload
{
1243 u16 offset
; /**< offset from start of msg to data */
1245 /* ensure sizeof(header + payload) == sizeof(hpi_message_V0)
1246 because old firmware expects data after message of this size */
1247 u8 pad_to_version0_size
[sizeof(struct hpi_message
) - /* V0 message */
1248 sizeof(struct hpi_message_header
) - sizeof(u32
) -
1252 struct hpi_msg_adapter_program_flash
{
1253 struct hpi_message_header h
;
1254 struct hpi_msg_adapter_program_flash_payload p
;
1258 struct hpi_res_adapter_program_flash
{
1259 struct hpi_response_header h
;
1261 u8 pad_to_version0_size
[sizeof(struct hpi_response
) - /* V0 res */
1262 sizeof(struct hpi_response_header
) - sizeof(u16
)];
1265 struct hpi_msg_adapter_debug_read
{
1266 struct hpi_message_header h
;
1271 struct hpi_res_adapter_debug_read
{
1272 struct hpi_response_header h
;
1277 #define hpi_message_header_v1 hpi_message_header
1278 #define hpi_response_header_v1 hpi_response_header
1280 /* V1 headers in Addition to v0 headers */
1281 struct hpi_message_header_v1
{
1282 struct hpi_message_header h0
;
1287 struct hpi_response_header_v1
{
1288 struct hpi_response_header h0
;
1290 u16 adapter_index
; /* the adapter index */
1291 u16 obj_index
; /* object index */
1296 struct hpi_msg_payload_v0
{
1297 struct hpi_message_header h
;
1299 struct hpi_subsys_msg s
;
1300 union hpi_adapterx_msg ax
;
1301 struct hpi_stream_msg d
;
1302 struct hpi_mixer_msg m
;
1303 union hpi_mixerx_msg mx
;
1304 struct hpi_control_msg c
;
1305 struct hpi_control_union_msg cu
;
1306 struct hpi_controlx_msg cx
;
1307 struct hpi_nvmemory_msg n
;
1308 struct hpi_gpio_msg l
;
1309 struct hpi_watchdog_msg w
;
1310 struct hpi_clock_msg t
;
1311 struct hpi_profile_msg p
;
1312 struct hpi_async_msg as
;
1316 struct hpi_res_payload_v0
{
1317 struct hpi_response_header h
;
1319 struct hpi_subsys_res s
;
1320 union hpi_adapterx_res ax
;
1321 struct hpi_stream_res d
;
1322 struct hpi_mixer_res m
;
1323 union hpi_mixerx_res mx
;
1324 struct hpi_control_res c
;
1325 union hpi_control_union_res cu
;
1326 struct hpi_controlx_res cx
;
1327 struct hpi_nvmemory_res n
;
1328 struct hpi_gpio_res l
;
1329 struct hpi_watchdog_res w
;
1330 struct hpi_clock_res t
;
1331 struct hpi_profile_res p
;
1332 struct hpi_async_res as
;
1336 union hpi_message_buffer_v1
{
1337 struct hpi_message m0
; /* version 0 */
1338 struct hpi_message_header_v1 h
;
1339 u8 buf
[HPI_MAX_PAYLOAD_SIZE
];
1342 union hpi_response_buffer_v1
{
1343 struct hpi_response r0
; /* version 0 */
1344 struct hpi_response_header_v1 h
;
1345 u8 buf
[HPI_MAX_PAYLOAD_SIZE
];
1348 compile_time_assert((sizeof(union hpi_message_buffer_v1
) <=
1349 HPI_MAX_PAYLOAD_SIZE
), message_buffer_ok
);
1350 compile_time_assert((sizeof(union hpi_response_buffer_v1
) <=
1351 HPI_MAX_PAYLOAD_SIZE
), response_buffer_ok
);
1353 /*////////////////////////////////////////////////////////////////////////// */
1354 /* declarations for compact control calls */
1355 struct hpi_control_defn
{
1364 /*////////////////////////////////////////////////////////////////////////// */
1365 /* declarations for control caching (internal to HPI<->DSP interaction) */
1367 /** indicates a cached u16 value is invalid. */
1368 #define HPI_CACHE_INVALID_UINT16 0xFFFF
1369 /** indicates a cached short value is invalid. */
1370 #define HPI_CACHE_INVALID_SHORT -32768
1372 /** A compact representation of (part of) a controls state.
1373 Used for efficient transfer of the control state
1374 between DSP and host or across a network
1376 struct hpi_control_cache_info
{
1377 /** one of HPI_CONTROL_* */
1379 /** The total size of cached information in 32-bit words. */
1380 u8 size_in32bit_words
;
1381 /** The original index of the control on the DSP */
1385 struct hpi_control_cache_vol
{
1386 struct hpi_control_cache_info i
;
1388 char temp_padding
[4];
1391 struct hpi_control_cache_meter
{
1392 struct hpi_control_cache_info i
;
1393 short an_log_peak
[2];
1397 struct hpi_control_cache_channelmode
{
1398 struct hpi_control_cache_info i
;
1400 char temp_padding
[6];
1403 struct hpi_control_cache_mux
{
1404 struct hpi_control_cache_info i
;
1405 u16 source_node_type
;
1406 u16 source_node_index
;
1407 char temp_padding
[4];
1410 struct hpi_control_cache_level
{
1411 struct hpi_control_cache_info i
;
1413 char temp_padding
[4];
1416 struct hpi_control_cache_tuner
{
1417 struct hpi_control_cache_info i
;
1423 struct hpi_control_cache_aes3rx
{
1424 struct hpi_control_cache_info i
;
1429 struct hpi_control_cache_aes3tx
{
1430 struct hpi_control_cache_info i
;
1432 char temp_padding
[4];
1435 struct hpi_control_cache_tonedetector
{
1436 struct hpi_control_cache_info i
;
1438 char temp_padding
[6];
1441 struct hpi_control_cache_silencedetector
{
1442 struct hpi_control_cache_info i
;
1444 char temp_padding
[4];
1447 struct hpi_control_cache_sampleclock
{
1448 struct hpi_control_cache_info i
;
1454 struct hpi_control_cache_microphone
{
1455 struct hpi_control_cache_info i
;
1457 char temp_padding
[6];
1460 struct hpi_control_cache_generic
{
1461 struct hpi_control_cache_info i
;
1466 struct hpi_control_cache_single
{
1468 struct hpi_control_cache_info i
;
1469 struct hpi_control_cache_vol vol
;
1470 struct hpi_control_cache_meter meter
;
1471 struct hpi_control_cache_channelmode mode
;
1472 struct hpi_control_cache_mux mux
;
1473 struct hpi_control_cache_level level
;
1474 struct hpi_control_cache_tuner tuner
;
1475 struct hpi_control_cache_aes3rx aes3rx
;
1476 struct hpi_control_cache_aes3tx aes3tx
;
1477 struct hpi_control_cache_tonedetector tone
;
1478 struct hpi_control_cache_silencedetector silence
;
1479 struct hpi_control_cache_sampleclock clk
;
1480 struct hpi_control_cache_microphone microphone
;
1481 struct hpi_control_cache_generic generic
;
1485 struct hpi_control_cache_pad
{
1486 struct hpi_control_cache_info i
;
1487 u32 field_valid_flags
;
1494 u32 traffic_supported
;
1495 u32 traffic_anouncement
;
1498 /* 2^N sized FIFO buffer (internal to HPI<->DSP interaction) */
1499 struct hpi_fifo_buffer
{
1505 #ifndef DISABLE_PRAGMA_PACK1
1509 /* skip host side function declarations for DSP
1510 compile and documentation extraction */
1512 char hpi_handle_object(const u32 handle
);
1514 void hpi_handle_to_indexes(const u32 handle
, u16
*pw_adapter_index
,
1515 u16
*pw_object_index
);
1517 u32
hpi_indexes_to_handle(const char c_object
, const u16 adapter_index
,
1518 const u16 object_index
);
1520 /*////////////////////////////////////////////////////////////////////////// */
1522 /* main HPI entry point */
1523 void hpi_send_recv(struct hpi_message
*phm
, struct hpi_response
*phr
);
1526 void hpi_send_recvUDP(struct hpi_message
*phm
, struct hpi_response
*phr
,
1527 const unsigned int timeout
);
1529 /* used in PnP OS/driver */
1530 u16
hpi_subsys_create_adapter(const struct hpi_resource
*p_resource
,
1531 u16
*pw_adapter_index
);
1533 u16
hpi_subsys_delete_adapter(u16 adapter_index
);
1535 u16
hpi_outstream_host_buffer_get_info(u32 h_outstream
, u8
**pp_buffer
,
1536 struct hpi_hostbuffer_status
**pp_status
);
1538 u16
hpi_instream_host_buffer_get_info(u32 h_instream
, u8
**pp_buffer
,
1539 struct hpi_hostbuffer_status
**pp_status
);
1541 u16
hpi_adapter_restart(u16 adapter_index
);
1544 The following 3 functions were last declared in header files for
1545 driver 3.10. HPI_ControlQuery() used to be the recommended way
1546 of getting a volume range. Declared here for binary asihpi32.dll
1550 void hpi_format_to_msg(struct hpi_msg_format
*pMF
,
1551 const struct hpi_format
*pF
);
1552 void hpi_stream_response_to_legacy(struct hpi_stream_res
*pSR
);
1554 /*////////////////////////////////////////////////////////////////////////// */
1555 /* declarations for individual HPI entry points */
1556 hpi_handler_func HPI_1000
;
1557 hpi_handler_func HPI_6000
;
1558 hpi_handler_func HPI_6205
;
1559 hpi_handler_func HPI_COMMON
;
1561 #endif /* _HPI_INTERNAL_H_ */