2 #include "hpi_internal.h"
3 #include "hpimsginit.h"
8 unsigned int obj_index:12;
9 unsigned int obj_type:4;
10 unsigned int adapter_index:14;
12 unsigned int read_only:1;
20 u32 hpi_indexes_to_handle(const char c_object, const u16 adapter_index,
21 const u16 object_index)
23 union handle_word handle;
25 handle.h.adapter_index = adapter_index;
27 handle.h.read_only = 0;
28 handle.h.obj_type = c_object;
29 handle.h.obj_index = object_index;
33 static u16 hpi_handle_indexes(const u32 h, u16 *p1, u16 *p2)
35 union handle_word uhandle;
37 return HPI_ERROR_INVALID_HANDLE;
41 *p1 = (u16)uhandle.h.adapter_index;
43 *p2 = (u16)uhandle.h.obj_index;
48 void hpi_handle_to_indexes(const u32 handle, u16 *pw_adapter_index,
51 hpi_handle_indexes(handle, pw_adapter_index, pw_object_index);
54 char hpi_handle_object(const u32 handle)
56 union handle_word uhandle;
58 return (char)uhandle.h.obj_type;
61 void hpi_format_to_msg(struct hpi_msg_format *pMF,
62 const struct hpi_format *pF)
64 pMF->sample_rate = pF->sample_rate;
65 pMF->bit_rate = pF->bit_rate;
66 pMF->attributes = pF->attributes;
67 pMF->channels = pF->channels;
68 pMF->format = pF->format;
71 static void hpi_msg_to_format(struct hpi_format *pF,
72 struct hpi_msg_format *pMF)
74 pF->sample_rate = pMF->sample_rate;
75 pF->bit_rate = pMF->bit_rate;
76 pF->attributes = pMF->attributes;
77 pF->channels = pMF->channels;
78 pF->format = pMF->format;
83 void hpi_stream_response_to_legacy(struct hpi_stream_res *pSR)
85 pSR->u.legacy_stream_info.auxiliary_data_available =
86 pSR->u.stream_info.auxiliary_data_available;
87 pSR->u.legacy_stream_info.state = pSR->u.stream_info.state;
90 static inline void hpi_send_recvV1(struct hpi_message_header *m,
91 struct hpi_response_header *r)
93 hpi_send_recv((struct hpi_message *)m, (struct hpi_response *)r);
96 u16 hpi_subsys_get_version_ex(u32 *pversion_ex)
98 struct hpi_message hm;
99 struct hpi_response hr;
101 hpi_init_message_response(&hm, &hr, HPI_OBJ_SUBSYSTEM,
102 HPI_SUBSYS_GET_VERSION);
103 hpi_send_recv(&hm, &hr);
104 *pversion_ex = hr.u.s.data;
108 u16 hpi_subsys_create_adapter(const struct hpi_resource *p_resource,
109 u16 *pw_adapter_index)
111 struct hpi_message hm;
112 struct hpi_response hr;
114 hpi_init_message_response(&hm, &hr, HPI_OBJ_SUBSYSTEM,
115 HPI_SUBSYS_CREATE_ADAPTER);
116 hm.u.s.resource = *p_resource;
118 hpi_send_recv(&hm, &hr);
120 *pw_adapter_index = hr.u.s.adapter_index;
124 u16 hpi_subsys_delete_adapter(u16 adapter_index)
126 struct hpi_message hm;
127 struct hpi_response hr;
128 hpi_init_message_response(&hm, &hr, HPI_OBJ_SUBSYSTEM,
129 HPI_SUBSYS_DELETE_ADAPTER);
130 hm.obj_index = adapter_index;
131 hpi_send_recv(&hm, &hr);
135 u16 hpi_subsys_get_num_adapters(int *pn_num_adapters)
137 struct hpi_message hm;
138 struct hpi_response hr;
139 hpi_init_message_response(&hm, &hr, HPI_OBJ_SUBSYSTEM,
140 HPI_SUBSYS_GET_NUM_ADAPTERS);
141 hpi_send_recv(&hm, &hr);
142 *pn_num_adapters = (int)hr.u.s.num_adapters;
146 u16 hpi_subsys_get_adapter(int iterator, u32 *padapter_index,
147 u16 *pw_adapter_type)
149 struct hpi_message hm;
150 struct hpi_response hr;
151 hpi_init_message_response(&hm, &hr, HPI_OBJ_SUBSYSTEM,
152 HPI_SUBSYS_GET_ADAPTER);
153 hm.obj_index = (u16)iterator;
154 hpi_send_recv(&hm, &hr);
155 *padapter_index = (int)hr.u.s.adapter_index;
156 *pw_adapter_type = hr.u.s.aw_adapter_list[0];
160 u16 hpi_adapter_open(u16 adapter_index)
162 struct hpi_message hm;
163 struct hpi_response hr;
164 hpi_init_message_response(&hm, &hr, HPI_OBJ_ADAPTER,
166 hm.adapter_index = adapter_index;
168 hpi_send_recv(&hm, &hr);
174 u16 hpi_adapter_close(u16 adapter_index)
176 struct hpi_message hm;
177 struct hpi_response hr;
178 hpi_init_message_response(&hm, &hr, HPI_OBJ_ADAPTER,
180 hm.adapter_index = adapter_index;
182 hpi_send_recv(&hm, &hr);
187 u16 hpi_adapter_set_mode(u16 adapter_index, u32 adapter_mode)
189 return hpi_adapter_set_mode_ex(adapter_index, adapter_mode,
190 HPI_ADAPTER_MODE_SET);
193 u16 hpi_adapter_set_mode_ex(u16 adapter_index, u32 adapter_mode,
196 struct hpi_message hm;
197 struct hpi_response hr;
199 hpi_init_message_response(&hm, &hr, HPI_OBJ_ADAPTER,
200 HPI_ADAPTER_SET_MODE);
201 hm.adapter_index = adapter_index;
202 hm.u.ax.mode.adapter_mode = adapter_mode;
203 hm.u.ax.mode.query_or_set = query_or_set;
204 hpi_send_recv(&hm, &hr);
208 u16 hpi_adapter_get_mode(u16 adapter_index, u32 *padapter_mode)
210 struct hpi_message hm;
211 struct hpi_response hr;
212 hpi_init_message_response(&hm, &hr, HPI_OBJ_ADAPTER,
213 HPI_ADAPTER_GET_MODE);
214 hm.adapter_index = adapter_index;
215 hpi_send_recv(&hm, &hr);
217 *padapter_mode = hr.u.ax.mode.adapter_mode;
221 u16 hpi_adapter_get_info(u16 adapter_index, u16 *pw_num_outstreams,
222 u16 *pw_num_instreams, u16 *pw_version, u32 *pserial_number,
223 u16 *pw_adapter_type)
225 struct hpi_message hm;
226 struct hpi_response hr;
227 hpi_init_message_response(&hm, &hr, HPI_OBJ_ADAPTER,
228 HPI_ADAPTER_GET_INFO);
229 hm.adapter_index = adapter_index;
231 hpi_send_recv(&hm, &hr);
233 *pw_adapter_type = hr.u.ax.info.adapter_type;
234 *pw_num_outstreams = hr.u.ax.info.num_outstreams;
235 *pw_num_instreams = hr.u.ax.info.num_instreams;
236 *pw_version = hr.u.ax.info.version;
237 *pserial_number = hr.u.ax.info.serial_number;
241 u16 hpi_adapter_get_module_by_index(u16 adapter_index, u16 module_index,
242 u16 *pw_num_outputs, u16 *pw_num_inputs, u16 *pw_version,
243 u32 *pserial_number, u16 *pw_module_type, u32 *ph_module)
245 struct hpi_message hm;
246 struct hpi_response hr;
248 hpi_init_message_response(&hm, &hr, HPI_OBJ_ADAPTER,
249 HPI_ADAPTER_MODULE_INFO);
250 hm.adapter_index = adapter_index;
251 hm.u.ax.module_info.index = module_index;
253 hpi_send_recv(&hm, &hr);
255 *pw_module_type = hr.u.ax.info.adapter_type;
256 *pw_num_outputs = hr.u.ax.info.num_outstreams;
257 *pw_num_inputs = hr.u.ax.info.num_instreams;
258 *pw_version = hr.u.ax.info.version;
259 *pserial_number = hr.u.ax.info.serial_number;
265 u16 hpi_adapter_get_assert2(u16 adapter_index, u16 *p_assert_count,
266 char *psz_assert, u32 *p_param1, u32 *p_param2,
267 u32 *p_dsp_string_addr, u16 *p_processor_id)
269 struct hpi_message hm;
270 struct hpi_response hr;
271 hpi_init_message_response(&hm, &hr, HPI_OBJ_ADAPTER,
272 HPI_ADAPTER_GET_ASSERT);
273 hm.adapter_index = adapter_index;
275 hpi_send_recv(&hm, &hr);
280 *p_assert_count = hr.u.ax.assert.count;
282 if (*p_assert_count) {
283 *p_param1 = hr.u.ax.assert.p1;
284 *p_param2 = hr.u.ax.assert.p2;
285 *p_processor_id = hr.u.ax.assert.dsp_index;
286 *p_dsp_string_addr = hr.u.ax.assert.dsp_msg_addr;
287 memcpy(psz_assert, hr.u.ax.assert.sz_message,
296 u16 hpi_adapter_test_assert(u16 adapter_index, u16 assert_id)
298 struct hpi_message hm;
299 struct hpi_response hr;
300 hpi_init_message_response(&hm, &hr, HPI_OBJ_ADAPTER,
301 HPI_ADAPTER_TEST_ASSERT);
302 hm.adapter_index = adapter_index;
303 hm.u.ax.test_assert.value = assert_id;
305 hpi_send_recv(&hm, &hr);
310 u16 hpi_adapter_enable_capability(u16 adapter_index, u16 capability, u32 key)
313 return HPI_ERROR_UNIMPLEMENTED;
315 struct hpi_message hm;
316 struct hpi_response hr;
317 hpi_init_message_response(&hm, &hr, HPI_OBJ_ADAPTER,
318 HPI_ADAPTER_ENABLE_CAPABILITY);
319 hm.adapter_index = adapter_index;
320 hm.u.ax.enable_cap.cap = capability;
321 hm.u.ax.enable_cap.key = key;
323 hpi_send_recv(&hm, &hr);
329 u16 hpi_adapter_self_test(u16 adapter_index)
331 struct hpi_message hm;
332 struct hpi_response hr;
333 hpi_init_message_response(&hm, &hr, HPI_OBJ_ADAPTER,
334 HPI_ADAPTER_SELFTEST);
335 hm.adapter_index = adapter_index;
336 hpi_send_recv(&hm, &hr);
340 u16 hpi_adapter_debug_read(u16 adapter_index, u32 dsp_address, char *p_buffer,
343 struct hpi_msg_adapter_debug_read hm;
344 struct hpi_res_adapter_debug_read hr;
346 hpi_init_message_responseV1(&hm.h, sizeof(hm), &hr.h, sizeof(hr),
347 HPI_OBJ_ADAPTER, HPI_ADAPTER_DEBUG_READ);
349 hm.h.adapter_index = adapter_index;
350 hm.dsp_address = dsp_address;
352 if (*count_bytes > (int)sizeof(hr.bytes))
353 *count_bytes = (int)sizeof(hr.bytes);
355 hm.count_bytes = *count_bytes;
357 hpi_send_recvV1(&hm.h, &hr.h);
360 int res_bytes = hr.h.size - sizeof(hr.h);
361 if (res_bytes > *count_bytes)
362 res_bytes = *count_bytes;
363 *count_bytes = res_bytes;
364 memcpy(p_buffer, &hr.bytes, res_bytes);
371 u16 hpi_adapter_set_property(u16 adapter_index, u16 property, u16 parameter1,
374 struct hpi_message hm;
375 struct hpi_response hr;
376 hpi_init_message_response(&hm, &hr, HPI_OBJ_ADAPTER,
377 HPI_ADAPTER_SET_PROPERTY);
378 hm.adapter_index = adapter_index;
379 hm.u.ax.property_set.property = property;
380 hm.u.ax.property_set.parameter1 = parameter1;
381 hm.u.ax.property_set.parameter2 = parameter2;
383 hpi_send_recv(&hm, &hr);
388 u16 hpi_adapter_get_property(u16 adapter_index, u16 property,
389 u16 *pw_parameter1, u16 *pw_parameter2)
391 struct hpi_message hm;
392 struct hpi_response hr;
393 hpi_init_message_response(&hm, &hr, HPI_OBJ_ADAPTER,
394 HPI_ADAPTER_GET_PROPERTY);
395 hm.adapter_index = adapter_index;
396 hm.u.ax.property_set.property = property;
398 hpi_send_recv(&hm, &hr);
401 *pw_parameter1 = hr.u.ax.property_get.parameter1;
403 *pw_parameter2 = hr.u.ax.property_get.parameter2;
409 u16 hpi_adapter_enumerate_property(u16 adapter_index, u16 index,
410 u16 what_to_enumerate, u16 property_index, u32 *psetting)
415 u16 hpi_format_create(struct hpi_format *p_format, u16 channels, u16 format,
416 u32 sample_rate, u32 bit_rate, u32 attributes)
419 struct hpi_msg_format fmt;
430 error = HPI_ERROR_INVALID_CHANNELS;
433 fmt.channels = channels;
436 case HPI_FORMAT_PCM16_SIGNED:
437 case HPI_FORMAT_PCM24_SIGNED:
438 case HPI_FORMAT_PCM32_SIGNED:
439 case HPI_FORMAT_PCM32_FLOAT:
440 case HPI_FORMAT_PCM16_BIGENDIAN:
441 case HPI_FORMAT_PCM8_UNSIGNED:
442 case HPI_FORMAT_MPEG_L1:
443 case HPI_FORMAT_MPEG_L2:
444 case HPI_FORMAT_MPEG_L3:
445 case HPI_FORMAT_DOLBY_AC2:
446 case HPI_FORMAT_AA_TAGIT1_HITS:
447 case HPI_FORMAT_AA_TAGIT1_INSERTS:
448 case HPI_FORMAT_RAW_BITSTREAM:
449 case HPI_FORMAT_AA_TAGIT1_HITS_EX1:
450 case HPI_FORMAT_OEM1:
451 case HPI_FORMAT_OEM2:
454 error = HPI_ERROR_INVALID_FORMAT;
459 if (sample_rate < 8000L) {
460 error = HPI_ERROR_INCOMPATIBLE_SAMPLERATE;
463 if (sample_rate > 200000L) {
464 error = HPI_ERROR_INCOMPATIBLE_SAMPLERATE;
465 sample_rate = 200000L;
467 fmt.sample_rate = sample_rate;
470 case HPI_FORMAT_MPEG_L1:
471 case HPI_FORMAT_MPEG_L2:
472 case HPI_FORMAT_MPEG_L3:
473 fmt.bit_rate = bit_rate;
475 case HPI_FORMAT_PCM16_SIGNED:
476 case HPI_FORMAT_PCM16_BIGENDIAN:
477 fmt.bit_rate = channels * sample_rate * 2;
479 case HPI_FORMAT_PCM32_SIGNED:
480 case HPI_FORMAT_PCM32_FLOAT:
481 fmt.bit_rate = channels * sample_rate * 4;
483 case HPI_FORMAT_PCM8_UNSIGNED:
484 fmt.bit_rate = channels * sample_rate;
491 case HPI_FORMAT_MPEG_L2:
493 && (attributes != HPI_MPEG_MODE_DEFAULT)) {
494 attributes = HPI_MPEG_MODE_DEFAULT;
495 error = HPI_ERROR_INVALID_FORMAT;
496 } else if (attributes > HPI_MPEG_MODE_DUALCHANNEL) {
497 attributes = HPI_MPEG_MODE_DEFAULT;
498 error = HPI_ERROR_INVALID_FORMAT;
500 fmt.attributes = attributes;
503 fmt.attributes = attributes;
506 hpi_msg_to_format(p_format, &fmt);
510 u16 hpi_stream_estimate_buffer_size(struct hpi_format *p_format,
511 u32 host_polling_rate_in_milli_seconds, u32 *recommended_buffer_size)
514 u32 bytes_per_second;
517 struct hpi_format *pF = p_format;
519 channels = pF->channels;
521 switch (pF->format) {
522 case HPI_FORMAT_PCM16_BIGENDIAN:
523 case HPI_FORMAT_PCM16_SIGNED:
524 bytes_per_second = pF->sample_rate * 2L * channels;
526 case HPI_FORMAT_PCM24_SIGNED:
527 bytes_per_second = pF->sample_rate * 3L * channels;
529 case HPI_FORMAT_PCM32_SIGNED:
530 case HPI_FORMAT_PCM32_FLOAT:
531 bytes_per_second = pF->sample_rate * 4L * channels;
533 case HPI_FORMAT_PCM8_UNSIGNED:
534 bytes_per_second = pF->sample_rate * 1L * channels;
536 case HPI_FORMAT_MPEG_L1:
537 case HPI_FORMAT_MPEG_L2:
538 case HPI_FORMAT_MPEG_L3:
539 bytes_per_second = pF->bit_rate / 8L;
541 case HPI_FORMAT_DOLBY_AC2:
543 bytes_per_second = 256000L / 8L;
546 return HPI_ERROR_INVALID_FORMAT;
548 size = (bytes_per_second * host_polling_rate_in_milli_seconds * 2) /
551 *recommended_buffer_size =
552 roundup_pow_of_two(((size + 4095L) & ~4095L));
556 u16 hpi_outstream_open(u16 adapter_index, u16 outstream_index,
559 struct hpi_message hm;
560 struct hpi_response hr;
561 hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM,
563 hm.adapter_index = adapter_index;
564 hm.obj_index = outstream_index;
566 hpi_send_recv(&hm, &hr);
570 hpi_indexes_to_handle(HPI_OBJ_OSTREAM, adapter_index,
577 u16 hpi_outstream_close(u32 h_outstream)
579 struct hpi_message hm;
580 struct hpi_response hr;
582 hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM,
583 HPI_OSTREAM_HOSTBUFFER_FREE);
584 if (hpi_handle_indexes(h_outstream, &hm.adapter_index, &hm.obj_index))
585 return HPI_ERROR_INVALID_HANDLE;
587 hpi_send_recv(&hm, &hr);
589 hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM,
590 HPI_OSTREAM_GROUP_RESET);
591 hpi_handle_indexes(h_outstream, &hm.adapter_index, &hm.obj_index);
592 hpi_send_recv(&hm, &hr);
594 hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM,
596 hpi_handle_indexes(h_outstream, &hm.adapter_index, &hm.obj_index);
597 hpi_send_recv(&hm, &hr);
602 u16 hpi_outstream_get_info_ex(u32 h_outstream, u16 *pw_state,
603 u32 *pbuffer_size, u32 *pdata_to_play, u32 *psamples_played,
604 u32 *pauxiliary_data_to_play)
606 struct hpi_message hm;
607 struct hpi_response hr;
608 hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM,
609 HPI_OSTREAM_GET_INFO);
610 if (hpi_handle_indexes(h_outstream, &hm.adapter_index, &hm.obj_index))
611 return HPI_ERROR_INVALID_HANDLE;
613 hpi_send_recv(&hm, &hr);
616 *pw_state = hr.u.d.u.stream_info.state;
618 *pbuffer_size = hr.u.d.u.stream_info.buffer_size;
620 *pdata_to_play = hr.u.d.u.stream_info.data_available;
622 *psamples_played = hr.u.d.u.stream_info.samples_transferred;
623 if (pauxiliary_data_to_play)
624 *pauxiliary_data_to_play =
625 hr.u.d.u.stream_info.auxiliary_data_available;
629 u16 hpi_outstream_write_buf(u32 h_outstream, const u8 *pb_data,
630 u32 bytes_to_write, const struct hpi_format *p_format)
632 struct hpi_message hm;
633 struct hpi_response hr;
634 hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM,
636 if (hpi_handle_indexes(h_outstream, &hm.adapter_index, &hm.obj_index))
637 return HPI_ERROR_INVALID_HANDLE;
638 hm.u.d.u.data.pb_data = (u8 *)pb_data;
639 hm.u.d.u.data.data_size = bytes_to_write;
641 hpi_format_to_msg(&hm.u.d.u.data.format, p_format);
643 hpi_send_recv(&hm, &hr);
648 u16 hpi_outstream_start(u32 h_outstream)
650 struct hpi_message hm;
651 struct hpi_response hr;
652 hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM,
654 if (hpi_handle_indexes(h_outstream, &hm.adapter_index, &hm.obj_index))
655 return HPI_ERROR_INVALID_HANDLE;
657 hpi_send_recv(&hm, &hr);
662 u16 hpi_outstream_wait_start(u32 h_outstream)
664 struct hpi_message hm;
665 struct hpi_response hr;
666 hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM,
667 HPI_OSTREAM_WAIT_START);
668 if (hpi_handle_indexes(h_outstream, &hm.adapter_index, &hm.obj_index))
669 return HPI_ERROR_INVALID_HANDLE;
671 hpi_send_recv(&hm, &hr);
676 u16 hpi_outstream_stop(u32 h_outstream)
678 struct hpi_message hm;
679 struct hpi_response hr;
680 hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM,
682 if (hpi_handle_indexes(h_outstream, &hm.adapter_index, &hm.obj_index))
683 return HPI_ERROR_INVALID_HANDLE;
685 hpi_send_recv(&hm, &hr);
690 u16 hpi_outstream_sinegen(u32 h_outstream)
692 struct hpi_message hm;
693 struct hpi_response hr;
694 hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM,
695 HPI_OSTREAM_SINEGEN);
696 if (hpi_handle_indexes(h_outstream, &hm.adapter_index, &hm.obj_index))
697 return HPI_ERROR_INVALID_HANDLE;
699 hpi_send_recv(&hm, &hr);
704 u16 hpi_outstream_reset(u32 h_outstream)
706 struct hpi_message hm;
707 struct hpi_response hr;
708 hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM,
710 if (hpi_handle_indexes(h_outstream, &hm.adapter_index, &hm.obj_index))
711 return HPI_ERROR_INVALID_HANDLE;
713 hpi_send_recv(&hm, &hr);
718 u16 hpi_outstream_query_format(u32 h_outstream, struct hpi_format *p_format)
720 struct hpi_message hm;
721 struct hpi_response hr;
723 hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM,
724 HPI_OSTREAM_QUERY_FORMAT);
725 if (hpi_handle_indexes(h_outstream, &hm.adapter_index, &hm.obj_index))
726 return HPI_ERROR_INVALID_HANDLE;
728 hpi_format_to_msg(&hm.u.d.u.data.format, p_format);
730 hpi_send_recv(&hm, &hr);
735 u16 hpi_outstream_set_format(u32 h_outstream, struct hpi_format *p_format)
737 struct hpi_message hm;
738 struct hpi_response hr;
740 hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM,
741 HPI_OSTREAM_SET_FORMAT);
742 if (hpi_handle_indexes(h_outstream, &hm.adapter_index, &hm.obj_index))
743 return HPI_ERROR_INVALID_HANDLE;
745 hpi_format_to_msg(&hm.u.d.u.data.format, p_format);
747 hpi_send_recv(&hm, &hr);
752 u16 hpi_outstream_set_velocity(u32 h_outstream, short velocity)
754 struct hpi_message hm;
755 struct hpi_response hr;
757 hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM,
758 HPI_OSTREAM_SET_VELOCITY);
759 if (hpi_handle_indexes(h_outstream, &hm.adapter_index, &hm.obj_index))
760 return HPI_ERROR_INVALID_HANDLE;
761 hm.u.d.u.velocity = velocity;
763 hpi_send_recv(&hm, &hr);
768 u16 hpi_outstream_set_punch_in_out(u32 h_outstream, u32 punch_in_sample,
769 u32 punch_out_sample)
771 struct hpi_message hm;
772 struct hpi_response hr;
774 hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM,
775 HPI_OSTREAM_SET_PUNCHINOUT);
776 if (hpi_handle_indexes(h_outstream, &hm.adapter_index, &hm.obj_index))
777 return HPI_ERROR_INVALID_HANDLE;
779 hm.u.d.u.pio.punch_in_sample = punch_in_sample;
780 hm.u.d.u.pio.punch_out_sample = punch_out_sample;
782 hpi_send_recv(&hm, &hr);
787 u16 hpi_outstream_ancillary_reset(u32 h_outstream, u16 mode)
789 struct hpi_message hm;
790 struct hpi_response hr;
792 hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM,
793 HPI_OSTREAM_ANC_RESET);
794 if (hpi_handle_indexes(h_outstream, &hm.adapter_index, &hm.obj_index))
795 return HPI_ERROR_INVALID_HANDLE;
796 hm.u.d.u.data.format.channels = mode;
797 hpi_send_recv(&hm, &hr);
801 u16 hpi_outstream_ancillary_get_info(u32 h_outstream, u32 *pframes_available)
803 struct hpi_message hm;
804 struct hpi_response hr;
806 hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM,
807 HPI_OSTREAM_ANC_GET_INFO);
808 if (hpi_handle_indexes(h_outstream, &hm.adapter_index, &hm.obj_index))
809 return HPI_ERROR_INVALID_HANDLE;
810 hpi_send_recv(&hm, &hr);
812 if (pframes_available)
814 hr.u.d.u.stream_info.data_available /
815 sizeof(struct hpi_anc_frame);
820 u16 hpi_outstream_ancillary_read(u32 h_outstream,
821 struct hpi_anc_frame *p_anc_frame_buffer,
822 u32 anc_frame_buffer_size_in_bytes,
823 u32 number_of_ancillary_frames_to_read)
825 struct hpi_message hm;
826 struct hpi_response hr;
828 hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM,
829 HPI_OSTREAM_ANC_READ);
830 if (hpi_handle_indexes(h_outstream, &hm.adapter_index, &hm.obj_index))
831 return HPI_ERROR_INVALID_HANDLE;
832 hm.u.d.u.data.pb_data = (u8 *)p_anc_frame_buffer;
833 hm.u.d.u.data.data_size =
834 number_of_ancillary_frames_to_read *
835 sizeof(struct hpi_anc_frame);
836 if (hm.u.d.u.data.data_size <= anc_frame_buffer_size_in_bytes)
837 hpi_send_recv(&hm, &hr);
839 hr.error = HPI_ERROR_INVALID_DATASIZE;
843 u16 hpi_outstream_set_time_scale(u32 h_outstream, u32 time_scale)
845 struct hpi_message hm;
846 struct hpi_response hr;
848 hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM,
849 HPI_OSTREAM_SET_TIMESCALE);
850 if (hpi_handle_indexes(h_outstream, &hm.adapter_index, &hm.obj_index))
851 return HPI_ERROR_INVALID_HANDLE;
853 hm.u.d.u.time_scale = time_scale;
855 hpi_send_recv(&hm, &hr);
860 u16 hpi_outstream_host_buffer_allocate(u32 h_outstream, u32 size_in_bytes)
862 struct hpi_message hm;
863 struct hpi_response hr;
865 hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM,
866 HPI_OSTREAM_HOSTBUFFER_ALLOC);
867 if (hpi_handle_indexes(h_outstream, &hm.adapter_index, &hm.obj_index))
868 return HPI_ERROR_INVALID_HANDLE;
869 hm.u.d.u.data.data_size = size_in_bytes;
870 hpi_send_recv(&hm, &hr);
874 u16 hpi_outstream_host_buffer_get_info(u32 h_outstream, u8 **pp_buffer,
875 struct hpi_hostbuffer_status **pp_status)
877 struct hpi_message hm;
878 struct hpi_response hr;
880 hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM,
881 HPI_OSTREAM_HOSTBUFFER_GET_INFO);
882 if (hpi_handle_indexes(h_outstream, &hm.adapter_index, &hm.obj_index))
883 return HPI_ERROR_INVALID_HANDLE;
884 hpi_send_recv(&hm, &hr);
888 *pp_buffer = hr.u.d.u.hostbuffer_info.p_buffer;
890 *pp_status = hr.u.d.u.hostbuffer_info.p_status;
895 u16 hpi_outstream_host_buffer_free(u32 h_outstream)
897 struct hpi_message hm;
898 struct hpi_response hr;
900 hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM,
901 HPI_OSTREAM_HOSTBUFFER_FREE);
902 if (hpi_handle_indexes(h_outstream, &hm.adapter_index, &hm.obj_index))
903 return HPI_ERROR_INVALID_HANDLE;
904 hpi_send_recv(&hm, &hr);
908 u16 hpi_outstream_group_add(u32 h_outstream, u32 h_stream)
910 struct hpi_message hm;
911 struct hpi_response hr;
915 hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM,
916 HPI_OSTREAM_GROUP_ADD);
918 if (hpi_handle_indexes(h_outstream, &hm.adapter_index, &hm.obj_index))
919 return HPI_ERROR_INVALID_HANDLE;
921 if (hpi_handle_indexes(h_stream, &adapter,
922 &hm.u.d.u.stream.stream_index))
923 return HPI_ERROR_INVALID_HANDLE;
925 c_obj_type = hpi_handle_object(h_stream);
926 switch (c_obj_type) {
927 case HPI_OBJ_OSTREAM:
928 case HPI_OBJ_ISTREAM:
929 hm.u.d.u.stream.object_type = c_obj_type;
932 return HPI_ERROR_INVALID_OBJ;
934 if (adapter != hm.adapter_index)
935 return HPI_ERROR_NO_INTERADAPTER_GROUPS;
937 hpi_send_recv(&hm, &hr);
941 u16 hpi_outstream_group_get_map(u32 h_outstream, u32 *poutstream_map,
944 struct hpi_message hm;
945 struct hpi_response hr;
947 hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM,
948 HPI_OSTREAM_GROUP_GETMAP);
949 if (hpi_handle_indexes(h_outstream, &hm.adapter_index, &hm.obj_index))
950 return HPI_ERROR_INVALID_HANDLE;
951 hpi_send_recv(&hm, &hr);
954 *poutstream_map = hr.u.d.u.group_info.outstream_group_map;
956 *pinstream_map = hr.u.d.u.group_info.instream_group_map;
961 u16 hpi_outstream_group_reset(u32 h_outstream)
963 struct hpi_message hm;
964 struct hpi_response hr;
966 hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM,
967 HPI_OSTREAM_GROUP_RESET);
968 if (hpi_handle_indexes(h_outstream, &hm.adapter_index, &hm.obj_index))
969 return HPI_ERROR_INVALID_HANDLE;
970 hpi_send_recv(&hm, &hr);
974 u16 hpi_instream_open(u16 adapter_index, u16 instream_index, u32 *ph_instream)
976 struct hpi_message hm;
977 struct hpi_response hr;
979 hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM,
981 hm.adapter_index = adapter_index;
982 hm.obj_index = instream_index;
984 hpi_send_recv(&hm, &hr);
988 hpi_indexes_to_handle(HPI_OBJ_ISTREAM, adapter_index,
996 u16 hpi_instream_close(u32 h_instream)
998 struct hpi_message hm;
999 struct hpi_response hr;
1001 hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM,
1002 HPI_ISTREAM_HOSTBUFFER_FREE);
1003 if (hpi_handle_indexes(h_instream, &hm.adapter_index, &hm.obj_index))
1004 return HPI_ERROR_INVALID_HANDLE;
1005 hpi_send_recv(&hm, &hr);
1007 hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM,
1008 HPI_ISTREAM_GROUP_RESET);
1009 hpi_handle_indexes(h_instream, &hm.adapter_index, &hm.obj_index);
1010 hpi_send_recv(&hm, &hr);
1012 hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM,
1014 hpi_handle_indexes(h_instream, &hm.adapter_index, &hm.obj_index);
1015 hpi_send_recv(&hm, &hr);
1020 u16 hpi_instream_query_format(u32 h_instream,
1021 const struct hpi_format *p_format)
1023 struct hpi_message hm;
1024 struct hpi_response hr;
1026 hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM,
1027 HPI_ISTREAM_QUERY_FORMAT);
1028 if (hpi_handle_indexes(h_instream, &hm.adapter_index, &hm.obj_index))
1029 return HPI_ERROR_INVALID_HANDLE;
1030 hpi_format_to_msg(&hm.u.d.u.data.format, p_format);
1032 hpi_send_recv(&hm, &hr);
1037 u16 hpi_instream_set_format(u32 h_instream, const struct hpi_format *p_format)
1039 struct hpi_message hm;
1040 struct hpi_response hr;
1042 hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM,
1043 HPI_ISTREAM_SET_FORMAT);
1044 if (hpi_handle_indexes(h_instream, &hm.adapter_index, &hm.obj_index))
1045 return HPI_ERROR_INVALID_HANDLE;
1046 hpi_format_to_msg(&hm.u.d.u.data.format, p_format);
1048 hpi_send_recv(&hm, &hr);
1053 u16 hpi_instream_read_buf(u32 h_instream, u8 *pb_data, u32 bytes_to_read)
1055 struct hpi_message hm;
1056 struct hpi_response hr;
1058 hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM,
1060 if (hpi_handle_indexes(h_instream, &hm.adapter_index, &hm.obj_index))
1061 return HPI_ERROR_INVALID_HANDLE;
1062 hm.u.d.u.data.data_size = bytes_to_read;
1063 hm.u.d.u.data.pb_data = pb_data;
1065 hpi_send_recv(&hm, &hr);
1070 u16 hpi_instream_start(u32 h_instream)
1072 struct hpi_message hm;
1073 struct hpi_response hr;
1075 hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM,
1077 if (hpi_handle_indexes(h_instream, &hm.adapter_index, &hm.obj_index))
1078 return HPI_ERROR_INVALID_HANDLE;
1080 hpi_send_recv(&hm, &hr);
1085 u16 hpi_instream_wait_start(u32 h_instream)
1087 struct hpi_message hm;
1088 struct hpi_response hr;
1090 hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM,
1091 HPI_ISTREAM_WAIT_START);
1092 if (hpi_handle_indexes(h_instream, &hm.adapter_index, &hm.obj_index))
1093 return HPI_ERROR_INVALID_HANDLE;
1095 hpi_send_recv(&hm, &hr);
1100 u16 hpi_instream_stop(u32 h_instream)
1102 struct hpi_message hm;
1103 struct hpi_response hr;
1105 hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM,
1107 if (hpi_handle_indexes(h_instream, &hm.adapter_index, &hm.obj_index))
1108 return HPI_ERROR_INVALID_HANDLE;
1110 hpi_send_recv(&hm, &hr);
1115 u16 hpi_instream_reset(u32 h_instream)
1117 struct hpi_message hm;
1118 struct hpi_response hr;
1120 hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM,
1122 if (hpi_handle_indexes(h_instream, &hm.adapter_index, &hm.obj_index))
1123 return HPI_ERROR_INVALID_HANDLE;
1125 hpi_send_recv(&hm, &hr);
1130 u16 hpi_instream_get_info_ex(u32 h_instream, u16 *pw_state, u32 *pbuffer_size,
1131 u32 *pdata_recorded, u32 *psamples_recorded,
1132 u32 *pauxiliary_data_recorded)
1134 struct hpi_message hm;
1135 struct hpi_response hr;
1136 hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM,
1137 HPI_ISTREAM_GET_INFO);
1138 if (hpi_handle_indexes(h_instream, &hm.adapter_index, &hm.obj_index))
1139 return HPI_ERROR_INVALID_HANDLE;
1141 hpi_send_recv(&hm, &hr);
1144 *pw_state = hr.u.d.u.stream_info.state;
1146 *pbuffer_size = hr.u.d.u.stream_info.buffer_size;
1148 *pdata_recorded = hr.u.d.u.stream_info.data_available;
1149 if (psamples_recorded)
1150 *psamples_recorded = hr.u.d.u.stream_info.samples_transferred;
1151 if (pauxiliary_data_recorded)
1152 *pauxiliary_data_recorded =
1153 hr.u.d.u.stream_info.auxiliary_data_available;
1157 u16 hpi_instream_ancillary_reset(u32 h_instream, u16 bytes_per_frame,
1158 u16 mode, u16 alignment, u16 idle_bit)
1160 struct hpi_message hm;
1161 struct hpi_response hr;
1162 hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM,
1163 HPI_ISTREAM_ANC_RESET);
1164 if (hpi_handle_indexes(h_instream, &hm.adapter_index, &hm.obj_index))
1165 return HPI_ERROR_INVALID_HANDLE;
1166 hm.u.d.u.data.format.attributes = bytes_per_frame;
1167 hm.u.d.u.data.format.format = (mode << 8) | (alignment & 0xff);
1168 hm.u.d.u.data.format.channels = idle_bit;
1169 hpi_send_recv(&hm, &hr);
1173 u16 hpi_instream_ancillary_get_info(u32 h_instream, u32 *pframe_space)
1175 struct hpi_message hm;
1176 struct hpi_response hr;
1177 hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM,
1178 HPI_ISTREAM_ANC_GET_INFO);
1179 if (hpi_handle_indexes(h_instream, &hm.adapter_index, &hm.obj_index))
1180 return HPI_ERROR_INVALID_HANDLE;
1181 hpi_send_recv(&hm, &hr);
1184 (hr.u.d.u.stream_info.buffer_size -
1185 hr.u.d.u.stream_info.data_available) /
1186 sizeof(struct hpi_anc_frame);
1190 u16 hpi_instream_ancillary_write(u32 h_instream,
1191 const struct hpi_anc_frame *p_anc_frame_buffer,
1192 u32 anc_frame_buffer_size_in_bytes,
1193 u32 number_of_ancillary_frames_to_write)
1195 struct hpi_message hm;
1196 struct hpi_response hr;
1198 hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM,
1199 HPI_ISTREAM_ANC_WRITE);
1200 if (hpi_handle_indexes(h_instream, &hm.adapter_index, &hm.obj_index))
1201 return HPI_ERROR_INVALID_HANDLE;
1202 hm.u.d.u.data.pb_data = (u8 *)p_anc_frame_buffer;
1203 hm.u.d.u.data.data_size =
1204 number_of_ancillary_frames_to_write *
1205 sizeof(struct hpi_anc_frame);
1206 if (hm.u.d.u.data.data_size <= anc_frame_buffer_size_in_bytes)
1207 hpi_send_recv(&hm, &hr);
1209 hr.error = HPI_ERROR_INVALID_DATASIZE;
1213 u16 hpi_instream_host_buffer_allocate(u32 h_instream, u32 size_in_bytes)
1216 struct hpi_message hm;
1217 struct hpi_response hr;
1219 hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM,
1220 HPI_ISTREAM_HOSTBUFFER_ALLOC);
1221 if (hpi_handle_indexes(h_instream, &hm.adapter_index, &hm.obj_index))
1222 return HPI_ERROR_INVALID_HANDLE;
1223 hm.u.d.u.data.data_size = size_in_bytes;
1224 hpi_send_recv(&hm, &hr);
1228 u16 hpi_instream_host_buffer_get_info(u32 h_instream, u8 **pp_buffer,
1229 struct hpi_hostbuffer_status **pp_status)
1231 struct hpi_message hm;
1232 struct hpi_response hr;
1234 hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM,
1235 HPI_ISTREAM_HOSTBUFFER_GET_INFO);
1236 if (hpi_handle_indexes(h_instream, &hm.adapter_index, &hm.obj_index))
1237 return HPI_ERROR_INVALID_HANDLE;
1238 hpi_send_recv(&hm, &hr);
1240 if (hr.error == 0) {
1242 *pp_buffer = hr.u.d.u.hostbuffer_info.p_buffer;
1244 *pp_status = hr.u.d.u.hostbuffer_info.p_status;
1249 u16 hpi_instream_host_buffer_free(u32 h_instream)
1252 struct hpi_message hm;
1253 struct hpi_response hr;
1255 hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM,
1256 HPI_ISTREAM_HOSTBUFFER_FREE);
1257 if (hpi_handle_indexes(h_instream, &hm.adapter_index, &hm.obj_index))
1258 return HPI_ERROR_INVALID_HANDLE;
1259 hpi_send_recv(&hm, &hr);
1263 u16 hpi_instream_group_add(u32 h_instream, u32 h_stream)
1265 struct hpi_message hm;
1266 struct hpi_response hr;
1270 hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM,
1271 HPI_ISTREAM_GROUP_ADD);
1274 if (hpi_handle_indexes(h_instream, &hm.adapter_index, &hm.obj_index))
1275 return HPI_ERROR_INVALID_HANDLE;
1277 if (hpi_handle_indexes(h_stream, &adapter,
1278 &hm.u.d.u.stream.stream_index))
1279 return HPI_ERROR_INVALID_HANDLE;
1281 c_obj_type = hpi_handle_object(h_stream);
1283 switch (c_obj_type) {
1284 case HPI_OBJ_OSTREAM:
1285 case HPI_OBJ_ISTREAM:
1286 hm.u.d.u.stream.object_type = c_obj_type;
1289 return HPI_ERROR_INVALID_OBJ;
1292 if (adapter != hm.adapter_index)
1293 return HPI_ERROR_NO_INTERADAPTER_GROUPS;
1295 hpi_send_recv(&hm, &hr);
1299 u16 hpi_instream_group_get_map(u32 h_instream, u32 *poutstream_map,
1302 struct hpi_message hm;
1303 struct hpi_response hr;
1305 hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM,
1306 HPI_ISTREAM_HOSTBUFFER_FREE);
1307 if (hpi_handle_indexes(h_instream, &hm.adapter_index, &hm.obj_index))
1308 return HPI_ERROR_INVALID_HANDLE;
1309 hpi_send_recv(&hm, &hr);
1312 *poutstream_map = hr.u.d.u.group_info.outstream_group_map;
1314 *pinstream_map = hr.u.d.u.group_info.instream_group_map;
1319 u16 hpi_instream_group_reset(u32 h_instream)
1321 struct hpi_message hm;
1322 struct hpi_response hr;
1324 hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM,
1325 HPI_ISTREAM_GROUP_RESET);
1326 if (hpi_handle_indexes(h_instream, &hm.adapter_index, &hm.obj_index))
1327 return HPI_ERROR_INVALID_HANDLE;
1328 hpi_send_recv(&hm, &hr);
1332 u16 hpi_mixer_open(u16 adapter_index, u32 *ph_mixer)
1334 struct hpi_message hm;
1335 struct hpi_response hr;
1336 hpi_init_message_response(&hm, &hr, HPI_OBJ_MIXER, HPI_MIXER_OPEN);
1337 hm.adapter_index = adapter_index;
1339 hpi_send_recv(&hm, &hr);
1343 hpi_indexes_to_handle(HPI_OBJ_MIXER, adapter_index,
1350 u16 hpi_mixer_close(u32 h_mixer)
1352 struct hpi_message hm;
1353 struct hpi_response hr;
1355 hpi_init_message_response(&hm, &hr, HPI_OBJ_MIXER, HPI_MIXER_CLOSE);
1356 if (hpi_handle_indexes(h_mixer, &hm.adapter_index, NULL))
1357 return HPI_ERROR_INVALID_HANDLE;
1359 hpi_send_recv(&hm, &hr);
1363 u16 hpi_mixer_get_control(u32 h_mixer, u16 src_node_type,
1364 u16 src_node_type_index, u16 dst_node_type, u16 dst_node_type_index,
1365 u16 control_type, u32 *ph_control)
1367 struct hpi_message hm;
1368 struct hpi_response hr;
1369 hpi_init_message_response(&hm, &hr, HPI_OBJ_MIXER,
1370 HPI_MIXER_GET_CONTROL);
1371 if (hpi_handle_indexes(h_mixer, &hm.adapter_index, NULL))
1372 return HPI_ERROR_INVALID_HANDLE;
1373 hm.u.m.node_type1 = src_node_type;
1374 hm.u.m.node_index1 = src_node_type_index;
1375 hm.u.m.node_type2 = dst_node_type;
1376 hm.u.m.node_index2 = dst_node_type_index;
1377 hm.u.m.control_type = control_type;
1379 hpi_send_recv(&hm, &hr);
1383 hpi_indexes_to_handle(HPI_OBJ_CONTROL,
1384 hm.adapter_index, hr.u.m.control_index);
1390 u16 hpi_mixer_get_control_by_index(u32 h_mixer, u16 control_index,
1391 u16 *pw_src_node_type, u16 *pw_src_node_index, u16 *pw_dst_node_type,
1392 u16 *pw_dst_node_index, u16 *pw_control_type, u32 *ph_control)
1394 struct hpi_message hm;
1395 struct hpi_response hr;
1396 hpi_init_message_response(&hm, &hr, HPI_OBJ_MIXER,
1397 HPI_MIXER_GET_CONTROL_BY_INDEX);
1398 if (hpi_handle_indexes(h_mixer, &hm.adapter_index, NULL))
1399 return HPI_ERROR_INVALID_HANDLE;
1400 hm.u.m.control_index = control_index;
1401 hpi_send_recv(&hm, &hr);
1403 if (pw_src_node_type) {
1405 hr.u.m.src_node_type + HPI_SOURCENODE_NONE;
1406 *pw_src_node_index = hr.u.m.src_node_index;
1407 *pw_dst_node_type = hr.u.m.dst_node_type + HPI_DESTNODE_NONE;
1408 *pw_dst_node_index = hr.u.m.dst_node_index;
1410 if (pw_control_type)
1411 *pw_control_type = hr.u.m.control_index;
1416 hpi_indexes_to_handle(HPI_OBJ_CONTROL,
1417 hm.adapter_index, control_index);
1424 u16 hpi_mixer_store(u32 h_mixer, enum HPI_MIXER_STORE_COMMAND command,
1427 struct hpi_message hm;
1428 struct hpi_response hr;
1429 hpi_init_message_response(&hm, &hr, HPI_OBJ_MIXER, HPI_MIXER_STORE);
1430 if (hpi_handle_indexes(h_mixer, &hm.adapter_index, NULL))
1431 return HPI_ERROR_INVALID_HANDLE;
1432 hm.u.mx.store.command = command;
1433 hm.u.mx.store.index = index;
1434 hpi_send_recv(&hm, &hr);
1439 u16 hpi_control_param_set(const u32 h_control, const u16 attrib,
1440 const u32 param1, const u32 param2)
1442 struct hpi_message hm;
1443 struct hpi_response hr;
1445 hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL,
1446 HPI_CONTROL_SET_STATE);
1447 if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index))
1448 return HPI_ERROR_INVALID_HANDLE;
1449 hm.u.c.attribute = attrib;
1450 hm.u.c.param1 = param1;
1451 hm.u.c.param2 = param2;
1452 hpi_send_recv(&hm, &hr);
1456 static u16 hpi_control_log_set2(u32 h_control, u16 attrib, short sv0,
1459 struct hpi_message hm;
1460 struct hpi_response hr;
1462 hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL,
1463 HPI_CONTROL_SET_STATE);
1464 if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index))
1465 return HPI_ERROR_INVALID_HANDLE;
1466 hm.u.c.attribute = attrib;
1467 hm.u.c.an_log_value[0] = sv0;
1468 hm.u.c.an_log_value[1] = sv1;
1469 hpi_send_recv(&hm, &hr);
1474 u16 hpi_control_param_get(const u32 h_control, const u16 attrib, u32 param1,
1475 u32 param2, u32 *pparam1, u32 *pparam2)
1477 struct hpi_message hm;
1478 struct hpi_response hr;
1480 hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL,
1481 HPI_CONTROL_GET_STATE);
1482 if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index))
1483 return HPI_ERROR_INVALID_HANDLE;
1484 hm.u.c.attribute = attrib;
1485 hm.u.c.param1 = param1;
1486 hm.u.c.param2 = param2;
1487 hpi_send_recv(&hm, &hr);
1489 *pparam1 = hr.u.c.param1;
1491 *pparam2 = hr.u.c.param2;
1496 #define hpi_control_param1_get(h, a, p1) \
1497 hpi_control_param_get(h, a, 0, 0, p1, NULL)
1498 #define hpi_control_param2_get(h, a, p1, p2) \
1499 hpi_control_param_get(h, a, 0, 0, p1, p2)
1501 static u16 hpi_control_log_get2(u32 h_control, u16 attrib, short *sv0,
1504 struct hpi_message hm;
1505 struct hpi_response hr;
1506 hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL,
1507 HPI_CONTROL_GET_STATE);
1508 if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index))
1509 return HPI_ERROR_INVALID_HANDLE;
1510 hm.u.c.attribute = attrib;
1512 hpi_send_recv(&hm, &hr);
1513 *sv0 = hr.u.c.an_log_value[0];
1515 *sv1 = hr.u.c.an_log_value[1];
1520 u16 hpi_control_query(const u32 h_control, const u16 attrib, const u32 index,
1521 const u32 param, u32 *psetting)
1523 struct hpi_message hm;
1524 struct hpi_response hr;
1526 hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL,
1527 HPI_CONTROL_GET_INFO);
1528 if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index))
1529 return HPI_ERROR_INVALID_HANDLE;
1531 hm.u.c.attribute = attrib;
1532 hm.u.c.param1 = index;
1533 hm.u.c.param2 = param;
1535 hpi_send_recv(&hm, &hr);
1536 *psetting = hr.u.c.param1;
1541 static u16 hpi_control_get_string(const u32 h_control, const u16 attribute,
1542 char *psz_string, const u32 string_length)
1544 unsigned int sub_string_index = 0, j = 0;
1549 if ((string_length < 1) || (string_length > 256))
1550 return HPI_ERROR_INVALID_CONTROL_VALUE;
1551 for (sub_string_index = 0; sub_string_index < string_length;
1552 sub_string_index += 8) {
1553 struct hpi_message hm;
1554 struct hpi_response hr;
1556 hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL,
1557 HPI_CONTROL_GET_STATE);
1558 if (hpi_handle_indexes(h_control, &hm.adapter_index,
1560 return HPI_ERROR_INVALID_HANDLE;
1561 hm.u.c.attribute = attribute;
1562 hm.u.c.param1 = sub_string_index;
1564 hpi_send_recv(&hm, &hr);
1566 if (sub_string_index == 0
1567 && (hr.u.cu.chars8.remaining_chars + 8) >
1569 return HPI_ERROR_INVALID_CONTROL_VALUE;
1575 for (j = 0; j < 8; j++) {
1576 c = hr.u.cu.chars8.sz_data[j];
1577 psz_string[sub_string_index + j] = c;
1579 if (n >= string_length) {
1580 psz_string[string_length - 1] = 0;
1581 err = HPI_ERROR_INVALID_CONTROL_VALUE;
1588 if ((hr.u.cu.chars8.remaining_chars == 0)
1589 && ((sub_string_index + j) < string_length)
1592 psz_string[sub_string_index + j] = c;
1600 u16 hpi_aesebu_receiver_query_format(const u32 h_aes_rx, const u32 index,
1606 err = hpi_control_query(h_aes_rx, HPI_AESEBURX_FORMAT, index, 0, &qr);
1607 *pw_format = (u16)qr;
1611 u16 hpi_aesebu_receiver_set_format(u32 h_control, u16 format)
1613 return hpi_control_param_set(h_control, HPI_AESEBURX_FORMAT, format,
1617 u16 hpi_aesebu_receiver_get_format(u32 h_control, u16 *pw_format)
1622 err = hpi_control_param1_get(h_control, HPI_AESEBURX_FORMAT, ¶m);
1623 if (!err && pw_format)
1624 *pw_format = (u16)param;
1629 u16 hpi_aesebu_receiver_get_sample_rate(u32 h_control, u32 *psample_rate)
1631 return hpi_control_param1_get(h_control, HPI_AESEBURX_SAMPLERATE,
1635 u16 hpi_aesebu_receiver_get_user_data(u32 h_control, u16 index, u16 *pw_data)
1637 struct hpi_message hm;
1638 struct hpi_response hr;
1639 hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL,
1640 HPI_CONTROL_GET_STATE);
1641 if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index))
1642 return HPI_ERROR_INVALID_HANDLE;
1643 hm.u.c.attribute = HPI_AESEBURX_USERDATA;
1644 hm.u.c.param1 = index;
1646 hpi_send_recv(&hm, &hr);
1649 *pw_data = (u16)hr.u.c.param2;
1653 u16 hpi_aesebu_receiver_get_channel_status(u32 h_control, u16 index,
1656 struct hpi_message hm;
1657 struct hpi_response hr;
1658 hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL,
1659 HPI_CONTROL_GET_STATE);
1660 if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index))
1661 return HPI_ERROR_INVALID_HANDLE;
1662 hm.u.c.attribute = HPI_AESEBURX_CHANNELSTATUS;
1663 hm.u.c.param1 = index;
1665 hpi_send_recv(&hm, &hr);
1668 *pw_data = (u16)hr.u.c.param2;
1672 u16 hpi_aesebu_receiver_get_error_status(u32 h_control, u16 *pw_error_data)
1677 error = hpi_control_param1_get(h_control, HPI_AESEBURX_ERRORSTATUS,
1680 *pw_error_data = (u16)error_data;
1684 u16 hpi_aesebu_transmitter_set_sample_rate(u32 h_control, u32 sample_rate)
1686 return hpi_control_param_set(h_control, HPI_AESEBUTX_SAMPLERATE,
1690 u16 hpi_aesebu_transmitter_set_user_data(u32 h_control, u16 index, u16 data)
1692 return hpi_control_param_set(h_control, HPI_AESEBUTX_USERDATA, index,
1696 u16 hpi_aesebu_transmitter_set_channel_status(u32 h_control, u16 index,
1699 return hpi_control_param_set(h_control, HPI_AESEBUTX_CHANNELSTATUS,
1703 u16 hpi_aesebu_transmitter_get_channel_status(u32 h_control, u16 index,
1706 return HPI_ERROR_INVALID_OPERATION;
1709 u16 hpi_aesebu_transmitter_query_format(const u32 h_aes_tx, const u32 index,
1715 err = hpi_control_query(h_aes_tx, HPI_AESEBUTX_FORMAT, index, 0, &qr);
1716 *pw_format = (u16)qr;
1720 u16 hpi_aesebu_transmitter_set_format(u32 h_control, u16 output_format)
1722 return hpi_control_param_set(h_control, HPI_AESEBUTX_FORMAT,
1726 u16 hpi_aesebu_transmitter_get_format(u32 h_control, u16 *pw_output_format)
1731 err = hpi_control_param1_get(h_control, HPI_AESEBUTX_FORMAT, ¶m);
1732 if (!err && pw_output_format)
1733 *pw_output_format = (u16)param;
1738 u16 hpi_bitstream_set_clock_edge(u32 h_control, u16 edge_type)
1740 return hpi_control_param_set(h_control, HPI_BITSTREAM_CLOCK_EDGE,
1744 u16 hpi_bitstream_set_data_polarity(u32 h_control, u16 polarity)
1746 return hpi_control_param_set(h_control, HPI_BITSTREAM_DATA_POLARITY,
1750 u16 hpi_bitstream_get_activity(u32 h_control, u16 *pw_clk_activity,
1751 u16 *pw_data_activity)
1753 struct hpi_message hm;
1754 struct hpi_response hr;
1755 hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL,
1756 HPI_CONTROL_GET_STATE);
1757 if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index))
1758 return HPI_ERROR_INVALID_HANDLE;
1759 hm.u.c.attribute = HPI_BITSTREAM_ACTIVITY;
1760 hpi_send_recv(&hm, &hr);
1761 if (pw_clk_activity)
1762 *pw_clk_activity = (u16)hr.u.c.param1;
1763 if (pw_data_activity)
1764 *pw_data_activity = (u16)hr.u.c.param2;
1768 u16 hpi_channel_mode_query_mode(const u32 h_mode, const u32 index,
1774 err = hpi_control_query(h_mode, HPI_CHANNEL_MODE_MODE, index, 0, &qr);
1779 u16 hpi_channel_mode_set(u32 h_control, u16 mode)
1781 return hpi_control_param_set(h_control, HPI_CHANNEL_MODE_MODE, mode,
1785 u16 hpi_channel_mode_get(u32 h_control, u16 *mode)
1788 u16 error = hpi_control_param1_get(h_control,
1789 HPI_CHANNEL_MODE_MODE, &mode32);
1791 *mode = (u16)mode32;
1795 u16 hpi_cobranet_hmi_write(u32 h_control, u32 hmi_address, u32 byte_count,
1798 struct hpi_message hm;
1799 struct hpi_response hr;
1801 hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROLEX,
1802 HPI_CONTROL_SET_STATE);
1803 if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index))
1804 return HPI_ERROR_INVALID_HANDLE;
1806 hm.u.cx.u.cobranet_data.byte_count = byte_count;
1807 hm.u.cx.u.cobranet_data.hmi_address = hmi_address;
1809 if (byte_count <= 8) {
1810 memcpy(hm.u.cx.u.cobranet_data.data, pb_data, byte_count);
1811 hm.u.cx.attribute = HPI_COBRANET_SET;
1813 hm.u.cx.u.cobranet_bigdata.pb_data = pb_data;
1814 hm.u.cx.attribute = HPI_COBRANET_SET_DATA;
1817 hpi_send_recv(&hm, &hr);
1822 u16 hpi_cobranet_hmi_read(u32 h_control, u32 hmi_address, u32 max_byte_count,
1823 u32 *pbyte_count, u8 *pb_data)
1825 struct hpi_message hm;
1826 struct hpi_response hr;
1828 hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROLEX,
1829 HPI_CONTROL_GET_STATE);
1830 if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index))
1831 return HPI_ERROR_INVALID_HANDLE;
1833 hm.u.cx.u.cobranet_data.byte_count = max_byte_count;
1834 hm.u.cx.u.cobranet_data.hmi_address = hmi_address;
1836 if (max_byte_count <= 8) {
1837 hm.u.cx.attribute = HPI_COBRANET_GET;
1839 hm.u.cx.u.cobranet_bigdata.pb_data = pb_data;
1840 hm.u.cx.attribute = HPI_COBRANET_GET_DATA;
1843 hpi_send_recv(&hm, &hr);
1844 if (!hr.error && pb_data) {
1846 *pbyte_count = hr.u.cx.u.cobranet_data.byte_count;
1848 if (*pbyte_count < max_byte_count)
1849 max_byte_count = *pbyte_count;
1851 if (hm.u.cx.attribute == HPI_COBRANET_GET) {
1852 memcpy(pb_data, hr.u.cx.u.cobranet_data.data,
1862 u16 hpi_cobranet_hmi_get_status(u32 h_control, u32 *pstatus,
1863 u32 *preadable_size, u32 *pwriteable_size)
1865 struct hpi_message hm;
1866 struct hpi_response hr;
1868 hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROLEX,
1869 HPI_CONTROL_GET_STATE);
1870 if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index))
1871 return HPI_ERROR_INVALID_HANDLE;
1873 hm.u.cx.attribute = HPI_COBRANET_GET_STATUS;
1875 hpi_send_recv(&hm, &hr);
1878 *pstatus = hr.u.cx.u.cobranet_status.status;
1881 hr.u.cx.u.cobranet_status.readable_size;
1882 if (pwriteable_size)
1884 hr.u.cx.u.cobranet_status.writeable_size;
1889 u16 hpi_cobranet_get_ip_address(u32 h_control, u32 *pdw_ip_address)
1895 error = hpi_cobranet_hmi_read(h_control,
1896 HPI_COBRANET_HMI_cobra_ip_mon_currentIP, 4, &byte_count,
1900 ((iP & 0xff000000) >> 8) | ((iP & 0x00ff0000) << 8) | ((iP &
1901 0x0000ff00) >> 8) | ((iP & 0x000000ff) << 8);
1904 *pdw_ip_address = 0;
1910 u16 hpi_cobranet_set_ip_address(u32 h_control, u32 dw_ip_address)
1915 iP = ((dw_ip_address & 0xff000000) >> 8) | ((dw_ip_address &
1916 0x00ff0000) << 8) | ((dw_ip_address & 0x0000ff00) >>
1917 8) | ((dw_ip_address & 0x000000ff) << 8);
1919 error = hpi_cobranet_hmi_write(h_control,
1920 HPI_COBRANET_HMI_cobra_ip_mon_currentIP, 4, (u8 *)&iP);
1926 u16 hpi_cobranet_get_static_ip_address(u32 h_control, u32 *pdw_ip_address)
1931 error = hpi_cobranet_hmi_read(h_control,
1932 HPI_COBRANET_HMI_cobra_ip_mon_staticIP, 4, &byte_count,
1936 ((iP & 0xff000000) >> 8) | ((iP & 0x00ff0000) << 8) | ((iP &
1937 0x0000ff00) >> 8) | ((iP & 0x000000ff) << 8);
1940 *pdw_ip_address = 0;
1946 u16 hpi_cobranet_set_static_ip_address(u32 h_control, u32 dw_ip_address)
1951 iP = ((dw_ip_address & 0xff000000) >> 8) | ((dw_ip_address &
1952 0x00ff0000) << 8) | ((dw_ip_address & 0x0000ff00) >>
1953 8) | ((dw_ip_address & 0x000000ff) << 8);
1955 error = hpi_cobranet_hmi_write(h_control,
1956 HPI_COBRANET_HMI_cobra_ip_mon_staticIP, 4, (u8 *)&iP);
1962 u16 hpi_cobranet_get_macaddress(u32 h_control, u32 *pmAC_MS_bs,
1969 error = hpi_cobranet_hmi_read(h_control,
1970 HPI_COBRANET_HMI_cobra_if_phy_address, 4, &byte_count,
1973 ((mAC & 0xff000000) >> 8) | ((mAC & 0x00ff0000) << 8) | ((mAC
1974 & 0x0000ff00) >> 8) | ((mAC & 0x000000ff) << 8);
1975 error += hpi_cobranet_hmi_read(h_control,
1976 HPI_COBRANET_HMI_cobra_if_phy_address + 1, 4, &byte_count,
1979 ((mAC & 0xff000000) >> 8) | ((mAC & 0x00ff0000) << 8) | ((mAC
1980 & 0x0000ff00) >> 8) | ((mAC & 0x000000ff) << 8);
1990 u16 hpi_compander_set_enable(u32 h_control, u32 enable)
1992 return hpi_control_param_set(h_control, HPI_GENERIC_ENABLE, enable,
1996 u16 hpi_compander_get_enable(u32 h_control, u32 *enable)
1998 return hpi_control_param1_get(h_control, HPI_GENERIC_ENABLE, enable);
2001 u16 hpi_compander_set_makeup_gain(u32 h_control, short makeup_gain0_01dB)
2003 return hpi_control_log_set2(h_control, HPI_COMPANDER_MAKEUPGAIN,
2004 makeup_gain0_01dB, 0);
2007 u16 hpi_compander_get_makeup_gain(u32 h_control, short *makeup_gain0_01dB)
2009 return hpi_control_log_get2(h_control, HPI_COMPANDER_MAKEUPGAIN,
2010 makeup_gain0_01dB, NULL);
2013 u16 hpi_compander_set_attack_time_constant(u32 h_control, unsigned int index,
2016 return hpi_control_param_set(h_control, HPI_COMPANDER_ATTACK, attack,
2020 u16 hpi_compander_get_attack_time_constant(u32 h_control, unsigned int index,
2023 return hpi_control_param_get(h_control, HPI_COMPANDER_ATTACK, 0,
2024 index, attack, NULL);
2027 u16 hpi_compander_set_decay_time_constant(u32 h_control, unsigned int index,
2030 return hpi_control_param_set(h_control, HPI_COMPANDER_DECAY, decay,
2034 u16 hpi_compander_get_decay_time_constant(u32 h_control, unsigned int index,
2037 return hpi_control_param_get(h_control, HPI_COMPANDER_DECAY, 0, index,
2042 u16 hpi_compander_set_threshold(u32 h_control, unsigned int index,
2043 short threshold0_01dB)
2045 struct hpi_message hm;
2046 struct hpi_response hr;
2048 hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL,
2049 HPI_CONTROL_SET_STATE);
2050 if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index))
2051 return HPI_ERROR_INVALID_HANDLE;
2052 hm.u.c.attribute = HPI_COMPANDER_THRESHOLD;
2053 hm.u.c.param2 = index;
2054 hm.u.c.an_log_value[0] = threshold0_01dB;
2056 hpi_send_recv(&hm, &hr);
2061 u16 hpi_compander_get_threshold(u32 h_control, unsigned int index,
2062 short *threshold0_01dB)
2064 struct hpi_message hm;
2065 struct hpi_response hr;
2067 hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL,
2068 HPI_CONTROL_GET_STATE);
2069 if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index))
2070 return HPI_ERROR_INVALID_HANDLE;
2071 hm.u.c.attribute = HPI_COMPANDER_THRESHOLD;
2072 hm.u.c.param2 = index;
2074 hpi_send_recv(&hm, &hr);
2075 *threshold0_01dB = hr.u.c.an_log_value[0];
2080 u16 hpi_compander_set_ratio(u32 h_control, u32 index, u32 ratio100)
2082 return hpi_control_param_set(h_control, HPI_COMPANDER_RATIO, ratio100,
2086 u16 hpi_compander_get_ratio(u32 h_control, u32 index, u32 *ratio100)
2088 return hpi_control_param_get(h_control, HPI_COMPANDER_RATIO, 0, index,
2092 u16 hpi_level_query_range(u32 h_control, short *min_gain_01dB,
2093 short *max_gain_01dB, short *step_gain_01dB)
2095 struct hpi_message hm;
2096 struct hpi_response hr;
2098 hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL,
2099 HPI_CONTROL_GET_STATE);
2100 if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index))
2101 return HPI_ERROR_INVALID_HANDLE;
2102 hm.u.c.attribute = HPI_LEVEL_RANGE;
2104 hpi_send_recv(&hm, &hr);
2106 hr.u.c.an_log_value[0] = 0;
2107 hr.u.c.an_log_value[1] = 0;
2111 *min_gain_01dB = hr.u.c.an_log_value[0];
2113 *max_gain_01dB = hr.u.c.an_log_value[1];
2115 *step_gain_01dB = (short)hr.u.c.param1;
2119 u16 hpi_level_set_gain(u32 h_control, short an_gain0_01dB[HPI_MAX_CHANNELS]
2122 return hpi_control_log_set2(h_control, HPI_LEVEL_GAIN,
2123 an_gain0_01dB[0], an_gain0_01dB[1]);
2126 u16 hpi_level_get_gain(u32 h_control, short an_gain0_01dB[HPI_MAX_CHANNELS]
2129 return hpi_control_log_get2(h_control, HPI_LEVEL_GAIN,
2130 &an_gain0_01dB[0], &an_gain0_01dB[1]);
2133 u16 hpi_meter_query_channels(const u32 h_meter, u32 *p_channels)
2135 return hpi_control_query(h_meter, HPI_METER_NUM_CHANNELS, 0, 0,
2139 u16 hpi_meter_get_peak(u32 h_control, short an_peakdB[HPI_MAX_CHANNELS]
2144 struct hpi_message hm;
2145 struct hpi_response hr;
2147 hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL,
2148 HPI_CONTROL_GET_STATE);
2149 if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index))
2150 return HPI_ERROR_INVALID_HANDLE;
2151 hm.obj_index = hm.obj_index;
2152 hm.u.c.attribute = HPI_METER_PEAK;
2154 hpi_send_recv(&hm, &hr);
2157 memcpy(an_peakdB, hr.u.c.an_log_value,
2158 sizeof(short) * HPI_MAX_CHANNELS);
2160 for (i = 0; i < HPI_MAX_CHANNELS; i++)
2161 an_peakdB[i] = HPI_METER_MINIMUM;
2165 u16 hpi_meter_get_rms(u32 h_control, short an_rmsdB[HPI_MAX_CHANNELS]
2170 struct hpi_message hm;
2171 struct hpi_response hr;
2173 hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL,
2174 HPI_CONTROL_GET_STATE);
2175 if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index))
2176 return HPI_ERROR_INVALID_HANDLE;
2177 hm.u.c.attribute = HPI_METER_RMS;
2179 hpi_send_recv(&hm, &hr);
2182 memcpy(an_rmsdB, hr.u.c.an_log_value,
2183 sizeof(short) * HPI_MAX_CHANNELS);
2185 for (i = 0; i < HPI_MAX_CHANNELS; i++)
2186 an_rmsdB[i] = HPI_METER_MINIMUM;
2191 u16 hpi_meter_set_rms_ballistics(u32 h_control, u16 attack, u16 decay)
2193 return hpi_control_param_set(h_control, HPI_METER_RMS_BALLISTICS,
2197 u16 hpi_meter_get_rms_ballistics(u32 h_control, u16 *pn_attack, u16 *pn_decay)
2203 error = hpi_control_param2_get(h_control, HPI_METER_RMS_BALLISTICS,
2207 *pn_attack = (unsigned short)attack;
2209 *pn_decay = (unsigned short)decay;
2214 u16 hpi_meter_set_peak_ballistics(u32 h_control, u16 attack, u16 decay)
2216 return hpi_control_param_set(h_control, HPI_METER_PEAK_BALLISTICS,
2220 u16 hpi_meter_get_peak_ballistics(u32 h_control, u16 *pn_attack,
2227 error = hpi_control_param2_get(h_control, HPI_METER_PEAK_BALLISTICS,
2231 *pn_attack = (short)attack;
2233 *pn_decay = (short)decay;
2238 u16 hpi_microphone_set_phantom_power(u32 h_control, u16 on_off)
2240 return hpi_control_param_set(h_control, HPI_MICROPHONE_PHANTOM_POWER,
2244 u16 hpi_microphone_get_phantom_power(u32 h_control, u16 *pw_on_off)
2248 error = hpi_control_param1_get(h_control,
2249 HPI_MICROPHONE_PHANTOM_POWER, &on_off);
2251 *pw_on_off = (u16)on_off;
2255 u16 hpi_multiplexer_set_source(u32 h_control, u16 source_node_type,
2256 u16 source_node_index)
2258 return hpi_control_param_set(h_control, HPI_MULTIPLEXER_SOURCE,
2259 source_node_type, source_node_index);
2262 u16 hpi_multiplexer_get_source(u32 h_control, u16 *source_node_type,
2263 u16 *source_node_index)
2266 u16 error = hpi_control_param2_get(h_control,
2267 HPI_MULTIPLEXER_SOURCE, &node,
2269 if (source_node_type)
2270 *source_node_type = (u16)node;
2271 if (source_node_index)
2272 *source_node_index = (u16)index;
2276 u16 hpi_multiplexer_query_source(u32 h_control, u16 index,
2277 u16 *source_node_type, u16 *source_node_index)
2279 struct hpi_message hm;
2280 struct hpi_response hr;
2281 hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL,
2282 HPI_CONTROL_GET_STATE);
2283 if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index))
2284 return HPI_ERROR_INVALID_HANDLE;
2285 hm.u.c.attribute = HPI_MULTIPLEXER_QUERYSOURCE;
2286 hm.u.c.param1 = index;
2288 hpi_send_recv(&hm, &hr);
2290 if (source_node_type)
2291 *source_node_type = (u16)hr.u.c.param1;
2292 if (source_node_index)
2293 *source_node_index = (u16)hr.u.c.param2;
2297 u16 hpi_parametric_eq_get_info(u32 h_control, u16 *pw_number_of_bands,
2304 error = hpi_control_param2_get(h_control, HPI_EQUALIZER_NUM_FILTERS,
2306 if (pw_number_of_bands)
2307 *pw_number_of_bands = (u16)oB;
2309 *pw_on_off = (u16)oO;
2313 u16 hpi_parametric_eq_set_state(u32 h_control, u16 on_off)
2315 return hpi_control_param_set(h_control, HPI_EQUALIZER_NUM_FILTERS,
2319 u16 hpi_parametric_eq_get_band(u32 h_control, u16 index, u16 *pn_type,
2320 u32 *pfrequency_hz, short *pnQ100, short *pn_gain0_01dB)
2322 struct hpi_message hm;
2323 struct hpi_response hr;
2325 hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL,
2326 HPI_CONTROL_GET_STATE);
2327 if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index))
2328 return HPI_ERROR_INVALID_HANDLE;
2329 hm.u.c.attribute = HPI_EQUALIZER_FILTER;
2330 hm.u.c.param2 = index;
2332 hpi_send_recv(&hm, &hr);
2335 *pfrequency_hz = hr.u.c.param1;
2337 *pn_type = (u16)(hr.u.c.param2 >> 16);
2339 *pnQ100 = hr.u.c.an_log_value[1];
2341 *pn_gain0_01dB = hr.u.c.an_log_value[0];
2346 u16 hpi_parametric_eq_set_band(u32 h_control, u16 index, u16 type,
2347 u32 frequency_hz, short q100, short gain0_01dB)
2349 struct hpi_message hm;
2350 struct hpi_response hr;
2352 hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL,
2353 HPI_CONTROL_SET_STATE);
2354 if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index))
2355 return HPI_ERROR_INVALID_HANDLE;
2357 hm.u.c.param1 = frequency_hz;
2358 hm.u.c.param2 = (index & 0xFFFFL) + ((u32)type << 16);
2359 hm.u.c.an_log_value[0] = gain0_01dB;
2360 hm.u.c.an_log_value[1] = q100;
2361 hm.u.c.attribute = HPI_EQUALIZER_FILTER;
2363 hpi_send_recv(&hm, &hr);
2368 u16 hpi_parametric_eq_get_coeffs(u32 h_control, u16 index, short coeffs[5]
2371 struct hpi_message hm;
2372 struct hpi_response hr;
2374 hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL,
2375 HPI_CONTROL_GET_STATE);
2376 if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index))
2377 return HPI_ERROR_INVALID_HANDLE;
2378 hm.u.c.attribute = HPI_EQUALIZER_COEFFICIENTS;
2379 hm.u.c.param2 = index;
2381 hpi_send_recv(&hm, &hr);
2383 coeffs[0] = (short)hr.u.c.an_log_value[0];
2384 coeffs[1] = (short)hr.u.c.an_log_value[1];
2385 coeffs[2] = (short)hr.u.c.param1;
2386 coeffs[3] = (short)(hr.u.c.param1 >> 16);
2387 coeffs[4] = (short)hr.u.c.param2;
2392 u16 hpi_sample_clock_query_source(const u32 h_clock, const u32 index,
2398 err = hpi_control_query(h_clock, HPI_SAMPLECLOCK_SOURCE, index, 0,
2400 *pw_source = (u16)qr;
2404 u16 hpi_sample_clock_set_source(u32 h_control, u16 source)
2406 return hpi_control_param_set(h_control, HPI_SAMPLECLOCK_SOURCE,
2410 u16 hpi_sample_clock_get_source(u32 h_control, u16 *pw_source)
2414 error = hpi_control_param1_get(h_control, HPI_SAMPLECLOCK_SOURCE,
2418 *pw_source = (u16)source;
2422 u16 hpi_sample_clock_query_source_index(const u32 h_clock, const u32 index,
2423 const u32 source, u16 *pw_source_index)
2428 err = hpi_control_query(h_clock, HPI_SAMPLECLOCK_SOURCE_INDEX, index,
2430 *pw_source_index = (u16)qr;
2434 u16 hpi_sample_clock_set_source_index(u32 h_control, u16 source_index)
2436 return hpi_control_param_set(h_control, HPI_SAMPLECLOCK_SOURCE_INDEX,
2440 u16 hpi_sample_clock_get_source_index(u32 h_control, u16 *pw_source_index)
2443 u32 source_index = 0;
2444 error = hpi_control_param1_get(h_control,
2445 HPI_SAMPLECLOCK_SOURCE_INDEX, &source_index);
2447 if (pw_source_index)
2448 *pw_source_index = (u16)source_index;
2452 u16 hpi_sample_clock_query_local_rate(const u32 h_clock, const u32 index,
2456 err = hpi_control_query(h_clock, HPI_SAMPLECLOCK_LOCAL_SAMPLERATE,
2462 u16 hpi_sample_clock_set_local_rate(u32 h_control, u32 sample_rate)
2464 return hpi_control_param_set(h_control,
2465 HPI_SAMPLECLOCK_LOCAL_SAMPLERATE, sample_rate, 0);
2468 u16 hpi_sample_clock_get_local_rate(u32 h_control, u32 *psample_rate)
2471 u32 sample_rate = 0;
2472 error = hpi_control_param1_get(h_control,
2473 HPI_SAMPLECLOCK_LOCAL_SAMPLERATE, &sample_rate);
2476 *psample_rate = sample_rate;
2480 u16 hpi_sample_clock_get_sample_rate(u32 h_control, u32 *psample_rate)
2483 u32 sample_rate = 0;
2484 error = hpi_control_param1_get(h_control, HPI_SAMPLECLOCK_SAMPLERATE,
2488 *psample_rate = sample_rate;
2492 u16 hpi_sample_clock_set_auto(u32 h_control, u32 enable)
2494 return hpi_control_param_set(h_control, HPI_SAMPLECLOCK_AUTO, enable,
2498 u16 hpi_sample_clock_get_auto(u32 h_control, u32 *penable)
2500 return hpi_control_param1_get(h_control, HPI_SAMPLECLOCK_AUTO,
2504 u16 hpi_sample_clock_set_local_rate_lock(u32 h_control, u32 lock)
2506 return hpi_control_param_set(h_control, HPI_SAMPLECLOCK_LOCAL_LOCK,
2510 u16 hpi_sample_clock_get_local_rate_lock(u32 h_control, u32 *plock)
2512 return hpi_control_param1_get(h_control, HPI_SAMPLECLOCK_LOCAL_LOCK,
2516 u16 hpi_tone_detector_get_frequency(u32 h_control, u32 index, u32 *frequency)
2518 return hpi_control_param_get(h_control, HPI_TONEDETECTOR_FREQUENCY,
2519 index, 0, frequency, NULL);
2522 u16 hpi_tone_detector_get_state(u32 h_control, u32 *state)
2524 return hpi_control_param1_get(h_control, HPI_TONEDETECTOR_STATE,
2528 u16 hpi_tone_detector_set_enable(u32 h_control, u32 enable)
2530 return hpi_control_param_set(h_control, HPI_GENERIC_ENABLE, enable,
2534 u16 hpi_tone_detector_get_enable(u32 h_control, u32 *enable)
2536 return hpi_control_param1_get(h_control, HPI_GENERIC_ENABLE, enable);
2539 u16 hpi_tone_detector_set_event_enable(u32 h_control, u32 event_enable)
2541 return hpi_control_param_set(h_control, HPI_GENERIC_EVENT_ENABLE,
2542 (u32)event_enable, 0);
2545 u16 hpi_tone_detector_get_event_enable(u32 h_control, u32 *event_enable)
2547 return hpi_control_param1_get(h_control, HPI_GENERIC_EVENT_ENABLE,
2551 u16 hpi_tone_detector_set_threshold(u32 h_control, int threshold)
2553 return hpi_control_param_set(h_control, HPI_TONEDETECTOR_THRESHOLD,
2557 u16 hpi_tone_detector_get_threshold(u32 h_control, int *threshold)
2559 return hpi_control_param1_get(h_control, HPI_TONEDETECTOR_THRESHOLD,
2563 u16 hpi_silence_detector_get_state(u32 h_control, u32 *state)
2565 return hpi_control_param1_get(h_control, HPI_SILENCEDETECTOR_STATE,
2569 u16 hpi_silence_detector_set_enable(u32 h_control, u32 enable)
2571 return hpi_control_param_set(h_control, HPI_GENERIC_ENABLE, enable,
2575 u16 hpi_silence_detector_get_enable(u32 h_control, u32 *enable)
2577 return hpi_control_param1_get(h_control, HPI_GENERIC_ENABLE, enable);
2580 u16 hpi_silence_detector_set_event_enable(u32 h_control, u32 event_enable)
2582 return hpi_control_param_set(h_control, HPI_GENERIC_EVENT_ENABLE,
2586 u16 hpi_silence_detector_get_event_enable(u32 h_control, u32 *event_enable)
2588 return hpi_control_param1_get(h_control, HPI_GENERIC_EVENT_ENABLE,
2592 u16 hpi_silence_detector_set_delay(u32 h_control, u32 delay)
2594 return hpi_control_param_set(h_control, HPI_SILENCEDETECTOR_DELAY,
2598 u16 hpi_silence_detector_get_delay(u32 h_control, u32 *delay)
2600 return hpi_control_param1_get(h_control, HPI_SILENCEDETECTOR_DELAY,
2604 u16 hpi_silence_detector_set_threshold(u32 h_control, int threshold)
2606 return hpi_control_param_set(h_control, HPI_SILENCEDETECTOR_THRESHOLD,
2610 u16 hpi_silence_detector_get_threshold(u32 h_control, int *threshold)
2612 return hpi_control_param1_get(h_control,
2613 HPI_SILENCEDETECTOR_THRESHOLD, (u32 *)threshold);
2616 u16 hpi_tuner_query_band(const u32 h_tuner, const u32 index, u16 *pw_band)
2621 err = hpi_control_query(h_tuner, HPI_TUNER_BAND, index, 0, &qr);
2626 u16 hpi_tuner_set_band(u32 h_control, u16 band)
2628 return hpi_control_param_set(h_control, HPI_TUNER_BAND, band, 0);
2631 u16 hpi_tuner_get_band(u32 h_control, u16 *pw_band)
2636 error = hpi_control_param1_get(h_control, HPI_TUNER_BAND, &band);
2638 *pw_band = (u16)band;
2642 u16 hpi_tuner_query_frequency(const u32 h_tuner, const u32 index,
2643 const u16 band, u32 *pfreq)
2645 return hpi_control_query(h_tuner, HPI_TUNER_FREQ, index, band, pfreq);
2648 u16 hpi_tuner_set_frequency(u32 h_control, u32 freq_ink_hz)
2650 return hpi_control_param_set(h_control, HPI_TUNER_FREQ, freq_ink_hz,
2654 u16 hpi_tuner_get_frequency(u32 h_control, u32 *pw_freq_ink_hz)
2656 return hpi_control_param1_get(h_control, HPI_TUNER_FREQ,
2660 u16 hpi_tuner_query_gain(const u32 h_tuner, const u32 index, u16 *pw_gain)
2665 err = hpi_control_query(h_tuner, HPI_TUNER_BAND, index, 0, &qr);
2670 u16 hpi_tuner_set_gain(u32 h_control, short gain)
2672 return hpi_control_param_set(h_control, HPI_TUNER_GAIN, gain, 0);
2675 u16 hpi_tuner_get_gain(u32 h_control, short *pn_gain)
2680 error = hpi_control_param1_get(h_control, HPI_TUNER_GAIN, &gain);
2682 *pn_gain = (u16)gain;
2686 u16 hpi_tuner_get_rf_level(u32 h_control, short *pw_level)
2688 struct hpi_message hm;
2689 struct hpi_response hr;
2691 hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL,
2692 HPI_CONTROL_GET_STATE);
2693 if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index))
2694 return HPI_ERROR_INVALID_HANDLE;
2695 hm.u.cu.attribute = HPI_TUNER_LEVEL_AVG;
2696 hpi_send_recv(&hm, &hr);
2698 *pw_level = hr.u.cu.tuner.s_level;
2702 u16 hpi_tuner_get_raw_rf_level(u32 h_control, short *pw_level)
2704 struct hpi_message hm;
2705 struct hpi_response hr;
2707 hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL,
2708 HPI_CONTROL_GET_STATE);
2709 if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index))
2710 return HPI_ERROR_INVALID_HANDLE;
2711 hm.u.cu.attribute = HPI_TUNER_LEVEL_RAW;
2712 hpi_send_recv(&hm, &hr);
2714 *pw_level = hr.u.cu.tuner.s_level;
2718 u16 hpi_tuner_query_deemphasis(const u32 h_tuner, const u32 index,
2719 const u16 band, u32 *pdeemphasis)
2721 return hpi_control_query(h_tuner, HPI_TUNER_DEEMPHASIS, index, band,
2725 u16 hpi_tuner_set_deemphasis(u32 h_control, u32 deemphasis)
2727 return hpi_control_param_set(h_control, HPI_TUNER_DEEMPHASIS,
2731 u16 hpi_tuner_get_deemphasis(u32 h_control, u32 *pdeemphasis)
2733 return hpi_control_param1_get(h_control, HPI_TUNER_DEEMPHASIS,
2737 u16 hpi_tuner_query_program(const u32 h_tuner, u32 *pbitmap_program)
2739 return hpi_control_query(h_tuner, HPI_TUNER_PROGRAM, 0, 0,
2743 u16 hpi_tuner_set_program(u32 h_control, u32 program)
2745 return hpi_control_param_set(h_control, HPI_TUNER_PROGRAM, program,
2749 u16 hpi_tuner_get_program(u32 h_control, u32 *pprogram)
2751 return hpi_control_param1_get(h_control, HPI_TUNER_PROGRAM, pprogram);
2754 u16 hpi_tuner_get_hd_radio_dsp_version(u32 h_control, char *psz_dsp_version,
2755 const u32 string_size)
2757 return hpi_control_get_string(h_control,
2758 HPI_TUNER_HDRADIO_DSP_VERSION, psz_dsp_version, string_size);
2761 u16 hpi_tuner_get_hd_radio_sdk_version(u32 h_control, char *psz_sdk_version,
2762 const u32 string_size)
2764 return hpi_control_get_string(h_control,
2765 HPI_TUNER_HDRADIO_SDK_VERSION, psz_sdk_version, string_size);
2768 u16 hpi_tuner_get_status(u32 h_control, u16 *pw_status_mask, u16 *pw_status)
2773 error = hpi_control_param1_get(h_control, HPI_TUNER_STATUS, &status);
2776 *pw_status_mask = (u16)(status >> 16);
2777 *pw_status = (u16)(status & 0xFFFF);
2779 *pw_status_mask = 0;
2786 u16 hpi_tuner_set_mode(u32 h_control, u32 mode, u32 value)
2788 return hpi_control_param_set(h_control, HPI_TUNER_MODE, mode, value);
2791 u16 hpi_tuner_get_mode(u32 h_control, u32 mode, u32 *pn_value)
2793 return hpi_control_param_get(h_control, HPI_TUNER_MODE, mode, 0,
2797 u16 hpi_tuner_get_hd_radio_signal_quality(u32 h_control, u32 *pquality)
2799 return hpi_control_param1_get(h_control,
2800 HPI_TUNER_HDRADIO_SIGNAL_QUALITY, pquality);
2803 u16 hpi_tuner_get_hd_radio_signal_blend(u32 h_control, u32 *pblend)
2805 return hpi_control_param1_get(h_control, HPI_TUNER_HDRADIO_BLEND,
2809 u16 hpi_tuner_set_hd_radio_signal_blend(u32 h_control, const u32 blend)
2811 return hpi_control_param_set(h_control, HPI_TUNER_HDRADIO_BLEND,
2815 u16 hpi_tuner_get_rds(u32 h_control, char *p_data)
2817 struct hpi_message hm;
2818 struct hpi_response hr;
2820 hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL,
2821 HPI_CONTROL_GET_STATE);
2822 if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index))
2823 return HPI_ERROR_INVALID_HANDLE;
2824 hm.u.c.attribute = HPI_TUNER_RDS;
2825 hpi_send_recv(&hm, &hr);
2827 *(u32 *)&p_data[0] = hr.u.cu.tuner.rds.data[0];
2828 *(u32 *)&p_data[4] = hr.u.cu.tuner.rds.data[1];
2829 *(u32 *)&p_data[8] = hr.u.cu.tuner.rds.bLER;
2834 u16 hpi_pad_get_channel_name(u32 h_control, char *psz_string,
2835 const u32 data_length)
2837 return hpi_control_get_string(h_control, HPI_PAD_CHANNEL_NAME,
2838 psz_string, data_length);
2841 u16 hpi_pad_get_artist(u32 h_control, char *psz_string, const u32 data_length)
2843 return hpi_control_get_string(h_control, HPI_PAD_ARTIST, psz_string,
2847 u16 hpi_pad_get_title(u32 h_control, char *psz_string, const u32 data_length)
2849 return hpi_control_get_string(h_control, HPI_PAD_TITLE, psz_string,
2853 u16 hpi_pad_get_comment(u32 h_control, char *psz_string,
2854 const u32 data_length)
2856 return hpi_control_get_string(h_control, HPI_PAD_COMMENT, psz_string,
2860 u16 hpi_pad_get_program_type(u32 h_control, u32 *ppTY)
2862 return hpi_control_param1_get(h_control, HPI_PAD_PROGRAM_TYPE, ppTY);
2865 u16 hpi_pad_get_rdsPI(u32 h_control, u32 *ppI)
2867 return hpi_control_param1_get(h_control, HPI_PAD_PROGRAM_ID, ppI);
2870 u16 hpi_volume_query_channels(const u32 h_volume, u32 *p_channels)
2872 return hpi_control_query(h_volume, HPI_VOLUME_NUM_CHANNELS, 0, 0,
2876 u16 hpi_volume_set_gain(u32 h_control, short an_log_gain[HPI_MAX_CHANNELS]
2879 return hpi_control_log_set2(h_control, HPI_VOLUME_GAIN,
2880 an_log_gain[0], an_log_gain[1]);
2883 u16 hpi_volume_get_gain(u32 h_control, short an_log_gain[HPI_MAX_CHANNELS]
2886 return hpi_control_log_get2(h_control, HPI_VOLUME_GAIN,
2887 &an_log_gain[0], &an_log_gain[1]);
2890 u16 hpi_volume_query_range(u32 h_control, short *min_gain_01dB,
2891 short *max_gain_01dB, short *step_gain_01dB)
2893 struct hpi_message hm;
2894 struct hpi_response hr;
2896 hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL,
2897 HPI_CONTROL_GET_STATE);
2898 if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index))
2899 return HPI_ERROR_INVALID_HANDLE;
2900 hm.u.c.attribute = HPI_VOLUME_RANGE;
2902 hpi_send_recv(&hm, &hr);
2904 hr.u.c.an_log_value[0] = 0;
2905 hr.u.c.an_log_value[1] = 0;
2909 *min_gain_01dB = hr.u.c.an_log_value[0];
2911 *max_gain_01dB = hr.u.c.an_log_value[1];
2913 *step_gain_01dB = (short)hr.u.c.param1;
2917 u16 hpi_volume_auto_fade_profile(u32 h_control,
2918 short an_stop_gain0_01dB[HPI_MAX_CHANNELS], u32 duration_ms,
2921 struct hpi_message hm;
2922 struct hpi_response hr;
2924 hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL,
2925 HPI_CONTROL_SET_STATE);
2926 if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index))
2927 return HPI_ERROR_INVALID_HANDLE;
2929 memcpy(hm.u.c.an_log_value, an_stop_gain0_01dB,
2930 sizeof(short) * HPI_MAX_CHANNELS);
2932 hm.u.c.attribute = HPI_VOLUME_AUTOFADE;
2933 hm.u.c.param1 = duration_ms;
2934 hm.u.c.param2 = profile;
2936 hpi_send_recv(&hm, &hr);
2941 u16 hpi_volume_auto_fade(u32 h_control,
2942 short an_stop_gain0_01dB[HPI_MAX_CHANNELS], u32 duration_ms)
2944 return hpi_volume_auto_fade_profile(h_control, an_stop_gain0_01dB,
2945 duration_ms, HPI_VOLUME_AUTOFADE_LOG);
2948 u16 hpi_vox_set_threshold(u32 h_control, short an_gain0_01dB)
2950 struct hpi_message hm;
2951 struct hpi_response hr;
2952 hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL,
2953 HPI_CONTROL_SET_STATE);
2954 if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index))
2955 return HPI_ERROR_INVALID_HANDLE;
2956 hm.u.c.attribute = HPI_VOX_THRESHOLD;
2958 hm.u.c.an_log_value[0] = an_gain0_01dB;
2960 hpi_send_recv(&hm, &hr);
2965 u16 hpi_vox_get_threshold(u32 h_control, short *an_gain0_01dB)
2967 struct hpi_message hm;
2968 struct hpi_response hr;
2969 hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL,
2970 HPI_CONTROL_GET_STATE);
2971 if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index))
2972 return HPI_ERROR_INVALID_HANDLE;
2973 hm.u.c.attribute = HPI_VOX_THRESHOLD;
2975 hpi_send_recv(&hm, &hr);
2977 *an_gain0_01dB = hr.u.c.an_log_value[0];