Commit | Line | Data |
---|---|---|
719f82d3 EB |
1 | /****************************************************************************** |
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 | ||
19 | HPI 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 | ||
3285ea10 | 31 | /* Each OS needs its own hpios.h */ |
719f82d3 EB |
32 | #include "hpios.h" |
33 | ||
34 | /* physical memory allocation */ | |
35 | void hpios_locked_mem_init(void | |
36 | ); | |
37 | void 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 | ||
44 | On success, *pLockedMemeHandle is a valid handle, and 0 is returned | |
45 | On error *pLockedMemHandle marked invalid, non-zero returned. | |
46 | ||
47 | If this function succeeds, then HpiOs_LockedMem_GetVirtAddr() and | |
48 | HpiOs_LockedMem_GetPyhsAddr() will always succed on the returned handle. | |
49 | */ | |
50 | u16 hpios_locked_mem_alloc(struct consistent_dma_area *p_locked_mem_handle, | |
51 | /**< memory handle */ | |
3285ea10 | 52 | u32 size, /**< Size in bytes to allocate */ |
719f82d3 EB |
53 | 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 | ||
59 | Frees any resources, then invalidates the handle. | |
60 | Returns 0 on success, 1 if handle is invalid. | |
61 | ||
62 | */ | |
63 | u16 hpios_locked_mem_free(struct consistent_dma_area *locked_mem_handle); | |
64 | ||
65 | /** Get the physical PCI address of memory represented by LockedMemHandle. | |
66 | ||
67 | If handle is invalid *pPhysicalAddr is set to zero and return 1 | |
68 | */ | |
69 | u16 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 | ||
74 | If handle is NULL *ppvVirtualAddr is set to NULL and return 1 | |
75 | */ | |
76 | u16 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 | |
80 | i.e it represents a valid memory area | |
81 | */ | |
82 | u16 hpios_locked_mem_valid(struct consistent_dma_area *locked_mem_handle); | |
83 | ||
84 | /* timing/delay */ | |
85 | void hpios_delay_micro_seconds(u32 num_micro_sec); | |
86 | ||
87 | struct hpi_message; | |
88 | struct hpi_response; | |
89 | ||
90 | typedef 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 | ||
719f82d3 EB |
99 | /******************************************* bus types */ |
100 | enum HPI_BUSES { | |
101 | HPI_BUS_ISAPNP = 1, | |
102 | HPI_BUS_PCI = 2, | |
103 | HPI_BUS_USB = 3, | |
104 | HPI_BUS_NET = 4 | |
105 | }; | |
106 | ||
ba94455c EB |
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 | |
115 | }; | |
116 | ||
719f82d3 EB |
117 | /******************************************* CONTROL ATTRIBUTES ****/ |
118 | /* (in order of control type ID */ | |
119 | ||
108ccb3f | 120 | /* This allows for 255 control types, 256 unique attributes each */ |
3285ea10 | 121 | #define HPI_CTL_ATTR(ctl, ai) ((HPI_CONTROL_##ctl << 8) + ai) |
719f82d3 EB |
122 | |
123 | /* Get the sub-index of the attribute for a control type */ | |
3285ea10 | 124 | #define HPI_CTL_ATTR_INDEX(i) (i & 0xff) |
719f82d3 | 125 | |
108ccb3f | 126 | /* Extract the control from the control attribute */ |
3285ea10 | 127 | #define HPI_CTL_ATTR_CONTROL(i) (i >> 8) |
719f82d3 EB |
128 | |
129 | /** Enable event generation for a control. | |
130 | 0=disable, 1=enable | |
131 | \note generic to all controls that can generate events | |
132 | */ | |
3285ea10 EB |
133 | |
134 | /** Unique identifiers for every control attribute | |
719f82d3 | 135 | */ |
3285ea10 EB |
136 | enum HPI_CONTROL_ATTRIBUTES { |
137 | HPI_GENERIC_ENABLE = HPI_CTL_ATTR(GENERIC, 1), | |
138 | HPI_GENERIC_EVENT_ENABLE = HPI_CTL_ATTR(GENERIC, 2), | |
139 | ||
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), | |
144 | ||
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), | |
150 | ||
151 | HPI_MULTIPLEXER_SOURCE = HPI_CTL_ATTR(MULTIPLEXER, 1), | |
152 | HPI_MULTIPLEXER_QUERYSOURCE = HPI_CTL_ATTR(MULTIPLEXER, 2), | |
153 | ||
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), | |
158 | ||
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), | |
164 | ||
165 | HPI_LEVEL_GAIN = HPI_CTL_ATTR(LEVEL, 1), | |
166 | HPI_LEVEL_RANGE = HPI_CTL_ATTR(LEVEL, 10), | |
167 | ||
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), | |
183 | ||
184 | HPI_VOX_THRESHOLD = HPI_CTL_ATTR(VOX, 1), | |
185 | ||
186 | HPI_CHANNEL_MODE_MODE = HPI_CTL_ATTR(CHANNEL_MODE, 1), | |
187 | ||
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), | |
192 | ||
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), | |
199 | ||
200 | HPI_MICROPHONE_PHANTOM_POWER = HPI_CTL_ATTR(MICROPHONE, 1), | |
201 | ||
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), | |
205 | ||
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), | |
212 | ||
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), | |
220 | ||
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), | |
224 | ||
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), | |
228 | ||
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) | |
237 | }; | |
719f82d3 EB |
238 | |
239 | #define HPI_POLARITY_POSITIVE 0 | |
240 | #define HPI_POLARITY_NEGATIVE 1 | |
241 | ||
719f82d3 EB |
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) | |
269 | ||
270 | /*------------------------------------------------------------ | |
271 | Cobranet Chip Status bits | |
272 | ------------------------------------------------------------*/ | |
273 | #define HPI_COBRANET_HMI_STATUS_RXPACKET 2 | |
274 | #define HPI_COBRANET_HMI_STATUS_TXPACKET 3 | |
275 | ||
276 | /*------------------------------------------------------------ | |
277 | Ethernet header size | |
278 | ------------------------------------------------------------*/ | |
279 | #define HPI_ETHERNET_HEADER_SIZE (16) | |
280 | ||
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 | |
295 | ||
296 | #define HPI_ETHERNET_UDP_PORT (44600) /*!< UDP messaging port */ | |
297 | ||
298 | /** Base network time out is set to 100 milli-seconds. */ | |
299 | #define HPI_ETHERNET_TIMEOUT_MS (100) | |
300 | ||
3285ea10 EB |
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 | |
313 | }; | |
719f82d3 EB |
314 | |
315 | /*****************************************************************************/ | |
316 | /*****************************************************************************/ | |
317 | /******** HPI LOW LEVEL MESSAGES *******/ | |
318 | /*****************************************************************************/ | |
319 | /*****************************************************************************/ | |
320 | /** Pnp ids */ | |
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 | |
329 | ||
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 | |
333 | ||
334 | #define HPI_USB_VENDOR_ID_AUDIOSCIENCE 0x1257 | |
335 | #define HPI_USB_W2K_TAG 0x57495341 /* "ASIW" */ | |
336 | #define HPI_USB_LINUX_TAG 0x4C495341 /* "ASIL" */ | |
337 | ||
3285ea10 EB |
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 | |
341 | */ | |
342 | #define HPI_ADAPTER_INDEX_INVALID 0xFFFF | |
343 | ||
719f82d3 EB |
344 | /** First 2 hex digits define the adapter family */ |
345 | #define HPI_ADAPTER_FAMILY_MASK 0xff00 | |
5a498ef1 | 346 | #define HPI_MODULE_FAMILY_MASK 0xfff0 |
719f82d3 EB |
347 | |
348 | #define HPI_ADAPTER_FAMILY_ASI(f) (f & HPI_ADAPTER_FAMILY_MASK) | |
5a498ef1 | 349 | #define HPI_MODULE_FAMILY_ASI(f) (f & HPI_MODULE_FAMILY_MASK) |
719f82d3 EB |
350 | #define HPI_ADAPTER_ASI(f) (f) |
351 | ||
3285ea10 EB |
352 | enum HPI_MESSAGE_TYPES { |
353 | HPI_TYPE_MESSAGE = 1, | |
354 | HPI_TYPE_RESPONSE = 2, | |
355 | HPI_TYPE_DATA = 3, | |
356 | HPI_TYPE_SSX2BYPASS_MESSAGE = 4 | |
357 | }; | |
358 | ||
359 | enum HPI_OBJECT_TYPES { | |
360 | HPI_OBJ_SUBSYSTEM = 1, | |
361 | HPI_OBJ_ADAPTER = 2, | |
362 | HPI_OBJ_OSTREAM = 3, | |
363 | HPI_OBJ_ISTREAM = 4, | |
364 | HPI_OBJ_MIXER = 5, | |
365 | HPI_OBJ_NODE = 6, | |
366 | HPI_OBJ_CONTROL = 7, | |
367 | HPI_OBJ_NVMEMORY = 8, | |
368 | HPI_OBJ_GPIO = 9, | |
369 | HPI_OBJ_WATCHDOG = 10, | |
370 | HPI_OBJ_CLOCK = 11, | |
371 | HPI_OBJ_PROFILE = 12, | |
372 | HPI_OBJ_CONTROLEX = 13, | |
373 | HPI_OBJ_ASYNCEVENT = 14 | |
374 | #define HPI_OBJ_MAXINDEX 14 | |
375 | }; | |
376 | ||
377 | #define HPI_OBJ_FUNCTION_SPACING 0x100 | |
ba94455c EB |
378 | #define HPI_FUNC_ID(obj, index) \ |
379 | (HPI_OBJ_##obj * HPI_OBJ_FUNCTION_SPACING + index) | |
3285ea10 | 380 | |
719f82d3 EB |
381 | #define HPI_EXTRACT_INDEX(fn) (fn & 0xff) |
382 | ||
3285ea10 EB |
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 | |
402 | ||
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), | |
719f82d3 | 421 | #define HPI_ADAPTER_FUNCTION_COUNT 18 |
3285ea10 EB |
422 | |
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 | |
448 | ||
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 | |
469 | ||
719f82d3 EB |
470 | /* NOTE: |
471 | GET_NODE_INFO, SET_CONNECTION, GET_CONNECTIONS are not currently used */ | |
3285ea10 EB |
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 | |
484 | ||
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), | |
719f82d3 | 488 | #define HPI_CONTROL_FUNCTION_COUNT 3 |
3285ea10 EB |
489 | |
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), | |
719f82d3 | 493 | #define HPI_NVMEMORY_FUNCTION_COUNT 3 |
3285ea10 EB |
494 | |
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), | |
719f82d3 | 500 | #define HPI_GPIO_FUNCTION_COUNT 5 |
3285ea10 EB |
501 | |
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), | |
719f82d3 | 508 | #define HPI_ASYNCEVENT_FUNCTION_COUNT 6 |
3285ea10 EB |
509 | |
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), | |
513 | ||
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), | |
517 | ||
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) | |
719f82d3 | 525 | #define HPI_PROFILE_FUNCTION_COUNT 7 |
3285ea10 | 526 | }; |
719f82d3 EB |
527 | |
528 | /* ////////////////////////////////////////////////////////////////////// */ | |
529 | /* STRUCTURES */ | |
530 | #ifndef DISABLE_PRAGMA_PACK1 | |
531 | #pragma pack(push, 1) | |
532 | #endif | |
533 | ||
534 | /** PCI bus resource */ | |
535 | struct hpi_pci { | |
536 | u32 __iomem *ap_mem_base[HPI_MAX_ADAPTER_MEM_SPACES]; | |
3285ea10 | 537 | struct pci_dev *pci_dev; |
719f82d3 EB |
538 | }; |
539 | ||
540 | struct hpi_resource { | |
541 | union { | |
542 | const struct hpi_pci *pci; | |
543 | const char *net_if; | |
544 | } r; | |
545 | #ifndef HPI64BIT /* keep structure size constant */ | |
546 | u32 pad_to64; | |
547 | #endif | |
548 | u16 bus_type; /* HPI_BUS_PNPISA, _PCI, _USB etc */ | |
549 | u16 padding; | |
550 | ||
551 | }; | |
552 | ||
553 | /** Format info used inside struct hpi_message | |
554 | Not the same as public API struct hpi_format */ | |
555 | struct hpi_msg_format { | |
1d595d2a EB |
556 | u32 sample_rate; /**< 11025, 32000, 44100 etc. */ |
557 | u32 bit_rate; /**< for MPEG */ | |
558 | u32 attributes; /**< stereo/joint_stereo/mono */ | |
559 | u16 channels; /**< 1,2..., (or ancillary mode or idle bit */ | |
719f82d3 EB |
560 | u16 format; /**< HPI_FORMAT_PCM16, _MPEG etc. see \ref HPI_FORMATS. */ |
561 | }; | |
562 | ||
563 | /** Buffer+format structure. | |
564 | Must be kept 7 * 32 bits to match public struct hpi_datastruct */ | |
565 | struct hpi_msg_data { | |
566 | struct hpi_msg_format format; | |
567 | u8 *pb_data; | |
568 | #ifndef HPI64BIT | |
569 | u32 padding; | |
570 | #endif | |
571 | u32 data_size; | |
572 | }; | |
573 | ||
574 | /** struct hpi_datastructure used up to 3.04 driver */ | |
575 | struct hpi_data_legacy32 { | |
576 | struct hpi_format format; | |
577 | u32 pb_data; | |
578 | u32 data_size; | |
579 | }; | |
580 | ||
581 | #ifdef HPI64BIT | |
582 | /* Compatibility version of struct hpi_data*/ | |
583 | struct hpi_data_compat32 { | |
584 | struct hpi_msg_format format; | |
585 | u32 pb_data; | |
586 | u32 padding; | |
587 | u32 data_size; | |
588 | }; | |
589 | #endif | |
590 | ||
591 | struct hpi_buffer { | |
592 | /** placehoder for backward compatability (see dwBufferSize) */ | |
593 | struct hpi_msg_format reserved; | |
1d595d2a | 594 | u32 command; /**< HPI_BUFFER_CMD_xxx*/ |
719f82d3 EB |
595 | u32 pci_address; /**< PCI physical address of buffer for DSP DMA */ |
596 | u32 buffer_size; /**< must line up with data_size of HPI_DATA*/ | |
597 | }; | |
598 | ||
599 | /*/////////////////////////////////////////////////////////////////////////// */ | |
600 | /* This is used for background buffer bus mastering stream buffers. */ | |
601 | struct hpi_hostbuffer_status { | |
602 | u32 samples_processed; | |
603 | u32 auxiliary_data_available; | |
604 | u32 stream_state; | |
605 | /* DSP index in to the host bus master buffer. */ | |
606 | u32 dSP_index; | |
607 | /* Host index in to the host bus master buffer. */ | |
608 | u32 host_index; | |
609 | u32 size_in_bytes; | |
610 | }; | |
611 | ||
612 | struct hpi_streamid { | |
613 | u16 object_type; | |
614 | /**< Type of object, HPI_OBJ_OSTREAM or HPI_OBJ_ISTREAM. */ | |
615 | u16 stream_index; /**< outstream or instream index. */ | |
616 | }; | |
617 | ||
618 | struct hpi_punchinout { | |
619 | u32 punch_in_sample; | |
620 | u32 punch_out_sample; | |
621 | }; | |
622 | ||
623 | struct hpi_subsys_msg { | |
624 | struct hpi_resource resource; | |
625 | }; | |
626 | ||
627 | struct hpi_subsys_res { | |
628 | u32 version; | |
2f918a64 EB |
629 | u32 data; /* extended version */ |
630 | u16 num_adapters; | |
719f82d3 | 631 | u16 adapter_index; |
2f918a64 EB |
632 | u16 adapter_type; |
633 | u16 pad16; | |
719f82d3 EB |
634 | }; |
635 | ||
719f82d3 | 636 | union hpi_adapterx_msg { |
719f82d3 | 637 | struct { |
3285ea10 EB |
638 | u32 dsp_address; |
639 | u32 count_bytes; | |
640 | } debug_read; | |
719f82d3 | 641 | struct { |
3285ea10 EB |
642 | u32 adapter_mode; |
643 | u16 query_or_set; | |
644 | } mode; | |
645 | struct { | |
646 | u16 index; | |
647 | } module_info; | |
719f82d3 EB |
648 | struct { |
649 | u32 checksum; | |
650 | u16 sequence; | |
651 | u16 length; | |
652 | u16 offset; /**< offset from start of msg to data */ | |
653 | u16 unused; | |
654 | } program_flash; | |
3285ea10 EB |
655 | struct { |
656 | u16 index; | |
657 | u16 what; | |
658 | u16 property_index; | |
659 | } property_enum; | |
719f82d3 EB |
660 | struct { |
661 | u16 property; | |
662 | u16 parameter1; | |
663 | u16 parameter2; | |
664 | } property_set; | |
665 | struct { | |
3285ea10 EB |
666 | u32 offset; |
667 | } query_flash; | |
719f82d3 | 668 | struct { |
3285ea10 EB |
669 | u32 pad32; |
670 | u16 key1; | |
671 | u16 key2; | |
672 | } restart; | |
719f82d3 | 673 | struct { |
3285ea10 EB |
674 | u32 offset; |
675 | u32 length; | |
676 | u32 key; | |
677 | } start_flash; | |
678 | struct { | |
679 | u32 pad32; | |
680 | u16 value; | |
681 | } test_assert; | |
719f82d3 EB |
682 | }; |
683 | ||
684 | struct hpi_adapter_res { | |
685 | u32 serial_number; | |
686 | u16 adapter_type; | |
3285ea10 | 687 | u16 adapter_index; |
719f82d3 EB |
688 | u16 num_instreams; |
689 | u16 num_outstreams; | |
690 | u16 num_mixers; | |
691 | u16 version; | |
692 | u8 sz_adapter_assert[HPI_STRING_LEN]; | |
693 | }; | |
694 | ||
695 | union hpi_adapterx_res { | |
3285ea10 | 696 | struct hpi_adapter_res info; |
719f82d3 | 697 | struct { |
3285ea10 EB |
698 | u32 p1; |
699 | u16 count; | |
700 | u16 dsp_index; | |
701 | u32 p2; | |
702 | u32 dsp_msg_addr; | |
703 | char sz_message[HPI_STRING_LEN]; | |
704 | } assert; | |
705 | struct { | |
706 | u32 adapter_mode; | |
707 | } mode; | |
719f82d3 EB |
708 | struct { |
709 | u16 sequence; | |
710 | } program_flash; | |
711 | struct { | |
712 | u16 parameter1; | |
713 | u16 parameter2; | |
714 | } property_get; | |
3285ea10 EB |
715 | struct { |
716 | u32 checksum; | |
717 | u32 length; | |
718 | u32 version; | |
719 | } query_flash; | |
719f82d3 EB |
720 | }; |
721 | ||
722 | struct hpi_stream_msg { | |
723 | union { | |
724 | struct hpi_msg_data data; | |
725 | struct hpi_data_legacy32 data32; | |
726 | u16 velocity; | |
727 | struct hpi_punchinout pio; | |
728 | u32 time_scale; | |
729 | struct hpi_buffer buffer; | |
730 | struct hpi_streamid stream; | |
731 | } u; | |
732 | }; | |
733 | ||
734 | struct hpi_stream_res { | |
735 | union { | |
736 | struct { | |
737 | /* size of hardware buffer */ | |
738 | u32 buffer_size; | |
739 | /* OutStream - data to play, | |
740 | InStream - data recorded */ | |
741 | u32 data_available; | |
742 | /* OutStream - samples played, | |
743 | InStream - samples recorded */ | |
744 | u32 samples_transferred; | |
745 | /* Adapter - OutStream - data to play, | |
746 | InStream - data recorded */ | |
747 | u32 auxiliary_data_available; | |
748 | u16 state; /* HPI_STATE_PLAYING, _STATE_STOPPED */ | |
749 | u16 padding; | |
750 | } stream_info; | |
751 | struct { | |
752 | u32 buffer_size; | |
753 | u32 data_available; | |
754 | u32 samples_transfered; | |
755 | u16 state; | |
756 | u16 outstream_index; | |
757 | u16 instream_index; | |
758 | u16 padding; | |
759 | u32 auxiliary_data_available; | |
760 | } legacy_stream_info; | |
761 | struct { | |
762 | /* bitmap of grouped OutStreams */ | |
763 | u32 outstream_group_map; | |
764 | /* bitmap of grouped InStreams */ | |
765 | u32 instream_group_map; | |
766 | } group_info; | |
767 | struct { | |
768 | /* pointer to the buffer */ | |
769 | u8 *p_buffer; | |
770 | /* pointer to the hostbuffer status */ | |
771 | struct hpi_hostbuffer_status *p_status; | |
772 | } hostbuffer_info; | |
773 | } u; | |
774 | }; | |
775 | ||
776 | struct hpi_mixer_msg { | |
777 | u16 control_index; | |
778 | u16 control_type; /* = HPI_CONTROL_METER _VOLUME etc */ | |
3285ea10 | 779 | u16 padding1; /* Maintain alignment of subsequent fields */ |
719f82d3 EB |
780 | u16 node_type1; /* = HPI_SOURCENODE_LINEIN etc */ |
781 | u16 node_index1; /* = 0..N */ | |
782 | u16 node_type2; | |
783 | u16 node_index2; | |
784 | u16 padding2; /* round to 4 bytes */ | |
785 | }; | |
786 | ||
787 | struct hpi_mixer_res { | |
788 | u16 src_node_type; /* = HPI_SOURCENODE_LINEIN etc */ | |
789 | u16 src_node_index; /* = 0..N */ | |
790 | u16 dst_node_type; | |
791 | u16 dst_node_index; | |
792 | /* Also controlType for MixerGetControlByIndex */ | |
793 | u16 control_index; | |
794 | /* may indicate which DSP the control is located on */ | |
795 | u16 dsp_index; | |
796 | }; | |
797 | ||
798 | union hpi_mixerx_msg { | |
799 | struct { | |
800 | u16 starting_index; | |
801 | u16 flags; | |
802 | u32 length_in_bytes; /* length in bytes of p_data */ | |
803 | u32 p_data; /* pointer to a data array */ | |
804 | } gcabi; | |
805 | struct { | |
806 | u16 command; | |
807 | u16 index; | |
808 | } store; /* for HPI_MIXER_STORE message */ | |
809 | }; | |
810 | ||
811 | union hpi_mixerx_res { | |
812 | struct { | |
813 | u32 bytes_returned; /* size of items returned */ | |
814 | u32 p_data; /* pointer to data array */ | |
815 | u16 more_to_do; /* indicates if there is more to do */ | |
816 | } gcabi; | |
817 | }; | |
818 | ||
819 | struct hpi_control_msg { | |
820 | u16 attribute; /* control attribute or property */ | |
821 | u16 saved_index; | |
822 | u32 param1; /* generic parameter 1 */ | |
823 | u32 param2; /* generic parameter 2 */ | |
824 | short an_log_value[HPI_MAX_CHANNELS]; | |
825 | }; | |
826 | ||
827 | struct hpi_control_union_msg { | |
828 | u16 attribute; /* control attribute or property */ | |
829 | u16 saved_index; /* only used in ctrl save/restore */ | |
830 | union { | |
831 | struct { | |
832 | u32 param1; /* generic parameter 1 */ | |
833 | u32 param2; /* generic parameter 2 */ | |
834 | short an_log_value[HPI_MAX_CHANNELS]; | |
835 | } old; | |
836 | union { | |
837 | u32 frequency; | |
838 | u32 gain; | |
839 | u32 band; | |
840 | u32 deemphasis; | |
841 | u32 program; | |
842 | struct { | |
843 | u32 mode; | |
844 | u32 value; | |
845 | } mode; | |
5a498ef1 | 846 | u32 blend; |
719f82d3 EB |
847 | } tuner; |
848 | } u; | |
849 | }; | |
850 | ||
851 | struct hpi_control_res { | |
852 | /* Could make union. dwParam, anLogValue never used in same response */ | |
853 | u32 param1; | |
854 | u32 param2; | |
855 | short an_log_value[HPI_MAX_CHANNELS]; | |
856 | }; | |
857 | ||
858 | union hpi_control_union_res { | |
859 | struct { | |
860 | u32 param1; | |
861 | u32 param2; | |
862 | short an_log_value[HPI_MAX_CHANNELS]; | |
863 | } old; | |
864 | union { | |
865 | u32 band; | |
866 | u32 frequency; | |
867 | u32 gain; | |
719f82d3 EB |
868 | u32 deemphasis; |
869 | struct { | |
870 | u32 data[2]; | |
871 | u32 bLER; | |
872 | } rds; | |
3285ea10 EB |
873 | short s_level; |
874 | struct { | |
875 | u16 value; | |
876 | u16 mask; | |
877 | } status; | |
719f82d3 EB |
878 | } tuner; |
879 | struct { | |
880 | char sz_data[8]; | |
881 | u32 remaining_chars; | |
882 | } chars8; | |
883 | char c_data12[12]; | |
884 | }; | |
885 | ||
886 | /* HPI_CONTROLX_STRUCTURES */ | |
887 | ||
888 | /* Message */ | |
889 | ||
890 | /** Used for all HMI variables where max length <= 8 bytes | |
891 | */ | |
892 | struct hpi_controlx_msg_cobranet_data { | |
893 | u32 hmi_address; | |
894 | u32 byte_count; | |
895 | u32 data[2]; | |
896 | }; | |
897 | ||
898 | /** Used for string data, and for packet bridge | |
899 | */ | |
900 | struct hpi_controlx_msg_cobranet_bigdata { | |
901 | u32 hmi_address; | |
902 | u32 byte_count; | |
903 | u8 *pb_data; | |
904 | #ifndef HPI64BIT | |
905 | u32 padding; | |
906 | #endif | |
907 | }; | |
908 | ||
909 | /** Used for PADS control reading of string fields. | |
910 | */ | |
911 | struct hpi_controlx_msg_pad_data { | |
912 | u32 field; | |
913 | u32 byte_count; | |
914 | u8 *pb_data; | |
915 | #ifndef HPI64BIT | |
916 | u32 padding; | |
917 | #endif | |
918 | }; | |
919 | ||
920 | /** Used for generic data | |
921 | */ | |
922 | ||
923 | struct hpi_controlx_msg_generic { | |
924 | u32 param1; | |
925 | u32 param2; | |
926 | }; | |
927 | ||
928 | struct hpi_controlx_msg { | |
929 | u16 attribute; /* control attribute or property */ | |
930 | u16 saved_index; | |
931 | union { | |
932 | struct hpi_controlx_msg_cobranet_data cobranet_data; | |
933 | struct hpi_controlx_msg_cobranet_bigdata cobranet_bigdata; | |
934 | struct hpi_controlx_msg_generic generic; | |
935 | struct hpi_controlx_msg_pad_data pad_data; | |
936 | /*struct param_value universal_value; */ | |
937 | /* nothing extra to send for status read */ | |
938 | } u; | |
939 | }; | |
940 | ||
941 | /* Response */ | |
942 | /** | |
943 | */ | |
944 | struct hpi_controlx_res_cobranet_data { | |
945 | u32 byte_count; | |
946 | u32 data[2]; | |
947 | }; | |
948 | ||
949 | struct hpi_controlx_res_cobranet_bigdata { | |
950 | u32 byte_count; | |
951 | }; | |
952 | ||
953 | struct hpi_controlx_res_cobranet_status { | |
954 | u32 status; | |
955 | u32 readable_size; | |
956 | u32 writeable_size; | |
957 | }; | |
958 | ||
959 | struct hpi_controlx_res_generic { | |
960 | u32 param1; | |
961 | u32 param2; | |
962 | }; | |
963 | ||
964 | struct hpi_controlx_res { | |
965 | union { | |
966 | struct hpi_controlx_res_cobranet_bigdata cobranet_bigdata; | |
967 | struct hpi_controlx_res_cobranet_data cobranet_data; | |
968 | struct hpi_controlx_res_cobranet_status cobranet_status; | |
969 | struct hpi_controlx_res_generic generic; | |
970 | /*struct param_info universal_info; */ | |
971 | /*struct param_value universal_value; */ | |
972 | } u; | |
973 | }; | |
974 | ||
975 | struct hpi_nvmemory_msg { | |
976 | u16 address; | |
977 | u16 data; | |
978 | }; | |
979 | ||
980 | struct hpi_nvmemory_res { | |
981 | u16 size_in_bytes; | |
982 | u16 data; | |
983 | }; | |
984 | ||
985 | struct hpi_gpio_msg { | |
986 | u16 bit_index; | |
987 | u16 bit_data; | |
988 | }; | |
989 | ||
990 | struct hpi_gpio_res { | |
991 | u16 number_input_bits; | |
992 | u16 number_output_bits; | |
993 | u16 bit_data[4]; | |
994 | }; | |
995 | ||
996 | struct hpi_async_msg { | |
997 | u32 events; | |
998 | u16 maximum_events; | |
999 | u16 padding; | |
1000 | }; | |
1001 | ||
1002 | struct hpi_async_res { | |
1003 | union { | |
1004 | struct { | |
1005 | u16 count; | |
1006 | } count; | |
1007 | struct { | |
1008 | u32 events; | |
1009 | u16 number_returned; | |
1010 | u16 padding; | |
1011 | } get; | |
1012 | struct hpi_async_event event; | |
1013 | } u; | |
1014 | }; | |
1015 | ||
1016 | struct hpi_watchdog_msg { | |
1017 | u32 time_ms; | |
1018 | }; | |
1019 | ||
1020 | struct hpi_watchdog_res { | |
1021 | u32 time_ms; | |
1022 | }; | |
1023 | ||
1024 | struct hpi_clock_msg { | |
1025 | u16 hours; | |
1026 | u16 minutes; | |
1027 | u16 seconds; | |
1028 | u16 milli_seconds; | |
1029 | }; | |
1030 | ||
1031 | struct hpi_clock_res { | |
1032 | u16 size_in_bytes; | |
1033 | u16 hours; | |
1034 | u16 minutes; | |
1035 | u16 seconds; | |
1036 | u16 milli_seconds; | |
1037 | u16 padding; | |
1038 | }; | |
1039 | ||
1040 | struct hpi_profile_msg { | |
1041 | u16 bin_index; | |
1042 | u16 padding; | |
1043 | }; | |
1044 | ||
1045 | struct hpi_profile_res_open { | |
1046 | u16 max_profiles; | |
1047 | }; | |
1048 | ||
1049 | struct hpi_profile_res_time { | |
3285ea10 | 1050 | u32 total_tick_count; |
719f82d3 | 1051 | u32 call_count; |
3285ea10 EB |
1052 | u32 max_tick_count; |
1053 | u32 ticks_per_millisecond; | |
1054 | u16 profile_interval; | |
719f82d3 EB |
1055 | }; |
1056 | ||
1057 | struct hpi_profile_res_name { | |
1058 | u8 sz_name[32]; | |
1059 | }; | |
1060 | ||
1061 | struct hpi_profile_res { | |
1062 | union { | |
1063 | struct hpi_profile_res_open o; | |
1064 | struct hpi_profile_res_time t; | |
1065 | struct hpi_profile_res_name n; | |
1066 | } u; | |
1067 | }; | |
1068 | ||
1069 | struct hpi_message_header { | |
1070 | u16 size; /* total size in bytes */ | |
1071 | u8 type; /* HPI_TYPE_MESSAGE */ | |
1072 | u8 version; /* message version */ | |
1073 | u16 object; /* HPI_OBJ_* */ | |
1074 | u16 function; /* HPI_SUBSYS_xxx, HPI_ADAPTER_xxx */ | |
1075 | u16 adapter_index; /* the adapter index */ | |
1076 | u16 obj_index; /* */ | |
1077 | }; | |
1078 | ||
1079 | struct hpi_message { | |
1080 | /* following fields must match HPI_MESSAGE_HEADER */ | |
1081 | u16 size; /* total size in bytes */ | |
1082 | u8 type; /* HPI_TYPE_MESSAGE */ | |
1083 | u8 version; /* message version */ | |
1084 | u16 object; /* HPI_OBJ_* */ | |
1085 | u16 function; /* HPI_SUBSYS_xxx, HPI_ADAPTER_xxx */ | |
1086 | u16 adapter_index; /* the adapter index */ | |
1087 | u16 obj_index; /* */ | |
1088 | union { | |
1089 | struct hpi_subsys_msg s; | |
719f82d3 EB |
1090 | union hpi_adapterx_msg ax; |
1091 | struct hpi_stream_msg d; | |
1092 | struct hpi_mixer_msg m; | |
1093 | union hpi_mixerx_msg mx; /* extended mixer; */ | |
1094 | struct hpi_control_msg c; /* mixer control; */ | |
1095 | /* identical to struct hpi_control_msg, | |
1096 | but field naming is improved */ | |
1097 | struct hpi_control_union_msg cu; | |
1098 | struct hpi_controlx_msg cx; /* extended mixer control; */ | |
1099 | struct hpi_nvmemory_msg n; | |
1100 | struct hpi_gpio_msg l; /* digital i/o */ | |
1101 | struct hpi_watchdog_msg w; | |
1102 | struct hpi_clock_msg t; /* dsp time */ | |
1103 | struct hpi_profile_msg p; | |
1104 | struct hpi_async_msg as; | |
1105 | char fixed_size[32]; | |
1106 | } u; | |
1107 | }; | |
1108 | ||
1109 | #define HPI_MESSAGE_SIZE_BY_OBJECT { \ | |
3285ea10 | 1110 | sizeof(struct hpi_message_header) , /* Default, no object type 0 */ \ |
719f82d3 EB |
1111 | sizeof(struct hpi_message_header) + sizeof(struct hpi_subsys_msg),\ |
1112 | sizeof(struct hpi_message_header) + sizeof(union hpi_adapterx_msg),\ | |
1113 | sizeof(struct hpi_message_header) + sizeof(struct hpi_stream_msg),\ | |
1114 | sizeof(struct hpi_message_header) + sizeof(struct hpi_stream_msg),\ | |
1115 | sizeof(struct hpi_message_header) + sizeof(struct hpi_mixer_msg),\ | |
1116 | sizeof(struct hpi_message_header) , /* no node message */ \ | |
1117 | sizeof(struct hpi_message_header) + sizeof(struct hpi_control_msg),\ | |
1118 | sizeof(struct hpi_message_header) + sizeof(struct hpi_nvmemory_msg),\ | |
1119 | sizeof(struct hpi_message_header) + sizeof(struct hpi_gpio_msg),\ | |
1120 | sizeof(struct hpi_message_header) + sizeof(struct hpi_watchdog_msg),\ | |
1121 | sizeof(struct hpi_message_header) + sizeof(struct hpi_clock_msg),\ | |
1122 | sizeof(struct hpi_message_header) + sizeof(struct hpi_profile_msg),\ | |
1123 | sizeof(struct hpi_message_header) + sizeof(struct hpi_controlx_msg),\ | |
1124 | sizeof(struct hpi_message_header) + sizeof(struct hpi_async_msg) \ | |
1125 | } | |
1126 | ||
1d595d2a EB |
1127 | /* |
1128 | Note that the wSpecificError error field should be inspected and potentially | |
1129 | reported whenever HPI_ERROR_DSP_COMMUNICATION or HPI_ERROR_DSP_BOOTLOAD is | |
1130 | returned in wError. | |
1131 | */ | |
719f82d3 EB |
1132 | struct hpi_response_header { |
1133 | u16 size; | |
1134 | u8 type; /* HPI_TYPE_RESPONSE */ | |
1135 | u8 version; /* response version */ | |
1136 | u16 object; /* HPI_OBJ_* */ | |
1137 | u16 function; /* HPI_SUBSYS_xxx, HPI_ADAPTER_xxx */ | |
1138 | u16 error; /* HPI_ERROR_xxx */ | |
1139 | u16 specific_error; /* adapter specific error */ | |
1140 | }; | |
1141 | ||
1142 | struct hpi_response { | |
1143 | /* following fields must match HPI_RESPONSE_HEADER */ | |
1144 | u16 size; | |
1145 | u8 type; /* HPI_TYPE_RESPONSE */ | |
1146 | u8 version; /* response version */ | |
1147 | u16 object; /* HPI_OBJ_* */ | |
1148 | u16 function; /* HPI_SUBSYS_xxx, HPI_ADAPTER_xxx */ | |
1149 | u16 error; /* HPI_ERROR_xxx */ | |
1150 | u16 specific_error; /* adapter specific error */ | |
1151 | union { | |
1152 | struct hpi_subsys_res s; | |
719f82d3 EB |
1153 | union hpi_adapterx_res ax; |
1154 | struct hpi_stream_res d; | |
1155 | struct hpi_mixer_res m; | |
1156 | union hpi_mixerx_res mx; /* extended mixer; */ | |
1157 | struct hpi_control_res c; /* mixer control; */ | |
1158 | /* identical to hpi_control_res, but field naming is improved */ | |
1159 | union hpi_control_union_res cu; | |
1160 | struct hpi_controlx_res cx; /* extended mixer control; */ | |
1161 | struct hpi_nvmemory_res n; | |
1162 | struct hpi_gpio_res l; /* digital i/o */ | |
1163 | struct hpi_watchdog_res w; | |
1164 | struct hpi_clock_res t; /* dsp time */ | |
1165 | struct hpi_profile_res p; | |
1166 | struct hpi_async_res as; | |
1167 | u8 bytes[52]; | |
1168 | } u; | |
1169 | }; | |
1170 | ||
1171 | #define HPI_RESPONSE_SIZE_BY_OBJECT { \ | |
3285ea10 | 1172 | sizeof(struct hpi_response_header) ,/* Default, no object type 0 */ \ |
719f82d3 EB |
1173 | sizeof(struct hpi_response_header) + sizeof(struct hpi_subsys_res),\ |
1174 | sizeof(struct hpi_response_header) + sizeof(union hpi_adapterx_res),\ | |
1175 | sizeof(struct hpi_response_header) + sizeof(struct hpi_stream_res),\ | |
1176 | sizeof(struct hpi_response_header) + sizeof(struct hpi_stream_res),\ | |
1177 | sizeof(struct hpi_response_header) + sizeof(struct hpi_mixer_res),\ | |
1178 | sizeof(struct hpi_response_header) , /* no node response */ \ | |
1179 | sizeof(struct hpi_response_header) + sizeof(struct hpi_control_res),\ | |
1180 | sizeof(struct hpi_response_header) + sizeof(struct hpi_nvmemory_res),\ | |
1181 | sizeof(struct hpi_response_header) + sizeof(struct hpi_gpio_res),\ | |
1182 | sizeof(struct hpi_response_header) + sizeof(struct hpi_watchdog_res),\ | |
1183 | sizeof(struct hpi_response_header) + sizeof(struct hpi_clock_res),\ | |
1184 | sizeof(struct hpi_response_header) + sizeof(struct hpi_profile_res),\ | |
1185 | sizeof(struct hpi_response_header) + sizeof(struct hpi_controlx_res),\ | |
1186 | sizeof(struct hpi_response_header) + sizeof(struct hpi_async_res) \ | |
1187 | } | |
1188 | ||
ba94455c | 1189 | /*********************** version 1 message/response **************************/ |
719f82d3 EB |
1190 | #define HPINET_ETHERNET_DATA_SIZE (1500) |
1191 | #define HPINET_IP_HDR_SIZE (20) | |
1192 | #define HPINET_IP_DATA_SIZE (HPINET_ETHERNET_DATA_SIZE - HPINET_IP_HDR_SIZE) | |
1193 | #define HPINET_UDP_HDR_SIZE (8) | |
1194 | #define HPINET_UDP_DATA_SIZE (HPINET_IP_DATA_SIZE - HPINET_UDP_HDR_SIZE) | |
1195 | #define HPINET_ASI_HDR_SIZE (2) | |
1196 | #define HPINET_ASI_DATA_SIZE (HPINET_UDP_DATA_SIZE - HPINET_ASI_HDR_SIZE) | |
1197 | ||
1198 | #define HPI_MAX_PAYLOAD_SIZE (HPINET_ASI_DATA_SIZE - 2) | |
1199 | ||
1200 | /* New style message/response, but still V0 compatible */ | |
1201 | struct hpi_msg_adapter_get_info { | |
1202 | struct hpi_message_header h; | |
1203 | }; | |
1204 | ||
1205 | struct hpi_res_adapter_get_info { | |
1206 | struct hpi_response_header h; /*v0 */ | |
1207 | struct hpi_adapter_res p; | |
1208 | }; | |
1209 | ||
1210 | /* padding is so these are same size as v0 hpi_message */ | |
1211 | struct hpi_msg_adapter_query_flash { | |
1212 | struct hpi_message_header h; | |
1213 | u32 offset; | |
1214 | u8 pad_to_version0_size[sizeof(struct hpi_message) - /* V0 res */ | |
1215 | sizeof(struct hpi_message_header) - 1 * sizeof(u32)]; | |
1216 | }; | |
1217 | ||
1218 | /* padding is so these are same size as v0 hpi_response */ | |
1219 | struct hpi_res_adapter_query_flash { | |
1220 | struct hpi_response_header h; | |
1221 | u32 checksum; | |
1222 | u32 length; | |
1223 | u32 version; | |
1224 | u8 pad_to_version0_size[sizeof(struct hpi_response) - /* V0 res */ | |
1225 | sizeof(struct hpi_response_header) - 3 * sizeof(u32)]; | |
1226 | }; | |
1227 | ||
1228 | struct hpi_msg_adapter_start_flash { | |
1229 | struct hpi_message_header h; | |
1230 | u32 offset; | |
1231 | u32 length; | |
1232 | u32 key; | |
1233 | u8 pad_to_version0_size[sizeof(struct hpi_message) - /* V0 res */ | |
1234 | sizeof(struct hpi_message_header) - 3 * sizeof(u32)]; | |
1235 | }; | |
1236 | ||
1237 | struct hpi_res_adapter_start_flash { | |
1238 | struct hpi_response_header h; | |
1239 | u8 pad_to_version0_size[sizeof(struct hpi_response) - /* V0 res */ | |
1240 | sizeof(struct hpi_response_header)]; | |
1241 | }; | |
1242 | ||
1243 | struct hpi_msg_adapter_program_flash_payload { | |
1244 | u32 checksum; | |
1245 | u16 sequence; | |
1246 | u16 length; | |
1247 | u16 offset; /**< offset from start of msg to data */ | |
1248 | u16 unused; | |
1249 | /* ensure sizeof(header + payload) == sizeof(hpi_message_V0) | |
1250 | because old firmware expects data after message of this size */ | |
1251 | u8 pad_to_version0_size[sizeof(struct hpi_message) - /* V0 message */ | |
1252 | sizeof(struct hpi_message_header) - sizeof(u32) - | |
1253 | 4 * sizeof(u16)]; | |
1254 | }; | |
1255 | ||
1256 | struct hpi_msg_adapter_program_flash { | |
1257 | struct hpi_message_header h; | |
1258 | struct hpi_msg_adapter_program_flash_payload p; | |
1259 | u32 data[256]; | |
1260 | }; | |
1261 | ||
1262 | struct hpi_res_adapter_program_flash { | |
1263 | struct hpi_response_header h; | |
1264 | u16 sequence; | |
1265 | u8 pad_to_version0_size[sizeof(struct hpi_response) - /* V0 res */ | |
1266 | sizeof(struct hpi_response_header) - sizeof(u16)]; | |
1267 | }; | |
1268 | ||
3285ea10 EB |
1269 | struct hpi_msg_adapter_debug_read { |
1270 | struct hpi_message_header h; | |
1271 | u32 dsp_address; | |
1272 | u32 count_bytes; | |
1273 | }; | |
1274 | ||
1275 | struct hpi_res_adapter_debug_read { | |
1276 | struct hpi_response_header h; | |
1277 | u8 bytes[256]; | |
1278 | }; | |
1279 | ||
719f82d3 EB |
1280 | #if 1 |
1281 | #define hpi_message_header_v1 hpi_message_header | |
1282 | #define hpi_response_header_v1 hpi_response_header | |
1283 | #else | |
1284 | /* V1 headers in Addition to v0 headers */ | |
1285 | struct hpi_message_header_v1 { | |
1286 | struct hpi_message_header h0; | |
1287 | /* struct { | |
1288 | } h1; */ | |
1289 | }; | |
1290 | ||
1291 | struct hpi_response_header_v1 { | |
1292 | struct hpi_response_header h0; | |
1293 | struct { | |
1294 | u16 adapter_index; /* the adapter index */ | |
1295 | u16 obj_index; /* object index */ | |
1296 | } h1; | |
1297 | }; | |
1298 | #endif | |
1299 | ||
719f82d3 EB |
1300 | struct hpi_msg_payload_v0 { |
1301 | struct hpi_message_header h; | |
1302 | union { | |
1303 | struct hpi_subsys_msg s; | |
719f82d3 EB |
1304 | union hpi_adapterx_msg ax; |
1305 | struct hpi_stream_msg d; | |
1306 | struct hpi_mixer_msg m; | |
1307 | union hpi_mixerx_msg mx; | |
1308 | struct hpi_control_msg c; | |
1309 | struct hpi_control_union_msg cu; | |
1310 | struct hpi_controlx_msg cx; | |
1311 | struct hpi_nvmemory_msg n; | |
1312 | struct hpi_gpio_msg l; | |
1313 | struct hpi_watchdog_msg w; | |
1314 | struct hpi_clock_msg t; | |
1315 | struct hpi_profile_msg p; | |
1316 | struct hpi_async_msg as; | |
1317 | } u; | |
1318 | }; | |
1319 | ||
1320 | struct hpi_res_payload_v0 { | |
1321 | struct hpi_response_header h; | |
1322 | union { | |
1323 | struct hpi_subsys_res s; | |
719f82d3 EB |
1324 | union hpi_adapterx_res ax; |
1325 | struct hpi_stream_res d; | |
1326 | struct hpi_mixer_res m; | |
1327 | union hpi_mixerx_res mx; | |
1328 | struct hpi_control_res c; | |
1329 | union hpi_control_union_res cu; | |
1330 | struct hpi_controlx_res cx; | |
1331 | struct hpi_nvmemory_res n; | |
1332 | struct hpi_gpio_res l; | |
1333 | struct hpi_watchdog_res w; | |
1334 | struct hpi_clock_res t; | |
1335 | struct hpi_profile_res p; | |
1336 | struct hpi_async_res as; | |
1337 | } u; | |
1338 | }; | |
1339 | ||
1340 | union hpi_message_buffer_v1 { | |
1341 | struct hpi_message m0; /* version 0 */ | |
1342 | struct hpi_message_header_v1 h; | |
3285ea10 | 1343 | u8 buf[HPI_MAX_PAYLOAD_SIZE]; |
719f82d3 EB |
1344 | }; |
1345 | ||
1346 | union hpi_response_buffer_v1 { | |
1347 | struct hpi_response r0; /* version 0 */ | |
1348 | struct hpi_response_header_v1 h; | |
3285ea10 | 1349 | u8 buf[HPI_MAX_PAYLOAD_SIZE]; |
719f82d3 EB |
1350 | }; |
1351 | ||
1352 | compile_time_assert((sizeof(union hpi_message_buffer_v1) <= | |
1353 | HPI_MAX_PAYLOAD_SIZE), message_buffer_ok); | |
1354 | compile_time_assert((sizeof(union hpi_response_buffer_v1) <= | |
1355 | HPI_MAX_PAYLOAD_SIZE), response_buffer_ok); | |
1356 | ||
1357 | /*////////////////////////////////////////////////////////////////////////// */ | |
1358 | /* declarations for compact control calls */ | |
1359 | struct hpi_control_defn { | |
1360 | u8 type; | |
1361 | u8 channels; | |
1362 | u8 src_node_type; | |
1363 | u8 src_node_index; | |
1364 | u8 dest_node_type; | |
1365 | u8 dest_node_index; | |
1366 | }; | |
1367 | ||
1368 | /*////////////////////////////////////////////////////////////////////////// */ | |
1369 | /* declarations for control caching (internal to HPI<->DSP interaction) */ | |
1370 | ||
3285ea10 EB |
1371 | /** indicates a cached u16 value is invalid. */ |
1372 | #define HPI_CACHE_INVALID_UINT16 0xFFFF | |
1373 | /** indicates a cached short value is invalid. */ | |
1374 | #define HPI_CACHE_INVALID_SHORT -32768 | |
1375 | ||
719f82d3 EB |
1376 | /** A compact representation of (part of) a controls state. |
1377 | Used for efficient transfer of the control state | |
1378 | between DSP and host or across a network | |
1379 | */ | |
1380 | struct hpi_control_cache_info { | |
1381 | /** one of HPI_CONTROL_* */ | |
1382 | u8 control_type; | |
1383 | /** The total size of cached information in 32-bit words. */ | |
1384 | u8 size_in32bit_words; | |
1385 | /** The original index of the control on the DSP */ | |
1386 | u16 control_index; | |
1387 | }; | |
1388 | ||
3285ea10 EB |
1389 | struct hpi_control_cache_vol { |
1390 | struct hpi_control_cache_info i; | |
1391 | short an_log[2]; | |
1392 | char temp_padding[4]; | |
1393 | }; | |
1394 | ||
1395 | struct hpi_control_cache_meter { | |
1396 | struct hpi_control_cache_info i; | |
1397 | short an_log_peak[2]; | |
1398 | short an_logRMS[2]; | |
1399 | }; | |
1400 | ||
1401 | struct hpi_control_cache_channelmode { | |
1402 | struct hpi_control_cache_info i; | |
1403 | u16 mode; | |
1404 | char temp_padding[6]; | |
1405 | }; | |
1406 | ||
1407 | struct hpi_control_cache_mux { | |
1408 | struct hpi_control_cache_info i; | |
1409 | u16 source_node_type; | |
1410 | u16 source_node_index; | |
1411 | char temp_padding[4]; | |
1412 | }; | |
1413 | ||
1414 | struct hpi_control_cache_level { | |
1415 | struct hpi_control_cache_info i; | |
1416 | short an_log[2]; | |
1417 | char temp_padding[4]; | |
1418 | }; | |
1419 | ||
1420 | struct hpi_control_cache_tuner { | |
1421 | struct hpi_control_cache_info i; | |
1422 | u32 freq_ink_hz; | |
1423 | u16 band; | |
1424 | short s_level_avg; | |
1425 | }; | |
1426 | ||
1427 | struct hpi_control_cache_aes3rx { | |
1428 | struct hpi_control_cache_info i; | |
1429 | u32 error_status; | |
1430 | u32 format; | |
1431 | }; | |
1432 | ||
1433 | struct hpi_control_cache_aes3tx { | |
1434 | struct hpi_control_cache_info i; | |
1435 | u32 format; | |
1436 | char temp_padding[4]; | |
1437 | }; | |
1438 | ||
1439 | struct hpi_control_cache_tonedetector { | |
1440 | struct hpi_control_cache_info i; | |
1441 | u16 state; | |
1442 | char temp_padding[6]; | |
1443 | }; | |
1444 | ||
1445 | struct hpi_control_cache_silencedetector { | |
1446 | struct hpi_control_cache_info i; | |
1447 | u32 state; | |
1448 | char temp_padding[4]; | |
1449 | }; | |
1450 | ||
1451 | struct hpi_control_cache_sampleclock { | |
1452 | struct hpi_control_cache_info i; | |
1453 | u16 source; | |
1454 | u16 source_index; | |
1455 | u32 sample_rate; | |
1456 | }; | |
1457 | ||
1458 | struct hpi_control_cache_microphone { | |
1459 | struct hpi_control_cache_info i; | |
1460 | u16 phantom_state; | |
1461 | char temp_padding[6]; | |
1462 | }; | |
1463 | ||
1464 | struct hpi_control_cache_generic { | |
719f82d3 | 1465 | struct hpi_control_cache_info i; |
3285ea10 EB |
1466 | u32 dw1; |
1467 | u32 dw2; | |
1468 | }; | |
1469 | ||
1470 | struct hpi_control_cache_single { | |
719f82d3 | 1471 | union { |
3285ea10 EB |
1472 | struct hpi_control_cache_info i; |
1473 | struct hpi_control_cache_vol vol; | |
1474 | struct hpi_control_cache_meter meter; | |
1475 | struct hpi_control_cache_channelmode mode; | |
1476 | struct hpi_control_cache_mux mux; | |
1477 | struct hpi_control_cache_level level; | |
1478 | struct hpi_control_cache_tuner tuner; | |
1479 | struct hpi_control_cache_aes3rx aes3rx; | |
1480 | struct hpi_control_cache_aes3tx aes3tx; | |
1481 | struct hpi_control_cache_tonedetector tone; | |
1482 | struct hpi_control_cache_silencedetector silence; | |
1483 | struct hpi_control_cache_sampleclock clk; | |
1484 | struct hpi_control_cache_microphone microphone; | |
1485 | struct hpi_control_cache_generic generic; | |
719f82d3 EB |
1486 | } u; |
1487 | }; | |
1488 | ||
1489 | struct hpi_control_cache_pad { | |
1490 | struct hpi_control_cache_info i; | |
1491 | u32 field_valid_flags; | |
1492 | u8 c_channel[8]; | |
1493 | u8 c_artist[40]; | |
1494 | u8 c_title[40]; | |
1495 | u8 c_comment[200]; | |
1496 | u32 pTY; | |
1497 | u32 pI; | |
1498 | u32 traffic_supported; | |
1499 | u32 traffic_anouncement; | |
1500 | }; | |
1501 | ||
ba94455c | 1502 | /* 2^N sized FIFO buffer (internal to HPI<->DSP interaction) */ |
719f82d3 EB |
1503 | struct hpi_fifo_buffer { |
1504 | u32 size; | |
1505 | u32 dSP_index; | |
1506 | u32 host_index; | |
1507 | }; | |
1508 | ||
1509 | #ifndef DISABLE_PRAGMA_PACK1 | |
1510 | #pragma pack(pop) | |
1511 | #endif | |
1512 | ||
1513 | /* skip host side function declarations for DSP | |
1514 | compile and documentation extraction */ | |
1515 | ||
1516 | char hpi_handle_object(const u32 handle); | |
1517 | ||
1518 | void hpi_handle_to_indexes(const u32 handle, u16 *pw_adapter_index, | |
1519 | u16 *pw_object_index); | |
1520 | ||
1521 | u32 hpi_indexes_to_handle(const char c_object, const u16 adapter_index, | |
1522 | const u16 object_index); | |
1523 | ||
1524 | /*////////////////////////////////////////////////////////////////////////// */ | |
1525 | ||
1526 | /* main HPI entry point */ | |
ba94455c | 1527 | void hpi_send_recv(struct hpi_message *phm, struct hpi_response *phr); |
719f82d3 EB |
1528 | |
1529 | /* UDP message */ | |
1530 | void hpi_send_recvUDP(struct hpi_message *phm, struct hpi_response *phr, | |
1531 | const unsigned int timeout); | |
1532 | ||
1533 | /* used in PnP OS/driver */ | |
ba94455c EB |
1534 | u16 hpi_subsys_create_adapter(const struct hpi_resource *p_resource, |
1535 | u16 *pw_adapter_index); | |
719f82d3 | 1536 | |
ba94455c | 1537 | u16 hpi_subsys_delete_adapter(u16 adapter_index); |
719f82d3 | 1538 | |
ba94455c | 1539 | u16 hpi_outstream_host_buffer_get_info(u32 h_outstream, u8 **pp_buffer, |
719f82d3 EB |
1540 | struct hpi_hostbuffer_status **pp_status); |
1541 | ||
ba94455c | 1542 | u16 hpi_instream_host_buffer_get_info(u32 h_instream, u8 **pp_buffer, |
719f82d3 EB |
1543 | struct hpi_hostbuffer_status **pp_status); |
1544 | ||
1545 | u16 hpi_adapter_restart(u16 adapter_index); | |
1546 | ||
1547 | /* | |
1548 | The following 3 functions were last declared in header files for | |
1549 | driver 3.10. HPI_ControlQuery() used to be the recommended way | |
1550 | of getting a volume range. Declared here for binary asihpi32.dll | |
1551 | compatibility. | |
1552 | */ | |
1553 | ||
1554 | void hpi_format_to_msg(struct hpi_msg_format *pMF, | |
1555 | const struct hpi_format *pF); | |
1556 | void hpi_stream_response_to_legacy(struct hpi_stream_res *pSR); | |
1557 | ||
1558 | /*////////////////////////////////////////////////////////////////////////// */ | |
1559 | /* declarations for individual HPI entry points */ | |
1560 | hpi_handler_func HPI_1000; | |
1561 | hpi_handler_func HPI_6000; | |
1562 | hpi_handler_func HPI_6205; | |
1563 | hpi_handler_func HPI_COMMON; | |
1564 | ||
1565 | #endif /* _HPI_INTERNAL_H_ */ |