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 void hpi_handle_to_indexes(const u32 handle
, u16
*pw_adapter_index
,
36 union handle_word uhandle
;
40 *pw_adapter_index
= (u16
)uhandle
.h
.adapter_index
;
42 *pw_object_index
= (u16
)uhandle
.h
.obj_index
;
45 char hpi_handle_object(const u32 handle
)
47 union handle_word uhandle
;
49 return (char)uhandle
.h
.obj_type
;
52 #define u32TOINDEX(h, i1) \
55 return HPI_ERROR_INVALID_OBJ; \
57 hpi_handle_to_indexes(h, i1, NULL); \
60 #define u32TOINDEXES(h, i1, i2) \
63 return HPI_ERROR_INVALID_OBJ; \
65 hpi_handle_to_indexes(h, i1, i2);\
68 void hpi_format_to_msg(struct hpi_msg_format
*pMF
,
69 const struct hpi_format
*pF
)
71 pMF
->sample_rate
= pF
->sample_rate
;
72 pMF
->bit_rate
= pF
->bit_rate
;
73 pMF
->attributes
= pF
->attributes
;
74 pMF
->channels
= pF
->channels
;
75 pMF
->format
= pF
->format
;
78 static void hpi_msg_to_format(struct hpi_format
*pF
,
79 struct hpi_msg_format
*pMF
)
81 pF
->sample_rate
= pMF
->sample_rate
;
82 pF
->bit_rate
= pMF
->bit_rate
;
83 pF
->attributes
= pMF
->attributes
;
84 pF
->channels
= pMF
->channels
;
85 pF
->format
= pMF
->format
;
90 void hpi_stream_response_to_legacy(struct hpi_stream_res
*pSR
)
92 pSR
->u
.legacy_stream_info
.auxiliary_data_available
=
93 pSR
->u
.stream_info
.auxiliary_data_available
;
94 pSR
->u
.legacy_stream_info
.state
= pSR
->u
.stream_info
.state
;
97 static struct hpi_hsubsys gh_subsys
;
99 struct hpi_hsubsys
*hpi_subsys_create(void)
101 struct hpi_message hm
;
102 struct hpi_response hr
;
104 memset(&gh_subsys
, 0, sizeof(struct hpi_hsubsys
));
107 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_SUBSYSTEM
,
109 hpi_send_recv(&hm
, &hr
);
118 void hpi_subsys_free(const struct hpi_hsubsys
*ph_subsys
)
120 struct hpi_message hm
;
121 struct hpi_response hr
;
123 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_SUBSYSTEM
,
125 hpi_send_recv(&hm
, &hr
);
129 u16
hpi_subsys_get_version(const struct hpi_hsubsys
*ph_subsys
, u32
*pversion
)
131 struct hpi_message hm
;
132 struct hpi_response hr
;
134 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_SUBSYSTEM
,
135 HPI_SUBSYS_GET_VERSION
);
136 hpi_send_recv(&hm
, &hr
);
137 *pversion
= hr
.u
.s
.version
;
141 u16
hpi_subsys_get_version_ex(const struct hpi_hsubsys
*ph_subsys
,
144 struct hpi_message hm
;
145 struct hpi_response hr
;
147 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_SUBSYSTEM
,
148 HPI_SUBSYS_GET_VERSION
);
149 hpi_send_recv(&hm
, &hr
);
150 *pversion_ex
= hr
.u
.s
.data
;
154 u16
hpi_subsys_get_info(const struct hpi_hsubsys
*ph_subsys
, u32
*pversion
,
155 u16
*pw_num_adapters
, u16 aw_adapter_list
[], u16 list_length
)
157 struct hpi_message hm
;
158 struct hpi_response hr
;
159 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_SUBSYSTEM
,
160 HPI_SUBSYS_GET_INFO
);
162 hpi_send_recv(&hm
, &hr
);
164 *pversion
= hr
.u
.s
.version
;
165 if (list_length
> HPI_MAX_ADAPTERS
)
166 memcpy(aw_adapter_list
, &hr
.u
.s
.aw_adapter_list
,
169 memcpy(aw_adapter_list
, &hr
.u
.s
.aw_adapter_list
, list_length
);
170 *pw_num_adapters
= hr
.u
.s
.num_adapters
;
174 u16
hpi_subsys_find_adapters(const struct hpi_hsubsys
*ph_subsys
,
175 u16
*pw_num_adapters
, u16 aw_adapter_list
[], u16 list_length
)
177 struct hpi_message hm
;
178 struct hpi_response hr
;
179 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_SUBSYSTEM
,
180 HPI_SUBSYS_FIND_ADAPTERS
);
182 hpi_send_recv(&hm
, &hr
);
184 if (list_length
> HPI_MAX_ADAPTERS
) {
185 memcpy(aw_adapter_list
, &hr
.u
.s
.aw_adapter_list
,
186 HPI_MAX_ADAPTERS
* sizeof(u16
));
187 memset(&aw_adapter_list
[HPI_MAX_ADAPTERS
], 0,
188 (list_length
- HPI_MAX_ADAPTERS
) * sizeof(u16
));
190 memcpy(aw_adapter_list
, &hr
.u
.s
.aw_adapter_list
,
191 list_length
* sizeof(u16
));
192 *pw_num_adapters
= hr
.u
.s
.num_adapters
;
197 u16
hpi_subsys_create_adapter(const struct hpi_hsubsys
*ph_subsys
,
198 const struct hpi_resource
*p_resource
, u16
*pw_adapter_index
)
200 struct hpi_message hm
;
201 struct hpi_response hr
;
203 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_SUBSYSTEM
,
204 HPI_SUBSYS_CREATE_ADAPTER
);
205 hm
.u
.s
.resource
= *p_resource
;
207 hpi_send_recv(&hm
, &hr
);
209 *pw_adapter_index
= hr
.u
.s
.adapter_index
;
213 u16
hpi_subsys_delete_adapter(const struct hpi_hsubsys
*ph_subsys
,
216 struct hpi_message hm
;
217 struct hpi_response hr
;
218 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_SUBSYSTEM
,
219 HPI_SUBSYS_DELETE_ADAPTER
);
220 hm
.adapter_index
= adapter_index
;
221 hpi_send_recv(&hm
, &hr
);
225 u16
hpi_subsys_get_num_adapters(const struct hpi_hsubsys
*ph_subsys
,
226 int *pn_num_adapters
)
228 struct hpi_message hm
;
229 struct hpi_response hr
;
230 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_SUBSYSTEM
,
231 HPI_SUBSYS_GET_NUM_ADAPTERS
);
232 hpi_send_recv(&hm
, &hr
);
233 *pn_num_adapters
= (int)hr
.u
.s
.num_adapters
;
237 u16
hpi_subsys_get_adapter(const struct hpi_hsubsys
*ph_subsys
, int iterator
,
238 u32
*padapter_index
, u16
*pw_adapter_type
)
240 struct hpi_message hm
;
241 struct hpi_response hr
;
242 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_SUBSYSTEM
,
243 HPI_SUBSYS_GET_ADAPTER
);
244 hm
.adapter_index
= (u16
)iterator
;
245 hpi_send_recv(&hm
, &hr
);
246 *padapter_index
= (int)hr
.u
.s
.adapter_index
;
247 *pw_adapter_type
= hr
.u
.s
.aw_adapter_list
[0];
251 u16
hpi_subsys_set_host_network_interface(const struct hpi_hsubsys
*ph_subsys
,
252 const char *sz_interface
)
254 struct hpi_message hm
;
255 struct hpi_response hr
;
256 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_SUBSYSTEM
,
257 HPI_SUBSYS_SET_NETWORK_INTERFACE
);
258 if (sz_interface
== NULL
)
259 return HPI_ERROR_INVALID_RESOURCE
;
260 hm
.u
.s
.resource
.r
.net_if
= sz_interface
;
261 hpi_send_recv(&hm
, &hr
);
265 u16
hpi_adapter_open(const struct hpi_hsubsys
*ph_subsys
, u16 adapter_index
)
267 struct hpi_message hm
;
268 struct hpi_response hr
;
269 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_ADAPTER
,
271 hm
.adapter_index
= adapter_index
;
273 hpi_send_recv(&hm
, &hr
);
279 u16
hpi_adapter_close(const struct hpi_hsubsys
*ph_subsys
, u16 adapter_index
)
281 struct hpi_message hm
;
282 struct hpi_response hr
;
283 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_ADAPTER
,
285 hm
.adapter_index
= adapter_index
;
287 hpi_send_recv(&hm
, &hr
);
292 u16
hpi_adapter_set_mode(const struct hpi_hsubsys
*ph_subsys
,
293 u16 adapter_index
, u32 adapter_mode
)
295 return hpi_adapter_set_mode_ex(ph_subsys
, adapter_index
, adapter_mode
,
296 HPI_ADAPTER_MODE_SET
);
299 u16
hpi_adapter_set_mode_ex(const struct hpi_hsubsys
*ph_subsys
,
300 u16 adapter_index
, u32 adapter_mode
, u16 query_or_set
)
302 struct hpi_message hm
;
303 struct hpi_response hr
;
305 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_ADAPTER
,
306 HPI_ADAPTER_SET_MODE
);
307 hm
.adapter_index
= adapter_index
;
308 hm
.u
.a
.adapter_mode
= adapter_mode
;
309 hm
.u
.a
.assert_id
= query_or_set
;
310 hpi_send_recv(&hm
, &hr
);
314 u16
hpi_adapter_get_mode(const struct hpi_hsubsys
*ph_subsys
,
315 u16 adapter_index
, u32
*padapter_mode
)
317 struct hpi_message hm
;
318 struct hpi_response hr
;
319 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_ADAPTER
,
320 HPI_ADAPTER_GET_MODE
);
321 hm
.adapter_index
= adapter_index
;
322 hpi_send_recv(&hm
, &hr
);
324 *padapter_mode
= hr
.u
.a
.serial_number
;
328 u16
hpi_adapter_get_info(const struct hpi_hsubsys
*ph_subsys
,
329 u16 adapter_index
, u16
*pw_num_outstreams
, u16
*pw_num_instreams
,
330 u16
*pw_version
, u32
*pserial_number
, u16
*pw_adapter_type
)
332 struct hpi_message hm
;
333 struct hpi_response hr
;
334 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_ADAPTER
,
335 HPI_ADAPTER_GET_INFO
);
336 hm
.adapter_index
= adapter_index
;
338 hpi_send_recv(&hm
, &hr
);
340 *pw_adapter_type
= hr
.u
.a
.adapter_type
;
341 *pw_num_outstreams
= hr
.u
.a
.num_outstreams
;
342 *pw_num_instreams
= hr
.u
.a
.num_instreams
;
343 *pw_version
= hr
.u
.a
.version
;
344 *pserial_number
= hr
.u
.a
.serial_number
;
348 u16
hpi_adapter_get_module_by_index(const struct hpi_hsubsys
*ph_subsys
,
349 u16 adapter_index
, u16 module_index
, u16
*pw_num_outputs
,
350 u16
*pw_num_inputs
, u16
*pw_version
, u32
*pserial_number
,
351 u16
*pw_module_type
, u32
*ph_module
)
353 struct hpi_message hm
;
354 struct hpi_response hr
;
356 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_ADAPTER
,
357 HPI_ADAPTER_MODULE_INFO
);
358 hm
.adapter_index
= adapter_index
;
359 hm
.u
.ax
.module_info
.index
= module_index
;
361 hpi_send_recv(&hm
, &hr
);
363 *pw_module_type
= hr
.u
.a
.adapter_type
;
364 *pw_num_outputs
= hr
.u
.a
.num_outstreams
;
365 *pw_num_inputs
= hr
.u
.a
.num_instreams
;
366 *pw_version
= hr
.u
.a
.version
;
367 *pserial_number
= hr
.u
.a
.serial_number
;
373 u16
hpi_adapter_get_assert(const struct hpi_hsubsys
*ph_subsys
,
374 u16 adapter_index
, u16
*assert_present
, char *psz_assert
,
377 struct hpi_message hm
;
378 struct hpi_response hr
;
379 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_ADAPTER
,
380 HPI_ADAPTER_GET_ASSERT
);
381 hm
.adapter_index
= adapter_index
;
382 hpi_send_recv(&hm
, &hr
);
388 *pw_line_number
= (u16
)hr
.u
.a
.serial_number
;
389 if (*pw_line_number
) {
392 char *src
= (char *)hr
.u
.a
.sz_adapter_assert
;
393 char *dst
= psz_assert
;
397 for (i
= 0; i
< HPI_STRING_LEN
; i
++) {
410 u16
hpi_adapter_get_assert_ex(const struct hpi_hsubsys
*ph_subsys
,
411 u16 adapter_index
, u16
*assert_present
, char *psz_assert
,
412 u32
*pline_number
, u16
*pw_assert_on_dsp
)
414 struct hpi_message hm
;
415 struct hpi_response hr
;
416 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_ADAPTER
,
417 HPI_ADAPTER_GET_ASSERT
);
418 hm
.adapter_index
= adapter_index
;
420 hpi_send_recv(&hm
, &hr
);
426 *pline_number
= hr
.u
.a
.serial_number
;
428 *assert_present
= hr
.u
.a
.adapter_type
;
430 *pw_assert_on_dsp
= hr
.u
.a
.adapter_index
;
432 if (!*assert_present
&& *pline_number
)
436 if (*assert_present
) {
439 char *src
= (char *)hr
.u
.a
.sz_adapter_assert
;
440 char *dst
= psz_assert
;
442 for (i
= 0; i
< HPI_STRING_LEN
; i
++) {
457 u16
hpi_adapter_test_assert(const struct hpi_hsubsys
*ph_subsys
,
458 u16 adapter_index
, u16 assert_id
)
460 struct hpi_message hm
;
461 struct hpi_response hr
;
462 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_ADAPTER
,
463 HPI_ADAPTER_TEST_ASSERT
);
464 hm
.adapter_index
= adapter_index
;
465 hm
.u
.a
.assert_id
= assert_id
;
467 hpi_send_recv(&hm
, &hr
);
472 u16
hpi_adapter_enable_capability(const struct hpi_hsubsys
*ph_subsys
,
473 u16 adapter_index
, u16 capability
, u32 key
)
475 struct hpi_message hm
;
476 struct hpi_response hr
;
477 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_ADAPTER
,
478 HPI_ADAPTER_ENABLE_CAPABILITY
);
479 hm
.adapter_index
= adapter_index
;
480 hm
.u
.a
.assert_id
= capability
;
481 hm
.u
.a
.adapter_mode
= key
;
483 hpi_send_recv(&hm
, &hr
);
488 u16
hpi_adapter_self_test(const struct hpi_hsubsys
*ph_subsys
,
491 struct hpi_message hm
;
492 struct hpi_response hr
;
493 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_ADAPTER
,
494 HPI_ADAPTER_SELFTEST
);
495 hm
.adapter_index
= adapter_index
;
496 hpi_send_recv(&hm
, &hr
);
500 u16
hpi_adapter_debug_read(const struct hpi_hsubsys
*ph_subsys
,
501 u16 adapter_index
, u32 dsp_address
, char *p_buffer
, int *count_bytes
)
503 struct hpi_message hm
;
504 struct hpi_response hr
;
505 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_ADAPTER
,
506 HPI_ADAPTER_DEBUG_READ
);
508 hr
.size
= sizeof(hr
);
510 hm
.adapter_index
= adapter_index
;
511 hm
.u
.ax
.debug_read
.dsp_address
= dsp_address
;
513 if (*count_bytes
> (int)sizeof(hr
.u
.bytes
))
514 *count_bytes
= sizeof(hr
.u
.bytes
);
516 hm
.u
.ax
.debug_read
.count_bytes
= *count_bytes
;
518 hpi_send_recv(&hm
, &hr
);
521 *count_bytes
= hr
.size
- 12;
522 memcpy(p_buffer
, &hr
.u
.bytes
, *count_bytes
);
528 u16
hpi_adapter_set_property(const struct hpi_hsubsys
*ph_subsys
,
529 u16 adapter_index
, u16 property
, u16 parameter1
, u16 parameter2
)
531 struct hpi_message hm
;
532 struct hpi_response hr
;
533 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_ADAPTER
,
534 HPI_ADAPTER_SET_PROPERTY
);
535 hm
.adapter_index
= adapter_index
;
536 hm
.u
.ax
.property_set
.property
= property
;
537 hm
.u
.ax
.property_set
.parameter1
= parameter1
;
538 hm
.u
.ax
.property_set
.parameter2
= parameter2
;
540 hpi_send_recv(&hm
, &hr
);
545 u16
hpi_adapter_get_property(const struct hpi_hsubsys
*ph_subsys
,
546 u16 adapter_index
, u16 property
, u16
*pw_parameter1
,
549 struct hpi_message hm
;
550 struct hpi_response hr
;
551 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_ADAPTER
,
552 HPI_ADAPTER_GET_PROPERTY
);
553 hm
.adapter_index
= adapter_index
;
554 hm
.u
.ax
.property_set
.property
= property
;
556 hpi_send_recv(&hm
, &hr
);
559 *pw_parameter1
= hr
.u
.ax
.property_get
.parameter1
;
561 *pw_parameter2
= hr
.u
.ax
.property_get
.parameter2
;
567 u16
hpi_adapter_enumerate_property(const struct hpi_hsubsys
*ph_subsys
,
568 u16 adapter_index
, u16 index
, u16 what_to_enumerate
,
569 u16 property_index
, u32
*psetting
)
574 u16
hpi_format_create(struct hpi_format
*p_format
, u16 channels
, u16 format
,
575 u32 sample_rate
, u32 bit_rate
, u32 attributes
)
578 struct hpi_msg_format fmt
;
589 error
= HPI_ERROR_INVALID_CHANNELS
;
592 fmt
.channels
= channels
;
595 case HPI_FORMAT_PCM16_SIGNED
:
596 case HPI_FORMAT_PCM24_SIGNED
:
597 case HPI_FORMAT_PCM32_SIGNED
:
598 case HPI_FORMAT_PCM32_FLOAT
:
599 case HPI_FORMAT_PCM16_BIGENDIAN
:
600 case HPI_FORMAT_PCM8_UNSIGNED
:
601 case HPI_FORMAT_MPEG_L1
:
602 case HPI_FORMAT_MPEG_L2
:
603 case HPI_FORMAT_MPEG_L3
:
604 case HPI_FORMAT_DOLBY_AC2
:
605 case HPI_FORMAT_AA_TAGIT1_HITS
:
606 case HPI_FORMAT_AA_TAGIT1_INSERTS
:
607 case HPI_FORMAT_RAW_BITSTREAM
:
608 case HPI_FORMAT_AA_TAGIT1_HITS_EX1
:
609 case HPI_FORMAT_OEM1
:
610 case HPI_FORMAT_OEM2
:
613 error
= HPI_ERROR_INVALID_FORMAT
;
618 if (sample_rate
< 8000L) {
619 error
= HPI_ERROR_INCOMPATIBLE_SAMPLERATE
;
622 if (sample_rate
> 200000L) {
623 error
= HPI_ERROR_INCOMPATIBLE_SAMPLERATE
;
624 sample_rate
= 200000L;
626 fmt
.sample_rate
= sample_rate
;
629 case HPI_FORMAT_MPEG_L1
:
630 case HPI_FORMAT_MPEG_L2
:
631 case HPI_FORMAT_MPEG_L3
:
632 fmt
.bit_rate
= bit_rate
;
634 case HPI_FORMAT_PCM16_SIGNED
:
635 case HPI_FORMAT_PCM16_BIGENDIAN
:
636 fmt
.bit_rate
= channels
* sample_rate
* 2;
638 case HPI_FORMAT_PCM32_SIGNED
:
639 case HPI_FORMAT_PCM32_FLOAT
:
640 fmt
.bit_rate
= channels
* sample_rate
* 4;
642 case HPI_FORMAT_PCM8_UNSIGNED
:
643 fmt
.bit_rate
= channels
* sample_rate
;
650 case HPI_FORMAT_MPEG_L2
:
652 && (attributes
!= HPI_MPEG_MODE_DEFAULT
)) {
653 attributes
= HPI_MPEG_MODE_DEFAULT
;
654 error
= HPI_ERROR_INVALID_FORMAT
;
655 } else if (attributes
> HPI_MPEG_MODE_DUALCHANNEL
) {
656 attributes
= HPI_MPEG_MODE_DEFAULT
;
657 error
= HPI_ERROR_INVALID_FORMAT
;
659 fmt
.attributes
= attributes
;
662 fmt
.attributes
= attributes
;
665 hpi_msg_to_format(p_format
, &fmt
);
669 u16
hpi_stream_estimate_buffer_size(struct hpi_format
*p_format
,
670 u32 host_polling_rate_in_milli_seconds
, u32
*recommended_buffer_size
)
673 u32 bytes_per_second
;
676 struct hpi_format
*pF
= p_format
;
678 channels
= pF
->channels
;
680 switch (pF
->format
) {
681 case HPI_FORMAT_PCM16_BIGENDIAN
:
682 case HPI_FORMAT_PCM16_SIGNED
:
683 bytes_per_second
= pF
->sample_rate
* 2L * channels
;
685 case HPI_FORMAT_PCM24_SIGNED
:
686 bytes_per_second
= pF
->sample_rate
* 3L * channels
;
688 case HPI_FORMAT_PCM32_SIGNED
:
689 case HPI_FORMAT_PCM32_FLOAT
:
690 bytes_per_second
= pF
->sample_rate
* 4L * channels
;
692 case HPI_FORMAT_PCM8_UNSIGNED
:
693 bytes_per_second
= pF
->sample_rate
* 1L * channels
;
695 case HPI_FORMAT_MPEG_L1
:
696 case HPI_FORMAT_MPEG_L2
:
697 case HPI_FORMAT_MPEG_L3
:
698 bytes_per_second
= pF
->bit_rate
/ 8L;
700 case HPI_FORMAT_DOLBY_AC2
:
702 bytes_per_second
= 256000L / 8L;
705 return HPI_ERROR_INVALID_FORMAT
;
707 size
= (bytes_per_second
* host_polling_rate_in_milli_seconds
* 2) /
710 *recommended_buffer_size
=
711 roundup_pow_of_two(((size
+ 4095L) & ~4095L));
715 u16
hpi_outstream_open(const struct hpi_hsubsys
*ph_subsys
, u16 adapter_index
,
716 u16 outstream_index
, u32
*ph_outstream
)
718 struct hpi_message hm
;
719 struct hpi_response hr
;
720 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_OSTREAM
,
722 hm
.adapter_index
= adapter_index
;
723 hm
.obj_index
= outstream_index
;
725 hpi_send_recv(&hm
, &hr
);
729 hpi_indexes_to_handle(HPI_OBJ_OSTREAM
, adapter_index
,
736 u16
hpi_outstream_close(const struct hpi_hsubsys
*ph_subsys
, u32 h_outstream
)
738 struct hpi_message hm
;
739 struct hpi_response hr
;
741 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_OSTREAM
,
742 HPI_OSTREAM_HOSTBUFFER_FREE
);
743 u32TOINDEXES(h_outstream
, &hm
.adapter_index
, &hm
.obj_index
);
744 hpi_send_recv(&hm
, &hr
);
746 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_OSTREAM
,
747 HPI_OSTREAM_GROUP_RESET
);
748 u32TOINDEXES(h_outstream
, &hm
.adapter_index
, &hm
.obj_index
);
749 hpi_send_recv(&hm
, &hr
);
751 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_OSTREAM
,
753 u32TOINDEXES(h_outstream
, &hm
.adapter_index
, &hm
.obj_index
);
754 hpi_send_recv(&hm
, &hr
);
759 u16
hpi_outstream_get_info_ex(const struct hpi_hsubsys
*ph_subsys
,
760 u32 h_outstream
, u16
*pw_state
, u32
*pbuffer_size
, u32
*pdata_to_play
,
761 u32
*psamples_played
, u32
*pauxiliary_data_to_play
)
763 struct hpi_message hm
;
764 struct hpi_response hr
;
765 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_OSTREAM
,
766 HPI_OSTREAM_GET_INFO
);
767 u32TOINDEXES(h_outstream
, &hm
.adapter_index
, &hm
.obj_index
);
769 hpi_send_recv(&hm
, &hr
);
772 *pw_state
= hr
.u
.d
.u
.stream_info
.state
;
774 *pbuffer_size
= hr
.u
.d
.u
.stream_info
.buffer_size
;
776 *pdata_to_play
= hr
.u
.d
.u
.stream_info
.data_available
;
778 *psamples_played
= hr
.u
.d
.u
.stream_info
.samples_transferred
;
779 if (pauxiliary_data_to_play
)
780 *pauxiliary_data_to_play
=
781 hr
.u
.d
.u
.stream_info
.auxiliary_data_available
;
785 u16
hpi_outstream_write_buf(const struct hpi_hsubsys
*ph_subsys
,
786 u32 h_outstream
, const u8
*pb_data
, u32 bytes_to_write
,
787 const struct hpi_format
*p_format
)
789 struct hpi_message hm
;
790 struct hpi_response hr
;
791 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_OSTREAM
,
793 u32TOINDEXES(h_outstream
, &hm
.adapter_index
, &hm
.obj_index
);
794 hm
.u
.d
.u
.data
.pb_data
= (u8
*)pb_data
;
795 hm
.u
.d
.u
.data
.data_size
= bytes_to_write
;
797 hpi_format_to_msg(&hm
.u
.d
.u
.data
.format
, p_format
);
799 hpi_send_recv(&hm
, &hr
);
804 u16
hpi_outstream_start(const struct hpi_hsubsys
*ph_subsys
, u32 h_outstream
)
806 struct hpi_message hm
;
807 struct hpi_response hr
;
808 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_OSTREAM
,
810 u32TOINDEXES(h_outstream
, &hm
.adapter_index
, &hm
.obj_index
);
812 hpi_send_recv(&hm
, &hr
);
817 u16
hpi_outstream_wait_start(const struct hpi_hsubsys
*ph_subsys
,
820 struct hpi_message hm
;
821 struct hpi_response hr
;
822 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_OSTREAM
,
823 HPI_OSTREAM_WAIT_START
);
824 u32TOINDEXES(h_outstream
, &hm
.adapter_index
, &hm
.obj_index
);
826 hpi_send_recv(&hm
, &hr
);
831 u16
hpi_outstream_stop(const struct hpi_hsubsys
*ph_subsys
, u32 h_outstream
)
833 struct hpi_message hm
;
834 struct hpi_response hr
;
835 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_OSTREAM
,
837 u32TOINDEXES(h_outstream
, &hm
.adapter_index
, &hm
.obj_index
);
839 hpi_send_recv(&hm
, &hr
);
844 u16
hpi_outstream_sinegen(const struct hpi_hsubsys
*ph_subsys
,
847 struct hpi_message hm
;
848 struct hpi_response hr
;
849 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_OSTREAM
,
850 HPI_OSTREAM_SINEGEN
);
851 u32TOINDEXES(h_outstream
, &hm
.adapter_index
, &hm
.obj_index
);
853 hpi_send_recv(&hm
, &hr
);
858 u16
hpi_outstream_reset(const struct hpi_hsubsys
*ph_subsys
, u32 h_outstream
)
860 struct hpi_message hm
;
861 struct hpi_response hr
;
862 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_OSTREAM
,
864 u32TOINDEXES(h_outstream
, &hm
.adapter_index
, &hm
.obj_index
);
866 hpi_send_recv(&hm
, &hr
);
871 u16
hpi_outstream_query_format(const struct hpi_hsubsys
*ph_subsys
,
872 u32 h_outstream
, struct hpi_format
*p_format
)
874 struct hpi_message hm
;
875 struct hpi_response hr
;
877 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_OSTREAM
,
878 HPI_OSTREAM_QUERY_FORMAT
);
879 u32TOINDEXES(h_outstream
, &hm
.adapter_index
, &hm
.obj_index
);
881 hpi_format_to_msg(&hm
.u
.d
.u
.data
.format
, p_format
);
883 hpi_send_recv(&hm
, &hr
);
888 u16
hpi_outstream_set_format(const struct hpi_hsubsys
*ph_subsys
,
889 u32 h_outstream
, struct hpi_format
*p_format
)
891 struct hpi_message hm
;
892 struct hpi_response hr
;
894 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_OSTREAM
,
895 HPI_OSTREAM_SET_FORMAT
);
896 u32TOINDEXES(h_outstream
, &hm
.adapter_index
, &hm
.obj_index
);
898 hpi_format_to_msg(&hm
.u
.d
.u
.data
.format
, p_format
);
900 hpi_send_recv(&hm
, &hr
);
905 u16
hpi_outstream_set_velocity(const struct hpi_hsubsys
*ph_subsys
,
906 u32 h_outstream
, short velocity
)
908 struct hpi_message hm
;
909 struct hpi_response hr
;
911 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_OSTREAM
,
912 HPI_OSTREAM_SET_VELOCITY
);
913 u32TOINDEXES(h_outstream
, &hm
.adapter_index
, &hm
.obj_index
);
914 hm
.u
.d
.u
.velocity
= velocity
;
916 hpi_send_recv(&hm
, &hr
);
921 u16
hpi_outstream_set_punch_in_out(const struct hpi_hsubsys
*ph_subsys
,
922 u32 h_outstream
, u32 punch_in_sample
, u32 punch_out_sample
)
924 struct hpi_message hm
;
925 struct hpi_response hr
;
927 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_OSTREAM
,
928 HPI_OSTREAM_SET_PUNCHINOUT
);
929 u32TOINDEXES(h_outstream
, &hm
.adapter_index
, &hm
.obj_index
);
931 hm
.u
.d
.u
.pio
.punch_in_sample
= punch_in_sample
;
932 hm
.u
.d
.u
.pio
.punch_out_sample
= punch_out_sample
;
934 hpi_send_recv(&hm
, &hr
);
939 u16
hpi_outstream_ancillary_reset(const struct hpi_hsubsys
*ph_subsys
,
940 u32 h_outstream
, u16 mode
)
942 struct hpi_message hm
;
943 struct hpi_response hr
;
945 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_OSTREAM
,
946 HPI_OSTREAM_ANC_RESET
);
947 u32TOINDEXES(h_outstream
, &hm
.adapter_index
, &hm
.obj_index
);
948 hm
.u
.d
.u
.data
.format
.channels
= mode
;
949 hpi_send_recv(&hm
, &hr
);
953 u16
hpi_outstream_ancillary_get_info(const struct hpi_hsubsys
*ph_subsys
,
954 u32 h_outstream
, u32
*pframes_available
)
956 struct hpi_message hm
;
957 struct hpi_response hr
;
959 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_OSTREAM
,
960 HPI_OSTREAM_ANC_GET_INFO
);
961 u32TOINDEXES(h_outstream
, &hm
.adapter_index
, &hm
.obj_index
);
962 hpi_send_recv(&hm
, &hr
);
964 if (pframes_available
)
966 hr
.u
.d
.u
.stream_info
.data_available
/
967 sizeof(struct hpi_anc_frame
);
972 u16
hpi_outstream_ancillary_read(const struct hpi_hsubsys
*ph_subsys
,
973 u32 h_outstream
, struct hpi_anc_frame
*p_anc_frame_buffer
,
974 u32 anc_frame_buffer_size_in_bytes
,
975 u32 number_of_ancillary_frames_to_read
)
977 struct hpi_message hm
;
978 struct hpi_response hr
;
980 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_OSTREAM
,
981 HPI_OSTREAM_ANC_READ
);
982 u32TOINDEXES(h_outstream
, &hm
.adapter_index
, &hm
.obj_index
);
983 hm
.u
.d
.u
.data
.pb_data
= (u8
*)p_anc_frame_buffer
;
984 hm
.u
.d
.u
.data
.data_size
=
985 number_of_ancillary_frames_to_read
*
986 sizeof(struct hpi_anc_frame
);
987 if (hm
.u
.d
.u
.data
.data_size
<= anc_frame_buffer_size_in_bytes
)
988 hpi_send_recv(&hm
, &hr
);
990 hr
.error
= HPI_ERROR_INVALID_DATA_TRANSFER
;
994 u16
hpi_outstream_set_time_scale(const struct hpi_hsubsys
*ph_subsys
,
995 u32 h_outstream
, u32 time_scale
)
997 struct hpi_message hm
;
998 struct hpi_response hr
;
1000 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_OSTREAM
,
1001 HPI_OSTREAM_SET_TIMESCALE
);
1002 u32TOINDEXES(h_outstream
, &hm
.adapter_index
, &hm
.obj_index
);
1004 hm
.u
.d
.u
.time_scale
= time_scale
;
1006 hpi_send_recv(&hm
, &hr
);
1011 u16
hpi_outstream_host_buffer_allocate(const struct hpi_hsubsys
*ph_subsys
,
1012 u32 h_outstream
, u32 size_in_bytes
)
1014 struct hpi_message hm
;
1015 struct hpi_response hr
;
1017 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_OSTREAM
,
1018 HPI_OSTREAM_HOSTBUFFER_ALLOC
);
1019 u32TOINDEXES(h_outstream
, &hm
.adapter_index
, &hm
.obj_index
);
1020 hm
.u
.d
.u
.data
.data_size
= size_in_bytes
;
1021 hpi_send_recv(&hm
, &hr
);
1025 u16
hpi_outstream_host_buffer_get_info(const struct hpi_hsubsys
*ph_subsys
,
1026 u32 h_outstream
, u8
**pp_buffer
,
1027 struct hpi_hostbuffer_status
**pp_status
)
1029 struct hpi_message hm
;
1030 struct hpi_response hr
;
1032 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_OSTREAM
,
1033 HPI_OSTREAM_HOSTBUFFER_GET_INFO
);
1034 u32TOINDEXES(h_outstream
, &hm
.adapter_index
, &hm
.obj_index
);
1035 hpi_send_recv(&hm
, &hr
);
1037 if (hr
.error
== 0) {
1039 *pp_buffer
= hr
.u
.d
.u
.hostbuffer_info
.p_buffer
;
1041 *pp_status
= hr
.u
.d
.u
.hostbuffer_info
.p_status
;
1046 u16
hpi_outstream_host_buffer_free(const struct hpi_hsubsys
*ph_subsys
,
1049 struct hpi_message hm
;
1050 struct hpi_response hr
;
1052 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_OSTREAM
,
1053 HPI_OSTREAM_HOSTBUFFER_FREE
);
1054 u32TOINDEXES(h_outstream
, &hm
.adapter_index
, &hm
.obj_index
);
1055 hpi_send_recv(&hm
, &hr
);
1059 u16
hpi_outstream_group_add(const struct hpi_hsubsys
*ph_subsys
,
1060 u32 h_outstream
, u32 h_stream
)
1062 struct hpi_message hm
;
1063 struct hpi_response hr
;
1067 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_OSTREAM
,
1068 HPI_OSTREAM_GROUP_ADD
);
1070 u32TOINDEXES(h_outstream
, &hm
.adapter_index
, &hm
.obj_index
);
1071 c_obj_type
= hpi_handle_object(h_stream
);
1072 switch (c_obj_type
) {
1073 case HPI_OBJ_OSTREAM
:
1074 hm
.u
.d
.u
.stream
.object_type
= HPI_OBJ_OSTREAM
;
1075 u32TOINDEXES(h_stream
, &adapter
,
1076 &hm
.u
.d
.u
.stream
.stream_index
);
1078 case HPI_OBJ_ISTREAM
:
1079 hm
.u
.d
.u
.stream
.object_type
= HPI_OBJ_ISTREAM
;
1080 u32TOINDEXES(h_stream
, &adapter
,
1081 &hm
.u
.d
.u
.stream
.stream_index
);
1084 return HPI_ERROR_INVALID_STREAM
;
1086 if (adapter
!= hm
.adapter_index
)
1087 return HPI_ERROR_NO_INTERADAPTER_GROUPS
;
1089 hpi_send_recv(&hm
, &hr
);
1093 u16
hpi_outstream_group_get_map(const struct hpi_hsubsys
*ph_subsys
,
1094 u32 h_outstream
, u32
*poutstream_map
, u32
*pinstream_map
)
1096 struct hpi_message hm
;
1097 struct hpi_response hr
;
1099 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_OSTREAM
,
1100 HPI_OSTREAM_GROUP_GETMAP
);
1101 u32TOINDEXES(h_outstream
, &hm
.adapter_index
, &hm
.obj_index
);
1102 hpi_send_recv(&hm
, &hr
);
1105 *poutstream_map
= hr
.u
.d
.u
.group_info
.outstream_group_map
;
1107 *pinstream_map
= hr
.u
.d
.u
.group_info
.instream_group_map
;
1112 u16
hpi_outstream_group_reset(const struct hpi_hsubsys
*ph_subsys
,
1115 struct hpi_message hm
;
1116 struct hpi_response hr
;
1118 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_OSTREAM
,
1119 HPI_OSTREAM_GROUP_RESET
);
1120 u32TOINDEXES(h_outstream
, &hm
.adapter_index
, &hm
.obj_index
);
1121 hpi_send_recv(&hm
, &hr
);
1125 u16
hpi_instream_open(const struct hpi_hsubsys
*ph_subsys
, u16 adapter_index
,
1126 u16 instream_index
, u32
*ph_instream
)
1128 struct hpi_message hm
;
1129 struct hpi_response hr
;
1131 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_ISTREAM
,
1133 hm
.adapter_index
= adapter_index
;
1134 hm
.obj_index
= instream_index
;
1136 hpi_send_recv(&hm
, &hr
);
1140 hpi_indexes_to_handle(HPI_OBJ_ISTREAM
, adapter_index
,
1148 u16
hpi_instream_close(const struct hpi_hsubsys
*ph_subsys
, u32 h_instream
)
1150 struct hpi_message hm
;
1151 struct hpi_response hr
;
1153 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_ISTREAM
,
1154 HPI_ISTREAM_HOSTBUFFER_FREE
);
1155 u32TOINDEXES(h_instream
, &hm
.adapter_index
, &hm
.obj_index
);
1156 hpi_send_recv(&hm
, &hr
);
1158 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_ISTREAM
,
1159 HPI_ISTREAM_GROUP_RESET
);
1160 u32TOINDEXES(h_instream
, &hm
.adapter_index
, &hm
.obj_index
);
1161 hpi_send_recv(&hm
, &hr
);
1163 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_ISTREAM
,
1165 u32TOINDEXES(h_instream
, &hm
.adapter_index
, &hm
.obj_index
);
1166 hpi_send_recv(&hm
, &hr
);
1171 u16
hpi_instream_query_format(const struct hpi_hsubsys
*ph_subsys
,
1172 u32 h_instream
, const struct hpi_format
*p_format
)
1174 struct hpi_message hm
;
1175 struct hpi_response hr
;
1177 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_ISTREAM
,
1178 HPI_ISTREAM_QUERY_FORMAT
);
1179 u32TOINDEXES(h_instream
, &hm
.adapter_index
, &hm
.obj_index
);
1180 hpi_format_to_msg(&hm
.u
.d
.u
.data
.format
, p_format
);
1182 hpi_send_recv(&hm
, &hr
);
1187 u16
hpi_instream_set_format(const struct hpi_hsubsys
*ph_subsys
,
1188 u32 h_instream
, const struct hpi_format
*p_format
)
1190 struct hpi_message hm
;
1191 struct hpi_response hr
;
1193 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_ISTREAM
,
1194 HPI_ISTREAM_SET_FORMAT
);
1195 u32TOINDEXES(h_instream
, &hm
.adapter_index
, &hm
.obj_index
);
1196 hpi_format_to_msg(&hm
.u
.d
.u
.data
.format
, p_format
);
1198 hpi_send_recv(&hm
, &hr
);
1203 u16
hpi_instream_read_buf(const struct hpi_hsubsys
*ph_subsys
, u32 h_instream
,
1204 u8
*pb_data
, u32 bytes_to_read
)
1206 struct hpi_message hm
;
1207 struct hpi_response hr
;
1209 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_ISTREAM
,
1211 u32TOINDEXES(h_instream
, &hm
.adapter_index
, &hm
.obj_index
);
1212 hm
.u
.d
.u
.data
.data_size
= bytes_to_read
;
1213 hm
.u
.d
.u
.data
.pb_data
= pb_data
;
1215 hpi_send_recv(&hm
, &hr
);
1220 u16
hpi_instream_start(const struct hpi_hsubsys
*ph_subsys
, u32 h_instream
)
1222 struct hpi_message hm
;
1223 struct hpi_response hr
;
1225 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_ISTREAM
,
1227 u32TOINDEXES(h_instream
, &hm
.adapter_index
, &hm
.obj_index
);
1229 hpi_send_recv(&hm
, &hr
);
1234 u16
hpi_instream_wait_start(const struct hpi_hsubsys
*ph_subsys
,
1237 struct hpi_message hm
;
1238 struct hpi_response hr
;
1240 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_ISTREAM
,
1241 HPI_ISTREAM_WAIT_START
);
1242 u32TOINDEXES(h_instream
, &hm
.adapter_index
, &hm
.obj_index
);
1244 hpi_send_recv(&hm
, &hr
);
1249 u16
hpi_instream_stop(const struct hpi_hsubsys
*ph_subsys
, u32 h_instream
)
1251 struct hpi_message hm
;
1252 struct hpi_response hr
;
1254 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_ISTREAM
,
1256 u32TOINDEXES(h_instream
, &hm
.adapter_index
, &hm
.obj_index
);
1258 hpi_send_recv(&hm
, &hr
);
1263 u16
hpi_instream_reset(const struct hpi_hsubsys
*ph_subsys
, u32 h_instream
)
1265 struct hpi_message hm
;
1266 struct hpi_response hr
;
1268 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_ISTREAM
,
1270 u32TOINDEXES(h_instream
, &hm
.adapter_index
, &hm
.obj_index
);
1272 hpi_send_recv(&hm
, &hr
);
1277 u16
hpi_instream_get_info_ex(const struct hpi_hsubsys
*ph_subsys
,
1278 u32 h_instream
, u16
*pw_state
, u32
*pbuffer_size
, u32
*pdata_recorded
,
1279 u32
*psamples_recorded
, u32
*pauxiliary_data_recorded
)
1281 struct hpi_message hm
;
1282 struct hpi_response hr
;
1283 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_ISTREAM
,
1284 HPI_ISTREAM_GET_INFO
);
1285 u32TOINDEXES(h_instream
, &hm
.adapter_index
, &hm
.obj_index
);
1287 hpi_send_recv(&hm
, &hr
);
1290 *pw_state
= hr
.u
.d
.u
.stream_info
.state
;
1292 *pbuffer_size
= hr
.u
.d
.u
.stream_info
.buffer_size
;
1294 *pdata_recorded
= hr
.u
.d
.u
.stream_info
.data_available
;
1295 if (psamples_recorded
)
1296 *psamples_recorded
= hr
.u
.d
.u
.stream_info
.samples_transferred
;
1297 if (pauxiliary_data_recorded
)
1298 *pauxiliary_data_recorded
=
1299 hr
.u
.d
.u
.stream_info
.auxiliary_data_available
;
1303 u16
hpi_instream_ancillary_reset(const struct hpi_hsubsys
*ph_subsys
,
1304 u32 h_instream
, u16 bytes_per_frame
, u16 mode
, u16 alignment
,
1307 struct hpi_message hm
;
1308 struct hpi_response hr
;
1309 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_ISTREAM
,
1310 HPI_ISTREAM_ANC_RESET
);
1311 u32TOINDEXES(h_instream
, &hm
.adapter_index
, &hm
.obj_index
);
1312 hm
.u
.d
.u
.data
.format
.attributes
= bytes_per_frame
;
1313 hm
.u
.d
.u
.data
.format
.format
= (mode
<< 8) | (alignment
& 0xff);
1314 hm
.u
.d
.u
.data
.format
.channels
= idle_bit
;
1315 hpi_send_recv(&hm
, &hr
);
1319 u16
hpi_instream_ancillary_get_info(const struct hpi_hsubsys
*ph_subsys
,
1320 u32 h_instream
, u32
*pframe_space
)
1322 struct hpi_message hm
;
1323 struct hpi_response hr
;
1324 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_ISTREAM
,
1325 HPI_ISTREAM_ANC_GET_INFO
);
1326 u32TOINDEXES(h_instream
, &hm
.adapter_index
, &hm
.obj_index
);
1327 hpi_send_recv(&hm
, &hr
);
1330 (hr
.u
.d
.u
.stream_info
.buffer_size
-
1331 hr
.u
.d
.u
.stream_info
.data_available
) /
1332 sizeof(struct hpi_anc_frame
);
1336 u16
hpi_instream_ancillary_write(const struct hpi_hsubsys
*ph_subsys
,
1337 u32 h_instream
, const struct hpi_anc_frame
*p_anc_frame_buffer
,
1338 u32 anc_frame_buffer_size_in_bytes
,
1339 u32 number_of_ancillary_frames_to_write
)
1341 struct hpi_message hm
;
1342 struct hpi_response hr
;
1344 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_ISTREAM
,
1345 HPI_ISTREAM_ANC_WRITE
);
1346 u32TOINDEXES(h_instream
, &hm
.adapter_index
, &hm
.obj_index
);
1347 hm
.u
.d
.u
.data
.pb_data
= (u8
*)p_anc_frame_buffer
;
1348 hm
.u
.d
.u
.data
.data_size
=
1349 number_of_ancillary_frames_to_write
*
1350 sizeof(struct hpi_anc_frame
);
1351 if (hm
.u
.d
.u
.data
.data_size
<= anc_frame_buffer_size_in_bytes
)
1352 hpi_send_recv(&hm
, &hr
);
1354 hr
.error
= HPI_ERROR_INVALID_DATA_TRANSFER
;
1358 u16
hpi_instream_host_buffer_allocate(const struct hpi_hsubsys
*ph_subsys
,
1359 u32 h_instream
, u32 size_in_bytes
)
1362 struct hpi_message hm
;
1363 struct hpi_response hr
;
1365 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_ISTREAM
,
1366 HPI_ISTREAM_HOSTBUFFER_ALLOC
);
1367 u32TOINDEXES(h_instream
, &hm
.adapter_index
, &hm
.obj_index
);
1368 hm
.u
.d
.u
.data
.data_size
= size_in_bytes
;
1369 hpi_send_recv(&hm
, &hr
);
1373 u16
hpi_instream_host_buffer_get_info(const struct hpi_hsubsys
*ph_subsys
,
1374 u32 h_instream
, u8
**pp_buffer
,
1375 struct hpi_hostbuffer_status
**pp_status
)
1377 struct hpi_message hm
;
1378 struct hpi_response hr
;
1380 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_ISTREAM
,
1381 HPI_ISTREAM_HOSTBUFFER_GET_INFO
);
1382 u32TOINDEXES(h_instream
, &hm
.adapter_index
, &hm
.obj_index
);
1383 hpi_send_recv(&hm
, &hr
);
1385 if (hr
.error
== 0) {
1387 *pp_buffer
= hr
.u
.d
.u
.hostbuffer_info
.p_buffer
;
1389 *pp_status
= hr
.u
.d
.u
.hostbuffer_info
.p_status
;
1394 u16
hpi_instream_host_buffer_free(const struct hpi_hsubsys
*ph_subsys
,
1398 struct hpi_message hm
;
1399 struct hpi_response hr
;
1401 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_ISTREAM
,
1402 HPI_ISTREAM_HOSTBUFFER_FREE
);
1403 u32TOINDEXES(h_instream
, &hm
.adapter_index
, &hm
.obj_index
);
1404 hpi_send_recv(&hm
, &hr
);
1408 u16
hpi_instream_group_add(const struct hpi_hsubsys
*ph_subsys
,
1409 u32 h_instream
, u32 h_stream
)
1411 struct hpi_message hm
;
1412 struct hpi_response hr
;
1416 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_ISTREAM
,
1417 HPI_ISTREAM_GROUP_ADD
);
1419 u32TOINDEXES(h_instream
, &hm
.adapter_index
, &hm
.obj_index
);
1420 c_obj_type
= hpi_handle_object(h_stream
);
1422 switch (c_obj_type
) {
1423 case HPI_OBJ_OSTREAM
:
1424 hm
.u
.d
.u
.stream
.object_type
= HPI_OBJ_OSTREAM
;
1425 u32TOINDEXES(h_stream
, &adapter
,
1426 &hm
.u
.d
.u
.stream
.stream_index
);
1428 case HPI_OBJ_ISTREAM
:
1429 hm
.u
.d
.u
.stream
.object_type
= HPI_OBJ_ISTREAM
;
1430 u32TOINDEXES(h_stream
, &adapter
,
1431 &hm
.u
.d
.u
.stream
.stream_index
);
1434 return HPI_ERROR_INVALID_STREAM
;
1437 if (adapter
!= hm
.adapter_index
)
1438 return HPI_ERROR_NO_INTERADAPTER_GROUPS
;
1440 hpi_send_recv(&hm
, &hr
);
1444 u16
hpi_instream_group_get_map(const struct hpi_hsubsys
*ph_subsys
,
1445 u32 h_instream
, u32
*poutstream_map
, u32
*pinstream_map
)
1447 struct hpi_message hm
;
1448 struct hpi_response hr
;
1450 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_ISTREAM
,
1451 HPI_ISTREAM_HOSTBUFFER_FREE
);
1452 u32TOINDEXES(h_instream
, &hm
.adapter_index
, &hm
.obj_index
);
1453 hpi_send_recv(&hm
, &hr
);
1456 *poutstream_map
= hr
.u
.d
.u
.group_info
.outstream_group_map
;
1458 *pinstream_map
= hr
.u
.d
.u
.group_info
.instream_group_map
;
1463 u16
hpi_instream_group_reset(const struct hpi_hsubsys
*ph_subsys
,
1466 struct hpi_message hm
;
1467 struct hpi_response hr
;
1469 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_ISTREAM
,
1470 HPI_ISTREAM_GROUP_RESET
);
1471 u32TOINDEXES(h_instream
, &hm
.adapter_index
, &hm
.obj_index
);
1472 hpi_send_recv(&hm
, &hr
);
1476 u16
hpi_mixer_open(const struct hpi_hsubsys
*ph_subsys
, u16 adapter_index
,
1479 struct hpi_message hm
;
1480 struct hpi_response hr
;
1481 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_MIXER
, HPI_MIXER_OPEN
);
1482 hm
.adapter_index
= adapter_index
;
1484 hpi_send_recv(&hm
, &hr
);
1488 hpi_indexes_to_handle(HPI_OBJ_MIXER
, adapter_index
,
1495 u16
hpi_mixer_close(const struct hpi_hsubsys
*ph_subsys
, u32 h_mixer
)
1497 struct hpi_message hm
;
1498 struct hpi_response hr
;
1499 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_MIXER
, HPI_MIXER_CLOSE
);
1500 u32TOINDEX(h_mixer
, &hm
.adapter_index
);
1501 hpi_send_recv(&hm
, &hr
);
1505 u16
hpi_mixer_get_control(const struct hpi_hsubsys
*ph_subsys
, u32 h_mixer
,
1506 u16 src_node_type
, u16 src_node_type_index
, u16 dst_node_type
,
1507 u16 dst_node_type_index
, u16 control_type
, u32
*ph_control
)
1509 struct hpi_message hm
;
1510 struct hpi_response hr
;
1511 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_MIXER
,
1512 HPI_MIXER_GET_CONTROL
);
1513 u32TOINDEX(h_mixer
, &hm
.adapter_index
);
1514 hm
.u
.m
.node_type1
= src_node_type
;
1515 hm
.u
.m
.node_index1
= src_node_type_index
;
1516 hm
.u
.m
.node_type2
= dst_node_type
;
1517 hm
.u
.m
.node_index2
= dst_node_type_index
;
1518 hm
.u
.m
.control_type
= control_type
;
1520 hpi_send_recv(&hm
, &hr
);
1524 hpi_indexes_to_handle(HPI_OBJ_CONTROL
,
1525 hm
.adapter_index
, hr
.u
.m
.control_index
);
1531 u16
hpi_mixer_get_control_by_index(const struct hpi_hsubsys
*ph_subsys
,
1532 u32 h_mixer
, u16 control_index
, u16
*pw_src_node_type
,
1533 u16
*pw_src_node_index
, u16
*pw_dst_node_type
, u16
*pw_dst_node_index
,
1534 u16
*pw_control_type
, u32
*ph_control
)
1536 struct hpi_message hm
;
1537 struct hpi_response hr
;
1538 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_MIXER
,
1539 HPI_MIXER_GET_CONTROL_BY_INDEX
);
1540 u32TOINDEX(h_mixer
, &hm
.adapter_index
);
1541 hm
.u
.m
.control_index
= control_index
;
1542 hpi_send_recv(&hm
, &hr
);
1544 if (pw_src_node_type
) {
1546 hr
.u
.m
.src_node_type
+ HPI_SOURCENODE_NONE
;
1547 *pw_src_node_index
= hr
.u
.m
.src_node_index
;
1548 *pw_dst_node_type
= hr
.u
.m
.dst_node_type
+ HPI_DESTNODE_NONE
;
1549 *pw_dst_node_index
= hr
.u
.m
.dst_node_index
;
1551 if (pw_control_type
)
1552 *pw_control_type
= hr
.u
.m
.control_index
;
1557 hpi_indexes_to_handle(HPI_OBJ_CONTROL
,
1558 hm
.adapter_index
, control_index
);
1565 u16
hpi_mixer_store(const struct hpi_hsubsys
*ph_subsys
, u32 h_mixer
,
1566 enum HPI_MIXER_STORE_COMMAND command
, u16 index
)
1568 struct hpi_message hm
;
1569 struct hpi_response hr
;
1570 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_MIXER
, HPI_MIXER_STORE
);
1571 u32TOINDEX(h_mixer
, &hm
.adapter_index
);
1572 hm
.u
.mx
.store
.command
= command
;
1573 hm
.u
.mx
.store
.index
= index
;
1574 hpi_send_recv(&hm
, &hr
);
1579 u16
hpi_control_param_set(const struct hpi_hsubsys
*ph_subsys
,
1580 const u32 h_control
, const u16 attrib
, const u32 param1
,
1583 struct hpi_message hm
;
1584 struct hpi_response hr
;
1586 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_CONTROL
,
1587 HPI_CONTROL_SET_STATE
);
1588 u32TOINDEXES(h_control
, &hm
.adapter_index
, &hm
.obj_index
);
1589 hm
.u
.c
.attribute
= attrib
;
1590 hm
.u
.c
.param1
= param1
;
1591 hm
.u
.c
.param2
= param2
;
1592 hpi_send_recv(&hm
, &hr
);
1596 static u16
hpi_control_log_set2(u32 h_control
, u16 attrib
, short sv0
,
1599 struct hpi_message hm
;
1600 struct hpi_response hr
;
1602 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_CONTROL
,
1603 HPI_CONTROL_SET_STATE
);
1604 u32TOINDEXES(h_control
, &hm
.adapter_index
, &hm
.obj_index
);
1605 hm
.u
.c
.attribute
= attrib
;
1606 hm
.u
.c
.an_log_value
[0] = sv0
;
1607 hm
.u
.c
.an_log_value
[1] = sv1
;
1608 hpi_send_recv(&hm
, &hr
);
1613 u16
hpi_control_param_get(const struct hpi_hsubsys
*ph_subsys
,
1614 const u32 h_control
, const u16 attrib
, u32 param1
, u32 param2
,
1615 u32
*pparam1
, u32
*pparam2
)
1617 struct hpi_message hm
;
1618 struct hpi_response hr
;
1620 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_CONTROL
,
1621 HPI_CONTROL_GET_STATE
);
1622 u32TOINDEXES(h_control
, &hm
.adapter_index
, &hm
.obj_index
);
1623 hm
.u
.c
.attribute
= attrib
;
1624 hm
.u
.c
.param1
= param1
;
1625 hm
.u
.c
.param2
= param2
;
1626 hpi_send_recv(&hm
, &hr
);
1628 *pparam1
= hr
.u
.c
.param1
;
1630 *pparam2
= hr
.u
.c
.param2
;
1635 #define hpi_control_param1_get(s, h, a, p1) \
1636 hpi_control_param_get(s, h, a, 0, 0, p1, NULL)
1637 #define hpi_control_param2_get(s, h, a, p1, p2) \
1638 hpi_control_param_get(s, h, a, 0, 0, p1, p2)
1640 static u16
hpi_control_log_get2(const struct hpi_hsubsys
*ph_subsys
,
1641 u32 h_control
, u16 attrib
, short *sv0
, short *sv1
)
1643 struct hpi_message hm
;
1644 struct hpi_response hr
;
1645 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_CONTROL
,
1646 HPI_CONTROL_GET_STATE
);
1647 u32TOINDEXES(h_control
, &hm
.adapter_index
, &hm
.obj_index
);
1648 hm
.u
.c
.attribute
= attrib
;
1650 hpi_send_recv(&hm
, &hr
);
1651 *sv0
= hr
.u
.c
.an_log_value
[0];
1653 *sv1
= hr
.u
.c
.an_log_value
[1];
1658 u16
hpi_control_query(const struct hpi_hsubsys
*ph_subsys
,
1659 const u32 h_control
, const u16 attrib
, const u32 index
,
1660 const u32 param
, u32
*psetting
)
1662 struct hpi_message hm
;
1663 struct hpi_response hr
;
1665 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_CONTROL
,
1666 HPI_CONTROL_GET_INFO
);
1667 u32TOINDEXES(h_control
, &hm
.adapter_index
, &hm
.obj_index
);
1669 hm
.u
.c
.attribute
= attrib
;
1670 hm
.u
.c
.param1
= index
;
1671 hm
.u
.c
.param2
= param
;
1673 hpi_send_recv(&hm
, &hr
);
1674 *psetting
= hr
.u
.c
.param1
;
1679 static u16
hpi_control_get_string(const u32 h_control
, const u16 attribute
,
1680 char *psz_string
, const u32 string_length
)
1682 unsigned int sub_string_index
= 0, j
= 0;
1687 if ((string_length
< 1) || (string_length
> 256))
1688 return HPI_ERROR_INVALID_CONTROL_VALUE
;
1689 for (sub_string_index
= 0; sub_string_index
< string_length
;
1690 sub_string_index
+= 8) {
1691 struct hpi_message hm
;
1692 struct hpi_response hr
;
1694 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_CONTROL
,
1695 HPI_CONTROL_GET_STATE
);
1696 u32TOINDEXES(h_control
, &hm
.adapter_index
, &hm
.obj_index
);
1697 hm
.u
.c
.attribute
= attribute
;
1698 hm
.u
.c
.param1
= sub_string_index
;
1700 hpi_send_recv(&hm
, &hr
);
1702 if (sub_string_index
== 0
1703 && (hr
.u
.cu
.chars8
.remaining_chars
+ 8) >
1705 return HPI_ERROR_INVALID_CONTROL_VALUE
;
1711 for (j
= 0; j
< 8; j
++) {
1712 c
= hr
.u
.cu
.chars8
.sz_data
[j
];
1713 psz_string
[sub_string_index
+ j
] = c
;
1715 if (n
>= string_length
) {
1716 psz_string
[string_length
- 1] = 0;
1717 hE
= HPI_ERROR_INVALID_CONTROL_VALUE
;
1724 if ((hr
.u
.cu
.chars8
.remaining_chars
== 0)
1725 && ((sub_string_index
+ j
) < string_length
)
1728 psz_string
[sub_string_index
+ j
] = c
;
1736 u16
HPI_AESEBU__receiver_query_format(const struct hpi_hsubsys
*ph_subsys
,
1737 const u32 h_aes_rx
, const u32 index
, u16
*pw_format
)
1742 err
= hpi_control_query(ph_subsys
, h_aes_rx
, HPI_AESEBURX_FORMAT
,
1744 *pw_format
= (u16
)qr
;
1748 u16
HPI_AESEBU__receiver_set_format(const struct hpi_hsubsys
*ph_subsys
,
1749 u32 h_control
, u16 format
)
1751 return hpi_control_param_set(ph_subsys
, h_control
,
1752 HPI_AESEBURX_FORMAT
, format
, 0);
1755 u16
HPI_AESEBU__receiver_get_format(const struct hpi_hsubsys
*ph_subsys
,
1756 u32 h_control
, u16
*pw_format
)
1761 err
= hpi_control_param1_get(ph_subsys
, h_control
,
1762 HPI_AESEBURX_FORMAT
, ¶m
);
1763 if (!err
&& pw_format
)
1764 *pw_format
= (u16
)param
;
1769 u16
HPI_AESEBU__receiver_get_sample_rate(const struct hpi_hsubsys
*ph_subsys
,
1770 u32 h_control
, u32
*psample_rate
)
1772 return hpi_control_param1_get(ph_subsys
, h_control
,
1773 HPI_AESEBURX_SAMPLERATE
, psample_rate
);
1776 u16
HPI_AESEBU__receiver_get_user_data(const struct hpi_hsubsys
*ph_subsys
,
1777 u32 h_control
, u16 index
, u16
*pw_data
)
1779 struct hpi_message hm
;
1780 struct hpi_response hr
;
1781 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_CONTROL
,
1782 HPI_CONTROL_GET_STATE
);
1783 u32TOINDEXES(h_control
, &hm
.adapter_index
, &hm
.obj_index
);
1784 hm
.u
.c
.attribute
= HPI_AESEBURX_USERDATA
;
1785 hm
.u
.c
.param1
= index
;
1787 hpi_send_recv(&hm
, &hr
);
1790 *pw_data
= (u16
)hr
.u
.c
.param2
;
1794 u16
HPI_AESEBU__receiver_get_channel_status(const struct hpi_hsubsys
1795 *ph_subsys
, u32 h_control
, u16 index
, u16
*pw_data
)
1797 struct hpi_message hm
;
1798 struct hpi_response hr
;
1799 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_CONTROL
,
1800 HPI_CONTROL_GET_STATE
);
1801 u32TOINDEXES(h_control
, &hm
.adapter_index
, &hm
.obj_index
);
1802 hm
.u
.c
.attribute
= HPI_AESEBURX_CHANNELSTATUS
;
1803 hm
.u
.c
.param1
= index
;
1805 hpi_send_recv(&hm
, &hr
);
1808 *pw_data
= (u16
)hr
.u
.c
.param2
;
1812 u16
HPI_AESEBU__receiver_get_error_status(const struct hpi_hsubsys
*ph_subsys
,
1813 u32 h_control
, u16
*pw_error_data
)
1818 error
= hpi_control_param1_get(ph_subsys
, h_control
,
1819 HPI_AESEBURX_ERRORSTATUS
, &error_data
);
1821 *pw_error_data
= (u16
)error_data
;
1825 u16
HPI_AESEBU__transmitter_set_sample_rate(const struct hpi_hsubsys
1826 *ph_subsys
, u32 h_control
, u32 sample_rate
)
1828 return hpi_control_param_set(ph_subsys
, h_control
,
1829 HPI_AESEBUTX_SAMPLERATE
, sample_rate
, 0);
1832 u16
HPI_AESEBU__transmitter_set_user_data(const struct hpi_hsubsys
*ph_subsys
,
1833 u32 h_control
, u16 index
, u16 data
)
1835 return hpi_control_param_set(ph_subsys
, h_control
,
1836 HPI_AESEBUTX_USERDATA
, index
, data
);
1839 u16
HPI_AESEBU__transmitter_set_channel_status(const struct hpi_hsubsys
1840 *ph_subsys
, u32 h_control
, u16 index
, u16 data
)
1842 return hpi_control_param_set(ph_subsys
, h_control
,
1843 HPI_AESEBUTX_CHANNELSTATUS
, index
, data
);
1846 u16
HPI_AESEBU__transmitter_get_channel_status(const struct hpi_hsubsys
1847 *ph_subsys
, u32 h_control
, u16 index
, u16
*pw_data
)
1849 return HPI_ERROR_INVALID_OPERATION
;
1852 u16
HPI_AESEBU__transmitter_query_format(const struct hpi_hsubsys
*ph_subsys
,
1853 const u32 h_aes_tx
, const u32 index
, u16
*pw_format
)
1858 err
= hpi_control_query(ph_subsys
, h_aes_tx
, HPI_AESEBUTX_FORMAT
,
1860 *pw_format
= (u16
)qr
;
1864 u16
HPI_AESEBU__transmitter_set_format(const struct hpi_hsubsys
*ph_subsys
,
1865 u32 h_control
, u16 output_format
)
1867 return hpi_control_param_set(ph_subsys
, h_control
,
1868 HPI_AESEBUTX_FORMAT
, output_format
, 0);
1871 u16
HPI_AESEBU__transmitter_get_format(const struct hpi_hsubsys
*ph_subsys
,
1872 u32 h_control
, u16
*pw_output_format
)
1877 err
= hpi_control_param1_get(ph_subsys
, h_control
,
1878 HPI_AESEBUTX_FORMAT
, ¶m
);
1879 if (!err
&& pw_output_format
)
1880 *pw_output_format
= (u16
)param
;
1885 u16
hpi_bitstream_set_clock_edge(const struct hpi_hsubsys
*ph_subsys
,
1886 u32 h_control
, u16 edge_type
)
1888 return hpi_control_param_set(ph_subsys
, h_control
,
1889 HPI_BITSTREAM_CLOCK_EDGE
, edge_type
, 0);
1892 u16
hpi_bitstream_set_data_polarity(const struct hpi_hsubsys
*ph_subsys
,
1893 u32 h_control
, u16 polarity
)
1895 return hpi_control_param_set(ph_subsys
, h_control
,
1896 HPI_BITSTREAM_DATA_POLARITY
, polarity
, 0);
1899 u16
hpi_bitstream_get_activity(const struct hpi_hsubsys
*ph_subsys
,
1900 u32 h_control
, u16
*pw_clk_activity
, u16
*pw_data_activity
)
1902 struct hpi_message hm
;
1903 struct hpi_response hr
;
1904 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_CONTROL
,
1905 HPI_CONTROL_GET_STATE
);
1906 u32TOINDEXES(h_control
, &hm
.adapter_index
, &hm
.obj_index
);
1907 hm
.u
.c
.attribute
= HPI_BITSTREAM_ACTIVITY
;
1908 hpi_send_recv(&hm
, &hr
);
1909 if (pw_clk_activity
)
1910 *pw_clk_activity
= (u16
)hr
.u
.c
.param1
;
1911 if (pw_data_activity
)
1912 *pw_data_activity
= (u16
)hr
.u
.c
.param2
;
1916 u16
hpi_channel_mode_query_mode(const struct hpi_hsubsys
*ph_subsys
,
1917 const u32 h_mode
, const u32 index
, u16
*pw_mode
)
1922 err
= hpi_control_query(ph_subsys
, h_mode
, HPI_CHANNEL_MODE_MODE
,
1928 u16
hpi_channel_mode_set(const struct hpi_hsubsys
*ph_subsys
, u32 h_control
,
1931 return hpi_control_param_set(ph_subsys
, h_control
,
1932 HPI_CHANNEL_MODE_MODE
, mode
, 0);
1935 u16
hpi_channel_mode_get(const struct hpi_hsubsys
*ph_subsys
, u32 h_control
,
1939 u16 error
= hpi_control_param1_get(ph_subsys
, h_control
,
1940 HPI_CHANNEL_MODE_MODE
, &mode32
);
1942 *mode
= (u16
)mode32
;
1946 u16
hpi_cobranet_hmi_write(const struct hpi_hsubsys
*ph_subsys
, u32 h_control
,
1947 u32 hmi_address
, u32 byte_count
, u8
*pb_data
)
1949 struct hpi_message hm
;
1950 struct hpi_response hr
;
1952 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_CONTROLEX
,
1953 HPI_CONTROL_SET_STATE
);
1954 u32TOINDEXES(h_control
, &hm
.adapter_index
, &hm
.obj_index
);
1956 hm
.u
.cx
.u
.cobranet_data
.byte_count
= byte_count
;
1957 hm
.u
.cx
.u
.cobranet_data
.hmi_address
= hmi_address
;
1959 if (byte_count
<= 8) {
1960 memcpy(hm
.u
.cx
.u
.cobranet_data
.data
, pb_data
, byte_count
);
1961 hm
.u
.cx
.attribute
= HPI_COBRANET_SET
;
1963 hm
.u
.cx
.u
.cobranet_bigdata
.pb_data
= pb_data
;
1964 hm
.u
.cx
.attribute
= HPI_COBRANET_SET_DATA
;
1967 hpi_send_recv(&hm
, &hr
);
1972 u16
hpi_cobranet_hmi_read(const struct hpi_hsubsys
*ph_subsys
, u32 h_control
,
1973 u32 hmi_address
, u32 max_byte_count
, u32
*pbyte_count
, u8
*pb_data
)
1975 struct hpi_message hm
;
1976 struct hpi_response hr
;
1978 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_CONTROLEX
,
1979 HPI_CONTROL_GET_STATE
);
1980 u32TOINDEXES(h_control
, &hm
.adapter_index
, &hm
.obj_index
);
1982 hm
.u
.cx
.u
.cobranet_data
.byte_count
= max_byte_count
;
1983 hm
.u
.cx
.u
.cobranet_data
.hmi_address
= hmi_address
;
1985 if (max_byte_count
<= 8) {
1986 hm
.u
.cx
.attribute
= HPI_COBRANET_GET
;
1988 hm
.u
.cx
.u
.cobranet_bigdata
.pb_data
= pb_data
;
1989 hm
.u
.cx
.attribute
= HPI_COBRANET_GET_DATA
;
1992 hpi_send_recv(&hm
, &hr
);
1993 if (!hr
.error
&& pb_data
) {
1995 *pbyte_count
= hr
.u
.cx
.u
.cobranet_data
.byte_count
;
1997 if (*pbyte_count
< max_byte_count
)
1998 max_byte_count
= *pbyte_count
;
2000 if (hm
.u
.cx
.attribute
== HPI_COBRANET_GET
) {
2001 memcpy(pb_data
, hr
.u
.cx
.u
.cobranet_data
.data
,
2011 u16
hpi_cobranet_hmi_get_status(const struct hpi_hsubsys
*ph_subsys
,
2012 u32 h_control
, u32
*pstatus
, u32
*preadable_size
,
2013 u32
*pwriteable_size
)
2015 struct hpi_message hm
;
2016 struct hpi_response hr
;
2018 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_CONTROLEX
,
2019 HPI_CONTROL_GET_STATE
);
2020 u32TOINDEXES(h_control
, &hm
.adapter_index
, &hm
.obj_index
);
2022 hm
.u
.cx
.attribute
= HPI_COBRANET_GET_STATUS
;
2024 hpi_send_recv(&hm
, &hr
);
2027 *pstatus
= hr
.u
.cx
.u
.cobranet_status
.status
;
2030 hr
.u
.cx
.u
.cobranet_status
.readable_size
;
2031 if (pwriteable_size
)
2033 hr
.u
.cx
.u
.cobranet_status
.writeable_size
;
2038 u16
hpi_cobranet_getI_paddress(const struct hpi_hsubsys
*ph_subsys
,
2039 u32 h_control
, u32
*pi_paddress
)
2045 error
= hpi_cobranet_hmi_read(ph_subsys
, h_control
,
2046 HPI_COBRANET_HMI_cobra_ip_mon_currentIP
, 4, &byte_count
,
2050 ((iP
& 0xff000000) >> 8) | ((iP
& 0x00ff0000) << 8) | ((iP
&
2051 0x0000ff00) >> 8) | ((iP
& 0x000000ff) << 8);
2060 u16
hpi_cobranet_setI_paddress(const struct hpi_hsubsys
*ph_subsys
,
2061 u32 h_control
, u32 i_paddress
)
2066 iP
= ((i_paddress
& 0xff000000) >> 8) | ((i_paddress
& 0x00ff0000) <<
2067 8) | ((i_paddress
& 0x0000ff00) >> 8) | ((i_paddress
&
2070 error
= hpi_cobranet_hmi_write(ph_subsys
, h_control
,
2071 HPI_COBRANET_HMI_cobra_ip_mon_currentIP
, 4, (u8
*)&iP
);
2077 u16
hpi_cobranet_get_staticI_paddress(const struct hpi_hsubsys
*ph_subsys
,
2078 u32 h_control
, u32
*pi_paddress
)
2083 error
= hpi_cobranet_hmi_read(ph_subsys
, h_control
,
2084 HPI_COBRANET_HMI_cobra_ip_mon_staticIP
, 4, &byte_count
,
2088 ((iP
& 0xff000000) >> 8) | ((iP
& 0x00ff0000) << 8) | ((iP
&
2089 0x0000ff00) >> 8) | ((iP
& 0x000000ff) << 8);
2098 u16
hpi_cobranet_set_staticI_paddress(const struct hpi_hsubsys
*ph_subsys
,
2099 u32 h_control
, u32 i_paddress
)
2104 iP
= ((i_paddress
& 0xff000000) >> 8) | ((i_paddress
& 0x00ff0000) <<
2105 8) | ((i_paddress
& 0x0000ff00) >> 8) | ((i_paddress
&
2108 error
= hpi_cobranet_hmi_write(ph_subsys
, h_control
,
2109 HPI_COBRANET_HMI_cobra_ip_mon_staticIP
, 4, (u8
*)&iP
);
2115 u16
hpi_cobranet_getMA_caddress(const struct hpi_hsubsys
*ph_subsys
,
2116 u32 h_control
, u32
*pmAC_MS_bs
, u32
*pmAC_LS_bs
)
2122 error
= hpi_cobranet_hmi_read(ph_subsys
, h_control
,
2123 HPI_COBRANET_HMI_cobra_if_phy_address
, 4, &byte_count
,
2126 ((mAC
& 0xff000000) >> 8) | ((mAC
& 0x00ff0000) << 8) | ((mAC
2127 & 0x0000ff00) >> 8) | ((mAC
& 0x000000ff) << 8);
2128 error
+= hpi_cobranet_hmi_read(ph_subsys
, h_control
,
2129 HPI_COBRANET_HMI_cobra_if_phy_address
+ 1, 4, &byte_count
,
2132 ((mAC
& 0xff000000) >> 8) | ((mAC
& 0x00ff0000) << 8) | ((mAC
2133 & 0x0000ff00) >> 8) | ((mAC
& 0x000000ff) << 8);
2143 u16
hpi_compander_set_enable(const struct hpi_hsubsys
*ph_subsys
,
2144 u32 h_control
, u32 enable
)
2146 return hpi_control_param_set(ph_subsys
, h_control
, HPI_GENERIC_ENABLE
,
2150 u16
hpi_compander_get_enable(const struct hpi_hsubsys
*ph_subsys
,
2151 u32 h_control
, u32
*enable
)
2153 return hpi_control_param1_get(ph_subsys
, h_control
,
2154 HPI_GENERIC_ENABLE
, enable
);
2157 u16
hpi_compander_set_makeup_gain(const struct hpi_hsubsys
*ph_subsys
,
2158 u32 h_control
, short makeup_gain0_01dB
)
2160 return hpi_control_log_set2(h_control
, HPI_COMPANDER_MAKEUPGAIN
,
2161 makeup_gain0_01dB
, 0);
2164 u16
hpi_compander_get_makeup_gain(const struct hpi_hsubsys
*ph_subsys
,
2165 u32 h_control
, short *makeup_gain0_01dB
)
2167 return hpi_control_log_get2(ph_subsys
, h_control
,
2168 HPI_COMPANDER_MAKEUPGAIN
, makeup_gain0_01dB
, NULL
);
2171 u16
hpi_compander_set_attack_time_constant(const struct hpi_hsubsys
2172 *ph_subsys
, u32 h_control
, unsigned int index
, u32 attack
)
2174 return hpi_control_param_set(ph_subsys
, h_control
,
2175 HPI_COMPANDER_ATTACK
, attack
, index
);
2178 u16
hpi_compander_get_attack_time_constant(const struct hpi_hsubsys
2179 *ph_subsys
, u32 h_control
, unsigned int index
, u32
*attack
)
2181 return hpi_control_param_get(ph_subsys
, h_control
,
2182 HPI_COMPANDER_ATTACK
, 0, index
, attack
, NULL
);
2185 u16
hpi_compander_set_decay_time_constant(const struct hpi_hsubsys
*ph_subsys
,
2186 u32 h_control
, unsigned int index
, u32 decay
)
2188 return hpi_control_param_set(ph_subsys
, h_control
,
2189 HPI_COMPANDER_DECAY
, decay
, index
);
2192 u16
hpi_compander_get_decay_time_constant(const struct hpi_hsubsys
*ph_subsys
,
2193 u32 h_control
, unsigned int index
, u32
*decay
)
2195 return hpi_control_param_get(ph_subsys
, h_control
,
2196 HPI_COMPANDER_DECAY
, 0, index
, decay
, NULL
);
2200 u16
hpi_compander_set_threshold(const struct hpi_hsubsys
*ph_subsys
,
2201 u32 h_control
, unsigned int index
, short threshold0_01dB
)
2203 struct hpi_message hm
;
2204 struct hpi_response hr
;
2206 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_CONTROL
,
2207 HPI_CONTROL_SET_STATE
);
2208 u32TOINDEXES(h_control
, &hm
.adapter_index
, &hm
.obj_index
);
2209 hm
.u
.c
.attribute
= HPI_COMPANDER_THRESHOLD
;
2210 hm
.u
.c
.param2
= index
;
2211 hm
.u
.c
.an_log_value
[0] = threshold0_01dB
;
2213 hpi_send_recv(&hm
, &hr
);
2218 u16
hpi_compander_get_threshold(const struct hpi_hsubsys
*ph_subsys
,
2219 u32 h_control
, unsigned int index
, short *threshold0_01dB
)
2221 struct hpi_message hm
;
2222 struct hpi_response hr
;
2224 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_CONTROL
,
2225 HPI_CONTROL_GET_STATE
);
2226 u32TOINDEXES(h_control
, &hm
.adapter_index
, &hm
.obj_index
);
2227 hm
.u
.c
.attribute
= HPI_COMPANDER_THRESHOLD
;
2228 hm
.u
.c
.param2
= index
;
2230 hpi_send_recv(&hm
, &hr
);
2231 *threshold0_01dB
= hr
.u
.c
.an_log_value
[0];
2236 u16
hpi_compander_set_ratio(const struct hpi_hsubsys
*ph_subsys
,
2237 u32 h_control
, u32 index
, u32 ratio100
)
2239 return hpi_control_param_set(ph_subsys
, h_control
,
2240 HPI_COMPANDER_RATIO
, ratio100
, index
);
2243 u16
hpi_compander_get_ratio(const struct hpi_hsubsys
*ph_subsys
,
2244 u32 h_control
, u32 index
, u32
*ratio100
)
2246 return hpi_control_param_get(ph_subsys
, h_control
,
2247 HPI_COMPANDER_RATIO
, 0, index
, ratio100
, NULL
);
2250 u16
hpi_level_query_range(const struct hpi_hsubsys
*ph_subsys
, u32 h_control
,
2251 short *min_gain_01dB
, short *max_gain_01dB
, short *step_gain_01dB
)
2253 struct hpi_message hm
;
2254 struct hpi_response hr
;
2256 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_CONTROL
,
2257 HPI_CONTROL_GET_STATE
);
2258 u32TOINDEXES(h_control
, &hm
.adapter_index
, &hm
.obj_index
);
2259 hm
.u
.c
.attribute
= HPI_LEVEL_RANGE
;
2261 hpi_send_recv(&hm
, &hr
);
2263 hr
.u
.c
.an_log_value
[0] = 0;
2264 hr
.u
.c
.an_log_value
[1] = 0;
2268 *min_gain_01dB
= hr
.u
.c
.an_log_value
[0];
2270 *max_gain_01dB
= hr
.u
.c
.an_log_value
[1];
2272 *step_gain_01dB
= (short)hr
.u
.c
.param1
;
2276 u16
hpi_level_set_gain(const struct hpi_hsubsys
*ph_subsys
, u32 h_control
,
2277 short an_gain0_01dB
[HPI_MAX_CHANNELS
]
2280 return hpi_control_log_set2(h_control
, HPI_LEVEL_GAIN
,
2281 an_gain0_01dB
[0], an_gain0_01dB
[1]);
2284 u16
hpi_level_get_gain(const struct hpi_hsubsys
*ph_subsys
, u32 h_control
,
2285 short an_gain0_01dB
[HPI_MAX_CHANNELS
]
2288 return hpi_control_log_get2(ph_subsys
, h_control
, HPI_LEVEL_GAIN
,
2289 &an_gain0_01dB
[0], &an_gain0_01dB
[1]);
2292 u16
hpi_meter_query_channels(const struct hpi_hsubsys
*ph_subsys
,
2293 const u32 h_meter
, u32
*p_channels
)
2295 return hpi_control_query(ph_subsys
, h_meter
, HPI_METER_NUM_CHANNELS
,
2299 u16
hpi_meter_get_peak(const struct hpi_hsubsys
*ph_subsys
, u32 h_control
,
2300 short an_peakdB
[HPI_MAX_CHANNELS
]
2305 struct hpi_message hm
;
2306 struct hpi_response hr
;
2308 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_CONTROL
,
2309 HPI_CONTROL_GET_STATE
);
2310 u32TOINDEXES(h_control
, &hm
.adapter_index
, &hm
.obj_index
);
2311 hm
.obj_index
= hm
.obj_index
;
2312 hm
.u
.c
.attribute
= HPI_METER_PEAK
;
2314 hpi_send_recv(&hm
, &hr
);
2317 memcpy(an_peakdB
, hr
.u
.c
.an_log_value
,
2318 sizeof(short) * HPI_MAX_CHANNELS
);
2320 for (i
= 0; i
< HPI_MAX_CHANNELS
; i
++)
2321 an_peakdB
[i
] = HPI_METER_MINIMUM
;
2325 u16
hpi_meter_get_rms(const struct hpi_hsubsys
*ph_subsys
, u32 h_control
,
2326 short an_rmsdB
[HPI_MAX_CHANNELS
]
2331 struct hpi_message hm
;
2332 struct hpi_response hr
;
2334 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_CONTROL
,
2335 HPI_CONTROL_GET_STATE
);
2336 u32TOINDEXES(h_control
, &hm
.adapter_index
, &hm
.obj_index
);
2337 hm
.u
.c
.attribute
= HPI_METER_RMS
;
2339 hpi_send_recv(&hm
, &hr
);
2342 memcpy(an_rmsdB
, hr
.u
.c
.an_log_value
,
2343 sizeof(short) * HPI_MAX_CHANNELS
);
2345 for (i
= 0; i
< HPI_MAX_CHANNELS
; i
++)
2346 an_rmsdB
[i
] = HPI_METER_MINIMUM
;
2351 u16
hpi_meter_set_rms_ballistics(const struct hpi_hsubsys
*ph_subsys
,
2352 u32 h_control
, u16 attack
, u16 decay
)
2354 return hpi_control_param_set(ph_subsys
, h_control
,
2355 HPI_METER_RMS_BALLISTICS
, attack
, decay
);
2358 u16
hpi_meter_get_rms_ballistics(const struct hpi_hsubsys
*ph_subsys
,
2359 u32 h_control
, u16
*pn_attack
, u16
*pn_decay
)
2365 error
= hpi_control_param2_get(ph_subsys
, h_control
,
2366 HPI_METER_RMS_BALLISTICS
, &attack
, &decay
);
2369 *pn_attack
= (unsigned short)attack
;
2371 *pn_decay
= (unsigned short)decay
;
2376 u16
hpi_meter_set_peak_ballistics(const struct hpi_hsubsys
*ph_subsys
,
2377 u32 h_control
, u16 attack
, u16 decay
)
2379 return hpi_control_param_set(ph_subsys
, h_control
,
2380 HPI_METER_PEAK_BALLISTICS
, attack
, decay
);
2383 u16
hpi_meter_get_peak_ballistics(const struct hpi_hsubsys
*ph_subsys
,
2384 u32 h_control
, u16
*pn_attack
, u16
*pn_decay
)
2390 error
= hpi_control_param2_get(ph_subsys
, h_control
,
2391 HPI_METER_PEAK_BALLISTICS
, &attack
, &decay
);
2394 *pn_attack
= (short)attack
;
2396 *pn_decay
= (short)decay
;
2401 u16
hpi_microphone_set_phantom_power(const struct hpi_hsubsys
*ph_subsys
,
2402 u32 h_control
, u16 on_off
)
2404 return hpi_control_param_set(ph_subsys
, h_control
,
2405 HPI_MICROPHONE_PHANTOM_POWER
, (u32
)on_off
, 0);
2408 u16
hpi_microphone_get_phantom_power(const struct hpi_hsubsys
*ph_subsys
,
2409 u32 h_control
, u16
*pw_on_off
)
2413 error
= hpi_control_param1_get(ph_subsys
, h_control
,
2414 HPI_MICROPHONE_PHANTOM_POWER
, &on_off
);
2416 *pw_on_off
= (u16
)on_off
;
2420 u16
hpi_multiplexer_set_source(const struct hpi_hsubsys
*ph_subsys
,
2421 u32 h_control
, u16 source_node_type
, u16 source_node_index
)
2423 return hpi_control_param_set(ph_subsys
, h_control
,
2424 HPI_MULTIPLEXER_SOURCE
, source_node_type
, source_node_index
);
2427 u16
hpi_multiplexer_get_source(const struct hpi_hsubsys
*ph_subsys
,
2428 u32 h_control
, u16
*source_node_type
, u16
*source_node_index
)
2431 u16 error
= hpi_control_param2_get(ph_subsys
, h_control
,
2432 HPI_MULTIPLEXER_SOURCE
, &node
,
2434 if (source_node_type
)
2435 *source_node_type
= (u16
)node
;
2436 if (source_node_index
)
2437 *source_node_index
= (u16
)index
;
2441 u16
hpi_multiplexer_query_source(const struct hpi_hsubsys
*ph_subsys
,
2442 u32 h_control
, u16 index
, u16
*source_node_type
,
2443 u16
*source_node_index
)
2445 struct hpi_message hm
;
2446 struct hpi_response hr
;
2447 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_CONTROL
,
2448 HPI_CONTROL_GET_STATE
);
2449 u32TOINDEXES(h_control
, &hm
.adapter_index
, &hm
.obj_index
);
2450 hm
.u
.c
.attribute
= HPI_MULTIPLEXER_QUERYSOURCE
;
2451 hm
.u
.c
.param1
= index
;
2453 hpi_send_recv(&hm
, &hr
);
2455 if (source_node_type
)
2456 *source_node_type
= (u16
)hr
.u
.c
.param1
;
2457 if (source_node_index
)
2458 *source_node_index
= (u16
)hr
.u
.c
.param2
;
2462 u16
hpi_parametricEQ__get_info(const struct hpi_hsubsys
*ph_subsys
,
2463 u32 h_control
, u16
*pw_number_of_bands
, u16
*pw_on_off
)
2469 error
= hpi_control_param2_get(ph_subsys
, h_control
,
2470 HPI_EQUALIZER_NUM_FILTERS
, &oO
, &oB
);
2471 if (pw_number_of_bands
)
2472 *pw_number_of_bands
= (u16
)oB
;
2474 *pw_on_off
= (u16
)oO
;
2478 u16
hpi_parametricEQ__set_state(const struct hpi_hsubsys
*ph_subsys
,
2479 u32 h_control
, u16 on_off
)
2481 return hpi_control_param_set(ph_subsys
, h_control
,
2482 HPI_EQUALIZER_NUM_FILTERS
, on_off
, 0);
2485 u16
hpi_parametricEQ__get_band(const struct hpi_hsubsys
*ph_subsys
,
2486 u32 h_control
, u16 index
, u16
*pn_type
, u32
*pfrequency_hz
,
2487 short *pnQ100
, short *pn_gain0_01dB
)
2489 struct hpi_message hm
;
2490 struct hpi_response hr
;
2492 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_CONTROL
,
2493 HPI_CONTROL_GET_STATE
);
2494 u32TOINDEXES(h_control
, &hm
.adapter_index
, &hm
.obj_index
);
2495 hm
.u
.c
.attribute
= HPI_EQUALIZER_FILTER
;
2496 hm
.u
.c
.param2
= index
;
2498 hpi_send_recv(&hm
, &hr
);
2501 *pfrequency_hz
= hr
.u
.c
.param1
;
2503 *pn_type
= (u16
)(hr
.u
.c
.param2
>> 16);
2505 *pnQ100
= hr
.u
.c
.an_log_value
[1];
2507 *pn_gain0_01dB
= hr
.u
.c
.an_log_value
[0];
2512 u16
hpi_parametricEQ__set_band(const struct hpi_hsubsys
*ph_subsys
,
2513 u32 h_control
, u16 index
, u16 type
, u32 frequency_hz
, short q100
,
2516 struct hpi_message hm
;
2517 struct hpi_response hr
;
2519 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_CONTROL
,
2520 HPI_CONTROL_SET_STATE
);
2521 u32TOINDEXES(h_control
, &hm
.adapter_index
, &hm
.obj_index
);
2523 hm
.u
.c
.param1
= frequency_hz
;
2524 hm
.u
.c
.param2
= (index
& 0xFFFFL
) + ((u32
)type
<< 16);
2525 hm
.u
.c
.an_log_value
[0] = gain0_01dB
;
2526 hm
.u
.c
.an_log_value
[1] = q100
;
2527 hm
.u
.c
.attribute
= HPI_EQUALIZER_FILTER
;
2529 hpi_send_recv(&hm
, &hr
);
2534 u16
hpi_parametricEQ__get_coeffs(const struct hpi_hsubsys
*ph_subsys
,
2535 u32 h_control
, u16 index
, short coeffs
[5]
2538 struct hpi_message hm
;
2539 struct hpi_response hr
;
2541 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_CONTROL
,
2542 HPI_CONTROL_GET_STATE
);
2543 u32TOINDEXES(h_control
, &hm
.adapter_index
, &hm
.obj_index
);
2544 hm
.u
.c
.attribute
= HPI_EQUALIZER_COEFFICIENTS
;
2545 hm
.u
.c
.param2
= index
;
2547 hpi_send_recv(&hm
, &hr
);
2549 coeffs
[0] = (short)hr
.u
.c
.an_log_value
[0];
2550 coeffs
[1] = (short)hr
.u
.c
.an_log_value
[1];
2551 coeffs
[2] = (short)hr
.u
.c
.param1
;
2552 coeffs
[3] = (short)(hr
.u
.c
.param1
>> 16);
2553 coeffs
[4] = (short)hr
.u
.c
.param2
;
2558 u16
hpi_sample_clock_query_source(const struct hpi_hsubsys
*ph_subsys
,
2559 const u32 h_clock
, const u32 index
, u16
*pw_source
)
2564 err
= hpi_control_query(ph_subsys
, h_clock
, HPI_SAMPLECLOCK_SOURCE
,
2566 *pw_source
= (u16
)qr
;
2570 u16
hpi_sample_clock_set_source(const struct hpi_hsubsys
*ph_subsys
,
2571 u32 h_control
, u16 source
)
2573 return hpi_control_param_set(ph_subsys
, h_control
,
2574 HPI_SAMPLECLOCK_SOURCE
, source
, 0);
2577 u16
hpi_sample_clock_get_source(const struct hpi_hsubsys
*ph_subsys
,
2578 u32 h_control
, u16
*pw_source
)
2582 error
= hpi_control_param1_get(ph_subsys
, h_control
,
2583 HPI_SAMPLECLOCK_SOURCE
, &source
);
2586 *pw_source
= (u16
)source
;
2590 u16
hpi_sample_clock_query_source_index(const struct hpi_hsubsys
*ph_subsys
,
2591 const u32 h_clock
, const u32 index
, const u32 source
,
2592 u16
*pw_source_index
)
2597 err
= hpi_control_query(ph_subsys
, h_clock
,
2598 HPI_SAMPLECLOCK_SOURCE_INDEX
, index
, source
, &qr
);
2599 *pw_source_index
= (u16
)qr
;
2603 u16
hpi_sample_clock_set_source_index(const struct hpi_hsubsys
*ph_subsys
,
2604 u32 h_control
, u16 source_index
)
2606 return hpi_control_param_set(ph_subsys
, h_control
,
2607 HPI_SAMPLECLOCK_SOURCE_INDEX
, source_index
, 0);
2610 u16
hpi_sample_clock_get_source_index(const struct hpi_hsubsys
*ph_subsys
,
2611 u32 h_control
, u16
*pw_source_index
)
2614 u32 source_index
= 0;
2615 error
= hpi_control_param1_get(ph_subsys
, h_control
,
2616 HPI_SAMPLECLOCK_SOURCE_INDEX
, &source_index
);
2618 if (pw_source_index
)
2619 *pw_source_index
= (u16
)source_index
;
2623 u16
hpi_sample_clock_query_local_rate(const struct hpi_hsubsys
*ph_subsys
,
2624 const u32 h_clock
, const u32 index
, u32
*prate
)
2627 err
= hpi_control_query(ph_subsys
, h_clock
,
2628 HPI_SAMPLECLOCK_LOCAL_SAMPLERATE
, index
, 0, prate
);
2633 u16
hpi_sample_clock_set_local_rate(const struct hpi_hsubsys
*ph_subsys
,
2634 u32 h_control
, u32 sample_rate
)
2636 return hpi_control_param_set(ph_subsys
, h_control
,
2637 HPI_SAMPLECLOCK_LOCAL_SAMPLERATE
, sample_rate
, 0);
2640 u16
hpi_sample_clock_get_local_rate(const struct hpi_hsubsys
*ph_subsys
,
2641 u32 h_control
, u32
*psample_rate
)
2644 u32 sample_rate
= 0;
2645 error
= hpi_control_param1_get(ph_subsys
, h_control
,
2646 HPI_SAMPLECLOCK_LOCAL_SAMPLERATE
, &sample_rate
);
2649 *psample_rate
= sample_rate
;
2653 u16
hpi_sample_clock_get_sample_rate(const struct hpi_hsubsys
*ph_subsys
,
2654 u32 h_control
, u32
*psample_rate
)
2657 u32 sample_rate
= 0;
2658 error
= hpi_control_param1_get(ph_subsys
, h_control
,
2659 HPI_SAMPLECLOCK_SAMPLERATE
, &sample_rate
);
2662 *psample_rate
= sample_rate
;
2666 u16
hpi_sample_clock_set_auto(const struct hpi_hsubsys
*ph_subsys
,
2667 u32 h_control
, u32 enable
)
2669 return hpi_control_param_set(ph_subsys
, h_control
,
2670 HPI_SAMPLECLOCK_AUTO
, enable
, 0);
2673 u16
hpi_sample_clock_get_auto(const struct hpi_hsubsys
*ph_subsys
,
2674 u32 h_control
, u32
*penable
)
2676 return hpi_control_param1_get(ph_subsys
, h_control
,
2677 HPI_SAMPLECLOCK_AUTO
, penable
);
2680 u16
hpi_sample_clock_set_local_rate_lock(const struct hpi_hsubsys
*ph_subsys
,
2681 u32 h_control
, u32 lock
)
2683 return hpi_control_param_set(ph_subsys
, h_control
,
2684 HPI_SAMPLECLOCK_LOCAL_LOCK
, lock
, 0);
2687 u16
hpi_sample_clock_get_local_rate_lock(const struct hpi_hsubsys
*ph_subsys
,
2688 u32 h_control
, u32
*plock
)
2690 return hpi_control_param1_get(ph_subsys
, h_control
,
2691 HPI_SAMPLECLOCK_LOCAL_LOCK
, plock
);
2694 u16
hpi_tone_detector_get_frequency(const struct hpi_hsubsys
*ph_subsys
,
2695 u32 h_control
, u32 index
, u32
*frequency
)
2697 return hpi_control_param_get(ph_subsys
, h_control
,
2698 HPI_TONEDETECTOR_FREQUENCY
, index
, 0, frequency
, NULL
);
2701 u16
hpi_tone_detector_get_state(const struct hpi_hsubsys
*ph_subsys
,
2702 u32 h_control
, u32
*state
)
2704 return hpi_control_param1_get(ph_subsys
, h_control
,
2705 HPI_TONEDETECTOR_STATE
, state
);
2708 u16
hpi_tone_detector_set_enable(const struct hpi_hsubsys
*ph_subsys
,
2709 u32 h_control
, u32 enable
)
2711 return hpi_control_param_set(ph_subsys
, h_control
, HPI_GENERIC_ENABLE
,
2715 u16
hpi_tone_detector_get_enable(const struct hpi_hsubsys
*ph_subsys
,
2716 u32 h_control
, u32
*enable
)
2718 return hpi_control_param1_get(ph_subsys
, h_control
,
2719 HPI_GENERIC_ENABLE
, enable
);
2722 u16
hpi_tone_detector_set_event_enable(const struct hpi_hsubsys
*ph_subsys
,
2723 u32 h_control
, u32 event_enable
)
2725 return hpi_control_param_set(ph_subsys
, h_control
,
2726 HPI_GENERIC_EVENT_ENABLE
, (u32
)event_enable
, 0);
2729 u16
hpi_tone_detector_get_event_enable(const struct hpi_hsubsys
*ph_subsys
,
2730 u32 h_control
, u32
*event_enable
)
2732 return hpi_control_param1_get(ph_subsys
, h_control
,
2733 HPI_GENERIC_EVENT_ENABLE
, event_enable
);
2736 u16
hpi_tone_detector_set_threshold(const struct hpi_hsubsys
*ph_subsys
,
2737 u32 h_control
, int threshold
)
2739 return hpi_control_param_set(ph_subsys
, h_control
,
2740 HPI_TONEDETECTOR_THRESHOLD
, (u32
)threshold
, 0);
2743 u16
hpi_tone_detector_get_threshold(const struct hpi_hsubsys
*ph_subsys
,
2744 u32 h_control
, int *threshold
)
2746 return hpi_control_param1_get(ph_subsys
, h_control
,
2747 HPI_TONEDETECTOR_THRESHOLD
, (u32
*)threshold
);
2750 u16
hpi_silence_detector_get_state(const struct hpi_hsubsys
*ph_subsys
,
2751 u32 h_control
, u32
*state
)
2753 return hpi_control_param1_get(ph_subsys
, h_control
,
2754 HPI_SILENCEDETECTOR_STATE
, state
);
2757 u16
hpi_silence_detector_set_enable(const struct hpi_hsubsys
*ph_subsys
,
2758 u32 h_control
, u32 enable
)
2760 return hpi_control_param_set(ph_subsys
, h_control
, HPI_GENERIC_ENABLE
,
2764 u16
hpi_silence_detector_get_enable(const struct hpi_hsubsys
*ph_subsys
,
2765 u32 h_control
, u32
*enable
)
2767 return hpi_control_param1_get(ph_subsys
, h_control
,
2768 HPI_GENERIC_ENABLE
, enable
);
2771 u16
hpi_silence_detector_set_event_enable(const struct hpi_hsubsys
*ph_subsys
,
2772 u32 h_control
, u32 event_enable
)
2774 return hpi_control_param_set(ph_subsys
, h_control
,
2775 HPI_GENERIC_EVENT_ENABLE
, event_enable
, 0);
2778 u16
hpi_silence_detector_get_event_enable(const struct hpi_hsubsys
*ph_subsys
,
2779 u32 h_control
, u32
*event_enable
)
2781 return hpi_control_param1_get(ph_subsys
, h_control
,
2782 HPI_GENERIC_EVENT_ENABLE
, event_enable
);
2785 u16
hpi_silence_detector_set_delay(const struct hpi_hsubsys
*ph_subsys
,
2786 u32 h_control
, u32 delay
)
2788 return hpi_control_param_set(ph_subsys
, h_control
,
2789 HPI_SILENCEDETECTOR_DELAY
, delay
, 0);
2792 u16
hpi_silence_detector_get_delay(const struct hpi_hsubsys
*ph_subsys
,
2793 u32 h_control
, u32
*delay
)
2795 return hpi_control_param1_get(ph_subsys
, h_control
,
2796 HPI_SILENCEDETECTOR_DELAY
, delay
);
2799 u16
hpi_silence_detector_set_threshold(const struct hpi_hsubsys
*ph_subsys
,
2800 u32 h_control
, int threshold
)
2802 return hpi_control_param_set(ph_subsys
, h_control
,
2803 HPI_SILENCEDETECTOR_THRESHOLD
, threshold
, 0);
2806 u16
hpi_silence_detector_get_threshold(const struct hpi_hsubsys
*ph_subsys
,
2807 u32 h_control
, int *threshold
)
2809 return hpi_control_param1_get(ph_subsys
, h_control
,
2810 HPI_SILENCEDETECTOR_THRESHOLD
, (u32
*)threshold
);
2813 u16
hpi_tuner_query_band(const struct hpi_hsubsys
*ph_subsys
,
2814 const u32 h_tuner
, const u32 index
, u16
*pw_band
)
2819 err
= hpi_control_query(ph_subsys
, h_tuner
, HPI_TUNER_BAND
, index
, 0,
2825 u16
hpi_tuner_set_band(const struct hpi_hsubsys
*ph_subsys
, u32 h_control
,
2828 return hpi_control_param_set(ph_subsys
, h_control
, HPI_TUNER_BAND
,
2832 u16
hpi_tuner_get_band(const struct hpi_hsubsys
*ph_subsys
, u32 h_control
,
2838 error
= hpi_control_param1_get(ph_subsys
, h_control
, HPI_TUNER_BAND
,
2841 *pw_band
= (u16
)band
;
2845 u16
hpi_tuner_query_frequency(const struct hpi_hsubsys
*ph_subsys
,
2846 const u32 h_tuner
, const u32 index
, const u16 band
, u32
*pfreq
)
2848 return hpi_control_query(ph_subsys
, h_tuner
, HPI_TUNER_FREQ
, index
,
2852 u16
hpi_tuner_set_frequency(const struct hpi_hsubsys
*ph_subsys
,
2853 u32 h_control
, u32 freq_ink_hz
)
2855 return hpi_control_param_set(ph_subsys
, h_control
, HPI_TUNER_FREQ
,
2859 u16
hpi_tuner_get_frequency(const struct hpi_hsubsys
*ph_subsys
,
2860 u32 h_control
, u32
*pw_freq_ink_hz
)
2862 return hpi_control_param1_get(ph_subsys
, h_control
, HPI_TUNER_FREQ
,
2866 u16
hpi_tuner_query_gain(const struct hpi_hsubsys
*ph_subsys
,
2867 const u32 h_tuner
, const u32 index
, u16
*pw_gain
)
2872 err
= hpi_control_query(ph_subsys
, h_tuner
, HPI_TUNER_BAND
, index
, 0,
2878 u16
hpi_tuner_set_gain(const struct hpi_hsubsys
*ph_subsys
, u32 h_control
,
2881 return hpi_control_param_set(ph_subsys
, h_control
, HPI_TUNER_GAIN
,
2885 u16
hpi_tuner_get_gain(const struct hpi_hsubsys
*ph_subsys
, u32 h_control
,
2891 error
= hpi_control_param1_get(ph_subsys
, h_control
, HPI_TUNER_GAIN
,
2894 *pn_gain
= (u16
)gain
;
2898 u16
hpi_tuner_getRF_level(const struct hpi_hsubsys
*ph_subsys
, u32 h_control
,
2901 struct hpi_message hm
;
2902 struct hpi_response hr
;
2904 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_CONTROL
,
2905 HPI_CONTROL_GET_STATE
);
2906 u32TOINDEXES(h_control
, &hm
.adapter_index
, &hm
.obj_index
);
2907 hm
.u
.c
.attribute
= HPI_TUNER_LEVEL
;
2908 hm
.u
.c
.param1
= HPI_TUNER_LEVEL_AVERAGE
;
2909 hpi_send_recv(&hm
, &hr
);
2911 *pw_level
= (short)hr
.u
.c
.param1
;
2915 u16
hpi_tuner_get_rawRF_level(const struct hpi_hsubsys
*ph_subsys
,
2916 u32 h_control
, short *pw_level
)
2918 struct hpi_message hm
;
2919 struct hpi_response hr
;
2921 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_CONTROL
,
2922 HPI_CONTROL_GET_STATE
);
2923 u32TOINDEXES(h_control
, &hm
.adapter_index
, &hm
.obj_index
);
2924 hm
.u
.c
.attribute
= HPI_TUNER_LEVEL
;
2925 hm
.u
.c
.param1
= HPI_TUNER_LEVEL_RAW
;
2926 hpi_send_recv(&hm
, &hr
);
2928 *pw_level
= (short)hr
.u
.c
.param1
;
2932 u16
hpi_tuner_query_deemphasis(const struct hpi_hsubsys
*ph_subsys
,
2933 const u32 h_tuner
, const u32 index
, const u16 band
, u32
*pdeemphasis
)
2935 return hpi_control_query(ph_subsys
, h_tuner
, HPI_TUNER_DEEMPHASIS
,
2936 index
, band
, pdeemphasis
);
2939 u16
hpi_tuner_set_deemphasis(const struct hpi_hsubsys
*ph_subsys
,
2940 u32 h_control
, u32 deemphasis
)
2942 return hpi_control_param_set(ph_subsys
, h_control
,
2943 HPI_TUNER_DEEMPHASIS
, deemphasis
, 0);
2946 u16
hpi_tuner_get_deemphasis(const struct hpi_hsubsys
*ph_subsys
,
2947 u32 h_control
, u32
*pdeemphasis
)
2949 return hpi_control_param1_get(ph_subsys
, h_control
,
2950 HPI_TUNER_DEEMPHASIS
, pdeemphasis
);
2953 u16
hpi_tuner_query_program(const struct hpi_hsubsys
*ph_subsys
,
2954 const u32 h_tuner
, u32
*pbitmap_program
)
2956 return hpi_control_query(ph_subsys
, h_tuner
, HPI_TUNER_PROGRAM
, 0, 0,
2960 u16
hpi_tuner_set_program(const struct hpi_hsubsys
*ph_subsys
, u32 h_control
,
2963 return hpi_control_param_set(ph_subsys
, h_control
, HPI_TUNER_PROGRAM
,
2967 u16
hpi_tuner_get_program(const struct hpi_hsubsys
*ph_subsys
, u32 h_control
,
2970 return hpi_control_param1_get(ph_subsys
, h_control
, HPI_TUNER_PROGRAM
,
2974 u16
hpi_tuner_get_hd_radio_dsp_version(const struct hpi_hsubsys
*ph_subsys
,
2975 u32 h_control
, char *psz_dsp_version
, const u32 string_size
)
2977 return hpi_control_get_string(h_control
,
2978 HPI_TUNER_HDRADIO_DSP_VERSION
, psz_dsp_version
, string_size
);
2981 u16
hpi_tuner_get_hd_radio_sdk_version(const struct hpi_hsubsys
*ph_subsys
,
2982 u32 h_control
, char *psz_sdk_version
, const u32 string_size
)
2984 return hpi_control_get_string(h_control
,
2985 HPI_TUNER_HDRADIO_SDK_VERSION
, psz_sdk_version
, string_size
);
2988 u16
hpi_tuner_get_status(const struct hpi_hsubsys
*ph_subsys
, u32 h_control
,
2989 u16
*pw_status_mask
, u16
*pw_status
)
2994 error
= hpi_control_param1_get(ph_subsys
, h_control
, HPI_TUNER_STATUS
,
2998 *pw_status_mask
= (u16
)(status
>> 16);
2999 *pw_status
= (u16
)(status
& 0xFFFF);
3001 *pw_status_mask
= 0;
3008 u16
hpi_tuner_set_mode(const struct hpi_hsubsys
*ph_subsys
, u32 h_control
,
3009 u32 mode
, u32 value
)
3011 return hpi_control_param_set(ph_subsys
, h_control
, HPI_TUNER_MODE
,
3015 u16
hpi_tuner_get_mode(const struct hpi_hsubsys
*ph_subsys
, u32 h_control
,
3016 u32 mode
, u32
*pn_value
)
3018 return hpi_control_param_get(ph_subsys
, h_control
, HPI_TUNER_MODE
,
3019 mode
, 0, pn_value
, NULL
);
3022 u16
hpi_tuner_get_hd_radio_signal_quality(const struct hpi_hsubsys
*ph_subsys
,
3023 u32 h_control
, u32
*pquality
)
3025 return hpi_control_param1_get(ph_subsys
, h_control
,
3026 HPI_TUNER_HDRADIO_SIGNAL_QUALITY
, pquality
);
3029 u16
hpi_tuner_get_hd_radio_signal_blend(const struct hpi_hsubsys
*ph_subsys
,
3030 u32 h_control
, u32
*pblend
)
3032 return hpi_control_param1_get(ph_subsys
, h_control
,
3033 HPI_TUNER_HDRADIO_BLEND
, pblend
);
3036 u16
hpi_tuner_set_hd_radio_signal_blend(const struct hpi_hsubsys
*ph_subsys
,
3037 u32 h_control
, const u32 blend
)
3039 return hpi_control_param_set(ph_subsys
, h_control
,
3040 HPI_TUNER_HDRADIO_BLEND
, blend
, 0);
3043 u16
hpi_tuner_getRDS(const struct hpi_hsubsys
*ph_subsys
, u32 h_control
,
3046 struct hpi_message hm
;
3047 struct hpi_response hr
;
3049 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_CONTROL
,
3050 HPI_CONTROL_GET_STATE
);
3051 u32TOINDEXES(h_control
, &hm
.adapter_index
, &hm
.obj_index
);
3052 hm
.u
.c
.attribute
= HPI_TUNER_RDS
;
3053 hpi_send_recv(&hm
, &hr
);
3055 *(u32
*)&p_data
[0] = hr
.u
.cu
.tuner
.rds
.data
[0];
3056 *(u32
*)&p_data
[4] = hr
.u
.cu
.tuner
.rds
.data
[1];
3057 *(u32
*)&p_data
[8] = hr
.u
.cu
.tuner
.rds
.bLER
;
3062 u16
HPI_PAD__get_channel_name(const struct hpi_hsubsys
*ph_subsys
,
3063 u32 h_control
, char *psz_string
, const u32 data_length
)
3065 return hpi_control_get_string(h_control
, HPI_PAD_CHANNEL_NAME
,
3066 psz_string
, data_length
);
3069 u16
HPI_PAD__get_artist(const struct hpi_hsubsys
*ph_subsys
, u32 h_control
,
3070 char *psz_string
, const u32 data_length
)
3072 return hpi_control_get_string(h_control
, HPI_PAD_ARTIST
, psz_string
,
3076 u16
HPI_PAD__get_title(const struct hpi_hsubsys
*ph_subsys
, u32 h_control
,
3077 char *psz_string
, const u32 data_length
)
3079 return hpi_control_get_string(h_control
, HPI_PAD_TITLE
, psz_string
,
3083 u16
HPI_PAD__get_comment(const struct hpi_hsubsys
*ph_subsys
, u32 h_control
,
3084 char *psz_string
, const u32 data_length
)
3086 return hpi_control_get_string(h_control
, HPI_PAD_COMMENT
, psz_string
,
3090 u16
HPI_PAD__get_program_type(const struct hpi_hsubsys
*ph_subsys
,
3091 u32 h_control
, u32
*ppTY
)
3093 return hpi_control_param1_get(ph_subsys
, h_control
,
3094 HPI_PAD_PROGRAM_TYPE
, ppTY
);
3097 u16
HPI_PAD__get_rdsPI(const struct hpi_hsubsys
*ph_subsys
, u32 h_control
,
3100 return hpi_control_param1_get(ph_subsys
, h_control
,
3101 HPI_PAD_PROGRAM_ID
, ppI
);
3104 u16
hpi_volume_query_channels(const struct hpi_hsubsys
*ph_subsys
,
3105 const u32 h_volume
, u32
*p_channels
)
3107 return hpi_control_query(ph_subsys
, h_volume
, HPI_VOLUME_NUM_CHANNELS
,
3111 u16
hpi_volume_set_gain(const struct hpi_hsubsys
*ph_subsys
, u32 h_control
,
3112 short an_log_gain
[HPI_MAX_CHANNELS
]
3115 return hpi_control_log_set2(h_control
, HPI_VOLUME_GAIN
,
3116 an_log_gain
[0], an_log_gain
[1]);
3119 u16
hpi_volume_get_gain(const struct hpi_hsubsys
*ph_subsys
, u32 h_control
,
3120 short an_log_gain
[HPI_MAX_CHANNELS
]
3123 return hpi_control_log_get2(ph_subsys
, h_control
, HPI_VOLUME_GAIN
,
3124 &an_log_gain
[0], &an_log_gain
[1]);
3127 u16
hpi_volume_query_range(const struct hpi_hsubsys
*ph_subsys
, u32 h_control
,
3128 short *min_gain_01dB
, short *max_gain_01dB
, short *step_gain_01dB
)
3130 struct hpi_message hm
;
3131 struct hpi_response hr
;
3133 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_CONTROL
,
3134 HPI_CONTROL_GET_STATE
);
3135 u32TOINDEXES(h_control
, &hm
.adapter_index
, &hm
.obj_index
);
3136 hm
.u
.c
.attribute
= HPI_VOLUME_RANGE
;
3138 hpi_send_recv(&hm
, &hr
);
3140 hr
.u
.c
.an_log_value
[0] = 0;
3141 hr
.u
.c
.an_log_value
[1] = 0;
3145 *min_gain_01dB
= hr
.u
.c
.an_log_value
[0];
3147 *max_gain_01dB
= hr
.u
.c
.an_log_value
[1];
3149 *step_gain_01dB
= (short)hr
.u
.c
.param1
;
3153 u16
hpi_volume_auto_fade_profile(const struct hpi_hsubsys
*ph_subsys
,
3154 u32 h_control
, short an_stop_gain0_01dB
[HPI_MAX_CHANNELS
],
3155 u32 duration_ms
, u16 profile
)
3157 struct hpi_message hm
;
3158 struct hpi_response hr
;
3160 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_CONTROL
,
3161 HPI_CONTROL_SET_STATE
);
3162 u32TOINDEXES(h_control
, &hm
.adapter_index
, &hm
.obj_index
);
3164 memcpy(hm
.u
.c
.an_log_value
, an_stop_gain0_01dB
,
3165 sizeof(short) * HPI_MAX_CHANNELS
);
3167 hm
.u
.c
.attribute
= HPI_VOLUME_AUTOFADE
;
3168 hm
.u
.c
.param1
= duration_ms
;
3169 hm
.u
.c
.param2
= profile
;
3171 hpi_send_recv(&hm
, &hr
);
3176 u16
hpi_volume_auto_fade(const struct hpi_hsubsys
*ph_subsys
, u32 h_control
,
3177 short an_stop_gain0_01dB
[HPI_MAX_CHANNELS
], u32 duration_ms
)
3179 return hpi_volume_auto_fade_profile(ph_subsys
, h_control
,
3180 an_stop_gain0_01dB
, duration_ms
, HPI_VOLUME_AUTOFADE_LOG
);
3183 u16
hpi_vox_set_threshold(const struct hpi_hsubsys
*ph_subsys
, u32 h_control
,
3184 short an_gain0_01dB
)
3186 struct hpi_message hm
;
3187 struct hpi_response hr
;
3188 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_CONTROL
,
3189 HPI_CONTROL_SET_STATE
);
3190 u32TOINDEXES(h_control
, &hm
.adapter_index
, &hm
.obj_index
);
3191 hm
.u
.c
.attribute
= HPI_VOX_THRESHOLD
;
3193 hm
.u
.c
.an_log_value
[0] = an_gain0_01dB
;
3195 hpi_send_recv(&hm
, &hr
);
3200 u16
hpi_vox_get_threshold(const struct hpi_hsubsys
*ph_subsys
, u32 h_control
,
3201 short *an_gain0_01dB
)
3203 struct hpi_message hm
;
3204 struct hpi_response hr
;
3205 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_CONTROL
,
3206 HPI_CONTROL_GET_STATE
);
3207 u32TOINDEXES(h_control
, &hm
.adapter_index
, &hm
.obj_index
);
3208 hm
.u
.c
.attribute
= HPI_VOX_THRESHOLD
;
3210 hpi_send_recv(&hm
, &hr
);
3212 *an_gain0_01dB
= hr
.u
.c
.an_log_value
[0];
3217 static size_t strv_packet_size
= MIN_STRV_PACKET_SIZE
;
3219 static size_t entity_type_to_size
[LAST_ENTITY_TYPE
] = {
3221 sizeof(struct hpi_entity
),
3236 static inline size_t hpi_entity_size(struct hpi_entity
*entity_ptr
)
3238 return entity_ptr
->header
.size
;
3241 static inline size_t hpi_entity_header_size(struct hpi_entity
*entity_ptr
)
3243 return sizeof(entity_ptr
->header
);
3246 static inline size_t hpi_entity_value_size(struct hpi_entity
*entity_ptr
)
3248 return hpi_entity_size(entity_ptr
) -
3249 hpi_entity_header_size(entity_ptr
);
3252 static inline size_t hpi_entity_item_count(struct hpi_entity
*entity_ptr
)
3254 return hpi_entity_value_size(entity_ptr
) /
3255 entity_type_to_size
[entity_ptr
->header
.type
];
3258 static inline struct hpi_entity
*hpi_entity_ptr_to_next(struct hpi_entity
3261 return (void *)(((u8
*)entity_ptr
) + hpi_entity_size(entity_ptr
));
3264 static inline u16
hpi_entity_check_type(const enum e_entity_type t
)
3266 if (t
>= 0 && t
< STR_TYPE_FIELD_MAX
)
3268 return HPI_ERROR_ENTITY_TYPE_INVALID
;
3271 static inline u16
hpi_entity_check_role(const enum e_entity_role r
)
3273 if (r
>= 0 && r
< STR_ROLE_FIELD_MAX
)
3275 return HPI_ERROR_ENTITY_ROLE_INVALID
;
3278 static u16
hpi_entity_get_next(struct hpi_entity
*entity
, int recursive_flag
,
3279 void *guard_p
, struct hpi_entity
**next
)
3281 HPI_DEBUG_ASSERT(entity
!= NULL
);
3282 HPI_DEBUG_ASSERT(next
!= NULL
);
3283 HPI_DEBUG_ASSERT(hpi_entity_size(entity
) != 0);
3285 if (guard_p
<= (void *)entity
) {
3290 if (recursive_flag
&& entity
->header
.type
== entity_type_sequence
)
3291 *next
= (struct hpi_entity
*)entity
->value
;
3293 *next
= (struct hpi_entity
*)hpi_entity_ptr_to_next(entity
);
3295 if (guard_p
<= (void *)*next
) {
3300 HPI_DEBUG_ASSERT(guard_p
>= (void *)hpi_entity_ptr_to_next(*next
));
3304 u16
hpi_entity_find_next(struct hpi_entity
*container_entity
,
3305 enum e_entity_type type
, enum e_entity_role role
, int recursive_flag
,
3306 struct hpi_entity
**current_match
)
3308 struct hpi_entity
*tmp
= NULL
;
3309 void *guard_p
= NULL
;
3311 HPI_DEBUG_ASSERT(container_entity
!= NULL
);
3312 guard_p
= hpi_entity_ptr_to_next(container_entity
);
3314 if (*current_match
!= NULL
)
3315 hpi_entity_get_next(*current_match
, recursive_flag
, guard_p
,
3318 hpi_entity_get_next(container_entity
, 1, guard_p
, &tmp
);
3323 HPI_DEBUG_ASSERT((void *)tmp
>= (void *)container_entity
);
3325 if ((!type
|| tmp
->header
.type
== type
) && (!role
3326 || tmp
->header
.role
== role
)) {
3327 *current_match
= tmp
;
3331 err
= hpi_entity_get_next(tmp
, recursive_flag
, guard_p
,
3336 tmp
= *current_match
;
3339 *current_match
= NULL
;
3343 void hpi_entity_free(struct hpi_entity
*entity
)
3348 static u16
hpi_entity_alloc_and_copy(struct hpi_entity
*src
,
3349 struct hpi_entity
**dst
)
3352 HPI_DEBUG_ASSERT(dst
!= NULL
);
3353 HPI_DEBUG_ASSERT(src
!= NULL
);
3355 buf_size
= hpi_entity_size(src
);
3356 *dst
= kmalloc(buf_size
, GFP_KERNEL
);
3358 return HPI_ERROR_MEMORY_ALLOC
;
3359 memcpy(*dst
, src
, buf_size
);
3363 u16
hpi_universal_info(const struct hpi_hsubsys
*ph_subsys
, u32 hC
,
3364 struct hpi_entity
**info
)
3366 struct hpi_msg_strv hm
;
3367 struct hpi_res_strv
*phr
;
3369 int remaining_attempts
= 2;
3370 size_t resp_packet_size
= 1024;
3374 while (remaining_attempts
--) {
3375 phr
= kmalloc(resp_packet_size
, GFP_KERNEL
);
3376 HPI_DEBUG_ASSERT(phr
!= NULL
);
3378 hpi_init_message_responseV1(&hm
.h
, (u16
)sizeof(hm
), &phr
->h
,
3379 (u16
)resp_packet_size
, HPI_OBJ_CONTROL
,
3380 HPI_CONTROL_GET_INFO
);
3381 u32TOINDEXES(hC
, &hm
.h
.adapter_index
, &hm
.h
.obj_index
);
3383 hm
.strv
.header
.size
= sizeof(hm
.strv
);
3384 phr
->strv
.header
.size
= resp_packet_size
- sizeof(phr
->h
);
3386 hpi_send_recv((struct hpi_message
*)&hm
.h
,
3387 (struct hpi_response
*)&phr
->h
);
3388 if (phr
->h
.error
== HPI_ERROR_RESPONSE_BUFFER_TOO_SMALL
) {
3390 HPI_DEBUG_ASSERT(phr
->h
.specific_error
>
3391 MIN_STRV_PACKET_SIZE
3392 && phr
->h
.specific_error
< 1500);
3393 resp_packet_size
= phr
->h
.specific_error
;
3395 remaining_attempts
= 0;
3397 hpi_entity_alloc_and_copy(&phr
->strv
, info
);
3400 hpi_err
= phr
->h
.error
;
3407 u16
hpi_universal_get(const struct hpi_hsubsys
*ph_subsys
, u32 hC
,
3408 struct hpi_entity
**value
)
3410 struct hpi_msg_strv hm
;
3411 struct hpi_res_strv
*phr
;
3413 int remaining_attempts
= 2;
3417 while (remaining_attempts
--) {
3418 phr
= kmalloc(strv_packet_size
, GFP_KERNEL
);
3420 return HPI_ERROR_MEMORY_ALLOC
;
3422 hpi_init_message_responseV1(&hm
.h
, (u16
)sizeof(hm
), &phr
->h
,
3423 (u16
)strv_packet_size
, HPI_OBJ_CONTROL
,
3424 HPI_CONTROL_GET_STATE
);
3425 u32TOINDEXES(hC
, &hm
.h
.adapter_index
, &hm
.h
.obj_index
);
3427 hm
.strv
.header
.size
= sizeof(hm
.strv
);
3428 phr
->strv
.header
.size
= strv_packet_size
- sizeof(phr
->h
);
3430 hpi_send_recv((struct hpi_message
*)&hm
.h
,
3431 (struct hpi_response
*)&phr
->h
);
3432 if (phr
->h
.error
== HPI_ERROR_RESPONSE_BUFFER_TOO_SMALL
) {
3434 HPI_DEBUG_ASSERT(phr
->h
.specific_error
>
3435 MIN_STRV_PACKET_SIZE
3436 && phr
->h
.specific_error
< 1000);
3437 strv_packet_size
= phr
->h
.specific_error
;
3439 remaining_attempts
= 0;
3441 hpi_entity_alloc_and_copy(&phr
->strv
, value
);
3444 hpi_err
= phr
->h
.error
;
3451 u16
hpi_universal_set(const struct hpi_hsubsys
*ph_subsys
, u32 hC
,
3452 struct hpi_entity
*value
)
3454 struct hpi_msg_strv
*phm
;
3455 struct hpi_res_strv hr
;
3457 phm
= kmalloc(sizeof(phm
->h
) + value
->header
.size
, GFP_KERNEL
);
3458 HPI_DEBUG_ASSERT(phm
!= NULL
);
3460 hpi_init_message_responseV1(&phm
->h
,
3461 sizeof(phm
->h
) + value
->header
.size
, &hr
.h
, sizeof(hr
),
3462 HPI_OBJ_CONTROL
, HPI_CONTROL_SET_STATE
);
3463 u32TOINDEXES(hC
, &phm
->h
.adapter_index
, &phm
->h
.obj_index
);
3464 hr
.strv
.header
.size
= sizeof(hr
.strv
);
3466 memcpy(&phm
->strv
, value
, value
->header
.size
);
3467 hpi_send_recv((struct hpi_message
*)&phm
->h
,
3468 (struct hpi_response
*)&hr
.h
);
3473 u16
hpi_entity_alloc_and_pack(const enum e_entity_type type
,
3474 const size_t item_count
, const enum e_entity_role role
, void *value
,
3475 struct hpi_entity
**entity
)
3477 size_t bytes_to_copy
, total_size
;
3481 hE
= hpi_entity_check_type(type
);
3485 HPI_DEBUG_ASSERT(role
> entity_role_null
&& type
< LAST_ENTITY_TYPE
);
3487 bytes_to_copy
= entity_type_to_size
[type
] * item_count
;
3488 total_size
= hpi_entity_header_size(*entity
) + bytes_to_copy
;
3490 HPI_DEBUG_ASSERT(total_size
>= hpi_entity_header_size(*entity
)
3491 && total_size
< STR_SIZE_FIELD_MAX
);
3493 *entity
= kmalloc(total_size
, GFP_KERNEL
);
3494 if (*entity
== NULL
)
3495 return HPI_ERROR_MEMORY_ALLOC
;
3496 memcpy((*entity
)->value
, value
, bytes_to_copy
);
3497 (*entity
)->header
.size
=
3498 hpi_entity_header_size(*entity
) + bytes_to_copy
;
3499 (*entity
)->header
.type
= type
;
3500 (*entity
)->header
.role
= role
;
3504 u16
hpi_entity_copy_value_from(struct hpi_entity
*entity
,
3505 enum e_entity_type type
, size_t item_count
, void *value_dst_p
)
3507 size_t bytes_to_copy
;
3509 if (entity
->header
.type
!= type
)
3510 return HPI_ERROR_ENTITY_TYPE_MISMATCH
;
3512 if (hpi_entity_item_count(entity
) != item_count
)
3513 return HPI_ERROR_ENTITY_ITEM_COUNT
;
3515 bytes_to_copy
= entity_type_to_size
[type
] * item_count
;
3516 memcpy(value_dst_p
, entity
->value
, bytes_to_copy
);
3520 u16
hpi_entity_unpack(struct hpi_entity
*entity
, enum e_entity_type
*type
,
3521 size_t *item_count
, enum e_entity_role
*role
, void **value
)
3524 HPI_DEBUG_ASSERT(entity
!= NULL
);
3527 *type
= entity
->header
.type
;
3530 *role
= entity
->header
.role
;
3533 *value
= entity
->value
;
3535 if (item_count
!= NULL
) {
3536 if (entity
->header
.type
== entity_type_sequence
) {
3537 void *guard_p
= hpi_entity_ptr_to_next(entity
);
3538 struct hpi_entity
*next
= NULL
;
3539 void *contents
= entity
->value
;
3542 while (contents
< guard_p
) {
3544 err
= hpi_entity_get_next(contents
, 0,
3546 if (next
== NULL
|| err
)
3551 *item_count
= hpi_entity_item_count(entity
);
3557 u16
hpi_gpio_open(const struct hpi_hsubsys
*ph_subsys
, u16 adapter_index
,
3558 u32
*ph_gpio
, u16
*pw_number_input_bits
, u16
*pw_number_output_bits
)
3560 struct hpi_message hm
;
3561 struct hpi_response hr
;
3562 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_GPIO
, HPI_GPIO_OPEN
);
3563 hm
.adapter_index
= adapter_index
;
3565 hpi_send_recv(&hm
, &hr
);
3567 if (hr
.error
== 0) {
3569 hpi_indexes_to_handle(HPI_OBJ_GPIO
, adapter_index
, 0);
3570 if (pw_number_input_bits
)
3571 *pw_number_input_bits
= hr
.u
.l
.number_input_bits
;
3572 if (pw_number_output_bits
)
3573 *pw_number_output_bits
= hr
.u
.l
.number_output_bits
;
3579 u16
hpi_gpio_read_bit(const struct hpi_hsubsys
*ph_subsys
, u32 h_gpio
,
3580 u16 bit_index
, u16
*pw_bit_data
)
3582 struct hpi_message hm
;
3583 struct hpi_response hr
;
3584 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_GPIO
, HPI_GPIO_READ_BIT
);
3585 u32TOINDEX(h_gpio
, &hm
.adapter_index
);
3586 hm
.u
.l
.bit_index
= bit_index
;
3588 hpi_send_recv(&hm
, &hr
);
3590 *pw_bit_data
= hr
.u
.l
.bit_data
[0];
3594 u16
hpi_gpio_read_all_bits(const struct hpi_hsubsys
*ph_subsys
, u32 h_gpio
,
3595 u16 aw_all_bit_data
[4]
3598 struct hpi_message hm
;
3599 struct hpi_response hr
;
3600 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_GPIO
, HPI_GPIO_READ_ALL
);
3601 u32TOINDEX(h_gpio
, &hm
.adapter_index
);
3603 hpi_send_recv(&hm
, &hr
);
3605 if (aw_all_bit_data
) {
3606 aw_all_bit_data
[0] = hr
.u
.l
.bit_data
[0];
3607 aw_all_bit_data
[1] = hr
.u
.l
.bit_data
[1];
3608 aw_all_bit_data
[2] = hr
.u
.l
.bit_data
[2];
3609 aw_all_bit_data
[3] = hr
.u
.l
.bit_data
[3];
3614 u16
hpi_gpio_write_bit(const struct hpi_hsubsys
*ph_subsys
, u32 h_gpio
,
3615 u16 bit_index
, u16 bit_data
)
3617 struct hpi_message hm
;
3618 struct hpi_response hr
;
3619 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_GPIO
, HPI_GPIO_WRITE_BIT
);
3620 u32TOINDEX(h_gpio
, &hm
.adapter_index
);
3621 hm
.u
.l
.bit_index
= bit_index
;
3622 hm
.u
.l
.bit_data
= bit_data
;
3624 hpi_send_recv(&hm
, &hr
);
3629 u16
hpi_gpio_write_status(const struct hpi_hsubsys
*ph_subsys
, u32 h_gpio
,
3630 u16 aw_all_bit_data
[4]
3633 struct hpi_message hm
;
3634 struct hpi_response hr
;
3635 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_GPIO
,
3636 HPI_GPIO_WRITE_STATUS
);
3637 u32TOINDEX(h_gpio
, &hm
.adapter_index
);
3639 hpi_send_recv(&hm
, &hr
);
3641 if (aw_all_bit_data
) {
3642 aw_all_bit_data
[0] = hr
.u
.l
.bit_data
[0];
3643 aw_all_bit_data
[1] = hr
.u
.l
.bit_data
[1];
3644 aw_all_bit_data
[2] = hr
.u
.l
.bit_data
[2];
3645 aw_all_bit_data
[3] = hr
.u
.l
.bit_data
[3];
3650 u16
hpi_async_event_open(const struct hpi_hsubsys
*ph_subsys
,
3651 u16 adapter_index
, u32
*ph_async
)
3653 struct hpi_message hm
;
3654 struct hpi_response hr
;
3655 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_ASYNCEVENT
,
3656 HPI_ASYNCEVENT_OPEN
);
3657 hm
.adapter_index
= adapter_index
;
3659 hpi_send_recv(&hm
, &hr
);
3664 hpi_indexes_to_handle(HPI_OBJ_ASYNCEVENT
,
3672 u16
hpi_async_event_close(const struct hpi_hsubsys
*ph_subsys
, u32 h_async
)
3674 struct hpi_message hm
;
3675 struct hpi_response hr
;
3676 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_ASYNCEVENT
,
3677 HPI_ASYNCEVENT_OPEN
);
3678 u32TOINDEX(h_async
, &hm
.adapter_index
);
3680 hpi_send_recv(&hm
, &hr
);
3685 u16
hpi_async_event_wait(const struct hpi_hsubsys
*ph_subsys
, u32 h_async
,
3686 u16 maximum_events
, struct hpi_async_event
*p_events
,
3687 u16
*pw_number_returned
)
3693 u16
hpi_async_event_get_count(const struct hpi_hsubsys
*ph_subsys
,
3694 u32 h_async
, u16
*pw_count
)
3696 struct hpi_message hm
;
3697 struct hpi_response hr
;
3698 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_ASYNCEVENT
,
3699 HPI_ASYNCEVENT_GETCOUNT
);
3700 u32TOINDEX(h_async
, &hm
.adapter_index
);
3702 hpi_send_recv(&hm
, &hr
);
3706 *pw_count
= hr
.u
.as
.u
.count
.count
;
3711 u16
hpi_async_event_get(const struct hpi_hsubsys
*ph_subsys
, u32 h_async
,
3712 u16 maximum_events
, struct hpi_async_event
*p_events
,
3713 u16
*pw_number_returned
)
3715 struct hpi_message hm
;
3716 struct hpi_response hr
;
3717 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_ASYNCEVENT
,
3718 HPI_ASYNCEVENT_GET
);
3719 u32TOINDEX(h_async
, &hm
.adapter_index
);
3721 hpi_send_recv(&hm
, &hr
);
3723 memcpy(p_events
, &hr
.u
.as
.u
.event
,
3724 sizeof(struct hpi_async_event
));
3725 *pw_number_returned
= 1;
3731 u16
hpi_nv_memory_open(const struct hpi_hsubsys
*ph_subsys
, u16 adapter_index
,
3732 u32
*ph_nv_memory
, u16
*pw_size_in_bytes
)
3734 struct hpi_message hm
;
3735 struct hpi_response hr
;
3736 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_NVMEMORY
,
3738 hm
.adapter_index
= adapter_index
;
3740 hpi_send_recv(&hm
, &hr
);
3742 if (hr
.error
== 0) {
3744 hpi_indexes_to_handle(HPI_OBJ_NVMEMORY
, adapter_index
,
3746 if (pw_size_in_bytes
)
3747 *pw_size_in_bytes
= hr
.u
.n
.size_in_bytes
;
3753 u16
hpi_nv_memory_read_byte(const struct hpi_hsubsys
*ph_subsys
,
3754 u32 h_nv_memory
, u16 index
, u16
*pw_data
)
3756 struct hpi_message hm
;
3757 struct hpi_response hr
;
3758 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_NVMEMORY
,
3759 HPI_NVMEMORY_READ_BYTE
);
3760 u32TOINDEX(h_nv_memory
, &hm
.adapter_index
);
3761 hm
.u
.n
.address
= index
;
3763 hpi_send_recv(&hm
, &hr
);
3765 *pw_data
= hr
.u
.n
.data
;
3769 u16
hpi_nv_memory_write_byte(const struct hpi_hsubsys
*ph_subsys
,
3770 u32 h_nv_memory
, u16 index
, u16 data
)
3772 struct hpi_message hm
;
3773 struct hpi_response hr
;
3774 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_NVMEMORY
,
3775 HPI_NVMEMORY_WRITE_BYTE
);
3776 u32TOINDEX(h_nv_memory
, &hm
.adapter_index
);
3777 hm
.u
.n
.address
= index
;
3780 hpi_send_recv(&hm
, &hr
);
3785 u16
hpi_profile_open_all(const struct hpi_hsubsys
*ph_subsys
,
3786 u16 adapter_index
, u16 profile_index
, u32
*ph_profile
,
3787 u16
*pw_max_profiles
)
3789 struct hpi_message hm
;
3790 struct hpi_response hr
;
3791 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_PROFILE
,
3792 HPI_PROFILE_OPEN_ALL
);
3793 hm
.adapter_index
= adapter_index
;
3794 hm
.obj_index
= profile_index
;
3795 hpi_send_recv(&hm
, &hr
);
3797 *pw_max_profiles
= hr
.u
.p
.u
.o
.max_profiles
;
3800 hpi_indexes_to_handle(HPI_OBJ_PROFILE
, adapter_index
,
3807 u16
hpi_profile_get(const struct hpi_hsubsys
*ph_subsys
, u32 h_profile
,
3808 u16 bin_index
, u16
*pw_seconds
, u32
*pmicro_seconds
, u32
*pcall_count
,
3809 u32
*pmax_micro_seconds
, u32
*pmin_micro_seconds
)
3811 struct hpi_message hm
;
3812 struct hpi_response hr
;
3813 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_PROFILE
, HPI_PROFILE_GET
);
3814 u32TOINDEXES(h_profile
, &hm
.adapter_index
, &hm
.obj_index
);
3815 hm
.u
.p
.bin_index
= bin_index
;
3816 hpi_send_recv(&hm
, &hr
);
3818 *pw_seconds
= hr
.u
.p
.u
.t
.seconds
;
3820 *pmicro_seconds
= hr
.u
.p
.u
.t
.micro_seconds
;
3822 *pcall_count
= hr
.u
.p
.u
.t
.call_count
;
3823 if (pmax_micro_seconds
)
3824 *pmax_micro_seconds
= hr
.u
.p
.u
.t
.max_micro_seconds
;
3825 if (pmin_micro_seconds
)
3826 *pmin_micro_seconds
= hr
.u
.p
.u
.t
.min_micro_seconds
;
3830 u16
hpi_profile_get_utilization(const struct hpi_hsubsys
*ph_subsys
,
3831 u32 h_profile
, u32
*putilization
)
3833 struct hpi_message hm
;
3834 struct hpi_response hr
;
3835 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_PROFILE
,
3836 HPI_PROFILE_GET_UTILIZATION
);
3837 u32TOINDEXES(h_profile
, &hm
.adapter_index
, &hm
.obj_index
);
3838 hpi_send_recv(&hm
, &hr
);
3844 *putilization
= hr
.u
.p
.u
.t
.call_count
;
3849 u16
hpi_profile_get_name(const struct hpi_hsubsys
*ph_subsys
, u32 h_profile
,
3850 u16 bin_index
, char *sz_name
, u16 name_length
)
3852 struct hpi_message hm
;
3853 struct hpi_response hr
;
3854 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_PROFILE
,
3855 HPI_PROFILE_GET_NAME
);
3856 u32TOINDEXES(h_profile
, &hm
.adapter_index
, &hm
.obj_index
);
3857 hm
.u
.p
.bin_index
= bin_index
;
3858 hpi_send_recv(&hm
, &hr
);
3861 strcpy(sz_name
, "??");
3864 memcpy(sz_name
, (char *)hr
.u
.p
.u
.n
.sz_name
,
3870 u16
hpi_profile_start_all(const struct hpi_hsubsys
*ph_subsys
, u32 h_profile
)
3872 struct hpi_message hm
;
3873 struct hpi_response hr
;
3874 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_PROFILE
,
3875 HPI_PROFILE_START_ALL
);
3876 u32TOINDEXES(h_profile
, &hm
.adapter_index
, &hm
.obj_index
);
3877 hpi_send_recv(&hm
, &hr
);
3882 u16
hpi_profile_stop_all(const struct hpi_hsubsys
*ph_subsys
, u32 h_profile
)
3884 struct hpi_message hm
;
3885 struct hpi_response hr
;
3886 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_PROFILE
,
3887 HPI_PROFILE_STOP_ALL
);
3888 u32TOINDEXES(h_profile
, &hm
.adapter_index
, &hm
.obj_index
);
3889 hpi_send_recv(&hm
, &hr
);
3894 u16
hpi_watchdog_open(const struct hpi_hsubsys
*ph_subsys
, u16 adapter_index
,
3897 struct hpi_message hm
;
3898 struct hpi_response hr
;
3899 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_WATCHDOG
,
3901 hm
.adapter_index
= adapter_index
;
3903 hpi_send_recv(&hm
, &hr
);
3907 hpi_indexes_to_handle(HPI_OBJ_WATCHDOG
, adapter_index
,
3914 u16
hpi_watchdog_set_time(const struct hpi_hsubsys
*ph_subsys
, u32 h_watchdog
,
3917 struct hpi_message hm
;
3918 struct hpi_response hr
;
3919 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_WATCHDOG
,
3920 HPI_WATCHDOG_SET_TIME
);
3921 u32TOINDEX(h_watchdog
, &hm
.adapter_index
);
3922 hm
.u
.w
.time_ms
= time_millisec
;
3924 hpi_send_recv(&hm
, &hr
);
3929 u16
hpi_watchdog_ping(const struct hpi_hsubsys
*ph_subsys
, u32 h_watchdog
)
3931 struct hpi_message hm
;
3932 struct hpi_response hr
;
3933 hpi_init_message_response(&hm
, &hr
, HPI_OBJ_WATCHDOG
,
3935 u32TOINDEX(h_watchdog
, &hm
.adapter_index
);
3937 hpi_send_recv(&hm
, &hr
);