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 | ||
31 | /* Each OS needs its own hpios.h, or specific define as above */ | |
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 */ | |
52 | u32 size, /**< size in bytes to allocate */ | |
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 | ||
99 | /*/////////////////////////////////////////////////////////////////////////// */ | |
100 | /* Private HPI Entity related definitions */ | |
101 | ||
102 | #define STR_SIZE_FIELD_MAX 65535U | |
103 | #define STR_TYPE_FIELD_MAX 255U | |
104 | #define STR_ROLE_FIELD_MAX 255U | |
105 | ||
106 | struct hpi_entity_str { | |
107 | uint16_t size; | |
108 | uint8_t type; | |
109 | uint8_t role; | |
110 | }; | |
111 | ||
112 | #if defined(_MSC_VER) | |
113 | #pragma warning(push) | |
114 | #pragma warning(disable : 4200) | |
115 | #endif | |
116 | ||
117 | struct hpi_entity { | |
118 | struct hpi_entity_str header; | |
119 | #if ! defined(HPI_OS_DSP_C6000) || (defined(HPI_OS_DSP_C6000) && (__TI_COMPILER_VERSION__ > 6000008)) | |
120 | /* DSP C6000 compiler v6.0.8 and lower | |
121 | do not support flexible array member */ | |
122 | uint8_t value[]; | |
123 | #else | |
124 | /* NOTE! Using sizeof(struct hpi_entity) will give erroneous results */ | |
125 | #define HPI_INTERNAL_WARN_ABOUT_ENTITY_VALUE | |
126 | uint8_t value[1]; | |
127 | #endif | |
128 | }; | |
129 | ||
130 | #if defined(_MSC_VER) | |
131 | #pragma warning(pop) | |
132 | #endif | |
133 | ||
134 | /******************************************* bus types */ | |
135 | enum HPI_BUSES { | |
136 | HPI_BUS_ISAPNP = 1, | |
137 | HPI_BUS_PCI = 2, | |
138 | HPI_BUS_USB = 3, | |
139 | HPI_BUS_NET = 4 | |
140 | }; | |
141 | ||
142 | /******************************************* CONTROL ATTRIBUTES ****/ | |
143 | /* (in order of control type ID */ | |
144 | ||
145 | /* This allows for 255 control types, 256 unique attributes each */ | |
146 | #define HPI_CTL_ATTR(ctl, ai) (HPI_CONTROL_##ctl * 0x100 + ai) | |
147 | ||
148 | /* Get the sub-index of the attribute for a control type */ | |
149 | #define HPI_CTL_ATTR_INDEX(i) (i&0xff) | |
150 | ||
151 | /* Generic control attributes. */ | |
152 | ||
153 | /** Enable a control. | |
154 | 0=disable, 1=enable | |
155 | \note generic to all mixer plugins? | |
156 | */ | |
157 | #define HPI_GENERIC_ENABLE HPI_CTL_ATTR(GENERIC, 1) | |
158 | ||
159 | /** Enable event generation for a control. | |
160 | 0=disable, 1=enable | |
161 | \note generic to all controls that can generate events | |
162 | */ | |
163 | #define HPI_GENERIC_EVENT_ENABLE HPI_CTL_ATTR(GENERIC, 2) | |
164 | ||
165 | /* Volume Control attributes */ | |
166 | #define HPI_VOLUME_GAIN HPI_CTL_ATTR(VOLUME, 1) | |
167 | #define HPI_VOLUME_AUTOFADE HPI_CTL_ATTR(VOLUME, 2) | |
168 | ||
169 | /** For HPI_ControlQuery() to get the number of channels of a volume control*/ | |
170 | #define HPI_VOLUME_NUM_CHANNELS HPI_CTL_ATTR(VOLUME, 6) | |
171 | #define HPI_VOLUME_RANGE HPI_CTL_ATTR(VOLUME, 10) | |
172 | ||
173 | /** Level Control attributes */ | |
174 | #define HPI_LEVEL_GAIN HPI_CTL_ATTR(LEVEL, 1) | |
175 | #define HPI_LEVEL_RANGE HPI_CTL_ATTR(LEVEL, 10) | |
176 | ||
177 | /* Meter Control attributes */ | |
178 | /** return RMS signal level */ | |
179 | #define HPI_METER_RMS HPI_CTL_ATTR(METER, 1) | |
180 | /** return peak signal level */ | |
181 | #define HPI_METER_PEAK HPI_CTL_ATTR(METER, 2) | |
182 | /** ballistics for ALL rms meters on adapter */ | |
183 | #define HPI_METER_RMS_BALLISTICS HPI_CTL_ATTR(METER, 3) | |
184 | /** ballistics for ALL peak meters on adapter */ | |
185 | #define HPI_METER_PEAK_BALLISTICS HPI_CTL_ATTR(METER, 4) | |
186 | ||
187 | /** For HPI_ControlQuery() to get the number of channels of a meter control*/ | |
188 | #define HPI_METER_NUM_CHANNELS HPI_CTL_ATTR(METER, 5) | |
189 | ||
190 | /* Multiplexer control attributes */ | |
191 | #define HPI_MULTIPLEXER_SOURCE HPI_CTL_ATTR(MULTIPLEXER, 1) | |
192 | #define HPI_MULTIPLEXER_QUERYSOURCE HPI_CTL_ATTR(MULTIPLEXER, 2) | |
193 | ||
194 | /** AES/EBU transmitter control attributes */ | |
195 | /** AESEBU or SPDIF */ | |
196 | #define HPI_AESEBUTX_FORMAT HPI_CTL_ATTR(AESEBUTX, 1) | |
197 | #define HPI_AESEBUTX_SAMPLERATE HPI_CTL_ATTR(AESEBUTX, 3) | |
198 | #define HPI_AESEBUTX_CHANNELSTATUS HPI_CTL_ATTR(AESEBUTX, 4) | |
199 | #define HPI_AESEBUTX_USERDATA HPI_CTL_ATTR(AESEBUTX, 5) | |
200 | ||
201 | /** AES/EBU receiver control attributes */ | |
202 | #define HPI_AESEBURX_FORMAT HPI_CTL_ATTR(AESEBURX, 1) | |
203 | #define HPI_AESEBURX_ERRORSTATUS HPI_CTL_ATTR(AESEBURX, 2) | |
204 | #define HPI_AESEBURX_SAMPLERATE HPI_CTL_ATTR(AESEBURX, 3) | |
205 | #define HPI_AESEBURX_CHANNELSTATUS HPI_CTL_ATTR(AESEBURX, 4) | |
206 | #define HPI_AESEBURX_USERDATA HPI_CTL_ATTR(AESEBURX, 5) | |
207 | ||
208 | /** \defgroup tuner_defs Tuners | |
209 | \{ | |
210 | */ | |
211 | /** \defgroup tuner_attrs Tuner control attributes | |
212 | \{ | |
213 | */ | |
214 | #define HPI_TUNER_BAND HPI_CTL_ATTR(TUNER, 1) | |
215 | #define HPI_TUNER_FREQ HPI_CTL_ATTR(TUNER, 2) | |
216 | #define HPI_TUNER_LEVEL HPI_CTL_ATTR(TUNER, 3) | |
217 | #define HPI_TUNER_AUDIOMUTE HPI_CTL_ATTR(TUNER, 4) | |
218 | /* use TUNER_STATUS instead */ | |
219 | #define HPI_TUNER_VIDEO_STATUS HPI_CTL_ATTR(TUNER, 5) | |
220 | #define HPI_TUNER_GAIN HPI_CTL_ATTR(TUNER, 6) | |
221 | #define HPI_TUNER_STATUS HPI_CTL_ATTR(TUNER, 7) | |
222 | #define HPI_TUNER_MODE HPI_CTL_ATTR(TUNER, 8) | |
223 | /** RDS data. */ | |
224 | #define HPI_TUNER_RDS HPI_CTL_ATTR(TUNER, 9) | |
225 | /** Audio pre-emphasis. */ | |
226 | #define HPI_TUNER_DEEMPHASIS HPI_CTL_ATTR(TUNER, 10) | |
227 | /** HD Radio tuner program control. */ | |
228 | #define HPI_TUNER_PROGRAM HPI_CTL_ATTR(TUNER, 11) | |
229 | /** HD Radio tuner digital signal quality. */ | |
230 | #define HPI_TUNER_HDRADIO_SIGNAL_QUALITY HPI_CTL_ATTR(TUNER, 12) | |
231 | /** HD Radio SDK firmware version. */ | |
232 | #define HPI_TUNER_HDRADIO_SDK_VERSION HPI_CTL_ATTR(TUNER, 13) | |
233 | /** HD Radio DSP firmware version. */ | |
234 | #define HPI_TUNER_HDRADIO_DSP_VERSION HPI_CTL_ATTR(TUNER, 14) | |
235 | ||
236 | /** \} */ | |
237 | ||
238 | /** \defgroup pads_attrs Tuner PADs control attributes | |
239 | \{ | |
240 | */ | |
241 | /** The text string containing the station/channel combination. */ | |
242 | #define HPI_PAD_CHANNEL_NAME HPI_CTL_ATTR(PAD, 1) | |
243 | /** The text string containing the artist. */ | |
244 | #define HPI_PAD_ARTIST HPI_CTL_ATTR(PAD, 2) | |
245 | /** The text string containing the title. */ | |
246 | #define HPI_PAD_TITLE HPI_CTL_ATTR(PAD, 3) | |
247 | /** The text string containing the comment. */ | |
248 | #define HPI_PAD_COMMENT HPI_CTL_ATTR(PAD, 4) | |
249 | /** The integer containing the PTY code. */ | |
250 | #define HPI_PAD_PROGRAM_TYPE HPI_CTL_ATTR(PAD, 5) | |
251 | /** The integer containing the program identification. */ | |
252 | #define HPI_PAD_PROGRAM_ID HPI_CTL_ATTR(PAD, 6) | |
253 | /** The integer containing whether traffic information is supported. | |
254 | Contains either 1 or 0. */ | |
255 | #define HPI_PAD_TA_SUPPORT HPI_CTL_ATTR(PAD, 7) | |
256 | /** The integer containing whether traffic announcement is in progress. | |
257 | Contains either 1 or 0. */ | |
258 | #define HPI_PAD_TA_ACTIVE HPI_CTL_ATTR(PAD, 8) | |
259 | /** \} */ | |
260 | /** \} */ | |
261 | ||
262 | /* VOX control attributes */ | |
263 | #define HPI_VOX_THRESHOLD HPI_CTL_ATTR(VOX, 1) | |
264 | ||
265 | /*?? channel mode used hpi_multiplexer_source attribute == 1 */ | |
266 | #define HPI_CHANNEL_MODE_MODE HPI_CTL_ATTR(CHANNEL_MODE, 1) | |
267 | ||
268 | /** \defgroup channel_modes Channel Modes | |
269 | Used for HPI_ChannelModeSet/Get() | |
270 | \{ | |
271 | */ | |
272 | /** Left channel out = left channel in, Right channel out = right channel in. */ | |
273 | #define HPI_CHANNEL_MODE_NORMAL 1 | |
274 | /** Left channel out = right channel in, Right channel out = left channel in. */ | |
275 | #define HPI_CHANNEL_MODE_SWAP 2 | |
276 | /** Left channel out = left channel in, Right channel out = left channel in. */ | |
277 | #define HPI_CHANNEL_MODE_LEFT_TO_STEREO 3 | |
278 | /** Left channel out = right channel in, Right channel out = right channel in.*/ | |
279 | #define HPI_CHANNEL_MODE_RIGHT_TO_STEREO 4 | |
280 | /** Left channel out = (left channel in + right channel in)/2, | |
281 | Right channel out = mute. */ | |
282 | #define HPI_CHANNEL_MODE_STEREO_TO_LEFT 5 | |
283 | /** Left channel out = mute, | |
284 | Right channel out = (right channel in + left channel in)/2. */ | |
285 | #define HPI_CHANNEL_MODE_STEREO_TO_RIGHT 6 | |
286 | #define HPI_CHANNEL_MODE_LAST 6 | |
287 | /** \} */ | |
288 | ||
289 | /* Bitstream control set attributes */ | |
290 | #define HPI_BITSTREAM_DATA_POLARITY HPI_CTL_ATTR(BITSTREAM, 1) | |
291 | #define HPI_BITSTREAM_CLOCK_EDGE HPI_CTL_ATTR(BITSTREAM, 2) | |
292 | #define HPI_BITSTREAM_CLOCK_SOURCE HPI_CTL_ATTR(BITSTREAM, 3) | |
293 | ||
294 | #define HPI_POLARITY_POSITIVE 0 | |
295 | #define HPI_POLARITY_NEGATIVE 1 | |
296 | ||
297 | /* Bitstream control get attributes */ | |
298 | #define HPI_BITSTREAM_ACTIVITY 1 | |
299 | ||
300 | /* SampleClock control attributes */ | |
301 | #define HPI_SAMPLECLOCK_SOURCE HPI_CTL_ATTR(SAMPLECLOCK, 1) | |
302 | #define HPI_SAMPLECLOCK_SAMPLERATE HPI_CTL_ATTR(SAMPLECLOCK, 2) | |
303 | #define HPI_SAMPLECLOCK_SOURCE_INDEX HPI_CTL_ATTR(SAMPLECLOCK, 3) | |
304 | #define HPI_SAMPLECLOCK_LOCAL_SAMPLERATE\ | |
305 | HPI_CTL_ATTR(SAMPLECLOCK, 4) | |
306 | #define HPI_SAMPLECLOCK_AUTO HPI_CTL_ATTR(SAMPLECLOCK, 5) | |
307 | #define HPI_SAMPLECLOCK_LOCAL_LOCK HPI_CTL_ATTR(SAMPLECLOCK, 6) | |
308 | ||
309 | /* Microphone control attributes */ | |
310 | #define HPI_MICROPHONE_PHANTOM_POWER HPI_CTL_ATTR(MICROPHONE, 1) | |
311 | ||
312 | /** Equalizer control attributes | |
313 | */ | |
314 | /** Used to get number of filters in an EQ. (Can't set) */ | |
315 | #define HPI_EQUALIZER_NUM_FILTERS HPI_CTL_ATTR(EQUALIZER, 1) | |
316 | /** Set/get the filter by type, freq, Q, gain */ | |
317 | #define HPI_EQUALIZER_FILTER HPI_CTL_ATTR(EQUALIZER, 2) | |
318 | /** Get the biquad coefficients */ | |
319 | #define HPI_EQUALIZER_COEFFICIENTS HPI_CTL_ATTR(EQUALIZER, 3) | |
320 | ||
321 | #define HPI_COMPANDER_PARAMS HPI_CTL_ATTR(COMPANDER, 1) | |
322 | ||
323 | /* Cobranet control attributes. | |
324 | MUST be distinct from all other control attributes. | |
325 | This is so that host side processing can easily identify a Cobranet control | |
326 | and apply additional host side operations (like copying data) as required. | |
327 | */ | |
328 | #define HPI_COBRANET_SET HPI_CTL_ATTR(COBRANET, 1) | |
329 | #define HPI_COBRANET_GET HPI_CTL_ATTR(COBRANET, 2) | |
330 | #define HPI_COBRANET_SET_DATA HPI_CTL_ATTR(COBRANET, 3) | |
331 | #define HPI_COBRANET_GET_DATA HPI_CTL_ATTR(COBRANET, 4) | |
332 | #define HPI_COBRANET_GET_STATUS HPI_CTL_ATTR(COBRANET, 5) | |
333 | #define HPI_COBRANET_SEND_PACKET HPI_CTL_ATTR(COBRANET, 6) | |
334 | #define HPI_COBRANET_GET_PACKET HPI_CTL_ATTR(COBRANET, 7) | |
335 | ||
336 | /*------------------------------------------------------------ | |
337 | Cobranet Chip Bridge - copied from HMI.H | |
338 | ------------------------------------------------------------*/ | |
339 | #define HPI_COBRANET_HMI_cobra_bridge 0x20000 | |
340 | #define HPI_COBRANET_HMI_cobra_bridge_tx_pkt_buf \ | |
341 | (HPI_COBRANET_HMI_cobra_bridge + 0x1000) | |
342 | #define HPI_COBRANET_HMI_cobra_bridge_rx_pkt_buf \ | |
343 | (HPI_COBRANET_HMI_cobra_bridge + 0x2000) | |
344 | #define HPI_COBRANET_HMI_cobra_if_table1 0x110000 | |
345 | #define HPI_COBRANET_HMI_cobra_if_phy_address \ | |
346 | (HPI_COBRANET_HMI_cobra_if_table1 + 0xd) | |
347 | #define HPI_COBRANET_HMI_cobra_protocolIP 0x72000 | |
348 | #define HPI_COBRANET_HMI_cobra_ip_mon_currentIP \ | |
349 | (HPI_COBRANET_HMI_cobra_protocolIP + 0x0) | |
350 | #define HPI_COBRANET_HMI_cobra_ip_mon_staticIP \ | |
351 | (HPI_COBRANET_HMI_cobra_protocolIP + 0x2) | |
352 | #define HPI_COBRANET_HMI_cobra_sys 0x100000 | |
353 | #define HPI_COBRANET_HMI_cobra_sys_desc \ | |
354 | (HPI_COBRANET_HMI_cobra_sys + 0x0) | |
355 | #define HPI_COBRANET_HMI_cobra_sys_objectID \ | |
356 | (HPI_COBRANET_HMI_cobra_sys + 0x100) | |
357 | #define HPI_COBRANET_HMI_cobra_sys_contact \ | |
358 | (HPI_COBRANET_HMI_cobra_sys + 0x200) | |
359 | #define HPI_COBRANET_HMI_cobra_sys_name \ | |
360 | (HPI_COBRANET_HMI_cobra_sys + 0x300) | |
361 | #define HPI_COBRANET_HMI_cobra_sys_location \ | |
362 | (HPI_COBRANET_HMI_cobra_sys + 0x400) | |
363 | ||
364 | /*------------------------------------------------------------ | |
365 | Cobranet Chip Status bits | |
366 | ------------------------------------------------------------*/ | |
367 | #define HPI_COBRANET_HMI_STATUS_RXPACKET 2 | |
368 | #define HPI_COBRANET_HMI_STATUS_TXPACKET 3 | |
369 | ||
370 | /*------------------------------------------------------------ | |
371 | Ethernet header size | |
372 | ------------------------------------------------------------*/ | |
373 | #define HPI_ETHERNET_HEADER_SIZE (16) | |
374 | ||
375 | /* These defines are used to fill in protocol information for an Ethernet packet | |
376 | sent using HMI on CS18102 */ | |
377 | /** ID supplied by Cirrius for ASI packets. */ | |
378 | #define HPI_ETHERNET_PACKET_ID 0x85 | |
379 | /** Simple packet - no special routing required */ | |
380 | #define HPI_ETHERNET_PACKET_V1 0x01 | |
381 | /** This packet must make its way to the host across the HPI interface */ | |
382 | #define HPI_ETHERNET_PACKET_HOSTED_VIA_HMI 0x20 | |
383 | /** This packet must make its way to the host across the HPI interface */ | |
384 | #define HPI_ETHERNET_PACKET_HOSTED_VIA_HMI_V1 0x21 | |
385 | /** This packet must make its way to the host across the HPI interface */ | |
386 | #define HPI_ETHERNET_PACKET_HOSTED_VIA_HPI 0x40 | |
387 | /** This packet must make its way to the host across the HPI interface */ | |
388 | #define HPI_ETHERNET_PACKET_HOSTED_VIA_HPI_V1 0x41 | |
389 | ||
390 | #define HPI_ETHERNET_UDP_PORT (44600) /*!< UDP messaging port */ | |
391 | ||
392 | /** Base network time out is set to 100 milli-seconds. */ | |
393 | #define HPI_ETHERNET_TIMEOUT_MS (100) | |
394 | ||
395 | /** \defgroup tonedet_attr Tonedetector attributes | |
396 | \{ | |
397 | Used by HPI_ToneDetector_Set() and HPI_ToneDetector_Get() | |
398 | */ | |
399 | ||
400 | /** Set the threshold level of a tonedetector, | |
401 | Threshold is a -ve number in units of dB/100, | |
402 | */ | |
403 | #define HPI_TONEDETECTOR_THRESHOLD HPI_CTL_ATTR(TONEDETECTOR, 1) | |
404 | ||
405 | /** Get the current state of tonedetection | |
406 | The result is a bitmap of detected tones. pairs of bits represent the left | |
407 | and right channels, with left channel in LSB. | |
408 | The lowest frequency detector state is in the LSB | |
409 | */ | |
410 | #define HPI_TONEDETECTOR_STATE HPI_CTL_ATTR(TONEDETECTOR, 2) | |
411 | ||
412 | /** Get the frequency of a tonedetector band. | |
413 | */ | |
414 | #define HPI_TONEDETECTOR_FREQUENCY HPI_CTL_ATTR(TONEDETECTOR, 3) | |
415 | ||
416 | /**\}*/ | |
417 | ||
418 | /** \defgroup silencedet_attr SilenceDetector attributes | |
419 | \{ | |
420 | */ | |
421 | ||
422 | /** Get the current state of tonedetection | |
423 | The result is a bitmap with 1s for silent channels. Left channel is in LSB | |
424 | */ | |
425 | #define HPI_SILENCEDETECTOR_STATE \ | |
426 | HPI_CTL_ATTR(SILENCEDETECTOR, 2) | |
427 | ||
428 | /** Set the threshold level of a SilenceDetector, | |
429 | Threshold is a -ve number in units of dB/100, | |
430 | */ | |
431 | #define HPI_SILENCEDETECTOR_THRESHOLD \ | |
432 | HPI_CTL_ATTR(SILENCEDETECTOR, 1) | |
433 | ||
434 | /** get/set the silence time before the detector triggers | |
435 | */ | |
436 | #define HPI_SILENCEDETECTOR_DELAY \ | |
437 | HPI_CTL_ATTR(SILENCEDETECTOR, 3) | |
438 | ||
439 | /**\}*/ | |
440 | ||
441 | /* Locked memory buffer alloc/free phases */ | |
442 | /** use one message to allocate or free physical memory */ | |
443 | #define HPI_BUFFER_CMD_EXTERNAL 0 | |
444 | /** alloc physical memory */ | |
445 | #define HPI_BUFFER_CMD_INTERNAL_ALLOC 1 | |
446 | /** send physical memory address to adapter */ | |
447 | #define HPI_BUFFER_CMD_INTERNAL_GRANTADAPTER 2 | |
448 | /** notify adapter to stop using physical buffer */ | |
449 | #define HPI_BUFFER_CMD_INTERNAL_REVOKEADAPTER 3 | |
450 | /** free physical buffer */ | |
451 | #define HPI_BUFFER_CMD_INTERNAL_FREE 4 | |
452 | ||
453 | /******************************************* CONTROLX ATTRIBUTES ****/ | |
454 | /* NOTE: All controlx attributes must be unique, unlike control attributes */ | |
455 | ||
456 | /*****************************************************************************/ | |
457 | /*****************************************************************************/ | |
458 | /******** HPI LOW LEVEL MESSAGES *******/ | |
459 | /*****************************************************************************/ | |
460 | /*****************************************************************************/ | |
461 | /** Pnp ids */ | |
462 | /** "ASI" - actual is "ASX" - need to change */ | |
463 | #define HPI_ID_ISAPNP_AUDIOSCIENCE 0x0669 | |
464 | /** PCI vendor ID that AudioScience uses */ | |
465 | #define HPI_PCI_VENDOR_ID_AUDIOSCIENCE 0x175C | |
466 | /** PCI vendor ID that the DSP56301 has */ | |
467 | #define HPI_PCI_VENDOR_ID_MOTOROLA 0x1057 | |
468 | /** PCI vendor ID that TI uses */ | |
469 | #define HPI_PCI_VENDOR_ID_TI 0x104C | |
470 | ||
471 | #define HPI_PCI_DEV_ID_PCI2040 0xAC60 | |
472 | /** TI's C6205 PCI interface has this ID */ | |
473 | #define HPI_PCI_DEV_ID_DSP6205 0xA106 | |
474 | ||
475 | #define HPI_USB_VENDOR_ID_AUDIOSCIENCE 0x1257 | |
476 | #define HPI_USB_W2K_TAG 0x57495341 /* "ASIW" */ | |
477 | #define HPI_USB_LINUX_TAG 0x4C495341 /* "ASIL" */ | |
478 | ||
479 | /** First 2 hex digits define the adapter family */ | |
480 | #define HPI_ADAPTER_FAMILY_MASK 0xff00 | |
481 | ||
482 | #define HPI_ADAPTER_FAMILY_ASI(f) (f & HPI_ADAPTER_FAMILY_MASK) | |
483 | #define HPI_ADAPTER_ASI(f) (f) | |
484 | ||
485 | /******************************************* message types */ | |
486 | #define HPI_TYPE_MESSAGE 1 | |
487 | #define HPI_TYPE_RESPONSE 2 | |
488 | #define HPI_TYPE_DATA 3 | |
489 | #define HPI_TYPE_SSX2BYPASS_MESSAGE 4 | |
490 | ||
491 | /******************************************* object types */ | |
492 | #define HPI_OBJ_SUBSYSTEM 1 | |
493 | #define HPI_OBJ_ADAPTER 2 | |
494 | #define HPI_OBJ_OSTREAM 3 | |
495 | #define HPI_OBJ_ISTREAM 4 | |
496 | #define HPI_OBJ_MIXER 5 | |
497 | #define HPI_OBJ_NODE 6 | |
498 | #define HPI_OBJ_CONTROL 7 | |
499 | #define HPI_OBJ_NVMEMORY 8 | |
500 | #define HPI_OBJ_GPIO 9 | |
501 | #define HPI_OBJ_WATCHDOG 10 | |
502 | #define HPI_OBJ_CLOCK 11 | |
503 | #define HPI_OBJ_PROFILE 12 | |
504 | #define HPI_OBJ_CONTROLEX 13 | |
505 | #define HPI_OBJ_ASYNCEVENT 14 | |
506 | ||
507 | #define HPI_OBJ_MAXINDEX 14 | |
508 | ||
509 | /******************************************* methods/functions */ | |
510 | ||
511 | #define HPI_OBJ_FUNCTION_SPACING 0x100 | |
512 | #define HPI_MAKE_INDEX(obj, index) (obj * HPI_OBJ_FUNCTION_SPACING + index) | |
513 | #define HPI_EXTRACT_INDEX(fn) (fn & 0xff) | |
514 | ||
515 | /* SUB-SYSTEM */ | |
516 | #define HPI_SUBSYS_OPEN HPI_MAKE_INDEX(HPI_OBJ_SUBSYSTEM, 1) | |
517 | #define HPI_SUBSYS_GET_VERSION HPI_MAKE_INDEX(HPI_OBJ_SUBSYSTEM, 2) | |
518 | #define HPI_SUBSYS_GET_INFO HPI_MAKE_INDEX(HPI_OBJ_SUBSYSTEM, 3) | |
519 | #define HPI_SUBSYS_FIND_ADAPTERS HPI_MAKE_INDEX(HPI_OBJ_SUBSYSTEM, 4) | |
520 | #define HPI_SUBSYS_CREATE_ADAPTER HPI_MAKE_INDEX(HPI_OBJ_SUBSYSTEM, 5) | |
521 | #define HPI_SUBSYS_CLOSE HPI_MAKE_INDEX(HPI_OBJ_SUBSYSTEM, 6) | |
522 | #define HPI_SUBSYS_DELETE_ADAPTER HPI_MAKE_INDEX(HPI_OBJ_SUBSYSTEM, 7) | |
523 | #define HPI_SUBSYS_DRIVER_LOAD HPI_MAKE_INDEX(HPI_OBJ_SUBSYSTEM, 8) | |
524 | #define HPI_SUBSYS_DRIVER_UNLOAD HPI_MAKE_INDEX(HPI_OBJ_SUBSYSTEM, 9) | |
525 | #define HPI_SUBSYS_READ_PORT_8 HPI_MAKE_INDEX(HPI_OBJ_SUBSYSTEM, 10) | |
526 | #define HPI_SUBSYS_WRITE_PORT_8 HPI_MAKE_INDEX(HPI_OBJ_SUBSYSTEM, 11) | |
527 | #define HPI_SUBSYS_GET_NUM_ADAPTERS HPI_MAKE_INDEX(HPI_OBJ_SUBSYSTEM, 12) | |
528 | #define HPI_SUBSYS_GET_ADAPTER HPI_MAKE_INDEX(HPI_OBJ_SUBSYSTEM, 13) | |
529 | #define HPI_SUBSYS_SET_NETWORK_INTERFACE HPI_MAKE_INDEX(HPI_OBJ_SUBSYSTEM, 14) | |
530 | #define HPI_SUBSYS_FUNCTION_COUNT 14 | |
531 | /* ADAPTER */ | |
532 | #define HPI_ADAPTER_OPEN HPI_MAKE_INDEX(HPI_OBJ_ADAPTER, 1) | |
533 | #define HPI_ADAPTER_CLOSE HPI_MAKE_INDEX(HPI_OBJ_ADAPTER, 2) | |
534 | #define HPI_ADAPTER_GET_INFO HPI_MAKE_INDEX(HPI_OBJ_ADAPTER, 3) | |
535 | #define HPI_ADAPTER_GET_ASSERT HPI_MAKE_INDEX(HPI_OBJ_ADAPTER, 4) | |
536 | #define HPI_ADAPTER_TEST_ASSERT HPI_MAKE_INDEX(HPI_OBJ_ADAPTER, 5) | |
537 | #define HPI_ADAPTER_SET_MODE HPI_MAKE_INDEX(HPI_OBJ_ADAPTER, 6) | |
538 | #define HPI_ADAPTER_GET_MODE HPI_MAKE_INDEX(HPI_OBJ_ADAPTER, 7) | |
539 | #define HPI_ADAPTER_ENABLE_CAPABILITY HPI_MAKE_INDEX(HPI_OBJ_ADAPTER, 8) | |
540 | #define HPI_ADAPTER_SELFTEST HPI_MAKE_INDEX(HPI_OBJ_ADAPTER, 9) | |
541 | #define HPI_ADAPTER_FIND_OBJECT HPI_MAKE_INDEX(HPI_OBJ_ADAPTER, 10) | |
542 | #define HPI_ADAPTER_QUERY_FLASH HPI_MAKE_INDEX(HPI_OBJ_ADAPTER, 11) | |
543 | #define HPI_ADAPTER_START_FLASH HPI_MAKE_INDEX(HPI_OBJ_ADAPTER, 12) | |
544 | #define HPI_ADAPTER_PROGRAM_FLASH HPI_MAKE_INDEX(HPI_OBJ_ADAPTER, 13) | |
545 | #define HPI_ADAPTER_SET_PROPERTY HPI_MAKE_INDEX(HPI_OBJ_ADAPTER, 14) | |
546 | #define HPI_ADAPTER_GET_PROPERTY HPI_MAKE_INDEX(HPI_OBJ_ADAPTER, 15) | |
547 | #define HPI_ADAPTER_ENUM_PROPERTY HPI_MAKE_INDEX(HPI_OBJ_ADAPTER, 16) | |
548 | #define HPI_ADAPTER_MODULE_INFO HPI_MAKE_INDEX(HPI_OBJ_ADAPTER, 17) | |
549 | #define HPI_ADAPTER_DEBUG_READ HPI_MAKE_INDEX(HPI_OBJ_ADAPTER, 18) | |
550 | #define HPI_ADAPTER_FUNCTION_COUNT 18 | |
551 | /* OUTPUT STREAM */ | |
552 | #define HPI_OSTREAM_OPEN HPI_MAKE_INDEX(HPI_OBJ_OSTREAM, 1) | |
553 | #define HPI_OSTREAM_CLOSE HPI_MAKE_INDEX(HPI_OBJ_OSTREAM, 2) | |
554 | #define HPI_OSTREAM_WRITE HPI_MAKE_INDEX(HPI_OBJ_OSTREAM, 3) | |
555 | #define HPI_OSTREAM_START HPI_MAKE_INDEX(HPI_OBJ_OSTREAM, 4) | |
556 | #define HPI_OSTREAM_STOP HPI_MAKE_INDEX(HPI_OBJ_OSTREAM, 5) | |
557 | #define HPI_OSTREAM_RESET HPI_MAKE_INDEX(HPI_OBJ_OSTREAM, 6) | |
558 | #define HPI_OSTREAM_GET_INFO HPI_MAKE_INDEX(HPI_OBJ_OSTREAM, 7) | |
559 | #define HPI_OSTREAM_QUERY_FORMAT HPI_MAKE_INDEX(HPI_OBJ_OSTREAM, 8) | |
560 | #define HPI_OSTREAM_DATA HPI_MAKE_INDEX(HPI_OBJ_OSTREAM, 9) | |
561 | #define HPI_OSTREAM_SET_VELOCITY HPI_MAKE_INDEX(HPI_OBJ_OSTREAM, 10) | |
562 | #define HPI_OSTREAM_SET_PUNCHINOUT HPI_MAKE_INDEX(HPI_OBJ_OSTREAM, 11) | |
563 | #define HPI_OSTREAM_SINEGEN HPI_MAKE_INDEX(HPI_OBJ_OSTREAM, 12) | |
564 | #define HPI_OSTREAM_ANC_RESET HPI_MAKE_INDEX(HPI_OBJ_OSTREAM, 13) | |
565 | #define HPI_OSTREAM_ANC_GET_INFO HPI_MAKE_INDEX(HPI_OBJ_OSTREAM, 14) | |
566 | #define HPI_OSTREAM_ANC_READ HPI_MAKE_INDEX(HPI_OBJ_OSTREAM, 15) | |
567 | #define HPI_OSTREAM_SET_TIMESCALE HPI_MAKE_INDEX(HPI_OBJ_OSTREAM, 16) | |
568 | #define HPI_OSTREAM_SET_FORMAT HPI_MAKE_INDEX(HPI_OBJ_OSTREAM, 17) | |
569 | #define HPI_OSTREAM_HOSTBUFFER_ALLOC HPI_MAKE_INDEX(HPI_OBJ_OSTREAM, 18) | |
570 | #define HPI_OSTREAM_HOSTBUFFER_FREE HPI_MAKE_INDEX(HPI_OBJ_OSTREAM, 19) | |
571 | #define HPI_OSTREAM_GROUP_ADD HPI_MAKE_INDEX(HPI_OBJ_OSTREAM, 20) | |
572 | #define HPI_OSTREAM_GROUP_GETMAP HPI_MAKE_INDEX(HPI_OBJ_OSTREAM, 21) | |
573 | #define HPI_OSTREAM_GROUP_RESET HPI_MAKE_INDEX(HPI_OBJ_OSTREAM, 22) | |
574 | #define HPI_OSTREAM_HOSTBUFFER_GET_INFO HPI_MAKE_INDEX(HPI_OBJ_OSTREAM, 23) | |
575 | #define HPI_OSTREAM_WAIT_START HPI_MAKE_INDEX(HPI_OBJ_OSTREAM, 24) | |
576 | #define HPI_OSTREAM_FUNCTION_COUNT 24 | |
577 | /* INPUT STREAM */ | |
578 | #define HPI_ISTREAM_OPEN HPI_MAKE_INDEX(HPI_OBJ_ISTREAM, 1) | |
579 | #define HPI_ISTREAM_CLOSE HPI_MAKE_INDEX(HPI_OBJ_ISTREAM, 2) | |
580 | #define HPI_ISTREAM_SET_FORMAT HPI_MAKE_INDEX(HPI_OBJ_ISTREAM, 3) | |
581 | #define HPI_ISTREAM_READ HPI_MAKE_INDEX(HPI_OBJ_ISTREAM, 4) | |
582 | #define HPI_ISTREAM_START HPI_MAKE_INDEX(HPI_OBJ_ISTREAM, 5) | |
583 | #define HPI_ISTREAM_STOP HPI_MAKE_INDEX(HPI_OBJ_ISTREAM, 6) | |
584 | #define HPI_ISTREAM_RESET HPI_MAKE_INDEX(HPI_OBJ_ISTREAM, 7) | |
585 | #define HPI_ISTREAM_GET_INFO HPI_MAKE_INDEX(HPI_OBJ_ISTREAM, 8) | |
586 | #define HPI_ISTREAM_QUERY_FORMAT HPI_MAKE_INDEX(HPI_OBJ_ISTREAM, 9) | |
587 | #define HPI_ISTREAM_ANC_RESET HPI_MAKE_INDEX(HPI_OBJ_ISTREAM, 10) | |
588 | #define HPI_ISTREAM_ANC_GET_INFO HPI_MAKE_INDEX(HPI_OBJ_ISTREAM, 11) | |
589 | #define HPI_ISTREAM_ANC_WRITE HPI_MAKE_INDEX(HPI_OBJ_ISTREAM, 12) | |
590 | #define HPI_ISTREAM_HOSTBUFFER_ALLOC HPI_MAKE_INDEX(HPI_OBJ_ISTREAM, 13) | |
591 | #define HPI_ISTREAM_HOSTBUFFER_FREE HPI_MAKE_INDEX(HPI_OBJ_ISTREAM, 14) | |
592 | #define HPI_ISTREAM_GROUP_ADD HPI_MAKE_INDEX(HPI_OBJ_ISTREAM, 15) | |
593 | #define HPI_ISTREAM_GROUP_GETMAP HPI_MAKE_INDEX(HPI_OBJ_ISTREAM, 16) | |
594 | #define HPI_ISTREAM_GROUP_RESET HPI_MAKE_INDEX(HPI_OBJ_ISTREAM, 17) | |
595 | #define HPI_ISTREAM_HOSTBUFFER_GET_INFO HPI_MAKE_INDEX(HPI_OBJ_ISTREAM, 18) | |
596 | #define HPI_ISTREAM_WAIT_START HPI_MAKE_INDEX(HPI_OBJ_ISTREAM, 19) | |
597 | #define HPI_ISTREAM_FUNCTION_COUNT 19 | |
598 | /* MIXER */ | |
599 | /* NOTE: | |
600 | GET_NODE_INFO, SET_CONNECTION, GET_CONNECTIONS are not currently used */ | |
601 | #define HPI_MIXER_OPEN HPI_MAKE_INDEX(HPI_OBJ_MIXER, 1) | |
602 | #define HPI_MIXER_CLOSE HPI_MAKE_INDEX(HPI_OBJ_MIXER, 2) | |
603 | #define HPI_MIXER_GET_INFO HPI_MAKE_INDEX(HPI_OBJ_MIXER, 3) | |
604 | #define HPI_MIXER_GET_NODE_INFO HPI_MAKE_INDEX(HPI_OBJ_MIXER, 4) | |
605 | #define HPI_MIXER_GET_CONTROL HPI_MAKE_INDEX(HPI_OBJ_MIXER, 5) | |
606 | #define HPI_MIXER_SET_CONNECTION HPI_MAKE_INDEX(HPI_OBJ_MIXER, 6) | |
607 | #define HPI_MIXER_GET_CONNECTIONS HPI_MAKE_INDEX(HPI_OBJ_MIXER, 7) | |
608 | #define HPI_MIXER_GET_CONTROL_BY_INDEX HPI_MAKE_INDEX(HPI_OBJ_MIXER, 8) | |
609 | #define HPI_MIXER_GET_CONTROL_ARRAY_BY_INDEX HPI_MAKE_INDEX(HPI_OBJ_MIXER, 9) | |
610 | #define HPI_MIXER_GET_CONTROL_MULTIPLE_VALUES HPI_MAKE_INDEX(HPI_OBJ_MIXER, 10) | |
611 | #define HPI_MIXER_STORE HPI_MAKE_INDEX(HPI_OBJ_MIXER, 11) | |
612 | #define HPI_MIXER_FUNCTION_COUNT 11 | |
613 | /* MIXER CONTROLS */ | |
614 | #define HPI_CONTROL_GET_INFO HPI_MAKE_INDEX(HPI_OBJ_CONTROL, 1) | |
615 | #define HPI_CONTROL_GET_STATE HPI_MAKE_INDEX(HPI_OBJ_CONTROL, 2) | |
616 | #define HPI_CONTROL_SET_STATE HPI_MAKE_INDEX(HPI_OBJ_CONTROL, 3) | |
617 | #define HPI_CONTROL_FUNCTION_COUNT 3 | |
618 | /* NONVOL MEMORY */ | |
619 | #define HPI_NVMEMORY_OPEN HPI_MAKE_INDEX(HPI_OBJ_NVMEMORY, 1) | |
620 | #define HPI_NVMEMORY_READ_BYTE HPI_MAKE_INDEX(HPI_OBJ_NVMEMORY, 2) | |
621 | #define HPI_NVMEMORY_WRITE_BYTE HPI_MAKE_INDEX(HPI_OBJ_NVMEMORY, 3) | |
622 | #define HPI_NVMEMORY_FUNCTION_COUNT 3 | |
623 | /* GPIO */ | |
624 | #define HPI_GPIO_OPEN HPI_MAKE_INDEX(HPI_OBJ_GPIO, 1) | |
625 | #define HPI_GPIO_READ_BIT HPI_MAKE_INDEX(HPI_OBJ_GPIO, 2) | |
626 | #define HPI_GPIO_WRITE_BIT HPI_MAKE_INDEX(HPI_OBJ_GPIO, 3) | |
627 | #define HPI_GPIO_READ_ALL HPI_MAKE_INDEX(HPI_OBJ_GPIO, 4) | |
628 | #define HPI_GPIO_WRITE_STATUS HPI_MAKE_INDEX(HPI_OBJ_GPIO, 5) | |
629 | #define HPI_GPIO_FUNCTION_COUNT 5 | |
630 | /* ASYNC EVENT */ | |
631 | #define HPI_ASYNCEVENT_OPEN HPI_MAKE_INDEX(HPI_OBJ_ASYNCEVENT, 1) | |
632 | #define HPI_ASYNCEVENT_CLOSE HPI_MAKE_INDEX(HPI_OBJ_ASYNCEVENT, 2) | |
633 | #define HPI_ASYNCEVENT_WAIT HPI_MAKE_INDEX(HPI_OBJ_ASYNCEVENT, 3) | |
634 | #define HPI_ASYNCEVENT_GETCOUNT HPI_MAKE_INDEX(HPI_OBJ_ASYNCEVENT, 4) | |
635 | #define HPI_ASYNCEVENT_GET HPI_MAKE_INDEX(HPI_OBJ_ASYNCEVENT, 5) | |
636 | #define HPI_ASYNCEVENT_SENDEVENTS HPI_MAKE_INDEX(HPI_OBJ_ASYNCEVENT, 6) | |
637 | #define HPI_ASYNCEVENT_FUNCTION_COUNT 6 | |
638 | /* WATCH-DOG */ | |
639 | #define HPI_WATCHDOG_OPEN HPI_MAKE_INDEX(HPI_OBJ_WATCHDOG, 1) | |
640 | #define HPI_WATCHDOG_SET_TIME HPI_MAKE_INDEX(HPI_OBJ_WATCHDOG, 2) | |
641 | #define HPI_WATCHDOG_PING HPI_MAKE_INDEX(HPI_OBJ_WATCHDOG, 3) | |
642 | /* CLOCK */ | |
643 | #define HPI_CLOCK_OPEN HPI_MAKE_INDEX(HPI_OBJ_CLOCK, 1) | |
644 | #define HPI_CLOCK_SET_TIME HPI_MAKE_INDEX(HPI_OBJ_CLOCK, 2) | |
645 | #define HPI_CLOCK_GET_TIME HPI_MAKE_INDEX(HPI_OBJ_CLOCK, 3) | |
646 | /* PROFILE */ | |
647 | #define HPI_PROFILE_OPEN_ALL HPI_MAKE_INDEX(HPI_OBJ_PROFILE, 1) | |
648 | #define HPI_PROFILE_START_ALL HPI_MAKE_INDEX(HPI_OBJ_PROFILE, 2) | |
649 | #define HPI_PROFILE_STOP_ALL HPI_MAKE_INDEX(HPI_OBJ_PROFILE, 3) | |
650 | #define HPI_PROFILE_GET HPI_MAKE_INDEX(HPI_OBJ_PROFILE, 4) | |
651 | #define HPI_PROFILE_GET_IDLECOUNT HPI_MAKE_INDEX(HPI_OBJ_PROFILE, 5) | |
652 | #define HPI_PROFILE_GET_NAME HPI_MAKE_INDEX(HPI_OBJ_PROFILE, 6) | |
653 | #define HPI_PROFILE_GET_UTILIZATION HPI_MAKE_INDEX(HPI_OBJ_PROFILE, 7) | |
654 | #define HPI_PROFILE_FUNCTION_COUNT 7 | |
655 | /* ////////////////////////////////////////////////////////////////////// */ | |
656 | /* PRIVATE ATTRIBUTES */ | |
657 | ||
658 | /* ////////////////////////////////////////////////////////////////////// */ | |
659 | /* STRUCTURES */ | |
660 | #ifndef DISABLE_PRAGMA_PACK1 | |
661 | #pragma pack(push, 1) | |
662 | #endif | |
663 | ||
664 | /** PCI bus resource */ | |
665 | struct hpi_pci { | |
666 | u32 __iomem *ap_mem_base[HPI_MAX_ADAPTER_MEM_SPACES]; | |
667 | struct pci_dev *p_os_data; | |
668 | ||
669 | #ifndef HPI64BIT /* keep structure size constant */ | |
670 | u32 padding[HPI_MAX_ADAPTER_MEM_SPACES + 1]; | |
671 | #endif | |
672 | u16 vendor_id; | |
673 | u16 device_id; | |
674 | u16 subsys_vendor_id; | |
675 | u16 subsys_device_id; | |
676 | u16 bus_number; | |
677 | u16 device_number; | |
678 | u32 interrupt; | |
679 | }; | |
680 | ||
681 | struct hpi_resource { | |
682 | union { | |
683 | const struct hpi_pci *pci; | |
684 | const char *net_if; | |
685 | } r; | |
686 | #ifndef HPI64BIT /* keep structure size constant */ | |
687 | u32 pad_to64; | |
688 | #endif | |
689 | u16 bus_type; /* HPI_BUS_PNPISA, _PCI, _USB etc */ | |
690 | u16 padding; | |
691 | ||
692 | }; | |
693 | ||
694 | /** Format info used inside struct hpi_message | |
695 | Not the same as public API struct hpi_format */ | |
696 | struct hpi_msg_format { | |
697 | u32 sample_rate; | |
698 | /**< 11025, 32000, 44100 ... */ | |
699 | u32 bit_rate; /**< for MPEG */ | |
700 | u32 attributes; | |
701 | /**< Stereo/JointStereo/Mono */ | |
702 | u16 channels; /**< 1,2..., (or ancillary mode or idle bit */ | |
703 | u16 format; /**< HPI_FORMAT_PCM16, _MPEG etc. see \ref HPI_FORMATS. */ | |
704 | }; | |
705 | ||
706 | /** Buffer+format structure. | |
707 | Must be kept 7 * 32 bits to match public struct hpi_datastruct */ | |
708 | struct hpi_msg_data { | |
709 | struct hpi_msg_format format; | |
710 | u8 *pb_data; | |
711 | #ifndef HPI64BIT | |
712 | u32 padding; | |
713 | #endif | |
714 | u32 data_size; | |
715 | }; | |
716 | ||
717 | /** struct hpi_datastructure used up to 3.04 driver */ | |
718 | struct hpi_data_legacy32 { | |
719 | struct hpi_format format; | |
720 | u32 pb_data; | |
721 | u32 data_size; | |
722 | }; | |
723 | ||
724 | #ifdef HPI64BIT | |
725 | /* Compatibility version of struct hpi_data*/ | |
726 | struct hpi_data_compat32 { | |
727 | struct hpi_msg_format format; | |
728 | u32 pb_data; | |
729 | u32 padding; | |
730 | u32 data_size; | |
731 | }; | |
732 | #endif | |
733 | ||
734 | struct hpi_buffer { | |
735 | /** placehoder for backward compatability (see dwBufferSize) */ | |
736 | struct hpi_msg_format reserved; | |
737 | u32 command; /**< HPI_BUFFER_CMD_xxx*/ | |
738 | u32 pci_address; /**< PCI physical address of buffer for DSP DMA */ | |
739 | u32 buffer_size; /**< must line up with data_size of HPI_DATA*/ | |
740 | }; | |
741 | ||
742 | /*/////////////////////////////////////////////////////////////////////////// */ | |
743 | /* This is used for background buffer bus mastering stream buffers. */ | |
744 | struct hpi_hostbuffer_status { | |
745 | u32 samples_processed; | |
746 | u32 auxiliary_data_available; | |
747 | u32 stream_state; | |
748 | /* DSP index in to the host bus master buffer. */ | |
749 | u32 dSP_index; | |
750 | /* Host index in to the host bus master buffer. */ | |
751 | u32 host_index; | |
752 | u32 size_in_bytes; | |
753 | }; | |
754 | ||
755 | struct hpi_streamid { | |
756 | u16 object_type; | |
757 | /**< Type of object, HPI_OBJ_OSTREAM or HPI_OBJ_ISTREAM. */ | |
758 | u16 stream_index; /**< outstream or instream index. */ | |
759 | }; | |
760 | ||
761 | struct hpi_punchinout { | |
762 | u32 punch_in_sample; | |
763 | u32 punch_out_sample; | |
764 | }; | |
765 | ||
766 | struct hpi_subsys_msg { | |
767 | struct hpi_resource resource; | |
768 | }; | |
769 | ||
770 | struct hpi_subsys_res { | |
771 | u32 version; | |
772 | u32 data; /* used to return extended version */ | |
773 | u16 num_adapters; /* number of adapters */ | |
774 | u16 adapter_index; | |
775 | u16 aw_adapter_list[HPI_MAX_ADAPTERS]; | |
776 | }; | |
777 | ||
778 | struct hpi_adapter_msg { | |
779 | u32 adapter_mode; /* adapter mode */ | |
780 | u16 assert_id; /* assert number for "test assert" call | |
781 | object_index for find object call | |
782 | query_or_set for hpi_adapter_set_mode_ex() */ | |
783 | u16 object_type; /* for adapter find object call */ | |
784 | }; | |
785 | ||
786 | union hpi_adapterx_msg { | |
787 | struct hpi_adapter_msg adapter; | |
788 | struct { | |
789 | u32 offset; | |
790 | } query_flash; | |
791 | struct { | |
792 | u32 offset; | |
793 | u32 length; | |
794 | u32 key; | |
795 | } start_flash; | |
796 | struct { | |
797 | u32 checksum; | |
798 | u16 sequence; | |
799 | u16 length; | |
800 | u16 offset; /**< offset from start of msg to data */ | |
801 | u16 unused; | |
802 | } program_flash; | |
803 | struct { | |
804 | u16 property; | |
805 | u16 parameter1; | |
806 | u16 parameter2; | |
807 | } property_set; | |
808 | struct { | |
809 | u16 index; | |
810 | u16 what; | |
811 | u16 property_index; | |
812 | } property_enum; | |
813 | struct { | |
814 | u16 index; | |
815 | } module_info; | |
816 | struct { | |
817 | u32 dsp_address; | |
818 | u32 count_bytes; | |
819 | } debug_read; | |
820 | }; | |
821 | ||
822 | struct hpi_adapter_res { | |
823 | u32 serial_number; | |
824 | u16 adapter_type; | |
825 | u16 adapter_index; /* is this needed? also used for dsp_index */ | |
826 | u16 num_instreams; | |
827 | u16 num_outstreams; | |
828 | u16 num_mixers; | |
829 | u16 version; | |
830 | u8 sz_adapter_assert[HPI_STRING_LEN]; | |
831 | }; | |
832 | ||
833 | union hpi_adapterx_res { | |
834 | struct hpi_adapter_res adapter; | |
835 | struct { | |
836 | u32 checksum; | |
837 | u32 length; | |
838 | u32 version; | |
839 | } query_flash; | |
840 | struct { | |
841 | u16 sequence; | |
842 | } program_flash; | |
843 | struct { | |
844 | u16 parameter1; | |
845 | u16 parameter2; | |
846 | } property_get; | |
847 | }; | |
848 | ||
849 | struct hpi_stream_msg { | |
850 | union { | |
851 | struct hpi_msg_data data; | |
852 | struct hpi_data_legacy32 data32; | |
853 | u16 velocity; | |
854 | struct hpi_punchinout pio; | |
855 | u32 time_scale; | |
856 | struct hpi_buffer buffer; | |
857 | struct hpi_streamid stream; | |
858 | } u; | |
859 | }; | |
860 | ||
861 | struct hpi_stream_res { | |
862 | union { | |
863 | struct { | |
864 | /* size of hardware buffer */ | |
865 | u32 buffer_size; | |
866 | /* OutStream - data to play, | |
867 | InStream - data recorded */ | |
868 | u32 data_available; | |
869 | /* OutStream - samples played, | |
870 | InStream - samples recorded */ | |
871 | u32 samples_transferred; | |
872 | /* Adapter - OutStream - data to play, | |
873 | InStream - data recorded */ | |
874 | u32 auxiliary_data_available; | |
875 | u16 state; /* HPI_STATE_PLAYING, _STATE_STOPPED */ | |
876 | u16 padding; | |
877 | } stream_info; | |
878 | struct { | |
879 | u32 buffer_size; | |
880 | u32 data_available; | |
881 | u32 samples_transfered; | |
882 | u16 state; | |
883 | u16 outstream_index; | |
884 | u16 instream_index; | |
885 | u16 padding; | |
886 | u32 auxiliary_data_available; | |
887 | } legacy_stream_info; | |
888 | struct { | |
889 | /* bitmap of grouped OutStreams */ | |
890 | u32 outstream_group_map; | |
891 | /* bitmap of grouped InStreams */ | |
892 | u32 instream_group_map; | |
893 | } group_info; | |
894 | struct { | |
895 | /* pointer to the buffer */ | |
896 | u8 *p_buffer; | |
897 | /* pointer to the hostbuffer status */ | |
898 | struct hpi_hostbuffer_status *p_status; | |
899 | } hostbuffer_info; | |
900 | } u; | |
901 | }; | |
902 | ||
903 | struct hpi_mixer_msg { | |
904 | u16 control_index; | |
905 | u16 control_type; /* = HPI_CONTROL_METER _VOLUME etc */ | |
906 | u16 padding1; /* maintain alignment of subsequent fields */ | |
907 | u16 node_type1; /* = HPI_SOURCENODE_LINEIN etc */ | |
908 | u16 node_index1; /* = 0..N */ | |
909 | u16 node_type2; | |
910 | u16 node_index2; | |
911 | u16 padding2; /* round to 4 bytes */ | |
912 | }; | |
913 | ||
914 | struct hpi_mixer_res { | |
915 | u16 src_node_type; /* = HPI_SOURCENODE_LINEIN etc */ | |
916 | u16 src_node_index; /* = 0..N */ | |
917 | u16 dst_node_type; | |
918 | u16 dst_node_index; | |
919 | /* Also controlType for MixerGetControlByIndex */ | |
920 | u16 control_index; | |
921 | /* may indicate which DSP the control is located on */ | |
922 | u16 dsp_index; | |
923 | }; | |
924 | ||
925 | union hpi_mixerx_msg { | |
926 | struct { | |
927 | u16 starting_index; | |
928 | u16 flags; | |
929 | u32 length_in_bytes; /* length in bytes of p_data */ | |
930 | u32 p_data; /* pointer to a data array */ | |
931 | } gcabi; | |
932 | struct { | |
933 | u16 command; | |
934 | u16 index; | |
935 | } store; /* for HPI_MIXER_STORE message */ | |
936 | }; | |
937 | ||
938 | union hpi_mixerx_res { | |
939 | struct { | |
940 | u32 bytes_returned; /* size of items returned */ | |
941 | u32 p_data; /* pointer to data array */ | |
942 | u16 more_to_do; /* indicates if there is more to do */ | |
943 | } gcabi; | |
944 | }; | |
945 | ||
946 | struct hpi_control_msg { | |
947 | u16 attribute; /* control attribute or property */ | |
948 | u16 saved_index; | |
949 | u32 param1; /* generic parameter 1 */ | |
950 | u32 param2; /* generic parameter 2 */ | |
951 | short an_log_value[HPI_MAX_CHANNELS]; | |
952 | }; | |
953 | ||
954 | struct hpi_control_union_msg { | |
955 | u16 attribute; /* control attribute or property */ | |
956 | u16 saved_index; /* only used in ctrl save/restore */ | |
957 | union { | |
958 | struct { | |
959 | u32 param1; /* generic parameter 1 */ | |
960 | u32 param2; /* generic parameter 2 */ | |
961 | short an_log_value[HPI_MAX_CHANNELS]; | |
962 | } old; | |
963 | union { | |
964 | u32 frequency; | |
965 | u32 gain; | |
966 | u32 band; | |
967 | u32 deemphasis; | |
968 | u32 program; | |
969 | struct { | |
970 | u32 mode; | |
971 | u32 value; | |
972 | } mode; | |
973 | } tuner; | |
974 | } u; | |
975 | }; | |
976 | ||
977 | struct hpi_control_res { | |
978 | /* Could make union. dwParam, anLogValue never used in same response */ | |
979 | u32 param1; | |
980 | u32 param2; | |
981 | short an_log_value[HPI_MAX_CHANNELS]; | |
982 | }; | |
983 | ||
984 | union hpi_control_union_res { | |
985 | struct { | |
986 | u32 param1; | |
987 | u32 param2; | |
988 | short an_log_value[HPI_MAX_CHANNELS]; | |
989 | } old; | |
990 | union { | |
991 | u32 band; | |
992 | u32 frequency; | |
993 | u32 gain; | |
994 | u32 level; | |
995 | u32 deemphasis; | |
996 | struct { | |
997 | u32 data[2]; | |
998 | u32 bLER; | |
999 | } rds; | |
1000 | } tuner; | |
1001 | struct { | |
1002 | char sz_data[8]; | |
1003 | u32 remaining_chars; | |
1004 | } chars8; | |
1005 | char c_data12[12]; | |
1006 | }; | |
1007 | ||
1008 | /* HPI_CONTROLX_STRUCTURES */ | |
1009 | ||
1010 | /* Message */ | |
1011 | ||
1012 | /** Used for all HMI variables where max length <= 8 bytes | |
1013 | */ | |
1014 | struct hpi_controlx_msg_cobranet_data { | |
1015 | u32 hmi_address; | |
1016 | u32 byte_count; | |
1017 | u32 data[2]; | |
1018 | }; | |
1019 | ||
1020 | /** Used for string data, and for packet bridge | |
1021 | */ | |
1022 | struct hpi_controlx_msg_cobranet_bigdata { | |
1023 | u32 hmi_address; | |
1024 | u32 byte_count; | |
1025 | u8 *pb_data; | |
1026 | #ifndef HPI64BIT | |
1027 | u32 padding; | |
1028 | #endif | |
1029 | }; | |
1030 | ||
1031 | /** Used for PADS control reading of string fields. | |
1032 | */ | |
1033 | struct hpi_controlx_msg_pad_data { | |
1034 | u32 field; | |
1035 | u32 byte_count; | |
1036 | u8 *pb_data; | |
1037 | #ifndef HPI64BIT | |
1038 | u32 padding; | |
1039 | #endif | |
1040 | }; | |
1041 | ||
1042 | /** Used for generic data | |
1043 | */ | |
1044 | ||
1045 | struct hpi_controlx_msg_generic { | |
1046 | u32 param1; | |
1047 | u32 param2; | |
1048 | }; | |
1049 | ||
1050 | struct hpi_controlx_msg { | |
1051 | u16 attribute; /* control attribute or property */ | |
1052 | u16 saved_index; | |
1053 | union { | |
1054 | struct hpi_controlx_msg_cobranet_data cobranet_data; | |
1055 | struct hpi_controlx_msg_cobranet_bigdata cobranet_bigdata; | |
1056 | struct hpi_controlx_msg_generic generic; | |
1057 | struct hpi_controlx_msg_pad_data pad_data; | |
1058 | /*struct param_value universal_value; */ | |
1059 | /* nothing extra to send for status read */ | |
1060 | } u; | |
1061 | }; | |
1062 | ||
1063 | /* Response */ | |
1064 | /** | |
1065 | */ | |
1066 | struct hpi_controlx_res_cobranet_data { | |
1067 | u32 byte_count; | |
1068 | u32 data[2]; | |
1069 | }; | |
1070 | ||
1071 | struct hpi_controlx_res_cobranet_bigdata { | |
1072 | u32 byte_count; | |
1073 | }; | |
1074 | ||
1075 | struct hpi_controlx_res_cobranet_status { | |
1076 | u32 status; | |
1077 | u32 readable_size; | |
1078 | u32 writeable_size; | |
1079 | }; | |
1080 | ||
1081 | struct hpi_controlx_res_generic { | |
1082 | u32 param1; | |
1083 | u32 param2; | |
1084 | }; | |
1085 | ||
1086 | struct hpi_controlx_res { | |
1087 | union { | |
1088 | struct hpi_controlx_res_cobranet_bigdata cobranet_bigdata; | |
1089 | struct hpi_controlx_res_cobranet_data cobranet_data; | |
1090 | struct hpi_controlx_res_cobranet_status cobranet_status; | |
1091 | struct hpi_controlx_res_generic generic; | |
1092 | /*struct param_info universal_info; */ | |
1093 | /*struct param_value universal_value; */ | |
1094 | } u; | |
1095 | }; | |
1096 | ||
1097 | struct hpi_nvmemory_msg { | |
1098 | u16 address; | |
1099 | u16 data; | |
1100 | }; | |
1101 | ||
1102 | struct hpi_nvmemory_res { | |
1103 | u16 size_in_bytes; | |
1104 | u16 data; | |
1105 | }; | |
1106 | ||
1107 | struct hpi_gpio_msg { | |
1108 | u16 bit_index; | |
1109 | u16 bit_data; | |
1110 | }; | |
1111 | ||
1112 | struct hpi_gpio_res { | |
1113 | u16 number_input_bits; | |
1114 | u16 number_output_bits; | |
1115 | u16 bit_data[4]; | |
1116 | }; | |
1117 | ||
1118 | struct hpi_async_msg { | |
1119 | u32 events; | |
1120 | u16 maximum_events; | |
1121 | u16 padding; | |
1122 | }; | |
1123 | ||
1124 | struct hpi_async_res { | |
1125 | union { | |
1126 | struct { | |
1127 | u16 count; | |
1128 | } count; | |
1129 | struct { | |
1130 | u32 events; | |
1131 | u16 number_returned; | |
1132 | u16 padding; | |
1133 | } get; | |
1134 | struct hpi_async_event event; | |
1135 | } u; | |
1136 | }; | |
1137 | ||
1138 | struct hpi_watchdog_msg { | |
1139 | u32 time_ms; | |
1140 | }; | |
1141 | ||
1142 | struct hpi_watchdog_res { | |
1143 | u32 time_ms; | |
1144 | }; | |
1145 | ||
1146 | struct hpi_clock_msg { | |
1147 | u16 hours; | |
1148 | u16 minutes; | |
1149 | u16 seconds; | |
1150 | u16 milli_seconds; | |
1151 | }; | |
1152 | ||
1153 | struct hpi_clock_res { | |
1154 | u16 size_in_bytes; | |
1155 | u16 hours; | |
1156 | u16 minutes; | |
1157 | u16 seconds; | |
1158 | u16 milli_seconds; | |
1159 | u16 padding; | |
1160 | }; | |
1161 | ||
1162 | struct hpi_profile_msg { | |
1163 | u16 bin_index; | |
1164 | u16 padding; | |
1165 | }; | |
1166 | ||
1167 | struct hpi_profile_res_open { | |
1168 | u16 max_profiles; | |
1169 | }; | |
1170 | ||
1171 | struct hpi_profile_res_time { | |
1172 | u32 micro_seconds; | |
1173 | u32 call_count; | |
1174 | u32 max_micro_seconds; | |
1175 | u32 min_micro_seconds; | |
1176 | u16 seconds; | |
1177 | }; | |
1178 | ||
1179 | struct hpi_profile_res_name { | |
1180 | u8 sz_name[32]; | |
1181 | }; | |
1182 | ||
1183 | struct hpi_profile_res { | |
1184 | union { | |
1185 | struct hpi_profile_res_open o; | |
1186 | struct hpi_profile_res_time t; | |
1187 | struct hpi_profile_res_name n; | |
1188 | } u; | |
1189 | }; | |
1190 | ||
1191 | struct hpi_message_header { | |
1192 | u16 size; /* total size in bytes */ | |
1193 | u8 type; /* HPI_TYPE_MESSAGE */ | |
1194 | u8 version; /* message version */ | |
1195 | u16 object; /* HPI_OBJ_* */ | |
1196 | u16 function; /* HPI_SUBSYS_xxx, HPI_ADAPTER_xxx */ | |
1197 | u16 adapter_index; /* the adapter index */ | |
1198 | u16 obj_index; /* */ | |
1199 | }; | |
1200 | ||
1201 | struct hpi_message { | |
1202 | /* following fields must match HPI_MESSAGE_HEADER */ | |
1203 | u16 size; /* total size in bytes */ | |
1204 | u8 type; /* HPI_TYPE_MESSAGE */ | |
1205 | u8 version; /* message version */ | |
1206 | u16 object; /* HPI_OBJ_* */ | |
1207 | u16 function; /* HPI_SUBSYS_xxx, HPI_ADAPTER_xxx */ | |
1208 | u16 adapter_index; /* the adapter index */ | |
1209 | u16 obj_index; /* */ | |
1210 | union { | |
1211 | struct hpi_subsys_msg s; | |
1212 | struct hpi_adapter_msg a; | |
1213 | union hpi_adapterx_msg ax; | |
1214 | struct hpi_stream_msg d; | |
1215 | struct hpi_mixer_msg m; | |
1216 | union hpi_mixerx_msg mx; /* extended mixer; */ | |
1217 | struct hpi_control_msg c; /* mixer control; */ | |
1218 | /* identical to struct hpi_control_msg, | |
1219 | but field naming is improved */ | |
1220 | struct hpi_control_union_msg cu; | |
1221 | struct hpi_controlx_msg cx; /* extended mixer control; */ | |
1222 | struct hpi_nvmemory_msg n; | |
1223 | struct hpi_gpio_msg l; /* digital i/o */ | |
1224 | struct hpi_watchdog_msg w; | |
1225 | struct hpi_clock_msg t; /* dsp time */ | |
1226 | struct hpi_profile_msg p; | |
1227 | struct hpi_async_msg as; | |
1228 | char fixed_size[32]; | |
1229 | } u; | |
1230 | }; | |
1231 | ||
1232 | #define HPI_MESSAGE_SIZE_BY_OBJECT { \ | |
1233 | sizeof(struct hpi_message_header) , /* default, no object type 0 */ \ | |
1234 | sizeof(struct hpi_message_header) + sizeof(struct hpi_subsys_msg),\ | |
1235 | sizeof(struct hpi_message_header) + sizeof(union hpi_adapterx_msg),\ | |
1236 | sizeof(struct hpi_message_header) + sizeof(struct hpi_stream_msg),\ | |
1237 | sizeof(struct hpi_message_header) + sizeof(struct hpi_stream_msg),\ | |
1238 | sizeof(struct hpi_message_header) + sizeof(struct hpi_mixer_msg),\ | |
1239 | sizeof(struct hpi_message_header) , /* no node message */ \ | |
1240 | sizeof(struct hpi_message_header) + sizeof(struct hpi_control_msg),\ | |
1241 | sizeof(struct hpi_message_header) + sizeof(struct hpi_nvmemory_msg),\ | |
1242 | sizeof(struct hpi_message_header) + sizeof(struct hpi_gpio_msg),\ | |
1243 | sizeof(struct hpi_message_header) + sizeof(struct hpi_watchdog_msg),\ | |
1244 | sizeof(struct hpi_message_header) + sizeof(struct hpi_clock_msg),\ | |
1245 | sizeof(struct hpi_message_header) + sizeof(struct hpi_profile_msg),\ | |
1246 | sizeof(struct hpi_message_header) + sizeof(struct hpi_controlx_msg),\ | |
1247 | sizeof(struct hpi_message_header) + sizeof(struct hpi_async_msg) \ | |
1248 | } | |
1249 | ||
1250 | struct hpi_response_header { | |
1251 | u16 size; | |
1252 | u8 type; /* HPI_TYPE_RESPONSE */ | |
1253 | u8 version; /* response version */ | |
1254 | u16 object; /* HPI_OBJ_* */ | |
1255 | u16 function; /* HPI_SUBSYS_xxx, HPI_ADAPTER_xxx */ | |
1256 | u16 error; /* HPI_ERROR_xxx */ | |
1257 | u16 specific_error; /* adapter specific error */ | |
1258 | }; | |
1259 | ||
1260 | struct hpi_response { | |
1261 | /* following fields must match HPI_RESPONSE_HEADER */ | |
1262 | u16 size; | |
1263 | u8 type; /* HPI_TYPE_RESPONSE */ | |
1264 | u8 version; /* response version */ | |
1265 | u16 object; /* HPI_OBJ_* */ | |
1266 | u16 function; /* HPI_SUBSYS_xxx, HPI_ADAPTER_xxx */ | |
1267 | u16 error; /* HPI_ERROR_xxx */ | |
1268 | u16 specific_error; /* adapter specific error */ | |
1269 | union { | |
1270 | struct hpi_subsys_res s; | |
1271 | struct hpi_adapter_res a; | |
1272 | union hpi_adapterx_res ax; | |
1273 | struct hpi_stream_res d; | |
1274 | struct hpi_mixer_res m; | |
1275 | union hpi_mixerx_res mx; /* extended mixer; */ | |
1276 | struct hpi_control_res c; /* mixer control; */ | |
1277 | /* identical to hpi_control_res, but field naming is improved */ | |
1278 | union hpi_control_union_res cu; | |
1279 | struct hpi_controlx_res cx; /* extended mixer control; */ | |
1280 | struct hpi_nvmemory_res n; | |
1281 | struct hpi_gpio_res l; /* digital i/o */ | |
1282 | struct hpi_watchdog_res w; | |
1283 | struct hpi_clock_res t; /* dsp time */ | |
1284 | struct hpi_profile_res p; | |
1285 | struct hpi_async_res as; | |
1286 | u8 bytes[52]; | |
1287 | } u; | |
1288 | }; | |
1289 | ||
1290 | #define HPI_RESPONSE_SIZE_BY_OBJECT { \ | |
1291 | sizeof(struct hpi_response_header) ,/* default, no object type 0 */ \ | |
1292 | sizeof(struct hpi_response_header) + sizeof(struct hpi_subsys_res),\ | |
1293 | sizeof(struct hpi_response_header) + sizeof(union hpi_adapterx_res),\ | |
1294 | sizeof(struct hpi_response_header) + sizeof(struct hpi_stream_res),\ | |
1295 | sizeof(struct hpi_response_header) + sizeof(struct hpi_stream_res),\ | |
1296 | sizeof(struct hpi_response_header) + sizeof(struct hpi_mixer_res),\ | |
1297 | sizeof(struct hpi_response_header) , /* no node response */ \ | |
1298 | sizeof(struct hpi_response_header) + sizeof(struct hpi_control_res),\ | |
1299 | sizeof(struct hpi_response_header) + sizeof(struct hpi_nvmemory_res),\ | |
1300 | sizeof(struct hpi_response_header) + sizeof(struct hpi_gpio_res),\ | |
1301 | sizeof(struct hpi_response_header) + sizeof(struct hpi_watchdog_res),\ | |
1302 | sizeof(struct hpi_response_header) + sizeof(struct hpi_clock_res),\ | |
1303 | sizeof(struct hpi_response_header) + sizeof(struct hpi_profile_res),\ | |
1304 | sizeof(struct hpi_response_header) + sizeof(struct hpi_controlx_res),\ | |
1305 | sizeof(struct hpi_response_header) + sizeof(struct hpi_async_res) \ | |
1306 | } | |
1307 | ||
1308 | /*********************** version 1 message/response *****************************/ | |
1309 | #define HPINET_ETHERNET_DATA_SIZE (1500) | |
1310 | #define HPINET_IP_HDR_SIZE (20) | |
1311 | #define HPINET_IP_DATA_SIZE (HPINET_ETHERNET_DATA_SIZE - HPINET_IP_HDR_SIZE) | |
1312 | #define HPINET_UDP_HDR_SIZE (8) | |
1313 | #define HPINET_UDP_DATA_SIZE (HPINET_IP_DATA_SIZE - HPINET_UDP_HDR_SIZE) | |
1314 | #define HPINET_ASI_HDR_SIZE (2) | |
1315 | #define HPINET_ASI_DATA_SIZE (HPINET_UDP_DATA_SIZE - HPINET_ASI_HDR_SIZE) | |
1316 | ||
1317 | #define HPI_MAX_PAYLOAD_SIZE (HPINET_ASI_DATA_SIZE - 2) | |
1318 | ||
1319 | /* New style message/response, but still V0 compatible */ | |
1320 | struct hpi_msg_adapter_get_info { | |
1321 | struct hpi_message_header h; | |
1322 | }; | |
1323 | ||
1324 | struct hpi_res_adapter_get_info { | |
1325 | struct hpi_response_header h; /*v0 */ | |
1326 | struct hpi_adapter_res p; | |
1327 | }; | |
1328 | ||
1329 | /* padding is so these are same size as v0 hpi_message */ | |
1330 | struct hpi_msg_adapter_query_flash { | |
1331 | struct hpi_message_header h; | |
1332 | u32 offset; | |
1333 | u8 pad_to_version0_size[sizeof(struct hpi_message) - /* V0 res */ | |
1334 | sizeof(struct hpi_message_header) - 1 * sizeof(u32)]; | |
1335 | }; | |
1336 | ||
1337 | /* padding is so these are same size as v0 hpi_response */ | |
1338 | struct hpi_res_adapter_query_flash { | |
1339 | struct hpi_response_header h; | |
1340 | u32 checksum; | |
1341 | u32 length; | |
1342 | u32 version; | |
1343 | u8 pad_to_version0_size[sizeof(struct hpi_response) - /* V0 res */ | |
1344 | sizeof(struct hpi_response_header) - 3 * sizeof(u32)]; | |
1345 | }; | |
1346 | ||
1347 | struct hpi_msg_adapter_start_flash { | |
1348 | struct hpi_message_header h; | |
1349 | u32 offset; | |
1350 | u32 length; | |
1351 | u32 key; | |
1352 | u8 pad_to_version0_size[sizeof(struct hpi_message) - /* V0 res */ | |
1353 | sizeof(struct hpi_message_header) - 3 * sizeof(u32)]; | |
1354 | }; | |
1355 | ||
1356 | struct hpi_res_adapter_start_flash { | |
1357 | struct hpi_response_header h; | |
1358 | u8 pad_to_version0_size[sizeof(struct hpi_response) - /* V0 res */ | |
1359 | sizeof(struct hpi_response_header)]; | |
1360 | }; | |
1361 | ||
1362 | struct hpi_msg_adapter_program_flash_payload { | |
1363 | u32 checksum; | |
1364 | u16 sequence; | |
1365 | u16 length; | |
1366 | u16 offset; /**< offset from start of msg to data */ | |
1367 | u16 unused; | |
1368 | /* ensure sizeof(header + payload) == sizeof(hpi_message_V0) | |
1369 | because old firmware expects data after message of this size */ | |
1370 | u8 pad_to_version0_size[sizeof(struct hpi_message) - /* V0 message */ | |
1371 | sizeof(struct hpi_message_header) - sizeof(u32) - | |
1372 | 4 * sizeof(u16)]; | |
1373 | }; | |
1374 | ||
1375 | struct hpi_msg_adapter_program_flash { | |
1376 | struct hpi_message_header h; | |
1377 | struct hpi_msg_adapter_program_flash_payload p; | |
1378 | u32 data[256]; | |
1379 | }; | |
1380 | ||
1381 | struct hpi_res_adapter_program_flash { | |
1382 | struct hpi_response_header h; | |
1383 | u16 sequence; | |
1384 | u8 pad_to_version0_size[sizeof(struct hpi_response) - /* V0 res */ | |
1385 | sizeof(struct hpi_response_header) - sizeof(u16)]; | |
1386 | }; | |
1387 | ||
1388 | #if 1 | |
1389 | #define hpi_message_header_v1 hpi_message_header | |
1390 | #define hpi_response_header_v1 hpi_response_header | |
1391 | #else | |
1392 | /* V1 headers in Addition to v0 headers */ | |
1393 | struct hpi_message_header_v1 { | |
1394 | struct hpi_message_header h0; | |
1395 | /* struct { | |
1396 | } h1; */ | |
1397 | }; | |
1398 | ||
1399 | struct hpi_response_header_v1 { | |
1400 | struct hpi_response_header h0; | |
1401 | struct { | |
1402 | u16 adapter_index; /* the adapter index */ | |
1403 | u16 obj_index; /* object index */ | |
1404 | } h1; | |
1405 | }; | |
1406 | #endif | |
1407 | ||
1408 | /* STRV HPI Packet */ | |
1409 | struct hpi_msg_strv { | |
1410 | struct hpi_message_header h; | |
1411 | struct hpi_entity strv; | |
1412 | }; | |
1413 | ||
1414 | struct hpi_res_strv { | |
1415 | struct hpi_response_header h; | |
1416 | struct hpi_entity strv; | |
1417 | }; | |
1418 | #define MIN_STRV_PACKET_SIZE sizeof(struct hpi_res_strv) | |
1419 | ||
1420 | struct hpi_msg_payload_v0 { | |
1421 | struct hpi_message_header h; | |
1422 | union { | |
1423 | struct hpi_subsys_msg s; | |
1424 | struct hpi_adapter_msg a; | |
1425 | union hpi_adapterx_msg ax; | |
1426 | struct hpi_stream_msg d; | |
1427 | struct hpi_mixer_msg m; | |
1428 | union hpi_mixerx_msg mx; | |
1429 | struct hpi_control_msg c; | |
1430 | struct hpi_control_union_msg cu; | |
1431 | struct hpi_controlx_msg cx; | |
1432 | struct hpi_nvmemory_msg n; | |
1433 | struct hpi_gpio_msg l; | |
1434 | struct hpi_watchdog_msg w; | |
1435 | struct hpi_clock_msg t; | |
1436 | struct hpi_profile_msg p; | |
1437 | struct hpi_async_msg as; | |
1438 | } u; | |
1439 | }; | |
1440 | ||
1441 | struct hpi_res_payload_v0 { | |
1442 | struct hpi_response_header h; | |
1443 | union { | |
1444 | struct hpi_subsys_res s; | |
1445 | struct hpi_adapter_res a; | |
1446 | union hpi_adapterx_res ax; | |
1447 | struct hpi_stream_res d; | |
1448 | struct hpi_mixer_res m; | |
1449 | union hpi_mixerx_res mx; | |
1450 | struct hpi_control_res c; | |
1451 | union hpi_control_union_res cu; | |
1452 | struct hpi_controlx_res cx; | |
1453 | struct hpi_nvmemory_res n; | |
1454 | struct hpi_gpio_res l; | |
1455 | struct hpi_watchdog_res w; | |
1456 | struct hpi_clock_res t; | |
1457 | struct hpi_profile_res p; | |
1458 | struct hpi_async_res as; | |
1459 | } u; | |
1460 | }; | |
1461 | ||
1462 | union hpi_message_buffer_v1 { | |
1463 | struct hpi_message m0; /* version 0 */ | |
1464 | struct hpi_message_header_v1 h; | |
1465 | unsigned char buf[HPI_MAX_PAYLOAD_SIZE]; | |
1466 | }; | |
1467 | ||
1468 | union hpi_response_buffer_v1 { | |
1469 | struct hpi_response r0; /* version 0 */ | |
1470 | struct hpi_response_header_v1 h; | |
1471 | unsigned char buf[HPI_MAX_PAYLOAD_SIZE]; | |
1472 | }; | |
1473 | ||
1474 | compile_time_assert((sizeof(union hpi_message_buffer_v1) <= | |
1475 | HPI_MAX_PAYLOAD_SIZE), message_buffer_ok); | |
1476 | compile_time_assert((sizeof(union hpi_response_buffer_v1) <= | |
1477 | HPI_MAX_PAYLOAD_SIZE), response_buffer_ok); | |
1478 | ||
1479 | /*////////////////////////////////////////////////////////////////////////// */ | |
1480 | /* declarations for compact control calls */ | |
1481 | struct hpi_control_defn { | |
1482 | u8 type; | |
1483 | u8 channels; | |
1484 | u8 src_node_type; | |
1485 | u8 src_node_index; | |
1486 | u8 dest_node_type; | |
1487 | u8 dest_node_index; | |
1488 | }; | |
1489 | ||
1490 | /*////////////////////////////////////////////////////////////////////////// */ | |
1491 | /* declarations for control caching (internal to HPI<->DSP interaction) */ | |
1492 | ||
1493 | /** A compact representation of (part of) a controls state. | |
1494 | Used for efficient transfer of the control state | |
1495 | between DSP and host or across a network | |
1496 | */ | |
1497 | struct hpi_control_cache_info { | |
1498 | /** one of HPI_CONTROL_* */ | |
1499 | u8 control_type; | |
1500 | /** The total size of cached information in 32-bit words. */ | |
1501 | u8 size_in32bit_words; | |
1502 | /** The original index of the control on the DSP */ | |
1503 | u16 control_index; | |
1504 | }; | |
1505 | ||
1506 | struct hpi_control_cache_single { | |
1507 | struct hpi_control_cache_info i; | |
1508 | union { | |
1509 | struct { /* volume */ | |
1510 | u16 an_log[2]; | |
1511 | } v; | |
1512 | struct { /* peak meter */ | |
1513 | u16 an_log_peak[2]; | |
1514 | u16 an_logRMS[2]; | |
1515 | } p; | |
1516 | struct { /* channel mode */ | |
1517 | u16 mode; | |
1518 | } m; | |
1519 | struct { /* multiplexer */ | |
1520 | u16 source_node_type; | |
1521 | u16 source_node_index; | |
1522 | } x; | |
1523 | struct { /* level/trim */ | |
1524 | u16 an_log[2]; | |
1525 | } l; | |
1526 | struct { /* tuner - partial caching. | |
1527 | some attributes go to the DSP. */ | |
1528 | u32 freq_ink_hz; | |
1529 | u16 band; | |
1530 | u16 level; | |
1531 | } t; | |
1532 | struct { /* AESEBU rx status */ | |
1533 | u32 error_status; | |
1534 | u32 source; | |
1535 | } aes3rx; | |
1536 | struct { /* AESEBU tx */ | |
1537 | u32 format; | |
1538 | } aes3tx; | |
1539 | struct { /* tone detector */ | |
1540 | u16 state; | |
1541 | } tone; | |
1542 | struct { /* silence detector */ | |
1543 | u32 state; | |
1544 | u32 count; | |
1545 | } silence; | |
1546 | struct { /* sample clock */ | |
1547 | u16 source; | |
1548 | u16 source_index; | |
1549 | u32 sample_rate; | |
1550 | } clk; | |
1551 | struct { /* microphone control */ | |
1552 | u16 state; | |
1553 | } phantom_power; | |
1554 | struct { /* generic control */ | |
1555 | u32 dw1; | |
1556 | u32 dw2; | |
1557 | } g; | |
1558 | } u; | |
1559 | }; | |
1560 | ||
1561 | struct hpi_control_cache_pad { | |
1562 | struct hpi_control_cache_info i; | |
1563 | u32 field_valid_flags; | |
1564 | u8 c_channel[8]; | |
1565 | u8 c_artist[40]; | |
1566 | u8 c_title[40]; | |
1567 | u8 c_comment[200]; | |
1568 | u32 pTY; | |
1569 | u32 pI; | |
1570 | u32 traffic_supported; | |
1571 | u32 traffic_anouncement; | |
1572 | }; | |
1573 | ||
1574 | /*/////////////////////////////////////////////////////////////////////////// */ | |
1575 | /* declarations for 2^N sized FIFO buffer (internal to HPI<->DSP interaction) */ | |
1576 | struct hpi_fifo_buffer { | |
1577 | u32 size; | |
1578 | u32 dSP_index; | |
1579 | u32 host_index; | |
1580 | }; | |
1581 | ||
1582 | #ifndef DISABLE_PRAGMA_PACK1 | |
1583 | #pragma pack(pop) | |
1584 | #endif | |
1585 | ||
1586 | /* skip host side function declarations for DSP | |
1587 | compile and documentation extraction */ | |
1588 | ||
1589 | char hpi_handle_object(const u32 handle); | |
1590 | ||
1591 | void hpi_handle_to_indexes(const u32 handle, u16 *pw_adapter_index, | |
1592 | u16 *pw_object_index); | |
1593 | ||
1594 | u32 hpi_indexes_to_handle(const char c_object, const u16 adapter_index, | |
1595 | const u16 object_index); | |
1596 | ||
1597 | /*////////////////////////////////////////////////////////////////////////// */ | |
1598 | ||
1599 | /* main HPI entry point */ | |
1600 | hpi_handler_func hpi_send_recv; | |
1601 | ||
1602 | /* UDP message */ | |
1603 | void hpi_send_recvUDP(struct hpi_message *phm, struct hpi_response *phr, | |
1604 | const unsigned int timeout); | |
1605 | ||
1606 | /* used in PnP OS/driver */ | |
1607 | u16 hpi_subsys_create_adapter(const struct hpi_hsubsys *ph_subsys, | |
1608 | const struct hpi_resource *p_resource, u16 *pw_adapter_index); | |
1609 | ||
1610 | u16 hpi_subsys_delete_adapter(const struct hpi_hsubsys *ph_subsys, | |
1611 | u16 adapter_index); | |
1612 | ||
1613 | u16 hpi_outstream_host_buffer_get_info(const struct hpi_hsubsys *ph_subsys, | |
1614 | u32 h_outstream, u8 **pp_buffer, | |
1615 | struct hpi_hostbuffer_status **pp_status); | |
1616 | ||
1617 | u16 hpi_instream_host_buffer_get_info(const struct hpi_hsubsys *ph_subsys, | |
1618 | u32 h_instream, u8 **pp_buffer, | |
1619 | struct hpi_hostbuffer_status **pp_status); | |
1620 | ||
1621 | u16 hpi_adapter_restart(u16 adapter_index); | |
1622 | ||
1623 | /* | |
1624 | The following 3 functions were last declared in header files for | |
1625 | driver 3.10. HPI_ControlQuery() used to be the recommended way | |
1626 | of getting a volume range. Declared here for binary asihpi32.dll | |
1627 | compatibility. | |
1628 | */ | |
1629 | ||
1630 | void hpi_format_to_msg(struct hpi_msg_format *pMF, | |
1631 | const struct hpi_format *pF); | |
1632 | void hpi_stream_response_to_legacy(struct hpi_stream_res *pSR); | |
1633 | ||
1634 | /*////////////////////////////////////////////////////////////////////////// */ | |
1635 | /* declarations for individual HPI entry points */ | |
1636 | hpi_handler_func HPI_1000; | |
1637 | hpi_handler_func HPI_6000; | |
1638 | hpi_handler_func HPI_6205; | |
1639 | hpi_handler_func HPI_COMMON; | |
1640 | ||
1641 | #endif /* _HPI_INTERNAL_H_ */ |