diff options
author | Eliot Blennerhassett <eblennerhassett@audioscience.com> | 2011-02-09 23:26:04 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2011-02-10 12:49:26 -0500 |
commit | ba94455c29c383713c360537b6323e3bd4c76434 (patch) | |
tree | c06d1f61e5f43ad17be64e7b5d9653979357ed72 /sound/pci/asihpi/hpifunc.c | |
parent | deb21a233470537276ee39239441d1bf679223cd (diff) |
ALSA: asihpi - Remove unused subsys pointer from all HPI functions.
asihpi.c don't link playback and capture streams, there is too much
offset between them.
Signed-off-by: Eliot Blennerhassett <eblennerhassett@audioscience.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/asihpi/hpifunc.c')
-rw-r--r-- | sound/pci/asihpi/hpifunc.c | 1385 |
1 files changed, 640 insertions, 745 deletions
diff --git a/sound/pci/asihpi/hpifunc.c b/sound/pci/asihpi/hpifunc.c index aafb76955f69..28e98dd9249b 100644 --- a/sound/pci/asihpi/hpifunc.c +++ b/sound/pci/asihpi/hpifunc.c | |||
@@ -30,16 +30,25 @@ u32 hpi_indexes_to_handle(const char c_object, const u16 adapter_index, | |||
30 | return handle.w; | 30 | return handle.w; |
31 | } | 31 | } |
32 | 32 | ||
33 | void hpi_handle_to_indexes(const u32 handle, u16 *pw_adapter_index, | 33 | static u16 hpi_handle_indexes(const u32 h, u16 *p1, u16 *p2) |
34 | u16 *pw_object_index) | ||
35 | { | 34 | { |
36 | union handle_word uhandle; | 35 | union handle_word uhandle; |
37 | uhandle.w = handle; | 36 | if (!h) |
37 | return HPI_ERROR_INVALID_HANDLE; | ||
38 | 38 | ||
39 | if (pw_adapter_index) | 39 | uhandle.w = h; |
40 | *pw_adapter_index = (u16)uhandle.h.adapter_index; | 40 | |
41 | if (pw_object_index) | 41 | *p1 = (u16)uhandle.h.adapter_index; |
42 | *pw_object_index = (u16)uhandle.h.obj_index; | 42 | if (p2) |
43 | *p2 = (u16)uhandle.h.obj_index; | ||
44 | |||
45 | return 0; | ||
46 | } | ||
47 | |||
48 | void hpi_handle_to_indexes(const u32 handle, u16 *pw_adapter_index, | ||
49 | u16 *pw_object_index) | ||
50 | { | ||
51 | hpi_handle_indexes(handle, pw_adapter_index, pw_object_index); | ||
43 | } | 52 | } |
44 | 53 | ||
45 | char hpi_handle_object(const u32 handle) | 54 | char hpi_handle_object(const u32 handle) |
@@ -49,22 +58,6 @@ char hpi_handle_object(const u32 handle) | |||
49 | return (char)uhandle.h.obj_type; | 58 | return (char)uhandle.h.obj_type; |
50 | } | 59 | } |
51 | 60 | ||
52 | #define u32TOINDEX(h, i1) \ | ||
53 | do {\ | ||
54 | if (h == 0) \ | ||
55 | return HPI_ERROR_INVALID_OBJ; \ | ||
56 | else \ | ||
57 | hpi_handle_to_indexes(h, i1, NULL); \ | ||
58 | } while (0) | ||
59 | |||
60 | #define u32TOINDEXES(h, i1, i2) \ | ||
61 | do {\ | ||
62 | if (h == 0) \ | ||
63 | return HPI_ERROR_INVALID_OBJ; \ | ||
64 | else \ | ||
65 | hpi_handle_to_indexes(h, i1, i2);\ | ||
66 | } while (0) | ||
67 | |||
68 | void hpi_format_to_msg(struct hpi_msg_format *pMF, | 61 | void hpi_format_to_msg(struct hpi_msg_format *pMF, |
69 | const struct hpi_format *pF) | 62 | const struct hpi_format *pF) |
70 | { | 63 | { |
@@ -94,26 +87,13 @@ void hpi_stream_response_to_legacy(struct hpi_stream_res *pSR) | |||
94 | pSR->u.legacy_stream_info.state = pSR->u.stream_info.state; | 87 | pSR->u.legacy_stream_info.state = pSR->u.stream_info.state; |
95 | } | 88 | } |
96 | 89 | ||
97 | static struct hpi_hsubsys gh_subsys; | 90 | static inline void hpi_send_recvV1(struct hpi_message_header *m, |
98 | 91 | struct hpi_response_header *r) | |
99 | struct hpi_hsubsys *hpi_subsys_create(void) | ||
100 | { | ||
101 | return &gh_subsys; | ||
102 | } | ||
103 | |||
104 | void hpi_subsys_free(const struct hpi_hsubsys *ph_subsys) | ||
105 | { | 92 | { |
106 | struct hpi_message hm; | 93 | hpi_send_recv((struct hpi_message *)m, (struct hpi_response *)r); |
107 | struct hpi_response hr; | ||
108 | |||
109 | hpi_init_message_response(&hm, &hr, HPI_OBJ_SUBSYSTEM, | ||
110 | HPI_SUBSYS_CLOSE); | ||
111 | hpi_send_recv(&hm, &hr); | ||
112 | |||
113 | } | 94 | } |
114 | 95 | ||
115 | u16 hpi_subsys_get_version_ex(const struct hpi_hsubsys *ph_subsys, | 96 | u16 hpi_subsys_get_version_ex(u32 *pversion_ex) |
116 | u32 *pversion_ex) | ||
117 | { | 97 | { |
118 | struct hpi_message hm; | 98 | struct hpi_message hm; |
119 | struct hpi_response hr; | 99 | struct hpi_response hr; |
@@ -125,8 +105,8 @@ u16 hpi_subsys_get_version_ex(const struct hpi_hsubsys *ph_subsys, | |||
125 | return hr.error; | 105 | return hr.error; |
126 | } | 106 | } |
127 | 107 | ||
128 | u16 hpi_subsys_create_adapter(const struct hpi_hsubsys *ph_subsys, | 108 | u16 hpi_subsys_create_adapter(const struct hpi_resource *p_resource, |
129 | const struct hpi_resource *p_resource, u16 *pw_adapter_index) | 109 | u16 *pw_adapter_index) |
130 | { | 110 | { |
131 | struct hpi_message hm; | 111 | struct hpi_message hm; |
132 | struct hpi_response hr; | 112 | struct hpi_response hr; |
@@ -141,8 +121,7 @@ u16 hpi_subsys_create_adapter(const struct hpi_hsubsys *ph_subsys, | |||
141 | return hr.error; | 121 | return hr.error; |
142 | } | 122 | } |
143 | 123 | ||
144 | u16 hpi_subsys_delete_adapter(const struct hpi_hsubsys *ph_subsys, | 124 | u16 hpi_subsys_delete_adapter(u16 adapter_index) |
145 | u16 adapter_index) | ||
146 | { | 125 | { |
147 | struct hpi_message hm; | 126 | struct hpi_message hm; |
148 | struct hpi_response hr; | 127 | struct hpi_response hr; |
@@ -153,8 +132,7 @@ u16 hpi_subsys_delete_adapter(const struct hpi_hsubsys *ph_subsys, | |||
153 | return hr.error; | 132 | return hr.error; |
154 | } | 133 | } |
155 | 134 | ||
156 | u16 hpi_subsys_get_num_adapters(const struct hpi_hsubsys *ph_subsys, | 135 | u16 hpi_subsys_get_num_adapters(int *pn_num_adapters) |
157 | int *pn_num_adapters) | ||
158 | { | 136 | { |
159 | struct hpi_message hm; | 137 | struct hpi_message hm; |
160 | struct hpi_response hr; | 138 | struct hpi_response hr; |
@@ -165,8 +143,8 @@ u16 hpi_subsys_get_num_adapters(const struct hpi_hsubsys *ph_subsys, | |||
165 | return hr.error; | 143 | return hr.error; |
166 | } | 144 | } |
167 | 145 | ||
168 | u16 hpi_subsys_get_adapter(const struct hpi_hsubsys *ph_subsys, int iterator, | 146 | u16 hpi_subsys_get_adapter(int iterator, u32 *padapter_index, |
169 | u32 *padapter_index, u16 *pw_adapter_type) | 147 | u16 *pw_adapter_type) |
170 | { | 148 | { |
171 | struct hpi_message hm; | 149 | struct hpi_message hm; |
172 | struct hpi_response hr; | 150 | struct hpi_response hr; |
@@ -179,7 +157,7 @@ u16 hpi_subsys_get_adapter(const struct hpi_hsubsys *ph_subsys, int iterator, | |||
179 | return hr.error; | 157 | return hr.error; |
180 | } | 158 | } |
181 | 159 | ||
182 | u16 hpi_adapter_open(const struct hpi_hsubsys *ph_subsys, u16 adapter_index) | 160 | u16 hpi_adapter_open(u16 adapter_index) |
183 | { | 161 | { |
184 | struct hpi_message hm; | 162 | struct hpi_message hm; |
185 | struct hpi_response hr; | 163 | struct hpi_response hr; |
@@ -193,7 +171,7 @@ u16 hpi_adapter_open(const struct hpi_hsubsys *ph_subsys, u16 adapter_index) | |||
193 | 171 | ||
194 | } | 172 | } |
195 | 173 | ||
196 | u16 hpi_adapter_close(const struct hpi_hsubsys *ph_subsys, u16 adapter_index) | 174 | u16 hpi_adapter_close(u16 adapter_index) |
197 | { | 175 | { |
198 | struct hpi_message hm; | 176 | struct hpi_message hm; |
199 | struct hpi_response hr; | 177 | struct hpi_response hr; |
@@ -206,15 +184,14 @@ u16 hpi_adapter_close(const struct hpi_hsubsys *ph_subsys, u16 adapter_index) | |||
206 | return hr.error; | 184 | return hr.error; |
207 | } | 185 | } |
208 | 186 | ||
209 | u16 hpi_adapter_set_mode(const struct hpi_hsubsys *ph_subsys, | 187 | u16 hpi_adapter_set_mode(u16 adapter_index, u32 adapter_mode) |
210 | u16 adapter_index, u32 adapter_mode) | ||
211 | { | 188 | { |
212 | return hpi_adapter_set_mode_ex(ph_subsys, adapter_index, adapter_mode, | 189 | return hpi_adapter_set_mode_ex(adapter_index, adapter_mode, |
213 | HPI_ADAPTER_MODE_SET); | 190 | HPI_ADAPTER_MODE_SET); |
214 | } | 191 | } |
215 | 192 | ||
216 | u16 hpi_adapter_set_mode_ex(const struct hpi_hsubsys *ph_subsys, | 193 | u16 hpi_adapter_set_mode_ex(u16 adapter_index, u32 adapter_mode, |
217 | u16 adapter_index, u32 adapter_mode, u16 query_or_set) | 194 | u16 query_or_set) |
218 | { | 195 | { |
219 | struct hpi_message hm; | 196 | struct hpi_message hm; |
220 | struct hpi_response hr; | 197 | struct hpi_response hr; |
@@ -228,8 +205,7 @@ u16 hpi_adapter_set_mode_ex(const struct hpi_hsubsys *ph_subsys, | |||
228 | return hr.error; | 205 | return hr.error; |
229 | } | 206 | } |
230 | 207 | ||
231 | u16 hpi_adapter_get_mode(const struct hpi_hsubsys *ph_subsys, | 208 | u16 hpi_adapter_get_mode(u16 adapter_index, u32 *padapter_mode) |
232 | u16 adapter_index, u32 *padapter_mode) | ||
233 | { | 209 | { |
234 | struct hpi_message hm; | 210 | struct hpi_message hm; |
235 | struct hpi_response hr; | 211 | struct hpi_response hr; |
@@ -242,9 +218,9 @@ u16 hpi_adapter_get_mode(const struct hpi_hsubsys *ph_subsys, | |||
242 | return hr.error; | 218 | return hr.error; |
243 | } | 219 | } |
244 | 220 | ||
245 | u16 hpi_adapter_get_info(const struct hpi_hsubsys *ph_subsys, | 221 | u16 hpi_adapter_get_info(u16 adapter_index, u16 *pw_num_outstreams, |
246 | u16 adapter_index, u16 *pw_num_outstreams, u16 *pw_num_instreams, | 222 | u16 *pw_num_instreams, u16 *pw_version, u32 *pserial_number, |
247 | u16 *pw_version, u32 *pserial_number, u16 *pw_adapter_type) | 223 | u16 *pw_adapter_type) |
248 | { | 224 | { |
249 | struct hpi_message hm; | 225 | struct hpi_message hm; |
250 | struct hpi_response hr; | 226 | struct hpi_response hr; |
@@ -262,10 +238,9 @@ u16 hpi_adapter_get_info(const struct hpi_hsubsys *ph_subsys, | |||
262 | return hr.error; | 238 | return hr.error; |
263 | } | 239 | } |
264 | 240 | ||
265 | u16 hpi_adapter_get_module_by_index(const struct hpi_hsubsys *ph_subsys, | 241 | u16 hpi_adapter_get_module_by_index(u16 adapter_index, u16 module_index, |
266 | u16 adapter_index, u16 module_index, u16 *pw_num_outputs, | 242 | u16 *pw_num_outputs, u16 *pw_num_inputs, u16 *pw_version, |
267 | u16 *pw_num_inputs, u16 *pw_version, u32 *pserial_number, | 243 | u32 *pserial_number, u16 *pw_module_type, u32 *ph_module) |
268 | u16 *pw_module_type, u32 *ph_module) | ||
269 | { | 244 | { |
270 | struct hpi_message hm; | 245 | struct hpi_message hm; |
271 | struct hpi_response hr; | 246 | struct hpi_response hr; |
@@ -287,10 +262,9 @@ u16 hpi_adapter_get_module_by_index(const struct hpi_hsubsys *ph_subsys, | |||
287 | return hr.error; | 262 | return hr.error; |
288 | } | 263 | } |
289 | 264 | ||
290 | u16 hpi_adapter_get_assert2(const struct hpi_hsubsys *ph_subsys, | 265 | u16 hpi_adapter_get_assert2(u16 adapter_index, u16 *p_assert_count, |
291 | u16 adapter_index, u16 *p_assert_count, char *psz_assert, | 266 | char *psz_assert, u32 *p_param1, u32 *p_param2, |
292 | u32 *p_param1, u32 *p_param2, u32 *p_dsp_string_addr, | 267 | u32 *p_dsp_string_addr, u16 *p_processor_id) |
293 | u16 *p_processor_id) | ||
294 | { | 268 | { |
295 | struct hpi_message hm; | 269 | struct hpi_message hm; |
296 | struct hpi_response hr; | 270 | struct hpi_response hr; |
@@ -319,8 +293,7 @@ u16 hpi_adapter_get_assert2(const struct hpi_hsubsys *ph_subsys, | |||
319 | return hr.error; | 293 | return hr.error; |
320 | } | 294 | } |
321 | 295 | ||
322 | u16 hpi_adapter_test_assert(const struct hpi_hsubsys *ph_subsys, | 296 | u16 hpi_adapter_test_assert(u16 adapter_index, u16 assert_id) |
323 | u16 adapter_index, u16 assert_id) | ||
324 | { | 297 | { |
325 | struct hpi_message hm; | 298 | struct hpi_message hm; |
326 | struct hpi_response hr; | 299 | struct hpi_response hr; |
@@ -334,8 +307,7 @@ u16 hpi_adapter_test_assert(const struct hpi_hsubsys *ph_subsys, | |||
334 | return hr.error; | 307 | return hr.error; |
335 | } | 308 | } |
336 | 309 | ||
337 | u16 hpi_adapter_enable_capability(const struct hpi_hsubsys *ph_subsys, | 310 | u16 hpi_adapter_enable_capability(u16 adapter_index, u16 capability, u32 key) |
338 | u16 adapter_index, u16 capability, u32 key) | ||
339 | { | 311 | { |
340 | #if 1 | 312 | #if 1 |
341 | return HPI_ERROR_UNIMPLEMENTED; | 313 | return HPI_ERROR_UNIMPLEMENTED; |
@@ -354,8 +326,7 @@ u16 hpi_adapter_enable_capability(const struct hpi_hsubsys *ph_subsys, | |||
354 | #endif | 326 | #endif |
355 | } | 327 | } |
356 | 328 | ||
357 | u16 hpi_adapter_self_test(const struct hpi_hsubsys *ph_subsys, | 329 | u16 hpi_adapter_self_test(u16 adapter_index) |
358 | u16 adapter_index) | ||
359 | { | 330 | { |
360 | struct hpi_message hm; | 331 | struct hpi_message hm; |
361 | struct hpi_response hr; | 332 | struct hpi_response hr; |
@@ -366,8 +337,8 @@ u16 hpi_adapter_self_test(const struct hpi_hsubsys *ph_subsys, | |||
366 | return hr.error; | 337 | return hr.error; |
367 | } | 338 | } |
368 | 339 | ||
369 | u16 hpi_adapter_debug_read(const struct hpi_hsubsys *ph_subsys, | 340 | u16 hpi_adapter_debug_read(u16 adapter_index, u32 dsp_address, char *p_buffer, |
370 | u16 adapter_index, u32 dsp_address, char *p_buffer, int *count_bytes) | 341 | int *count_bytes) |
371 | { | 342 | { |
372 | struct hpi_msg_adapter_debug_read hm; | 343 | struct hpi_msg_adapter_debug_read hm; |
373 | struct hpi_res_adapter_debug_read hr; | 344 | struct hpi_res_adapter_debug_read hr; |
@@ -383,7 +354,7 @@ u16 hpi_adapter_debug_read(const struct hpi_hsubsys *ph_subsys, | |||
383 | 354 | ||
384 | hm.count_bytes = *count_bytes; | 355 | hm.count_bytes = *count_bytes; |
385 | 356 | ||
386 | hpi_send_recv((struct hpi_message *)&hm, (struct hpi_response *)&hr); | 357 | hpi_send_recvV1(&hm.h, &hr.h); |
387 | 358 | ||
388 | if (!hr.h.error) { | 359 | if (!hr.h.error) { |
389 | int res_bytes = hr.h.size - sizeof(hr.h); | 360 | int res_bytes = hr.h.size - sizeof(hr.h); |
@@ -397,8 +368,8 @@ u16 hpi_adapter_debug_read(const struct hpi_hsubsys *ph_subsys, | |||
397 | return hr.h.error; | 368 | return hr.h.error; |
398 | } | 369 | } |
399 | 370 | ||
400 | u16 hpi_adapter_set_property(const struct hpi_hsubsys *ph_subsys, | 371 | u16 hpi_adapter_set_property(u16 adapter_index, u16 property, u16 parameter1, |
401 | u16 adapter_index, u16 property, u16 parameter1, u16 parameter2) | 372 | u16 parameter2) |
402 | { | 373 | { |
403 | struct hpi_message hm; | 374 | struct hpi_message hm; |
404 | struct hpi_response hr; | 375 | struct hpi_response hr; |
@@ -414,9 +385,8 @@ u16 hpi_adapter_set_property(const struct hpi_hsubsys *ph_subsys, | |||
414 | return hr.error; | 385 | return hr.error; |
415 | } | 386 | } |
416 | 387 | ||
417 | u16 hpi_adapter_get_property(const struct hpi_hsubsys *ph_subsys, | 388 | u16 hpi_adapter_get_property(u16 adapter_index, u16 property, |
418 | u16 adapter_index, u16 property, u16 *pw_parameter1, | 389 | u16 *pw_parameter1, u16 *pw_parameter2) |
419 | u16 *pw_parameter2) | ||
420 | { | 390 | { |
421 | struct hpi_message hm; | 391 | struct hpi_message hm; |
422 | struct hpi_response hr; | 392 | struct hpi_response hr; |
@@ -436,9 +406,8 @@ u16 hpi_adapter_get_property(const struct hpi_hsubsys *ph_subsys, | |||
436 | return hr.error; | 406 | return hr.error; |
437 | } | 407 | } |
438 | 408 | ||
439 | u16 hpi_adapter_enumerate_property(const struct hpi_hsubsys *ph_subsys, | 409 | u16 hpi_adapter_enumerate_property(u16 adapter_index, u16 index, |
440 | u16 adapter_index, u16 index, u16 what_to_enumerate, | 410 | u16 what_to_enumerate, u16 property_index, u32 *psetting) |
441 | u16 property_index, u32 *psetting) | ||
442 | { | 411 | { |
443 | return 0; | 412 | return 0; |
444 | } | 413 | } |
@@ -584,8 +553,8 @@ u16 hpi_stream_estimate_buffer_size(struct hpi_format *p_format, | |||
584 | return 0; | 553 | return 0; |
585 | } | 554 | } |
586 | 555 | ||
587 | u16 hpi_outstream_open(const struct hpi_hsubsys *ph_subsys, u16 adapter_index, | 556 | u16 hpi_outstream_open(u16 adapter_index, u16 outstream_index, |
588 | u16 outstream_index, u32 *ph_outstream) | 557 | u32 *ph_outstream) |
589 | { | 558 | { |
590 | struct hpi_message hm; | 559 | struct hpi_message hm; |
591 | struct hpi_response hr; | 560 | struct hpi_response hr; |
@@ -605,38 +574,41 @@ u16 hpi_outstream_open(const struct hpi_hsubsys *ph_subsys, u16 adapter_index, | |||
605 | return hr.error; | 574 | return hr.error; |
606 | } | 575 | } |
607 | 576 | ||
608 | u16 hpi_outstream_close(const struct hpi_hsubsys *ph_subsys, u32 h_outstream) | 577 | u16 hpi_outstream_close(u32 h_outstream) |
609 | { | 578 | { |
610 | struct hpi_message hm; | 579 | struct hpi_message hm; |
611 | struct hpi_response hr; | 580 | struct hpi_response hr; |
612 | 581 | ||
613 | hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM, | 582 | hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM, |
614 | HPI_OSTREAM_HOSTBUFFER_FREE); | 583 | HPI_OSTREAM_HOSTBUFFER_FREE); |
615 | u32TOINDEXES(h_outstream, &hm.adapter_index, &hm.obj_index); | 584 | if (hpi_handle_indexes(h_outstream, &hm.adapter_index, &hm.obj_index)) |
585 | return HPI_ERROR_INVALID_HANDLE; | ||
586 | |||
616 | hpi_send_recv(&hm, &hr); | 587 | hpi_send_recv(&hm, &hr); |
617 | 588 | ||
618 | hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM, | 589 | hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM, |
619 | HPI_OSTREAM_GROUP_RESET); | 590 | HPI_OSTREAM_GROUP_RESET); |
620 | u32TOINDEXES(h_outstream, &hm.adapter_index, &hm.obj_index); | 591 | hpi_handle_indexes(h_outstream, &hm.adapter_index, &hm.obj_index); |
621 | hpi_send_recv(&hm, &hr); | 592 | hpi_send_recv(&hm, &hr); |
622 | 593 | ||
623 | hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM, | 594 | hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM, |
624 | HPI_OSTREAM_CLOSE); | 595 | HPI_OSTREAM_CLOSE); |
625 | u32TOINDEXES(h_outstream, &hm.adapter_index, &hm.obj_index); | 596 | hpi_handle_indexes(h_outstream, &hm.adapter_index, &hm.obj_index); |
626 | hpi_send_recv(&hm, &hr); | 597 | hpi_send_recv(&hm, &hr); |
627 | 598 | ||
628 | return hr.error; | 599 | return hr.error; |
629 | } | 600 | } |
630 | 601 | ||
631 | u16 hpi_outstream_get_info_ex(const struct hpi_hsubsys *ph_subsys, | 602 | u16 hpi_outstream_get_info_ex(u32 h_outstream, u16 *pw_state, |
632 | u32 h_outstream, u16 *pw_state, u32 *pbuffer_size, u32 *pdata_to_play, | 603 | u32 *pbuffer_size, u32 *pdata_to_play, u32 *psamples_played, |
633 | u32 *psamples_played, u32 *pauxiliary_data_to_play) | 604 | u32 *pauxiliary_data_to_play) |
634 | { | 605 | { |
635 | struct hpi_message hm; | 606 | struct hpi_message hm; |
636 | struct hpi_response hr; | 607 | struct hpi_response hr; |
637 | hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM, | 608 | hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM, |
638 | HPI_OSTREAM_GET_INFO); | 609 | HPI_OSTREAM_GET_INFO); |
639 | u32TOINDEXES(h_outstream, &hm.adapter_index, &hm.obj_index); | 610 | if (hpi_handle_indexes(h_outstream, &hm.adapter_index, &hm.obj_index)) |
611 | return HPI_ERROR_INVALID_HANDLE; | ||
640 | 612 | ||
641 | hpi_send_recv(&hm, &hr); | 613 | hpi_send_recv(&hm, &hr); |
642 | 614 | ||
@@ -654,15 +626,15 @@ u16 hpi_outstream_get_info_ex(const struct hpi_hsubsys *ph_subsys, | |||
654 | return hr.error; | 626 | return hr.error; |
655 | } | 627 | } |
656 | 628 | ||
657 | u16 hpi_outstream_write_buf(const struct hpi_hsubsys *ph_subsys, | 629 | u16 hpi_outstream_write_buf(u32 h_outstream, const u8 *pb_data, |
658 | u32 h_outstream, const u8 *pb_data, u32 bytes_to_write, | 630 | u32 bytes_to_write, const struct hpi_format *p_format) |
659 | const struct hpi_format *p_format) | ||
660 | { | 631 | { |
661 | struct hpi_message hm; | 632 | struct hpi_message hm; |
662 | struct hpi_response hr; | 633 | struct hpi_response hr; |
663 | hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM, | 634 | hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM, |
664 | HPI_OSTREAM_WRITE); | 635 | HPI_OSTREAM_WRITE); |
665 | u32TOINDEXES(h_outstream, &hm.adapter_index, &hm.obj_index); | 636 | if (hpi_handle_indexes(h_outstream, &hm.adapter_index, &hm.obj_index)) |
637 | return HPI_ERROR_INVALID_HANDLE; | ||
666 | hm.u.d.u.data.pb_data = (u8 *)pb_data; | 638 | hm.u.d.u.data.pb_data = (u8 *)pb_data; |
667 | hm.u.d.u.data.data_size = bytes_to_write; | 639 | hm.u.d.u.data.data_size = bytes_to_write; |
668 | 640 | ||
@@ -673,82 +645,85 @@ u16 hpi_outstream_write_buf(const struct hpi_hsubsys *ph_subsys, | |||
673 | return hr.error; | 645 | return hr.error; |
674 | } | 646 | } |
675 | 647 | ||
676 | u16 hpi_outstream_start(const struct hpi_hsubsys *ph_subsys, u32 h_outstream) | 648 | u16 hpi_outstream_start(u32 h_outstream) |
677 | { | 649 | { |
678 | struct hpi_message hm; | 650 | struct hpi_message hm; |
679 | struct hpi_response hr; | 651 | struct hpi_response hr; |
680 | hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM, | 652 | hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM, |
681 | HPI_OSTREAM_START); | 653 | HPI_OSTREAM_START); |
682 | u32TOINDEXES(h_outstream, &hm.adapter_index, &hm.obj_index); | 654 | if (hpi_handle_indexes(h_outstream, &hm.adapter_index, &hm.obj_index)) |
655 | return HPI_ERROR_INVALID_HANDLE; | ||
683 | 656 | ||
684 | hpi_send_recv(&hm, &hr); | 657 | hpi_send_recv(&hm, &hr); |
685 | 658 | ||
686 | return hr.error; | 659 | return hr.error; |
687 | } | 660 | } |
688 | 661 | ||
689 | u16 hpi_outstream_wait_start(const struct hpi_hsubsys *ph_subsys, | 662 | u16 hpi_outstream_wait_start(u32 h_outstream) |
690 | u32 h_outstream) | ||
691 | { | 663 | { |
692 | struct hpi_message hm; | 664 | struct hpi_message hm; |
693 | struct hpi_response hr; | 665 | struct hpi_response hr; |
694 | hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM, | 666 | hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM, |
695 | HPI_OSTREAM_WAIT_START); | 667 | HPI_OSTREAM_WAIT_START); |
696 | u32TOINDEXES(h_outstream, &hm.adapter_index, &hm.obj_index); | 668 | if (hpi_handle_indexes(h_outstream, &hm.adapter_index, &hm.obj_index)) |
669 | return HPI_ERROR_INVALID_HANDLE; | ||
697 | 670 | ||
698 | hpi_send_recv(&hm, &hr); | 671 | hpi_send_recv(&hm, &hr); |
699 | 672 | ||
700 | return hr.error; | 673 | return hr.error; |
701 | } | 674 | } |
702 | 675 | ||
703 | u16 hpi_outstream_stop(const struct hpi_hsubsys *ph_subsys, u32 h_outstream) | 676 | u16 hpi_outstream_stop(u32 h_outstream) |
704 | { | 677 | { |
705 | struct hpi_message hm; | 678 | struct hpi_message hm; |
706 | struct hpi_response hr; | 679 | struct hpi_response hr; |
707 | hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM, | 680 | hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM, |
708 | HPI_OSTREAM_STOP); | 681 | HPI_OSTREAM_STOP); |
709 | u32TOINDEXES(h_outstream, &hm.adapter_index, &hm.obj_index); | 682 | if (hpi_handle_indexes(h_outstream, &hm.adapter_index, &hm.obj_index)) |
683 | return HPI_ERROR_INVALID_HANDLE; | ||
710 | 684 | ||
711 | hpi_send_recv(&hm, &hr); | 685 | hpi_send_recv(&hm, &hr); |
712 | 686 | ||
713 | return hr.error; | 687 | return hr.error; |
714 | } | 688 | } |
715 | 689 | ||
716 | u16 hpi_outstream_sinegen(const struct hpi_hsubsys *ph_subsys, | 690 | u16 hpi_outstream_sinegen(u32 h_outstream) |
717 | u32 h_outstream) | ||
718 | { | 691 | { |
719 | struct hpi_message hm; | 692 | struct hpi_message hm; |
720 | struct hpi_response hr; | 693 | struct hpi_response hr; |
721 | hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM, | 694 | hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM, |
722 | HPI_OSTREAM_SINEGEN); | 695 | HPI_OSTREAM_SINEGEN); |
723 | u32TOINDEXES(h_outstream, &hm.adapter_index, &hm.obj_index); | 696 | if (hpi_handle_indexes(h_outstream, &hm.adapter_index, &hm.obj_index)) |
697 | return HPI_ERROR_INVALID_HANDLE; | ||
724 | 698 | ||
725 | hpi_send_recv(&hm, &hr); | 699 | hpi_send_recv(&hm, &hr); |
726 | 700 | ||
727 | return hr.error; | 701 | return hr.error; |
728 | } | 702 | } |
729 | 703 | ||
730 | u16 hpi_outstream_reset(const struct hpi_hsubsys *ph_subsys, u32 h_outstream) | 704 | u16 hpi_outstream_reset(u32 h_outstream) |
731 | { | 705 | { |
732 | struct hpi_message hm; | 706 | struct hpi_message hm; |
733 | struct hpi_response hr; | 707 | struct hpi_response hr; |
734 | hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM, | 708 | hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM, |
735 | HPI_OSTREAM_RESET); | 709 | HPI_OSTREAM_RESET); |
736 | u32TOINDEXES(h_outstream, &hm.adapter_index, &hm.obj_index); | 710 | if (hpi_handle_indexes(h_outstream, &hm.adapter_index, &hm.obj_index)) |
711 | return HPI_ERROR_INVALID_HANDLE; | ||
737 | 712 | ||
738 | hpi_send_recv(&hm, &hr); | 713 | hpi_send_recv(&hm, &hr); |
739 | 714 | ||
740 | return hr.error; | 715 | return hr.error; |
741 | } | 716 | } |
742 | 717 | ||
743 | u16 hpi_outstream_query_format(const struct hpi_hsubsys *ph_subsys, | 718 | u16 hpi_outstream_query_format(u32 h_outstream, struct hpi_format *p_format) |
744 | u32 h_outstream, struct hpi_format *p_format) | ||
745 | { | 719 | { |
746 | struct hpi_message hm; | 720 | struct hpi_message hm; |
747 | struct hpi_response hr; | 721 | struct hpi_response hr; |
748 | 722 | ||
749 | hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM, | 723 | hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM, |
750 | HPI_OSTREAM_QUERY_FORMAT); | 724 | HPI_OSTREAM_QUERY_FORMAT); |
751 | u32TOINDEXES(h_outstream, &hm.adapter_index, &hm.obj_index); | 725 | if (hpi_handle_indexes(h_outstream, &hm.adapter_index, &hm.obj_index)) |
726 | return HPI_ERROR_INVALID_HANDLE; | ||
752 | 727 | ||
753 | hpi_format_to_msg(&hm.u.d.u.data.format, p_format); | 728 | hpi_format_to_msg(&hm.u.d.u.data.format, p_format); |
754 | 729 | ||
@@ -757,15 +732,15 @@ u16 hpi_outstream_query_format(const struct hpi_hsubsys *ph_subsys, | |||
757 | return hr.error; | 732 | return hr.error; |
758 | } | 733 | } |
759 | 734 | ||
760 | u16 hpi_outstream_set_format(const struct hpi_hsubsys *ph_subsys, | 735 | u16 hpi_outstream_set_format(u32 h_outstream, struct hpi_format *p_format) |
761 | u32 h_outstream, struct hpi_format *p_format) | ||
762 | { | 736 | { |
763 | struct hpi_message hm; | 737 | struct hpi_message hm; |
764 | struct hpi_response hr; | 738 | struct hpi_response hr; |
765 | 739 | ||
766 | hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM, | 740 | hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM, |
767 | HPI_OSTREAM_SET_FORMAT); | 741 | HPI_OSTREAM_SET_FORMAT); |
768 | u32TOINDEXES(h_outstream, &hm.adapter_index, &hm.obj_index); | 742 | if (hpi_handle_indexes(h_outstream, &hm.adapter_index, &hm.obj_index)) |
743 | return HPI_ERROR_INVALID_HANDLE; | ||
769 | 744 | ||
770 | hpi_format_to_msg(&hm.u.d.u.data.format, p_format); | 745 | hpi_format_to_msg(&hm.u.d.u.data.format, p_format); |
771 | 746 | ||
@@ -774,15 +749,15 @@ u16 hpi_outstream_set_format(const struct hpi_hsubsys *ph_subsys, | |||
774 | return hr.error; | 749 | return hr.error; |
775 | } | 750 | } |
776 | 751 | ||
777 | u16 hpi_outstream_set_velocity(const struct hpi_hsubsys *ph_subsys, | 752 | u16 hpi_outstream_set_velocity(u32 h_outstream, short velocity) |
778 | u32 h_outstream, short velocity) | ||
779 | { | 753 | { |
780 | struct hpi_message hm; | 754 | struct hpi_message hm; |
781 | struct hpi_response hr; | 755 | struct hpi_response hr; |
782 | 756 | ||
783 | hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM, | 757 | hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM, |
784 | HPI_OSTREAM_SET_VELOCITY); | 758 | HPI_OSTREAM_SET_VELOCITY); |
785 | u32TOINDEXES(h_outstream, &hm.adapter_index, &hm.obj_index); | 759 | if (hpi_handle_indexes(h_outstream, &hm.adapter_index, &hm.obj_index)) |
760 | return HPI_ERROR_INVALID_HANDLE; | ||
786 | hm.u.d.u.velocity = velocity; | 761 | hm.u.d.u.velocity = velocity; |
787 | 762 | ||
788 | hpi_send_recv(&hm, &hr); | 763 | hpi_send_recv(&hm, &hr); |
@@ -790,15 +765,16 @@ u16 hpi_outstream_set_velocity(const struct hpi_hsubsys *ph_subsys, | |||
790 | return hr.error; | 765 | return hr.error; |
791 | } | 766 | } |
792 | 767 | ||
793 | u16 hpi_outstream_set_punch_in_out(const struct hpi_hsubsys *ph_subsys, | 768 | u16 hpi_outstream_set_punch_in_out(u32 h_outstream, u32 punch_in_sample, |
794 | u32 h_outstream, u32 punch_in_sample, u32 punch_out_sample) | 769 | u32 punch_out_sample) |
795 | { | 770 | { |
796 | struct hpi_message hm; | 771 | struct hpi_message hm; |
797 | struct hpi_response hr; | 772 | struct hpi_response hr; |
798 | 773 | ||
799 | hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM, | 774 | hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM, |
800 | HPI_OSTREAM_SET_PUNCHINOUT); | 775 | HPI_OSTREAM_SET_PUNCHINOUT); |
801 | u32TOINDEXES(h_outstream, &hm.adapter_index, &hm.obj_index); | 776 | if (hpi_handle_indexes(h_outstream, &hm.adapter_index, &hm.obj_index)) |
777 | return HPI_ERROR_INVALID_HANDLE; | ||
802 | 778 | ||
803 | hm.u.d.u.pio.punch_in_sample = punch_in_sample; | 779 | hm.u.d.u.pio.punch_in_sample = punch_in_sample; |
804 | hm.u.d.u.pio.punch_out_sample = punch_out_sample; | 780 | hm.u.d.u.pio.punch_out_sample = punch_out_sample; |
@@ -808,29 +784,29 @@ u16 hpi_outstream_set_punch_in_out(const struct hpi_hsubsys *ph_subsys, | |||
808 | return hr.error; | 784 | return hr.error; |
809 | } | 785 | } |
810 | 786 | ||
811 | u16 hpi_outstream_ancillary_reset(const struct hpi_hsubsys *ph_subsys, | 787 | u16 hpi_outstream_ancillary_reset(u32 h_outstream, u16 mode) |
812 | u32 h_outstream, u16 mode) | ||
813 | { | 788 | { |
814 | struct hpi_message hm; | 789 | struct hpi_message hm; |
815 | struct hpi_response hr; | 790 | struct hpi_response hr; |
816 | 791 | ||
817 | hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM, | 792 | hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM, |
818 | HPI_OSTREAM_ANC_RESET); | 793 | HPI_OSTREAM_ANC_RESET); |
819 | u32TOINDEXES(h_outstream, &hm.adapter_index, &hm.obj_index); | 794 | if (hpi_handle_indexes(h_outstream, &hm.adapter_index, &hm.obj_index)) |
795 | return HPI_ERROR_INVALID_HANDLE; | ||
820 | hm.u.d.u.data.format.channels = mode; | 796 | hm.u.d.u.data.format.channels = mode; |
821 | hpi_send_recv(&hm, &hr); | 797 | hpi_send_recv(&hm, &hr); |
822 | return hr.error; | 798 | return hr.error; |
823 | } | 799 | } |
824 | 800 | ||
825 | u16 hpi_outstream_ancillary_get_info(const struct hpi_hsubsys *ph_subsys, | 801 | u16 hpi_outstream_ancillary_get_info(u32 h_outstream, u32 *pframes_available) |
826 | u32 h_outstream, u32 *pframes_available) | ||
827 | { | 802 | { |
828 | struct hpi_message hm; | 803 | struct hpi_message hm; |
829 | struct hpi_response hr; | 804 | struct hpi_response hr; |
830 | 805 | ||
831 | hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM, | 806 | hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM, |
832 | HPI_OSTREAM_ANC_GET_INFO); | 807 | HPI_OSTREAM_ANC_GET_INFO); |
833 | u32TOINDEXES(h_outstream, &hm.adapter_index, &hm.obj_index); | 808 | if (hpi_handle_indexes(h_outstream, &hm.adapter_index, &hm.obj_index)) |
809 | return HPI_ERROR_INVALID_HANDLE; | ||
834 | hpi_send_recv(&hm, &hr); | 810 | hpi_send_recv(&hm, &hr); |
835 | if (hr.error == 0) { | 811 | if (hr.error == 0) { |
836 | if (pframes_available) | 812 | if (pframes_available) |
@@ -841,8 +817,8 @@ u16 hpi_outstream_ancillary_get_info(const struct hpi_hsubsys *ph_subsys, | |||
841 | return hr.error; | 817 | return hr.error; |
842 | } | 818 | } |
843 | 819 | ||
844 | u16 hpi_outstream_ancillary_read(const struct hpi_hsubsys *ph_subsys, | 820 | u16 hpi_outstream_ancillary_read(u32 h_outstream, |
845 | u32 h_outstream, struct hpi_anc_frame *p_anc_frame_buffer, | 821 | struct hpi_anc_frame *p_anc_frame_buffer, |
846 | u32 anc_frame_buffer_size_in_bytes, | 822 | u32 anc_frame_buffer_size_in_bytes, |
847 | u32 number_of_ancillary_frames_to_read) | 823 | u32 number_of_ancillary_frames_to_read) |
848 | { | 824 | { |
@@ -851,7 +827,8 @@ u16 hpi_outstream_ancillary_read(const struct hpi_hsubsys *ph_subsys, | |||
851 | 827 | ||
852 | hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM, | 828 | hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM, |
853 | HPI_OSTREAM_ANC_READ); | 829 | HPI_OSTREAM_ANC_READ); |
854 | u32TOINDEXES(h_outstream, &hm.adapter_index, &hm.obj_index); | 830 | if (hpi_handle_indexes(h_outstream, &hm.adapter_index, &hm.obj_index)) |
831 | return HPI_ERROR_INVALID_HANDLE; | ||
855 | hm.u.d.u.data.pb_data = (u8 *)p_anc_frame_buffer; | 832 | hm.u.d.u.data.pb_data = (u8 *)p_anc_frame_buffer; |
856 | hm.u.d.u.data.data_size = | 833 | hm.u.d.u.data.data_size = |
857 | number_of_ancillary_frames_to_read * | 834 | number_of_ancillary_frames_to_read * |
@@ -859,19 +836,19 @@ u16 hpi_outstream_ancillary_read(const struct hpi_hsubsys *ph_subsys, | |||
859 | if (hm.u.d.u.data.data_size <= anc_frame_buffer_size_in_bytes) | 836 | if (hm.u.d.u.data.data_size <= anc_frame_buffer_size_in_bytes) |
860 | hpi_send_recv(&hm, &hr); | 837 | hpi_send_recv(&hm, &hr); |
861 | else | 838 | else |
862 | hr.error = HPI_ERROR_INVALID_DATA_TRANSFER; | 839 | hr.error = HPI_ERROR_INVALID_DATASIZE; |
863 | return hr.error; | 840 | return hr.error; |
864 | } | 841 | } |
865 | 842 | ||
866 | u16 hpi_outstream_set_time_scale(const struct hpi_hsubsys *ph_subsys, | 843 | u16 hpi_outstream_set_time_scale(u32 h_outstream, u32 time_scale) |
867 | u32 h_outstream, u32 time_scale) | ||
868 | { | 844 | { |
869 | struct hpi_message hm; | 845 | struct hpi_message hm; |
870 | struct hpi_response hr; | 846 | struct hpi_response hr; |
871 | 847 | ||
872 | hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM, | 848 | hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM, |
873 | HPI_OSTREAM_SET_TIMESCALE); | 849 | HPI_OSTREAM_SET_TIMESCALE); |
874 | u32TOINDEXES(h_outstream, &hm.adapter_index, &hm.obj_index); | 850 | if (hpi_handle_indexes(h_outstream, &hm.adapter_index, &hm.obj_index)) |
851 | return HPI_ERROR_INVALID_HANDLE; | ||
875 | 852 | ||
876 | hm.u.d.u.time_scale = time_scale; | 853 | hm.u.d.u.time_scale = time_scale; |
877 | 854 | ||
@@ -880,22 +857,21 @@ u16 hpi_outstream_set_time_scale(const struct hpi_hsubsys *ph_subsys, | |||
880 | return hr.error; | 857 | return hr.error; |
881 | } | 858 | } |
882 | 859 | ||
883 | u16 hpi_outstream_host_buffer_allocate(const struct hpi_hsubsys *ph_subsys, | 860 | u16 hpi_outstream_host_buffer_allocate(u32 h_outstream, u32 size_in_bytes) |
884 | u32 h_outstream, u32 size_in_bytes) | ||
885 | { | 861 | { |
886 | struct hpi_message hm; | 862 | struct hpi_message hm; |
887 | struct hpi_response hr; | 863 | struct hpi_response hr; |
888 | 864 | ||
889 | hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM, | 865 | hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM, |
890 | HPI_OSTREAM_HOSTBUFFER_ALLOC); | 866 | HPI_OSTREAM_HOSTBUFFER_ALLOC); |
891 | u32TOINDEXES(h_outstream, &hm.adapter_index, &hm.obj_index); | 867 | if (hpi_handle_indexes(h_outstream, &hm.adapter_index, &hm.obj_index)) |
868 | return HPI_ERROR_INVALID_HANDLE; | ||
892 | hm.u.d.u.data.data_size = size_in_bytes; | 869 | hm.u.d.u.data.data_size = size_in_bytes; |
893 | hpi_send_recv(&hm, &hr); | 870 | hpi_send_recv(&hm, &hr); |
894 | return hr.error; | 871 | return hr.error; |
895 | } | 872 | } |
896 | 873 | ||
897 | u16 hpi_outstream_host_buffer_get_info(const struct hpi_hsubsys *ph_subsys, | 874 | u16 hpi_outstream_host_buffer_get_info(u32 h_outstream, u8 **pp_buffer, |
898 | u32 h_outstream, u8 **pp_buffer, | ||
899 | struct hpi_hostbuffer_status **pp_status) | 875 | struct hpi_hostbuffer_status **pp_status) |
900 | { | 876 | { |
901 | struct hpi_message hm; | 877 | struct hpi_message hm; |
@@ -903,7 +879,8 @@ u16 hpi_outstream_host_buffer_get_info(const struct hpi_hsubsys *ph_subsys, | |||
903 | 879 | ||
904 | hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM, | 880 | hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM, |
905 | HPI_OSTREAM_HOSTBUFFER_GET_INFO); | 881 | HPI_OSTREAM_HOSTBUFFER_GET_INFO); |
906 | u32TOINDEXES(h_outstream, &hm.adapter_index, &hm.obj_index); | 882 | if (hpi_handle_indexes(h_outstream, &hm.adapter_index, &hm.obj_index)) |
883 | return HPI_ERROR_INVALID_HANDLE; | ||
907 | hpi_send_recv(&hm, &hr); | 884 | hpi_send_recv(&hm, &hr); |
908 | 885 | ||
909 | if (hr.error == 0) { | 886 | if (hr.error == 0) { |
@@ -915,21 +892,20 @@ u16 hpi_outstream_host_buffer_get_info(const struct hpi_hsubsys *ph_subsys, | |||
915 | return hr.error; | 892 | return hr.error; |
916 | } | 893 | } |
917 | 894 | ||
918 | u16 hpi_outstream_host_buffer_free(const struct hpi_hsubsys *ph_subsys, | 895 | u16 hpi_outstream_host_buffer_free(u32 h_outstream) |
919 | u32 h_outstream) | ||
920 | { | 896 | { |
921 | struct hpi_message hm; | 897 | struct hpi_message hm; |
922 | struct hpi_response hr; | 898 | struct hpi_response hr; |
923 | 899 | ||
924 | hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM, | 900 | hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM, |
925 | HPI_OSTREAM_HOSTBUFFER_FREE); | 901 | HPI_OSTREAM_HOSTBUFFER_FREE); |
926 | u32TOINDEXES(h_outstream, &hm.adapter_index, &hm.obj_index); | 902 | if (hpi_handle_indexes(h_outstream, &hm.adapter_index, &hm.obj_index)) |
903 | return HPI_ERROR_INVALID_HANDLE; | ||
927 | hpi_send_recv(&hm, &hr); | 904 | hpi_send_recv(&hm, &hr); |
928 | return hr.error; | 905 | return hr.error; |
929 | } | 906 | } |
930 | 907 | ||
931 | u16 hpi_outstream_group_add(const struct hpi_hsubsys *ph_subsys, | 908 | u16 hpi_outstream_group_add(u32 h_outstream, u32 h_stream) |
932 | u32 h_outstream, u32 h_stream) | ||
933 | { | 909 | { |
934 | struct hpi_message hm; | 910 | struct hpi_message hm; |
935 | struct hpi_response hr; | 911 | struct hpi_response hr; |
@@ -938,22 +914,22 @@ u16 hpi_outstream_group_add(const struct hpi_hsubsys *ph_subsys, | |||
938 | 914 | ||
939 | hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM, | 915 | hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM, |
940 | HPI_OSTREAM_GROUP_ADD); | 916 | HPI_OSTREAM_GROUP_ADD); |
941 | hr.error = 0; | 917 | |
942 | u32TOINDEXES(h_outstream, &hm.adapter_index, &hm.obj_index); | 918 | if (hpi_handle_indexes(h_outstream, &hm.adapter_index, &hm.obj_index)) |
919 | return HPI_ERROR_INVALID_HANDLE; | ||
920 | |||
921 | if (hpi_handle_indexes(h_stream, &adapter, | ||
922 | &hm.u.d.u.stream.stream_index)) | ||
923 | return HPI_ERROR_INVALID_HANDLE; | ||
924 | |||
943 | c_obj_type = hpi_handle_object(h_stream); | 925 | c_obj_type = hpi_handle_object(h_stream); |
944 | switch (c_obj_type) { | 926 | switch (c_obj_type) { |
945 | case HPI_OBJ_OSTREAM: | 927 | case HPI_OBJ_OSTREAM: |
946 | hm.u.d.u.stream.object_type = HPI_OBJ_OSTREAM; | ||
947 | u32TOINDEXES(h_stream, &adapter, | ||
948 | &hm.u.d.u.stream.stream_index); | ||
949 | break; | ||
950 | case HPI_OBJ_ISTREAM: | 928 | case HPI_OBJ_ISTREAM: |
951 | hm.u.d.u.stream.object_type = HPI_OBJ_ISTREAM; | 929 | hm.u.d.u.stream.object_type = c_obj_type; |
952 | u32TOINDEXES(h_stream, &adapter, | ||
953 | &hm.u.d.u.stream.stream_index); | ||
954 | break; | 930 | break; |
955 | default: | 931 | default: |
956 | return HPI_ERROR_INVALID_STREAM; | 932 | return HPI_ERROR_INVALID_OBJ; |
957 | } | 933 | } |
958 | if (adapter != hm.adapter_index) | 934 | if (adapter != hm.adapter_index) |
959 | return HPI_ERROR_NO_INTERADAPTER_GROUPS; | 935 | return HPI_ERROR_NO_INTERADAPTER_GROUPS; |
@@ -962,15 +938,16 @@ u16 hpi_outstream_group_add(const struct hpi_hsubsys *ph_subsys, | |||
962 | return hr.error; | 938 | return hr.error; |
963 | } | 939 | } |
964 | 940 | ||
965 | u16 hpi_outstream_group_get_map(const struct hpi_hsubsys *ph_subsys, | 941 | u16 hpi_outstream_group_get_map(u32 h_outstream, u32 *poutstream_map, |
966 | u32 h_outstream, u32 *poutstream_map, u32 *pinstream_map) | 942 | u32 *pinstream_map) |
967 | { | 943 | { |
968 | struct hpi_message hm; | 944 | struct hpi_message hm; |
969 | struct hpi_response hr; | 945 | struct hpi_response hr; |
970 | 946 | ||
971 | hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM, | 947 | hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM, |
972 | HPI_OSTREAM_GROUP_GETMAP); | 948 | HPI_OSTREAM_GROUP_GETMAP); |
973 | u32TOINDEXES(h_outstream, &hm.adapter_index, &hm.obj_index); | 949 | if (hpi_handle_indexes(h_outstream, &hm.adapter_index, &hm.obj_index)) |
950 | return HPI_ERROR_INVALID_HANDLE; | ||
974 | hpi_send_recv(&hm, &hr); | 951 | hpi_send_recv(&hm, &hr); |
975 | 952 | ||
976 | if (poutstream_map) | 953 | if (poutstream_map) |
@@ -981,21 +958,20 @@ u16 hpi_outstream_group_get_map(const struct hpi_hsubsys *ph_subsys, | |||
981 | return hr.error; | 958 | return hr.error; |
982 | } | 959 | } |
983 | 960 | ||
984 | u16 hpi_outstream_group_reset(const struct hpi_hsubsys *ph_subsys, | 961 | u16 hpi_outstream_group_reset(u32 h_outstream) |
985 | u32 h_outstream) | ||
986 | { | 962 | { |
987 | struct hpi_message hm; | 963 | struct hpi_message hm; |
988 | struct hpi_response hr; | 964 | struct hpi_response hr; |
989 | 965 | ||
990 | hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM, | 966 | hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM, |
991 | HPI_OSTREAM_GROUP_RESET); | 967 | HPI_OSTREAM_GROUP_RESET); |
992 | u32TOINDEXES(h_outstream, &hm.adapter_index, &hm.obj_index); | 968 | if (hpi_handle_indexes(h_outstream, &hm.adapter_index, &hm.obj_index)) |
969 | return HPI_ERROR_INVALID_HANDLE; | ||
993 | hpi_send_recv(&hm, &hr); | 970 | hpi_send_recv(&hm, &hr); |
994 | return hr.error; | 971 | return hr.error; |
995 | } | 972 | } |
996 | 973 | ||
997 | u16 hpi_instream_open(const struct hpi_hsubsys *ph_subsys, u16 adapter_index, | 974 | u16 hpi_instream_open(u16 adapter_index, u16 instream_index, u32 *ph_instream) |
998 | u16 instream_index, u32 *ph_instream) | ||
999 | { | 975 | { |
1000 | struct hpi_message hm; | 976 | struct hpi_message hm; |
1001 | struct hpi_response hr; | 977 | struct hpi_response hr; |
@@ -1017,38 +993,40 @@ u16 hpi_instream_open(const struct hpi_hsubsys *ph_subsys, u16 adapter_index, | |||
1017 | return hr.error; | 993 | return hr.error; |
1018 | } | 994 | } |
1019 | 995 | ||
1020 | u16 hpi_instream_close(const struct hpi_hsubsys *ph_subsys, u32 h_instream) | 996 | u16 hpi_instream_close(u32 h_instream) |
1021 | { | 997 | { |
1022 | struct hpi_message hm; | 998 | struct hpi_message hm; |
1023 | struct hpi_response hr; | 999 | struct hpi_response hr; |
1024 | 1000 | ||
1025 | hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM, | 1001 | hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM, |
1026 | HPI_ISTREAM_HOSTBUFFER_FREE); | 1002 | HPI_ISTREAM_HOSTBUFFER_FREE); |
1027 | u32TOINDEXES(h_instream, &hm.adapter_index, &hm.obj_index); | 1003 | if (hpi_handle_indexes(h_instream, &hm.adapter_index, &hm.obj_index)) |
1004 | return HPI_ERROR_INVALID_HANDLE; | ||
1028 | hpi_send_recv(&hm, &hr); | 1005 | hpi_send_recv(&hm, &hr); |
1029 | 1006 | ||
1030 | hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM, | 1007 | hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM, |
1031 | HPI_ISTREAM_GROUP_RESET); | 1008 | HPI_ISTREAM_GROUP_RESET); |
1032 | u32TOINDEXES(h_instream, &hm.adapter_index, &hm.obj_index); | 1009 | hpi_handle_indexes(h_instream, &hm.adapter_index, &hm.obj_index); |
1033 | hpi_send_recv(&hm, &hr); | 1010 | hpi_send_recv(&hm, &hr); |
1034 | 1011 | ||
1035 | hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM, | 1012 | hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM, |
1036 | HPI_ISTREAM_CLOSE); | 1013 | HPI_ISTREAM_CLOSE); |
1037 | u32TOINDEXES(h_instream, &hm.adapter_index, &hm.obj_index); | 1014 | hpi_handle_indexes(h_instream, &hm.adapter_index, &hm.obj_index); |
1038 | hpi_send_recv(&hm, &hr); | 1015 | hpi_send_recv(&hm, &hr); |
1039 | 1016 | ||
1040 | return hr.error; | 1017 | return hr.error; |
1041 | } | 1018 | } |
1042 | 1019 | ||
1043 | u16 hpi_instream_query_format(const struct hpi_hsubsys *ph_subsys, | 1020 | u16 hpi_instream_query_format(u32 h_instream, |
1044 | u32 h_instream, const struct hpi_format *p_format) | 1021 | const struct hpi_format *p_format) |
1045 | { | 1022 | { |
1046 | struct hpi_message hm; | 1023 | struct hpi_message hm; |
1047 | struct hpi_response hr; | 1024 | struct hpi_response hr; |
1048 | 1025 | ||
1049 | hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM, | 1026 | hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM, |
1050 | HPI_ISTREAM_QUERY_FORMAT); | 1027 | HPI_ISTREAM_QUERY_FORMAT); |
1051 | u32TOINDEXES(h_instream, &hm.adapter_index, &hm.obj_index); | 1028 | if (hpi_handle_indexes(h_instream, &hm.adapter_index, &hm.obj_index)) |
1029 | return HPI_ERROR_INVALID_HANDLE; | ||
1052 | hpi_format_to_msg(&hm.u.d.u.data.format, p_format); | 1030 | hpi_format_to_msg(&hm.u.d.u.data.format, p_format); |
1053 | 1031 | ||
1054 | hpi_send_recv(&hm, &hr); | 1032 | hpi_send_recv(&hm, &hr); |
@@ -1056,15 +1034,15 @@ u16 hpi_instream_query_format(const struct hpi_hsubsys *ph_subsys, | |||
1056 | return hr.error; | 1034 | return hr.error; |
1057 | } | 1035 | } |
1058 | 1036 | ||
1059 | u16 hpi_instream_set_format(const struct hpi_hsubsys *ph_subsys, | 1037 | u16 hpi_instream_set_format(u32 h_instream, const struct hpi_format *p_format) |
1060 | u32 h_instream, const struct hpi_format *p_format) | ||
1061 | { | 1038 | { |
1062 | struct hpi_message hm; | 1039 | struct hpi_message hm; |
1063 | struct hpi_response hr; | 1040 | struct hpi_response hr; |
1064 | 1041 | ||
1065 | hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM, | 1042 | hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM, |
1066 | HPI_ISTREAM_SET_FORMAT); | 1043 | HPI_ISTREAM_SET_FORMAT); |
1067 | u32TOINDEXES(h_instream, &hm.adapter_index, &hm.obj_index); | 1044 | if (hpi_handle_indexes(h_instream, &hm.adapter_index, &hm.obj_index)) |
1045 | return HPI_ERROR_INVALID_HANDLE; | ||
1068 | hpi_format_to_msg(&hm.u.d.u.data.format, p_format); | 1046 | hpi_format_to_msg(&hm.u.d.u.data.format, p_format); |
1069 | 1047 | ||
1070 | hpi_send_recv(&hm, &hr); | 1048 | hpi_send_recv(&hm, &hr); |
@@ -1072,15 +1050,15 @@ u16 hpi_instream_set_format(const struct hpi_hsubsys *ph_subsys, | |||
1072 | return hr.error; | 1050 | return hr.error; |
1073 | } | 1051 | } |
1074 | 1052 | ||
1075 | u16 hpi_instream_read_buf(const struct hpi_hsubsys *ph_subsys, u32 h_instream, | 1053 | u16 hpi_instream_read_buf(u32 h_instream, u8 *pb_data, u32 bytes_to_read) |
1076 | u8 *pb_data, u32 bytes_to_read) | ||
1077 | { | 1054 | { |
1078 | struct hpi_message hm; | 1055 | struct hpi_message hm; |
1079 | struct hpi_response hr; | 1056 | struct hpi_response hr; |
1080 | 1057 | ||
1081 | hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM, | 1058 | hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM, |
1082 | HPI_ISTREAM_READ); | 1059 | HPI_ISTREAM_READ); |
1083 | u32TOINDEXES(h_instream, &hm.adapter_index, &hm.obj_index); | 1060 | if (hpi_handle_indexes(h_instream, &hm.adapter_index, &hm.obj_index)) |
1061 | return HPI_ERROR_INVALID_HANDLE; | ||
1084 | hm.u.d.u.data.data_size = bytes_to_read; | 1062 | hm.u.d.u.data.data_size = bytes_to_read; |
1085 | hm.u.d.u.data.pb_data = pb_data; | 1063 | hm.u.d.u.data.pb_data = pb_data; |
1086 | 1064 | ||
@@ -1089,72 +1067,76 @@ u16 hpi_instream_read_buf(const struct hpi_hsubsys *ph_subsys, u32 h_instream, | |||
1089 | return hr.error; | 1067 | return hr.error; |
1090 | } | 1068 | } |
1091 | 1069 | ||
1092 | u16 hpi_instream_start(const struct hpi_hsubsys *ph_subsys, u32 h_instream) | 1070 | u16 hpi_instream_start(u32 h_instream) |
1093 | { | 1071 | { |
1094 | struct hpi_message hm; | 1072 | struct hpi_message hm; |
1095 | struct hpi_response hr; | 1073 | struct hpi_response hr; |
1096 | 1074 | ||
1097 | hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM, | 1075 | hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM, |
1098 | HPI_ISTREAM_START); | 1076 | HPI_ISTREAM_START); |
1099 | u32TOINDEXES(h_instream, &hm.adapter_index, &hm.obj_index); | 1077 | if (hpi_handle_indexes(h_instream, &hm.adapter_index, &hm.obj_index)) |
1078 | return HPI_ERROR_INVALID_HANDLE; | ||
1100 | 1079 | ||
1101 | hpi_send_recv(&hm, &hr); | 1080 | hpi_send_recv(&hm, &hr); |
1102 | 1081 | ||
1103 | return hr.error; | 1082 | return hr.error; |
1104 | } | 1083 | } |
1105 | 1084 | ||
1106 | u16 hpi_instream_wait_start(const struct hpi_hsubsys *ph_subsys, | 1085 | u16 hpi_instream_wait_start(u32 h_instream) |
1107 | u32 h_instream) | ||
1108 | { | 1086 | { |
1109 | struct hpi_message hm; | 1087 | struct hpi_message hm; |
1110 | struct hpi_response hr; | 1088 | struct hpi_response hr; |
1111 | 1089 | ||
1112 | hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM, | 1090 | hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM, |
1113 | HPI_ISTREAM_WAIT_START); | 1091 | HPI_ISTREAM_WAIT_START); |
1114 | u32TOINDEXES(h_instream, &hm.adapter_index, &hm.obj_index); | 1092 | if (hpi_handle_indexes(h_instream, &hm.adapter_index, &hm.obj_index)) |
1093 | return HPI_ERROR_INVALID_HANDLE; | ||
1115 | 1094 | ||
1116 | hpi_send_recv(&hm, &hr); | 1095 | hpi_send_recv(&hm, &hr); |
1117 | 1096 | ||
1118 | return hr.error; | 1097 | return hr.error; |
1119 | } | 1098 | } |
1120 | 1099 | ||
1121 | u16 hpi_instream_stop(const struct hpi_hsubsys *ph_subsys, u32 h_instream) | 1100 | u16 hpi_instream_stop(u32 h_instream) |
1122 | { | 1101 | { |
1123 | struct hpi_message hm; | 1102 | struct hpi_message hm; |
1124 | struct hpi_response hr; | 1103 | struct hpi_response hr; |
1125 | 1104 | ||
1126 | hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM, | 1105 | hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM, |
1127 | HPI_ISTREAM_STOP); | 1106 | HPI_ISTREAM_STOP); |
1128 | u32TOINDEXES(h_instream, &hm.adapter_index, &hm.obj_index); | 1107 | if (hpi_handle_indexes(h_instream, &hm.adapter_index, &hm.obj_index)) |
1108 | return HPI_ERROR_INVALID_HANDLE; | ||
1129 | 1109 | ||
1130 | hpi_send_recv(&hm, &hr); | 1110 | hpi_send_recv(&hm, &hr); |
1131 | 1111 | ||
1132 | return hr.error; | 1112 | return hr.error; |
1133 | } | 1113 | } |
1134 | 1114 | ||
1135 | u16 hpi_instream_reset(const struct hpi_hsubsys *ph_subsys, u32 h_instream) | 1115 | u16 hpi_instream_reset(u32 h_instream) |
1136 | { | 1116 | { |
1137 | struct hpi_message hm; | 1117 | struct hpi_message hm; |
1138 | struct hpi_response hr; | 1118 | struct hpi_response hr; |
1139 | 1119 | ||
1140 | hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM, | 1120 | hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM, |
1141 | HPI_ISTREAM_RESET); | 1121 | HPI_ISTREAM_RESET); |
1142 | u32TOINDEXES(h_instream, &hm.adapter_index, &hm.obj_index); | 1122 | if (hpi_handle_indexes(h_instream, &hm.adapter_index, &hm.obj_index)) |
1123 | return HPI_ERROR_INVALID_HANDLE; | ||
1143 | 1124 | ||
1144 | hpi_send_recv(&hm, &hr); | 1125 | hpi_send_recv(&hm, &hr); |
1145 | 1126 | ||
1146 | return hr.error; | 1127 | return hr.error; |
1147 | } | 1128 | } |
1148 | 1129 | ||
1149 | u16 hpi_instream_get_info_ex(const struct hpi_hsubsys *ph_subsys, | 1130 | u16 hpi_instream_get_info_ex(u32 h_instream, u16 *pw_state, u32 *pbuffer_size, |
1150 | u32 h_instream, u16 *pw_state, u32 *pbuffer_size, u32 *pdata_recorded, | 1131 | u32 *pdata_recorded, u32 *psamples_recorded, |
1151 | u32 *psamples_recorded, u32 *pauxiliary_data_recorded) | 1132 | u32 *pauxiliary_data_recorded) |
1152 | { | 1133 | { |
1153 | struct hpi_message hm; | 1134 | struct hpi_message hm; |
1154 | struct hpi_response hr; | 1135 | struct hpi_response hr; |
1155 | hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM, | 1136 | hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM, |
1156 | HPI_ISTREAM_GET_INFO); | 1137 | HPI_ISTREAM_GET_INFO); |
1157 | u32TOINDEXES(h_instream, &hm.adapter_index, &hm.obj_index); | 1138 | if (hpi_handle_indexes(h_instream, &hm.adapter_index, &hm.obj_index)) |
1139 | return HPI_ERROR_INVALID_HANDLE; | ||
1158 | 1140 | ||
1159 | hpi_send_recv(&hm, &hr); | 1141 | hpi_send_recv(&hm, &hr); |
1160 | 1142 | ||
@@ -1172,15 +1154,15 @@ u16 hpi_instream_get_info_ex(const struct hpi_hsubsys *ph_subsys, | |||
1172 | return hr.error; | 1154 | return hr.error; |
1173 | } | 1155 | } |
1174 | 1156 | ||
1175 | u16 hpi_instream_ancillary_reset(const struct hpi_hsubsys *ph_subsys, | 1157 | u16 hpi_instream_ancillary_reset(u32 h_instream, u16 bytes_per_frame, |
1176 | u32 h_instream, u16 bytes_per_frame, u16 mode, u16 alignment, | 1158 | u16 mode, u16 alignment, u16 idle_bit) |
1177 | u16 idle_bit) | ||
1178 | { | 1159 | { |
1179 | struct hpi_message hm; | 1160 | struct hpi_message hm; |
1180 | struct hpi_response hr; | 1161 | struct hpi_response hr; |
1181 | hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM, | 1162 | hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM, |
1182 | HPI_ISTREAM_ANC_RESET); | 1163 | HPI_ISTREAM_ANC_RESET); |
1183 | u32TOINDEXES(h_instream, &hm.adapter_index, &hm.obj_index); | 1164 | if (hpi_handle_indexes(h_instream, &hm.adapter_index, &hm.obj_index)) |
1165 | return HPI_ERROR_INVALID_HANDLE; | ||
1184 | hm.u.d.u.data.format.attributes = bytes_per_frame; | 1166 | hm.u.d.u.data.format.attributes = bytes_per_frame; |
1185 | hm.u.d.u.data.format.format = (mode << 8) | (alignment & 0xff); | 1167 | hm.u.d.u.data.format.format = (mode << 8) | (alignment & 0xff); |
1186 | hm.u.d.u.data.format.channels = idle_bit; | 1168 | hm.u.d.u.data.format.channels = idle_bit; |
@@ -1188,14 +1170,14 @@ u16 hpi_instream_ancillary_reset(const struct hpi_hsubsys *ph_subsys, | |||
1188 | return hr.error; | 1170 | return hr.error; |
1189 | } | 1171 | } |
1190 | 1172 | ||
1191 | u16 hpi_instream_ancillary_get_info(const struct hpi_hsubsys *ph_subsys, | 1173 | u16 hpi_instream_ancillary_get_info(u32 h_instream, u32 *pframe_space) |
1192 | u32 h_instream, u32 *pframe_space) | ||
1193 | { | 1174 | { |
1194 | struct hpi_message hm; | 1175 | struct hpi_message hm; |
1195 | struct hpi_response hr; | 1176 | struct hpi_response hr; |
1196 | hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM, | 1177 | hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM, |
1197 | HPI_ISTREAM_ANC_GET_INFO); | 1178 | HPI_ISTREAM_ANC_GET_INFO); |
1198 | u32TOINDEXES(h_instream, &hm.adapter_index, &hm.obj_index); | 1179 | if (hpi_handle_indexes(h_instream, &hm.adapter_index, &hm.obj_index)) |
1180 | return HPI_ERROR_INVALID_HANDLE; | ||
1199 | hpi_send_recv(&hm, &hr); | 1181 | hpi_send_recv(&hm, &hr); |
1200 | if (pframe_space) | 1182 | if (pframe_space) |
1201 | *pframe_space = | 1183 | *pframe_space = |
@@ -1205,8 +1187,8 @@ u16 hpi_instream_ancillary_get_info(const struct hpi_hsubsys *ph_subsys, | |||
1205 | return hr.error; | 1187 | return hr.error; |
1206 | } | 1188 | } |
1207 | 1189 | ||
1208 | u16 hpi_instream_ancillary_write(const struct hpi_hsubsys *ph_subsys, | 1190 | u16 hpi_instream_ancillary_write(u32 h_instream, |
1209 | u32 h_instream, const struct hpi_anc_frame *p_anc_frame_buffer, | 1191 | const struct hpi_anc_frame *p_anc_frame_buffer, |
1210 | u32 anc_frame_buffer_size_in_bytes, | 1192 | u32 anc_frame_buffer_size_in_bytes, |
1211 | u32 number_of_ancillary_frames_to_write) | 1193 | u32 number_of_ancillary_frames_to_write) |
1212 | { | 1194 | { |
@@ -1215,7 +1197,8 @@ u16 hpi_instream_ancillary_write(const struct hpi_hsubsys *ph_subsys, | |||
1215 | 1197 | ||
1216 | hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM, | 1198 | hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM, |
1217 | HPI_ISTREAM_ANC_WRITE); | 1199 | HPI_ISTREAM_ANC_WRITE); |
1218 | u32TOINDEXES(h_instream, &hm.adapter_index, &hm.obj_index); | 1200 | if (hpi_handle_indexes(h_instream, &hm.adapter_index, &hm.obj_index)) |
1201 | return HPI_ERROR_INVALID_HANDLE; | ||
1219 | hm.u.d.u.data.pb_data = (u8 *)p_anc_frame_buffer; | 1202 | hm.u.d.u.data.pb_data = (u8 *)p_anc_frame_buffer; |
1220 | hm.u.d.u.data.data_size = | 1203 | hm.u.d.u.data.data_size = |
1221 | number_of_ancillary_frames_to_write * | 1204 | number_of_ancillary_frames_to_write * |
@@ -1223,12 +1206,11 @@ u16 hpi_instream_ancillary_write(const struct hpi_hsubsys *ph_subsys, | |||
1223 | if (hm.u.d.u.data.data_size <= anc_frame_buffer_size_in_bytes) | 1206 | if (hm.u.d.u.data.data_size <= anc_frame_buffer_size_in_bytes) |
1224 | hpi_send_recv(&hm, &hr); | 1207 | hpi_send_recv(&hm, &hr); |
1225 | else | 1208 | else |
1226 | hr.error = HPI_ERROR_INVALID_DATA_TRANSFER; | 1209 | hr.error = HPI_ERROR_INVALID_DATASIZE; |
1227 | return hr.error; | 1210 | return hr.error; |
1228 | } | 1211 | } |
1229 | 1212 | ||
1230 | u16 hpi_instream_host_buffer_allocate(const struct hpi_hsubsys *ph_subsys, | 1213 | u16 hpi_instream_host_buffer_allocate(u32 h_instream, u32 size_in_bytes) |
1231 | u32 h_instream, u32 size_in_bytes) | ||
1232 | { | 1214 | { |
1233 | 1215 | ||
1234 | struct hpi_message hm; | 1216 | struct hpi_message hm; |
@@ -1236,14 +1218,14 @@ u16 hpi_instream_host_buffer_allocate(const struct hpi_hsubsys *ph_subsys, | |||
1236 | 1218 | ||
1237 | hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM, | 1219 | hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM, |
1238 | HPI_ISTREAM_HOSTBUFFER_ALLOC); | 1220 | HPI_ISTREAM_HOSTBUFFER_ALLOC); |
1239 | u32TOINDEXES(h_instream, &hm.adapter_index, &hm.obj_index); | 1221 | if (hpi_handle_indexes(h_instream, &hm.adapter_index, &hm.obj_index)) |
1222 | return HPI_ERROR_INVALID_HANDLE; | ||
1240 | hm.u.d.u.data.data_size = size_in_bytes; | 1223 | hm.u.d.u.data.data_size = size_in_bytes; |
1241 | hpi_send_recv(&hm, &hr); | 1224 | hpi_send_recv(&hm, &hr); |
1242 | return hr.error; | 1225 | return hr.error; |
1243 | } | 1226 | } |
1244 | 1227 | ||
1245 | u16 hpi_instream_host_buffer_get_info(const struct hpi_hsubsys *ph_subsys, | 1228 | u16 hpi_instream_host_buffer_get_info(u32 h_instream, u8 **pp_buffer, |
1246 | u32 h_instream, u8 **pp_buffer, | ||
1247 | struct hpi_hostbuffer_status **pp_status) | 1229 | struct hpi_hostbuffer_status **pp_status) |
1248 | { | 1230 | { |
1249 | struct hpi_message hm; | 1231 | struct hpi_message hm; |
@@ -1251,7 +1233,8 @@ u16 hpi_instream_host_buffer_get_info(const struct hpi_hsubsys *ph_subsys, | |||
1251 | 1233 | ||
1252 | hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM, | 1234 | hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM, |
1253 | HPI_ISTREAM_HOSTBUFFER_GET_INFO); | 1235 | HPI_ISTREAM_HOSTBUFFER_GET_INFO); |
1254 | u32TOINDEXES(h_instream, &hm.adapter_index, &hm.obj_index); | 1236 | if (hpi_handle_indexes(h_instream, &hm.adapter_index, &hm.obj_index)) |
1237 | return HPI_ERROR_INVALID_HANDLE; | ||
1255 | hpi_send_recv(&hm, &hr); | 1238 | hpi_send_recv(&hm, &hr); |
1256 | 1239 | ||
1257 | if (hr.error == 0) { | 1240 | if (hr.error == 0) { |
@@ -1263,8 +1246,7 @@ u16 hpi_instream_host_buffer_get_info(const struct hpi_hsubsys *ph_subsys, | |||
1263 | return hr.error; | 1246 | return hr.error; |
1264 | } | 1247 | } |
1265 | 1248 | ||
1266 | u16 hpi_instream_host_buffer_free(const struct hpi_hsubsys *ph_subsys, | 1249 | u16 hpi_instream_host_buffer_free(u32 h_instream) |
1267 | u32 h_instream) | ||
1268 | { | 1250 | { |
1269 | 1251 | ||
1270 | struct hpi_message hm; | 1252 | struct hpi_message hm; |
@@ -1272,13 +1254,13 @@ u16 hpi_instream_host_buffer_free(const struct hpi_hsubsys *ph_subsys, | |||
1272 | 1254 | ||
1273 | hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM, | 1255 | hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM, |
1274 | HPI_ISTREAM_HOSTBUFFER_FREE); | 1256 | HPI_ISTREAM_HOSTBUFFER_FREE); |
1275 | u32TOINDEXES(h_instream, &hm.adapter_index, &hm.obj_index); | 1257 | if (hpi_handle_indexes(h_instream, &hm.adapter_index, &hm.obj_index)) |
1258 | return HPI_ERROR_INVALID_HANDLE; | ||
1276 | hpi_send_recv(&hm, &hr); | 1259 | hpi_send_recv(&hm, &hr); |
1277 | return hr.error; | 1260 | return hr.error; |
1278 | } | 1261 | } |
1279 | 1262 | ||
1280 | u16 hpi_instream_group_add(const struct hpi_hsubsys *ph_subsys, | 1263 | u16 hpi_instream_group_add(u32 h_instream, u32 h_stream) |
1281 | u32 h_instream, u32 h_stream) | ||
1282 | { | 1264 | { |
1283 | struct hpi_message hm; | 1265 | struct hpi_message hm; |
1284 | struct hpi_response hr; | 1266 | struct hpi_response hr; |
@@ -1288,22 +1270,23 @@ u16 hpi_instream_group_add(const struct hpi_hsubsys *ph_subsys, | |||
1288 | hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM, | 1270 | hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM, |
1289 | HPI_ISTREAM_GROUP_ADD); | 1271 | HPI_ISTREAM_GROUP_ADD); |
1290 | hr.error = 0; | 1272 | hr.error = 0; |
1291 | u32TOINDEXES(h_instream, &hm.adapter_index, &hm.obj_index); | 1273 | |
1274 | if (hpi_handle_indexes(h_instream, &hm.adapter_index, &hm.obj_index)) | ||
1275 | return HPI_ERROR_INVALID_HANDLE; | ||
1276 | |||
1277 | if (hpi_handle_indexes(h_stream, &adapter, | ||
1278 | &hm.u.d.u.stream.stream_index)) | ||
1279 | return HPI_ERROR_INVALID_HANDLE; | ||
1280 | |||
1292 | c_obj_type = hpi_handle_object(h_stream); | 1281 | c_obj_type = hpi_handle_object(h_stream); |
1293 | 1282 | ||
1294 | switch (c_obj_type) { | 1283 | switch (c_obj_type) { |
1295 | case HPI_OBJ_OSTREAM: | 1284 | case HPI_OBJ_OSTREAM: |
1296 | hm.u.d.u.stream.object_type = HPI_OBJ_OSTREAM; | ||
1297 | u32TOINDEXES(h_stream, &adapter, | ||
1298 | &hm.u.d.u.stream.stream_index); | ||
1299 | break; | ||
1300 | case HPI_OBJ_ISTREAM: | 1285 | case HPI_OBJ_ISTREAM: |
1301 | hm.u.d.u.stream.object_type = HPI_OBJ_ISTREAM; | 1286 | hm.u.d.u.stream.object_type = c_obj_type; |
1302 | u32TOINDEXES(h_stream, &adapter, | ||
1303 | &hm.u.d.u.stream.stream_index); | ||
1304 | break; | 1287 | break; |
1305 | default: | 1288 | default: |
1306 | return HPI_ERROR_INVALID_STREAM; | 1289 | return HPI_ERROR_INVALID_OBJ; |
1307 | } | 1290 | } |
1308 | 1291 | ||
1309 | if (adapter != hm.adapter_index) | 1292 | if (adapter != hm.adapter_index) |
@@ -1313,15 +1296,16 @@ u16 hpi_instream_group_add(const struct hpi_hsubsys *ph_subsys, | |||
1313 | return hr.error; | 1296 | return hr.error; |
1314 | } | 1297 | } |
1315 | 1298 | ||
1316 | u16 hpi_instream_group_get_map(const struct hpi_hsubsys *ph_subsys, | 1299 | u16 hpi_instream_group_get_map(u32 h_instream, u32 *poutstream_map, |
1317 | u32 h_instream, u32 *poutstream_map, u32 *pinstream_map) | 1300 | u32 *pinstream_map) |
1318 | { | 1301 | { |
1319 | struct hpi_message hm; | 1302 | struct hpi_message hm; |
1320 | struct hpi_response hr; | 1303 | struct hpi_response hr; |
1321 | 1304 | ||
1322 | hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM, | 1305 | hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM, |
1323 | HPI_ISTREAM_HOSTBUFFER_FREE); | 1306 | HPI_ISTREAM_HOSTBUFFER_FREE); |
1324 | u32TOINDEXES(h_instream, &hm.adapter_index, &hm.obj_index); | 1307 | if (hpi_handle_indexes(h_instream, &hm.adapter_index, &hm.obj_index)) |
1308 | return HPI_ERROR_INVALID_HANDLE; | ||
1325 | hpi_send_recv(&hm, &hr); | 1309 | hpi_send_recv(&hm, &hr); |
1326 | 1310 | ||
1327 | if (poutstream_map) | 1311 | if (poutstream_map) |
@@ -1332,21 +1316,20 @@ u16 hpi_instream_group_get_map(const struct hpi_hsubsys *ph_subsys, | |||
1332 | return hr.error; | 1316 | return hr.error; |
1333 | } | 1317 | } |
1334 | 1318 | ||
1335 | u16 hpi_instream_group_reset(const struct hpi_hsubsys *ph_subsys, | 1319 | u16 hpi_instream_group_reset(u32 h_instream) |
1336 | u32 h_instream) | ||
1337 | { | 1320 | { |
1338 | struct hpi_message hm; | 1321 | struct hpi_message hm; |
1339 | struct hpi_response hr; | 1322 | struct hpi_response hr; |
1340 | 1323 | ||
1341 | hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM, | 1324 | hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM, |
1342 | HPI_ISTREAM_GROUP_RESET); | 1325 | HPI_ISTREAM_GROUP_RESET); |
1343 | u32TOINDEXES(h_instream, &hm.adapter_index, &hm.obj_index); | 1326 | if (hpi_handle_indexes(h_instream, &hm.adapter_index, &hm.obj_index)) |
1327 | return HPI_ERROR_INVALID_HANDLE; | ||
1344 | hpi_send_recv(&hm, &hr); | 1328 | hpi_send_recv(&hm, &hr); |
1345 | return hr.error; | 1329 | return hr.error; |
1346 | } | 1330 | } |
1347 | 1331 | ||
1348 | u16 hpi_mixer_open(const struct hpi_hsubsys *ph_subsys, u16 adapter_index, | 1332 | u16 hpi_mixer_open(u16 adapter_index, u32 *ph_mixer) |
1349 | u32 *ph_mixer) | ||
1350 | { | 1333 | { |
1351 | struct hpi_message hm; | 1334 | struct hpi_message hm; |
1352 | struct hpi_response hr; | 1335 | struct hpi_response hr; |
@@ -1364,25 +1347,29 @@ u16 hpi_mixer_open(const struct hpi_hsubsys *ph_subsys, u16 adapter_index, | |||
1364 | return hr.error; | 1347 | return hr.error; |
1365 | } | 1348 | } |
1366 | 1349 | ||
1367 | u16 hpi_mixer_close(const struct hpi_hsubsys *ph_subsys, u32 h_mixer) | 1350 | u16 hpi_mixer_close(u32 h_mixer) |
1368 | { | 1351 | { |
1369 | struct hpi_message hm; | 1352 | struct hpi_message hm; |
1370 | struct hpi_response hr; | 1353 | struct hpi_response hr; |
1354 | |||
1371 | hpi_init_message_response(&hm, &hr, HPI_OBJ_MIXER, HPI_MIXER_CLOSE); | 1355 | hpi_init_message_response(&hm, &hr, HPI_OBJ_MIXER, HPI_MIXER_CLOSE); |
1372 | u32TOINDEX(h_mixer, &hm.adapter_index); | 1356 | if (hpi_handle_indexes(h_mixer, &hm.adapter_index, NULL)) |
1357 | return HPI_ERROR_INVALID_HANDLE; | ||
1358 | |||
1373 | hpi_send_recv(&hm, &hr); | 1359 | hpi_send_recv(&hm, &hr); |
1374 | return hr.error; | 1360 | return hr.error; |
1375 | } | 1361 | } |
1376 | 1362 | ||
1377 | u16 hpi_mixer_get_control(const struct hpi_hsubsys *ph_subsys, u32 h_mixer, | 1363 | u16 hpi_mixer_get_control(u32 h_mixer, u16 src_node_type, |
1378 | u16 src_node_type, u16 src_node_type_index, u16 dst_node_type, | 1364 | u16 src_node_type_index, u16 dst_node_type, u16 dst_node_type_index, |
1379 | u16 dst_node_type_index, u16 control_type, u32 *ph_control) | 1365 | u16 control_type, u32 *ph_control) |
1380 | { | 1366 | { |
1381 | struct hpi_message hm; | 1367 | struct hpi_message hm; |
1382 | struct hpi_response hr; | 1368 | struct hpi_response hr; |
1383 | hpi_init_message_response(&hm, &hr, HPI_OBJ_MIXER, | 1369 | hpi_init_message_response(&hm, &hr, HPI_OBJ_MIXER, |
1384 | HPI_MIXER_GET_CONTROL); | 1370 | HPI_MIXER_GET_CONTROL); |
1385 | u32TOINDEX(h_mixer, &hm.adapter_index); | 1371 | if (hpi_handle_indexes(h_mixer, &hm.adapter_index, NULL)) |
1372 | return HPI_ERROR_INVALID_HANDLE; | ||
1386 | hm.u.m.node_type1 = src_node_type; | 1373 | hm.u.m.node_type1 = src_node_type; |
1387 | hm.u.m.node_index1 = src_node_type_index; | 1374 | hm.u.m.node_index1 = src_node_type_index; |
1388 | hm.u.m.node_type2 = dst_node_type; | 1375 | hm.u.m.node_type2 = dst_node_type; |
@@ -1400,16 +1387,16 @@ u16 hpi_mixer_get_control(const struct hpi_hsubsys *ph_subsys, u32 h_mixer, | |||
1400 | return hr.error; | 1387 | return hr.error; |
1401 | } | 1388 | } |
1402 | 1389 | ||
1403 | u16 hpi_mixer_get_control_by_index(const struct hpi_hsubsys *ph_subsys, | 1390 | u16 hpi_mixer_get_control_by_index(u32 h_mixer, u16 control_index, |
1404 | u32 h_mixer, u16 control_index, u16 *pw_src_node_type, | 1391 | u16 *pw_src_node_type, u16 *pw_src_node_index, u16 *pw_dst_node_type, |
1405 | u16 *pw_src_node_index, u16 *pw_dst_node_type, u16 *pw_dst_node_index, | 1392 | u16 *pw_dst_node_index, u16 *pw_control_type, u32 *ph_control) |
1406 | u16 *pw_control_type, u32 *ph_control) | ||
1407 | { | 1393 | { |
1408 | struct hpi_message hm; | 1394 | struct hpi_message hm; |
1409 | struct hpi_response hr; | 1395 | struct hpi_response hr; |
1410 | hpi_init_message_response(&hm, &hr, HPI_OBJ_MIXER, | 1396 | hpi_init_message_response(&hm, &hr, HPI_OBJ_MIXER, |
1411 | HPI_MIXER_GET_CONTROL_BY_INDEX); | 1397 | HPI_MIXER_GET_CONTROL_BY_INDEX); |
1412 | u32TOINDEX(h_mixer, &hm.adapter_index); | 1398 | if (hpi_handle_indexes(h_mixer, &hm.adapter_index, NULL)) |
1399 | return HPI_ERROR_INVALID_HANDLE; | ||
1413 | hm.u.m.control_index = control_index; | 1400 | hm.u.m.control_index = control_index; |
1414 | hpi_send_recv(&hm, &hr); | 1401 | hpi_send_recv(&hm, &hr); |
1415 | 1402 | ||
@@ -1434,13 +1421,14 @@ u16 hpi_mixer_get_control_by_index(const struct hpi_hsubsys *ph_subsys, | |||
1434 | return hr.error; | 1421 | return hr.error; |
1435 | } | 1422 | } |
1436 | 1423 | ||
1437 | u16 hpi_mixer_store(const struct hpi_hsubsys *ph_subsys, u32 h_mixer, | 1424 | u16 hpi_mixer_store(u32 h_mixer, enum HPI_MIXER_STORE_COMMAND command, |
1438 | enum HPI_MIXER_STORE_COMMAND command, u16 index) | 1425 | u16 index) |
1439 | { | 1426 | { |
1440 | struct hpi_message hm; | 1427 | struct hpi_message hm; |
1441 | struct hpi_response hr; | 1428 | struct hpi_response hr; |
1442 | hpi_init_message_response(&hm, &hr, HPI_OBJ_MIXER, HPI_MIXER_STORE); | 1429 | hpi_init_message_response(&hm, &hr, HPI_OBJ_MIXER, HPI_MIXER_STORE); |
1443 | u32TOINDEX(h_mixer, &hm.adapter_index); | 1430 | if (hpi_handle_indexes(h_mixer, &hm.adapter_index, NULL)) |
1431 | return HPI_ERROR_INVALID_HANDLE; | ||
1444 | hm.u.mx.store.command = command; | 1432 | hm.u.mx.store.command = command; |
1445 | hm.u.mx.store.index = index; | 1433 | hm.u.mx.store.index = index; |
1446 | hpi_send_recv(&hm, &hr); | 1434 | hpi_send_recv(&hm, &hr); |
@@ -1448,16 +1436,16 @@ u16 hpi_mixer_store(const struct hpi_hsubsys *ph_subsys, u32 h_mixer, | |||
1448 | } | 1436 | } |
1449 | 1437 | ||
1450 | static | 1438 | static |
1451 | u16 hpi_control_param_set(const struct hpi_hsubsys *ph_subsys, | 1439 | u16 hpi_control_param_set(const u32 h_control, const u16 attrib, |
1452 | const u32 h_control, const u16 attrib, const u32 param1, | 1440 | const u32 param1, const u32 param2) |
1453 | const u32 param2) | ||
1454 | { | 1441 | { |
1455 | struct hpi_message hm; | 1442 | struct hpi_message hm; |
1456 | struct hpi_response hr; | 1443 | struct hpi_response hr; |
1457 | 1444 | ||
1458 | hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, | 1445 | hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, |
1459 | HPI_CONTROL_SET_STATE); | 1446 | HPI_CONTROL_SET_STATE); |
1460 | u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); | 1447 | if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index)) |
1448 | return HPI_ERROR_INVALID_HANDLE; | ||
1461 | hm.u.c.attribute = attrib; | 1449 | hm.u.c.attribute = attrib; |
1462 | hm.u.c.param1 = param1; | 1450 | hm.u.c.param1 = param1; |
1463 | hm.u.c.param2 = param2; | 1451 | hm.u.c.param2 = param2; |
@@ -1473,7 +1461,8 @@ static u16 hpi_control_log_set2(u32 h_control, u16 attrib, short sv0, | |||
1473 | 1461 | ||
1474 | hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, | 1462 | hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, |
1475 | HPI_CONTROL_SET_STATE); | 1463 | HPI_CONTROL_SET_STATE); |
1476 | u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); | 1464 | if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index)) |
1465 | return HPI_ERROR_INVALID_HANDLE; | ||
1477 | hm.u.c.attribute = attrib; | 1466 | hm.u.c.attribute = attrib; |
1478 | hm.u.c.an_log_value[0] = sv0; | 1467 | hm.u.c.an_log_value[0] = sv0; |
1479 | hm.u.c.an_log_value[1] = sv1; | 1468 | hm.u.c.an_log_value[1] = sv1; |
@@ -1482,16 +1471,16 @@ static u16 hpi_control_log_set2(u32 h_control, u16 attrib, short sv0, | |||
1482 | } | 1471 | } |
1483 | 1472 | ||
1484 | static | 1473 | static |
1485 | u16 hpi_control_param_get(const struct hpi_hsubsys *ph_subsys, | 1474 | u16 hpi_control_param_get(const u32 h_control, const u16 attrib, u32 param1, |
1486 | const u32 h_control, const u16 attrib, u32 param1, u32 param2, | 1475 | u32 param2, u32 *pparam1, u32 *pparam2) |
1487 | u32 *pparam1, u32 *pparam2) | ||
1488 | { | 1476 | { |
1489 | struct hpi_message hm; | 1477 | struct hpi_message hm; |
1490 | struct hpi_response hr; | 1478 | struct hpi_response hr; |
1491 | 1479 | ||
1492 | hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, | 1480 | hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, |
1493 | HPI_CONTROL_GET_STATE); | 1481 | HPI_CONTROL_GET_STATE); |
1494 | u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); | 1482 | if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index)) |
1483 | return HPI_ERROR_INVALID_HANDLE; | ||
1495 | hm.u.c.attribute = attrib; | 1484 | hm.u.c.attribute = attrib; |
1496 | hm.u.c.param1 = param1; | 1485 | hm.u.c.param1 = param1; |
1497 | hm.u.c.param2 = param2; | 1486 | hm.u.c.param2 = param2; |
@@ -1504,19 +1493,20 @@ u16 hpi_control_param_get(const struct hpi_hsubsys *ph_subsys, | |||
1504 | return hr.error; | 1493 | return hr.error; |
1505 | } | 1494 | } |
1506 | 1495 | ||
1507 | #define hpi_control_param1_get(s, h, a, p1) \ | 1496 | #define hpi_control_param1_get(h, a, p1) \ |
1508 | hpi_control_param_get(s, h, a, 0, 0, p1, NULL) | 1497 | hpi_control_param_get(h, a, 0, 0, p1, NULL) |
1509 | #define hpi_control_param2_get(s, h, a, p1, p2) \ | 1498 | #define hpi_control_param2_get(h, a, p1, p2) \ |
1510 | hpi_control_param_get(s, h, a, 0, 0, p1, p2) | 1499 | hpi_control_param_get(h, a, 0, 0, p1, p2) |
1511 | 1500 | ||
1512 | static u16 hpi_control_log_get2(const struct hpi_hsubsys *ph_subsys, | 1501 | static u16 hpi_control_log_get2(u32 h_control, u16 attrib, short *sv0, |
1513 | u32 h_control, u16 attrib, short *sv0, short *sv1) | 1502 | short *sv1) |
1514 | { | 1503 | { |
1515 | struct hpi_message hm; | 1504 | struct hpi_message hm; |
1516 | struct hpi_response hr; | 1505 | struct hpi_response hr; |
1517 | hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, | 1506 | hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, |
1518 | HPI_CONTROL_GET_STATE); | 1507 | HPI_CONTROL_GET_STATE); |
1519 | u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); | 1508 | if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index)) |
1509 | return HPI_ERROR_INVALID_HANDLE; | ||
1520 | hm.u.c.attribute = attrib; | 1510 | hm.u.c.attribute = attrib; |
1521 | 1511 | ||
1522 | hpi_send_recv(&hm, &hr); | 1512 | hpi_send_recv(&hm, &hr); |
@@ -1527,8 +1517,7 @@ static u16 hpi_control_log_get2(const struct hpi_hsubsys *ph_subsys, | |||
1527 | } | 1517 | } |
1528 | 1518 | ||
1529 | static | 1519 | static |
1530 | u16 hpi_control_query(const struct hpi_hsubsys *ph_subsys, | 1520 | u16 hpi_control_query(const u32 h_control, const u16 attrib, const u32 index, |
1531 | const u32 h_control, const u16 attrib, const u32 index, | ||
1532 | const u32 param, u32 *psetting) | 1521 | const u32 param, u32 *psetting) |
1533 | { | 1522 | { |
1534 | struct hpi_message hm; | 1523 | struct hpi_message hm; |
@@ -1536,7 +1525,8 @@ u16 hpi_control_query(const struct hpi_hsubsys *ph_subsys, | |||
1536 | 1525 | ||
1537 | hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, | 1526 | hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, |
1538 | HPI_CONTROL_GET_INFO); | 1527 | HPI_CONTROL_GET_INFO); |
1539 | u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); | 1528 | if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index)) |
1529 | return HPI_ERROR_INVALID_HANDLE; | ||
1540 | 1530 | ||
1541 | hm.u.c.attribute = attrib; | 1531 | hm.u.c.attribute = attrib; |
1542 | hm.u.c.param1 = index; | 1532 | hm.u.c.param1 = index; |
@@ -1565,7 +1555,9 @@ static u16 hpi_control_get_string(const u32 h_control, const u16 attribute, | |||
1565 | 1555 | ||
1566 | hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, | 1556 | hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, |
1567 | HPI_CONTROL_GET_STATE); | 1557 | HPI_CONTROL_GET_STATE); |
1568 | u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); | 1558 | if (hpi_handle_indexes(h_control, &hm.adapter_index, |
1559 | &hm.obj_index)) | ||
1560 | return HPI_ERROR_INVALID_HANDLE; | ||
1569 | hm.u.c.attribute = attribute; | 1561 | hm.u.c.attribute = attribute; |
1570 | hm.u.c.param1 = sub_string_index; | 1562 | hm.u.c.param1 = sub_string_index; |
1571 | hm.u.c.param2 = 0; | 1563 | hm.u.c.param2 = 0; |
@@ -1605,54 +1597,49 @@ static u16 hpi_control_get_string(const u32 h_control, const u16 attribute, | |||
1605 | return err; | 1597 | return err; |
1606 | } | 1598 | } |
1607 | 1599 | ||
1608 | u16 HPI_AESEBU__receiver_query_format(const struct hpi_hsubsys *ph_subsys, | 1600 | u16 hpi_aesebu_receiver_query_format(const u32 h_aes_rx, const u32 index, |
1609 | const u32 h_aes_rx, const u32 index, u16 *pw_format) | 1601 | u16 *pw_format) |
1610 | { | 1602 | { |
1611 | u32 qr; | 1603 | u32 qr; |
1612 | u16 err; | 1604 | u16 err; |
1613 | 1605 | ||
1614 | err = hpi_control_query(ph_subsys, h_aes_rx, HPI_AESEBURX_FORMAT, | 1606 | err = hpi_control_query(h_aes_rx, HPI_AESEBURX_FORMAT, index, 0, &qr); |
1615 | index, 0, &qr); | ||
1616 | *pw_format = (u16)qr; | 1607 | *pw_format = (u16)qr; |
1617 | return err; | 1608 | return err; |
1618 | } | 1609 | } |
1619 | 1610 | ||
1620 | u16 HPI_AESEBU__receiver_set_format(const struct hpi_hsubsys *ph_subsys, | 1611 | u16 hpi_aesebu_receiver_set_format(u32 h_control, u16 format) |
1621 | u32 h_control, u16 format) | ||
1622 | { | 1612 | { |
1623 | return hpi_control_param_set(ph_subsys, h_control, | 1613 | return hpi_control_param_set(h_control, HPI_AESEBURX_FORMAT, format, |
1624 | HPI_AESEBURX_FORMAT, format, 0); | 1614 | 0); |
1625 | } | 1615 | } |
1626 | 1616 | ||
1627 | u16 HPI_AESEBU__receiver_get_format(const struct hpi_hsubsys *ph_subsys, | 1617 | u16 hpi_aesebu_receiver_get_format(u32 h_control, u16 *pw_format) |
1628 | u32 h_control, u16 *pw_format) | ||
1629 | { | 1618 | { |
1630 | u16 err; | 1619 | u16 err; |
1631 | u32 param; | 1620 | u32 param; |
1632 | 1621 | ||
1633 | err = hpi_control_param1_get(ph_subsys, h_control, | 1622 | err = hpi_control_param1_get(h_control, HPI_AESEBURX_FORMAT, ¶m); |
1634 | HPI_AESEBURX_FORMAT, ¶m); | ||
1635 | if (!err && pw_format) | 1623 | if (!err && pw_format) |
1636 | *pw_format = (u16)param; | 1624 | *pw_format = (u16)param; |
1637 | 1625 | ||
1638 | return err; | 1626 | return err; |
1639 | } | 1627 | } |
1640 | 1628 | ||
1641 | u16 HPI_AESEBU__receiver_get_sample_rate(const struct hpi_hsubsys *ph_subsys, | 1629 | u16 hpi_aesebu_receiver_get_sample_rate(u32 h_control, u32 *psample_rate) |
1642 | u32 h_control, u32 *psample_rate) | ||
1643 | { | 1630 | { |
1644 | return hpi_control_param1_get(ph_subsys, h_control, | 1631 | return hpi_control_param1_get(h_control, HPI_AESEBURX_SAMPLERATE, |
1645 | HPI_AESEBURX_SAMPLERATE, psample_rate); | 1632 | psample_rate); |
1646 | } | 1633 | } |
1647 | 1634 | ||
1648 | u16 HPI_AESEBU__receiver_get_user_data(const struct hpi_hsubsys *ph_subsys, | 1635 | u16 hpi_aesebu_receiver_get_user_data(u32 h_control, u16 index, u16 *pw_data) |
1649 | u32 h_control, u16 index, u16 *pw_data) | ||
1650 | { | 1636 | { |
1651 | struct hpi_message hm; | 1637 | struct hpi_message hm; |
1652 | struct hpi_response hr; | 1638 | struct hpi_response hr; |
1653 | hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, | 1639 | hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, |
1654 | HPI_CONTROL_GET_STATE); | 1640 | HPI_CONTROL_GET_STATE); |
1655 | u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); | 1641 | if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index)) |
1642 | return HPI_ERROR_INVALID_HANDLE; | ||
1656 | hm.u.c.attribute = HPI_AESEBURX_USERDATA; | 1643 | hm.u.c.attribute = HPI_AESEBURX_USERDATA; |
1657 | hm.u.c.param1 = index; | 1644 | hm.u.c.param1 = index; |
1658 | 1645 | ||
@@ -1663,14 +1650,15 @@ u16 HPI_AESEBU__receiver_get_user_data(const struct hpi_hsubsys *ph_subsys, | |||
1663 | return hr.error; | 1650 | return hr.error; |
1664 | } | 1651 | } |
1665 | 1652 | ||
1666 | u16 HPI_AESEBU__receiver_get_channel_status(const struct hpi_hsubsys | 1653 | u16 hpi_aesebu_receiver_get_channel_status(u32 h_control, u16 index, |
1667 | *ph_subsys, u32 h_control, u16 index, u16 *pw_data) | 1654 | u16 *pw_data) |
1668 | { | 1655 | { |
1669 | struct hpi_message hm; | 1656 | struct hpi_message hm; |
1670 | struct hpi_response hr; | 1657 | struct hpi_response hr; |
1671 | hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, | 1658 | hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, |
1672 | HPI_CONTROL_GET_STATE); | 1659 | HPI_CONTROL_GET_STATE); |
1673 | u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); | 1660 | if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index)) |
1661 | return HPI_ERROR_INVALID_HANDLE; | ||
1674 | hm.u.c.attribute = HPI_AESEBURX_CHANNELSTATUS; | 1662 | hm.u.c.attribute = HPI_AESEBURX_CHANNELSTATUS; |
1675 | hm.u.c.param1 = index; | 1663 | hm.u.c.param1 = index; |
1676 | 1664 | ||
@@ -1681,101 +1669,93 @@ u16 HPI_AESEBU__receiver_get_channel_status(const struct hpi_hsubsys | |||
1681 | return hr.error; | 1669 | return hr.error; |
1682 | } | 1670 | } |
1683 | 1671 | ||
1684 | u16 HPI_AESEBU__receiver_get_error_status(const struct hpi_hsubsys *ph_subsys, | 1672 | u16 hpi_aesebu_receiver_get_error_status(u32 h_control, u16 *pw_error_data) |
1685 | u32 h_control, u16 *pw_error_data) | ||
1686 | { | 1673 | { |
1687 | u32 error_data = 0; | 1674 | u32 error_data = 0; |
1688 | u16 error = 0; | 1675 | u16 error = 0; |
1689 | 1676 | ||
1690 | error = hpi_control_param1_get(ph_subsys, h_control, | 1677 | error = hpi_control_param1_get(h_control, HPI_AESEBURX_ERRORSTATUS, |
1691 | HPI_AESEBURX_ERRORSTATUS, &error_data); | 1678 | &error_data); |
1692 | if (pw_error_data) | 1679 | if (pw_error_data) |
1693 | *pw_error_data = (u16)error_data; | 1680 | *pw_error_data = (u16)error_data; |
1694 | return error; | 1681 | return error; |
1695 | } | 1682 | } |
1696 | 1683 | ||
1697 | u16 HPI_AESEBU__transmitter_set_sample_rate(const struct hpi_hsubsys | 1684 | u16 hpi_aesebu_transmitter_set_sample_rate(u32 h_control, u32 sample_rate) |
1698 | *ph_subsys, u32 h_control, u32 sample_rate) | ||
1699 | { | 1685 | { |
1700 | return hpi_control_param_set(ph_subsys, h_control, | 1686 | return hpi_control_param_set(h_control, HPI_AESEBUTX_SAMPLERATE, |
1701 | HPI_AESEBUTX_SAMPLERATE, sample_rate, 0); | 1687 | sample_rate, 0); |
1702 | } | 1688 | } |
1703 | 1689 | ||
1704 | u16 HPI_AESEBU__transmitter_set_user_data(const struct hpi_hsubsys *ph_subsys, | 1690 | u16 hpi_aesebu_transmitter_set_user_data(u32 h_control, u16 index, u16 data) |
1705 | u32 h_control, u16 index, u16 data) | ||
1706 | { | 1691 | { |
1707 | return hpi_control_param_set(ph_subsys, h_control, | 1692 | return hpi_control_param_set(h_control, HPI_AESEBUTX_USERDATA, index, |
1708 | HPI_AESEBUTX_USERDATA, index, data); | 1693 | data); |
1709 | } | 1694 | } |
1710 | 1695 | ||
1711 | u16 HPI_AESEBU__transmitter_set_channel_status(const struct hpi_hsubsys | 1696 | u16 hpi_aesebu_transmitter_set_channel_status(u32 h_control, u16 index, |
1712 | *ph_subsys, u32 h_control, u16 index, u16 data) | 1697 | u16 data) |
1713 | { | 1698 | { |
1714 | return hpi_control_param_set(ph_subsys, h_control, | 1699 | return hpi_control_param_set(h_control, HPI_AESEBUTX_CHANNELSTATUS, |
1715 | HPI_AESEBUTX_CHANNELSTATUS, index, data); | 1700 | index, data); |
1716 | } | 1701 | } |
1717 | 1702 | ||
1718 | u16 HPI_AESEBU__transmitter_get_channel_status(const struct hpi_hsubsys | 1703 | u16 hpi_aesebu_transmitter_get_channel_status(u32 h_control, u16 index, |
1719 | *ph_subsys, u32 h_control, u16 index, u16 *pw_data) | 1704 | u16 *pw_data) |
1720 | { | 1705 | { |
1721 | return HPI_ERROR_INVALID_OPERATION; | 1706 | return HPI_ERROR_INVALID_OPERATION; |
1722 | } | 1707 | } |
1723 | 1708 | ||
1724 | u16 HPI_AESEBU__transmitter_query_format(const struct hpi_hsubsys *ph_subsys, | 1709 | u16 hpi_aesebu_transmitter_query_format(const u32 h_aes_tx, const u32 index, |
1725 | const u32 h_aes_tx, const u32 index, u16 *pw_format) | 1710 | u16 *pw_format) |
1726 | { | 1711 | { |
1727 | u32 qr; | 1712 | u32 qr; |
1728 | u16 err; | 1713 | u16 err; |
1729 | 1714 | ||
1730 | err = hpi_control_query(ph_subsys, h_aes_tx, HPI_AESEBUTX_FORMAT, | 1715 | err = hpi_control_query(h_aes_tx, HPI_AESEBUTX_FORMAT, index, 0, &qr); |
1731 | index, 0, &qr); | ||
1732 | *pw_format = (u16)qr; | 1716 | *pw_format = (u16)qr; |
1733 | return err; | 1717 | return err; |
1734 | } | 1718 | } |
1735 | 1719 | ||
1736 | u16 HPI_AESEBU__transmitter_set_format(const struct hpi_hsubsys *ph_subsys, | 1720 | u16 hpi_aesebu_transmitter_set_format(u32 h_control, u16 output_format) |
1737 | u32 h_control, u16 output_format) | ||
1738 | { | 1721 | { |
1739 | return hpi_control_param_set(ph_subsys, h_control, | 1722 | return hpi_control_param_set(h_control, HPI_AESEBUTX_FORMAT, |
1740 | HPI_AESEBUTX_FORMAT, output_format, 0); | 1723 | output_format, 0); |
1741 | } | 1724 | } |
1742 | 1725 | ||
1743 | u16 HPI_AESEBU__transmitter_get_format(const struct hpi_hsubsys *ph_subsys, | 1726 | u16 hpi_aesebu_transmitter_get_format(u32 h_control, u16 *pw_output_format) |
1744 | u32 h_control, u16 *pw_output_format) | ||
1745 | { | 1727 | { |
1746 | u16 err; | 1728 | u16 err; |
1747 | u32 param; | 1729 | u32 param; |
1748 | 1730 | ||
1749 | err = hpi_control_param1_get(ph_subsys, h_control, | 1731 | err = hpi_control_param1_get(h_control, HPI_AESEBUTX_FORMAT, ¶m); |
1750 | HPI_AESEBUTX_FORMAT, ¶m); | ||
1751 | if (!err && pw_output_format) | 1732 | if (!err && pw_output_format) |
1752 | *pw_output_format = (u16)param; | 1733 | *pw_output_format = (u16)param; |
1753 | 1734 | ||
1754 | return err; | 1735 | return err; |
1755 | } | 1736 | } |
1756 | 1737 | ||
1757 | u16 hpi_bitstream_set_clock_edge(const struct hpi_hsubsys *ph_subsys, | 1738 | u16 hpi_bitstream_set_clock_edge(u32 h_control, u16 edge_type) |
1758 | u32 h_control, u16 edge_type) | ||
1759 | { | 1739 | { |
1760 | return hpi_control_param_set(ph_subsys, h_control, | 1740 | return hpi_control_param_set(h_control, HPI_BITSTREAM_CLOCK_EDGE, |
1761 | HPI_BITSTREAM_CLOCK_EDGE, edge_type, 0); | 1741 | edge_type, 0); |
1762 | } | 1742 | } |
1763 | 1743 | ||
1764 | u16 hpi_bitstream_set_data_polarity(const struct hpi_hsubsys *ph_subsys, | 1744 | u16 hpi_bitstream_set_data_polarity(u32 h_control, u16 polarity) |
1765 | u32 h_control, u16 polarity) | ||
1766 | { | 1745 | { |
1767 | return hpi_control_param_set(ph_subsys, h_control, | 1746 | return hpi_control_param_set(h_control, HPI_BITSTREAM_DATA_POLARITY, |
1768 | HPI_BITSTREAM_DATA_POLARITY, polarity, 0); | 1747 | polarity, 0); |
1769 | } | 1748 | } |
1770 | 1749 | ||
1771 | u16 hpi_bitstream_get_activity(const struct hpi_hsubsys *ph_subsys, | 1750 | u16 hpi_bitstream_get_activity(u32 h_control, u16 *pw_clk_activity, |
1772 | u32 h_control, u16 *pw_clk_activity, u16 *pw_data_activity) | 1751 | u16 *pw_data_activity) |
1773 | { | 1752 | { |
1774 | struct hpi_message hm; | 1753 | struct hpi_message hm; |
1775 | struct hpi_response hr; | 1754 | struct hpi_response hr; |
1776 | hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, | 1755 | hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, |
1777 | HPI_CONTROL_GET_STATE); | 1756 | HPI_CONTROL_GET_STATE); |
1778 | u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); | 1757 | if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index)) |
1758 | return HPI_ERROR_INVALID_HANDLE; | ||
1779 | hm.u.c.attribute = HPI_BITSTREAM_ACTIVITY; | 1759 | hm.u.c.attribute = HPI_BITSTREAM_ACTIVITY; |
1780 | hpi_send_recv(&hm, &hr); | 1760 | hpi_send_recv(&hm, &hr); |
1781 | if (pw_clk_activity) | 1761 | if (pw_clk_activity) |
@@ -1785,45 +1765,43 @@ u16 hpi_bitstream_get_activity(const struct hpi_hsubsys *ph_subsys, | |||
1785 | return hr.error; | 1765 | return hr.error; |
1786 | } | 1766 | } |
1787 | 1767 | ||
1788 | u16 hpi_channel_mode_query_mode(const struct hpi_hsubsys *ph_subsys, | 1768 | u16 hpi_channel_mode_query_mode(const u32 h_mode, const u32 index, |
1789 | const u32 h_mode, const u32 index, u16 *pw_mode) | 1769 | u16 *pw_mode) |
1790 | { | 1770 | { |
1791 | u32 qr; | 1771 | u32 qr; |
1792 | u16 err; | 1772 | u16 err; |
1793 | 1773 | ||
1794 | err = hpi_control_query(ph_subsys, h_mode, HPI_CHANNEL_MODE_MODE, | 1774 | err = hpi_control_query(h_mode, HPI_CHANNEL_MODE_MODE, index, 0, &qr); |
1795 | index, 0, &qr); | ||
1796 | *pw_mode = (u16)qr; | 1775 | *pw_mode = (u16)qr; |
1797 | return err; | 1776 | return err; |
1798 | } | 1777 | } |
1799 | 1778 | ||
1800 | u16 hpi_channel_mode_set(const struct hpi_hsubsys *ph_subsys, u32 h_control, | 1779 | u16 hpi_channel_mode_set(u32 h_control, u16 mode) |
1801 | u16 mode) | ||
1802 | { | 1780 | { |
1803 | return hpi_control_param_set(ph_subsys, h_control, | 1781 | return hpi_control_param_set(h_control, HPI_CHANNEL_MODE_MODE, mode, |
1804 | HPI_CHANNEL_MODE_MODE, mode, 0); | 1782 | 0); |
1805 | } | 1783 | } |
1806 | 1784 | ||
1807 | u16 hpi_channel_mode_get(const struct hpi_hsubsys *ph_subsys, u32 h_control, | 1785 | u16 hpi_channel_mode_get(u32 h_control, u16 *mode) |
1808 | u16 *mode) | ||
1809 | { | 1786 | { |
1810 | u32 mode32 = 0; | 1787 | u32 mode32 = 0; |
1811 | u16 error = hpi_control_param1_get(ph_subsys, h_control, | 1788 | u16 error = hpi_control_param1_get(h_control, |
1812 | HPI_CHANNEL_MODE_MODE, &mode32); | 1789 | HPI_CHANNEL_MODE_MODE, &mode32); |
1813 | if (mode) | 1790 | if (mode) |
1814 | *mode = (u16)mode32; | 1791 | *mode = (u16)mode32; |
1815 | return error; | 1792 | return error; |
1816 | } | 1793 | } |
1817 | 1794 | ||
1818 | u16 hpi_cobranet_hmi_write(const struct hpi_hsubsys *ph_subsys, u32 h_control, | 1795 | u16 hpi_cobranet_hmi_write(u32 h_control, u32 hmi_address, u32 byte_count, |
1819 | u32 hmi_address, u32 byte_count, u8 *pb_data) | 1796 | u8 *pb_data) |
1820 | { | 1797 | { |
1821 | struct hpi_message hm; | 1798 | struct hpi_message hm; |
1822 | struct hpi_response hr; | 1799 | struct hpi_response hr; |
1823 | 1800 | ||
1824 | hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROLEX, | 1801 | hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROLEX, |
1825 | HPI_CONTROL_SET_STATE); | 1802 | HPI_CONTROL_SET_STATE); |
1826 | u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); | 1803 | if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index)) |
1804 | return HPI_ERROR_INVALID_HANDLE; | ||
1827 | 1805 | ||
1828 | hm.u.cx.u.cobranet_data.byte_count = byte_count; | 1806 | hm.u.cx.u.cobranet_data.byte_count = byte_count; |
1829 | hm.u.cx.u.cobranet_data.hmi_address = hmi_address; | 1807 | hm.u.cx.u.cobranet_data.hmi_address = hmi_address; |
@@ -1841,15 +1819,16 @@ u16 hpi_cobranet_hmi_write(const struct hpi_hsubsys *ph_subsys, u32 h_control, | |||
1841 | return hr.error; | 1819 | return hr.error; |
1842 | } | 1820 | } |
1843 | 1821 | ||
1844 | u16 hpi_cobranet_hmi_read(const struct hpi_hsubsys *ph_subsys, u32 h_control, | 1822 | u16 hpi_cobranet_hmi_read(u32 h_control, u32 hmi_address, u32 max_byte_count, |
1845 | u32 hmi_address, u32 max_byte_count, u32 *pbyte_count, u8 *pb_data) | 1823 | u32 *pbyte_count, u8 *pb_data) |
1846 | { | 1824 | { |
1847 | struct hpi_message hm; | 1825 | struct hpi_message hm; |
1848 | struct hpi_response hr; | 1826 | struct hpi_response hr; |
1849 | 1827 | ||
1850 | hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROLEX, | 1828 | hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROLEX, |
1851 | HPI_CONTROL_GET_STATE); | 1829 | HPI_CONTROL_GET_STATE); |
1852 | u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); | 1830 | if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index)) |
1831 | return HPI_ERROR_INVALID_HANDLE; | ||
1853 | 1832 | ||
1854 | hm.u.cx.u.cobranet_data.byte_count = max_byte_count; | 1833 | hm.u.cx.u.cobranet_data.byte_count = max_byte_count; |
1855 | hm.u.cx.u.cobranet_data.hmi_address = hmi_address; | 1834 | hm.u.cx.u.cobranet_data.hmi_address = hmi_address; |
@@ -1880,16 +1859,16 @@ u16 hpi_cobranet_hmi_read(const struct hpi_hsubsys *ph_subsys, u32 h_control, | |||
1880 | return hr.error; | 1859 | return hr.error; |
1881 | } | 1860 | } |
1882 | 1861 | ||
1883 | u16 hpi_cobranet_hmi_get_status(const struct hpi_hsubsys *ph_subsys, | 1862 | u16 hpi_cobranet_hmi_get_status(u32 h_control, u32 *pstatus, |
1884 | u32 h_control, u32 *pstatus, u32 *preadable_size, | 1863 | u32 *preadable_size, u32 *pwriteable_size) |
1885 | u32 *pwriteable_size) | ||
1886 | { | 1864 | { |
1887 | struct hpi_message hm; | 1865 | struct hpi_message hm; |
1888 | struct hpi_response hr; | 1866 | struct hpi_response hr; |
1889 | 1867 | ||
1890 | hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROLEX, | 1868 | hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROLEX, |
1891 | HPI_CONTROL_GET_STATE); | 1869 | HPI_CONTROL_GET_STATE); |
1892 | u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); | 1870 | if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index)) |
1871 | return HPI_ERROR_INVALID_HANDLE; | ||
1893 | 1872 | ||
1894 | hm.u.cx.attribute = HPI_COBRANET_GET_STATUS; | 1873 | hm.u.cx.attribute = HPI_COBRANET_GET_STATUS; |
1895 | 1874 | ||
@@ -1907,97 +1886,93 @@ u16 hpi_cobranet_hmi_get_status(const struct hpi_hsubsys *ph_subsys, | |||
1907 | return hr.error; | 1886 | return hr.error; |
1908 | } | 1887 | } |
1909 | 1888 | ||
1910 | u16 hpi_cobranet_getI_paddress(const struct hpi_hsubsys *ph_subsys, | 1889 | u16 hpi_cobranet_get_ip_address(u32 h_control, u32 *pdw_ip_address) |
1911 | u32 h_control, u32 *pi_paddress) | ||
1912 | { | 1890 | { |
1913 | u32 byte_count; | 1891 | u32 byte_count; |
1914 | u32 iP; | 1892 | u32 iP; |
1915 | u16 error; | 1893 | u16 error; |
1916 | 1894 | ||
1917 | error = hpi_cobranet_hmi_read(ph_subsys, h_control, | 1895 | error = hpi_cobranet_hmi_read(h_control, |
1918 | HPI_COBRANET_HMI_cobra_ip_mon_currentIP, 4, &byte_count, | 1896 | HPI_COBRANET_HMI_cobra_ip_mon_currentIP, 4, &byte_count, |
1919 | (u8 *)&iP); | 1897 | (u8 *)&iP); |
1920 | 1898 | ||
1921 | *pi_paddress = | 1899 | *pdw_ip_address = |
1922 | ((iP & 0xff000000) >> 8) | ((iP & 0x00ff0000) << 8) | ((iP & | 1900 | ((iP & 0xff000000) >> 8) | ((iP & 0x00ff0000) << 8) | ((iP & |
1923 | 0x0000ff00) >> 8) | ((iP & 0x000000ff) << 8); | 1901 | 0x0000ff00) >> 8) | ((iP & 0x000000ff) << 8); |
1924 | 1902 | ||
1925 | if (error) | 1903 | if (error) |
1926 | *pi_paddress = 0; | 1904 | *pdw_ip_address = 0; |
1927 | 1905 | ||
1928 | return error; | 1906 | return error; |
1929 | 1907 | ||
1930 | } | 1908 | } |
1931 | 1909 | ||
1932 | u16 hpi_cobranet_setI_paddress(const struct hpi_hsubsys *ph_subsys, | 1910 | u16 hpi_cobranet_set_ip_address(u32 h_control, u32 dw_ip_address) |
1933 | u32 h_control, u32 i_paddress) | ||
1934 | { | 1911 | { |
1935 | u32 iP; | 1912 | u32 iP; |
1936 | u16 error; | 1913 | u16 error; |
1937 | 1914 | ||
1938 | iP = ((i_paddress & 0xff000000) >> 8) | ((i_paddress & 0x00ff0000) << | 1915 | iP = ((dw_ip_address & 0xff000000) >> 8) | ((dw_ip_address & |
1939 | 8) | ((i_paddress & 0x0000ff00) >> 8) | ((i_paddress & | 1916 | 0x00ff0000) << 8) | ((dw_ip_address & 0x0000ff00) >> |
1940 | 0x000000ff) << 8); | 1917 | 8) | ((dw_ip_address & 0x000000ff) << 8); |
1941 | 1918 | ||
1942 | error = hpi_cobranet_hmi_write(ph_subsys, h_control, | 1919 | error = hpi_cobranet_hmi_write(h_control, |
1943 | HPI_COBRANET_HMI_cobra_ip_mon_currentIP, 4, (u8 *)&iP); | 1920 | HPI_COBRANET_HMI_cobra_ip_mon_currentIP, 4, (u8 *)&iP); |
1944 | 1921 | ||
1945 | return error; | 1922 | return error; |
1946 | 1923 | ||
1947 | } | 1924 | } |
1948 | 1925 | ||
1949 | u16 hpi_cobranet_get_staticI_paddress(const struct hpi_hsubsys *ph_subsys, | 1926 | u16 hpi_cobranet_get_static_ip_address(u32 h_control, u32 *pdw_ip_address) |
1950 | u32 h_control, u32 *pi_paddress) | ||
1951 | { | 1927 | { |
1952 | u32 byte_count; | 1928 | u32 byte_count; |
1953 | u32 iP; | 1929 | u32 iP; |
1954 | u16 error; | 1930 | u16 error; |
1955 | error = hpi_cobranet_hmi_read(ph_subsys, h_control, | 1931 | error = hpi_cobranet_hmi_read(h_control, |
1956 | HPI_COBRANET_HMI_cobra_ip_mon_staticIP, 4, &byte_count, | 1932 | HPI_COBRANET_HMI_cobra_ip_mon_staticIP, 4, &byte_count, |
1957 | (u8 *)&iP); | 1933 | (u8 *)&iP); |
1958 | 1934 | ||
1959 | *pi_paddress = | 1935 | *pdw_ip_address = |
1960 | ((iP & 0xff000000) >> 8) | ((iP & 0x00ff0000) << 8) | ((iP & | 1936 | ((iP & 0xff000000) >> 8) | ((iP & 0x00ff0000) << 8) | ((iP & |
1961 | 0x0000ff00) >> 8) | ((iP & 0x000000ff) << 8); | 1937 | 0x0000ff00) >> 8) | ((iP & 0x000000ff) << 8); |
1962 | 1938 | ||
1963 | if (error) | 1939 | if (error) |
1964 | *pi_paddress = 0; | 1940 | *pdw_ip_address = 0; |
1965 | 1941 | ||
1966 | return error; | 1942 | return error; |
1967 | 1943 | ||
1968 | } | 1944 | } |
1969 | 1945 | ||
1970 | u16 hpi_cobranet_set_staticI_paddress(const struct hpi_hsubsys *ph_subsys, | 1946 | u16 hpi_cobranet_set_static_ip_address(u32 h_control, u32 dw_ip_address) |
1971 | u32 h_control, u32 i_paddress) | ||
1972 | { | 1947 | { |
1973 | u32 iP; | 1948 | u32 iP; |
1974 | u16 error; | 1949 | u16 error; |
1975 | 1950 | ||
1976 | iP = ((i_paddress & 0xff000000) >> 8) | ((i_paddress & 0x00ff0000) << | 1951 | iP = ((dw_ip_address & 0xff000000) >> 8) | ((dw_ip_address & |
1977 | 8) | ((i_paddress & 0x0000ff00) >> 8) | ((i_paddress & | 1952 | 0x00ff0000) << 8) | ((dw_ip_address & 0x0000ff00) >> |
1978 | 0x000000ff) << 8); | 1953 | 8) | ((dw_ip_address & 0x000000ff) << 8); |
1979 | 1954 | ||
1980 | error = hpi_cobranet_hmi_write(ph_subsys, h_control, | 1955 | error = hpi_cobranet_hmi_write(h_control, |
1981 | HPI_COBRANET_HMI_cobra_ip_mon_staticIP, 4, (u8 *)&iP); | 1956 | HPI_COBRANET_HMI_cobra_ip_mon_staticIP, 4, (u8 *)&iP); |
1982 | 1957 | ||
1983 | return error; | 1958 | return error; |
1984 | 1959 | ||
1985 | } | 1960 | } |
1986 | 1961 | ||
1987 | u16 hpi_cobranet_getMA_caddress(const struct hpi_hsubsys *ph_subsys, | 1962 | u16 hpi_cobranet_get_macaddress(u32 h_control, u32 *pmAC_MS_bs, |
1988 | u32 h_control, u32 *pmAC_MS_bs, u32 *pmAC_LS_bs) | 1963 | u32 *pmAC_LS_bs) |
1989 | { | 1964 | { |
1990 | u32 byte_count; | 1965 | u32 byte_count; |
1991 | u16 error; | 1966 | u16 error; |
1992 | u32 mAC; | 1967 | u32 mAC; |
1993 | 1968 | ||
1994 | error = hpi_cobranet_hmi_read(ph_subsys, h_control, | 1969 | error = hpi_cobranet_hmi_read(h_control, |
1995 | HPI_COBRANET_HMI_cobra_if_phy_address, 4, &byte_count, | 1970 | HPI_COBRANET_HMI_cobra_if_phy_address, 4, &byte_count, |
1996 | (u8 *)&mAC); | 1971 | (u8 *)&mAC); |
1997 | *pmAC_MS_bs = | 1972 | *pmAC_MS_bs = |
1998 | ((mAC & 0xff000000) >> 8) | ((mAC & 0x00ff0000) << 8) | ((mAC | 1973 | ((mAC & 0xff000000) >> 8) | ((mAC & 0x00ff0000) << 8) | ((mAC |
1999 | & 0x0000ff00) >> 8) | ((mAC & 0x000000ff) << 8); | 1974 | & 0x0000ff00) >> 8) | ((mAC & 0x000000ff) << 8); |
2000 | error += hpi_cobranet_hmi_read(ph_subsys, h_control, | 1975 | error += hpi_cobranet_hmi_read(h_control, |
2001 | HPI_COBRANET_HMI_cobra_if_phy_address + 1, 4, &byte_count, | 1976 | HPI_COBRANET_HMI_cobra_if_phy_address + 1, 4, &byte_count, |
2002 | (u8 *)&mAC); | 1977 | (u8 *)&mAC); |
2003 | *pmAC_LS_bs = | 1978 | *pmAC_LS_bs = |
@@ -2012,72 +1987,68 @@ u16 hpi_cobranet_getMA_caddress(const struct hpi_hsubsys *ph_subsys, | |||
2012 | return error; | 1987 | return error; |
2013 | } | 1988 | } |
2014 | 1989 | ||
2015 | u16 hpi_compander_set_enable(const struct hpi_hsubsys *ph_subsys, | 1990 | u16 hpi_compander_set_enable(u32 h_control, u32 enable) |
2016 | u32 h_control, u32 enable) | ||
2017 | { | 1991 | { |
2018 | return hpi_control_param_set(ph_subsys, h_control, HPI_GENERIC_ENABLE, | 1992 | return hpi_control_param_set(h_control, HPI_GENERIC_ENABLE, enable, |
2019 | enable, 0); | 1993 | 0); |
2020 | } | 1994 | } |
2021 | 1995 | ||
2022 | u16 hpi_compander_get_enable(const struct hpi_hsubsys *ph_subsys, | 1996 | u16 hpi_compander_get_enable(u32 h_control, u32 *enable) |
2023 | u32 h_control, u32 *enable) | ||
2024 | { | 1997 | { |
2025 | return hpi_control_param1_get(ph_subsys, h_control, | 1998 | return hpi_control_param1_get(h_control, HPI_GENERIC_ENABLE, enable); |
2026 | HPI_GENERIC_ENABLE, enable); | ||
2027 | } | 1999 | } |
2028 | 2000 | ||
2029 | u16 hpi_compander_set_makeup_gain(const struct hpi_hsubsys *ph_subsys, | 2001 | u16 hpi_compander_set_makeup_gain(u32 h_control, short makeup_gain0_01dB) |
2030 | u32 h_control, short makeup_gain0_01dB) | ||
2031 | { | 2002 | { |
2032 | return hpi_control_log_set2(h_control, HPI_COMPANDER_MAKEUPGAIN, | 2003 | return hpi_control_log_set2(h_control, HPI_COMPANDER_MAKEUPGAIN, |
2033 | makeup_gain0_01dB, 0); | 2004 | makeup_gain0_01dB, 0); |
2034 | } | 2005 | } |
2035 | 2006 | ||
2036 | u16 hpi_compander_get_makeup_gain(const struct hpi_hsubsys *ph_subsys, | 2007 | u16 hpi_compander_get_makeup_gain(u32 h_control, short *makeup_gain0_01dB) |
2037 | u32 h_control, short *makeup_gain0_01dB) | ||
2038 | { | 2008 | { |
2039 | return hpi_control_log_get2(ph_subsys, h_control, | 2009 | return hpi_control_log_get2(h_control, HPI_COMPANDER_MAKEUPGAIN, |
2040 | HPI_COMPANDER_MAKEUPGAIN, makeup_gain0_01dB, NULL); | 2010 | makeup_gain0_01dB, NULL); |
2041 | } | 2011 | } |
2042 | 2012 | ||
2043 | u16 hpi_compander_set_attack_time_constant(const struct hpi_hsubsys | 2013 | u16 hpi_compander_set_attack_time_constant(u32 h_control, unsigned int index, |
2044 | *ph_subsys, u32 h_control, unsigned int index, u32 attack) | 2014 | u32 attack) |
2045 | { | 2015 | { |
2046 | return hpi_control_param_set(ph_subsys, h_control, | 2016 | return hpi_control_param_set(h_control, HPI_COMPANDER_ATTACK, attack, |
2047 | HPI_COMPANDER_ATTACK, attack, index); | 2017 | index); |
2048 | } | 2018 | } |
2049 | 2019 | ||
2050 | u16 hpi_compander_get_attack_time_constant(const struct hpi_hsubsys | 2020 | u16 hpi_compander_get_attack_time_constant(u32 h_control, unsigned int index, |
2051 | *ph_subsys, u32 h_control, unsigned int index, u32 *attack) | 2021 | u32 *attack) |
2052 | { | 2022 | { |
2053 | return hpi_control_param_get(ph_subsys, h_control, | 2023 | return hpi_control_param_get(h_control, HPI_COMPANDER_ATTACK, 0, |
2054 | HPI_COMPANDER_ATTACK, 0, index, attack, NULL); | 2024 | index, attack, NULL); |
2055 | } | 2025 | } |
2056 | 2026 | ||
2057 | u16 hpi_compander_set_decay_time_constant(const struct hpi_hsubsys *ph_subsys, | 2027 | u16 hpi_compander_set_decay_time_constant(u32 h_control, unsigned int index, |
2058 | u32 h_control, unsigned int index, u32 decay) | 2028 | u32 decay) |
2059 | { | 2029 | { |
2060 | return hpi_control_param_set(ph_subsys, h_control, | 2030 | return hpi_control_param_set(h_control, HPI_COMPANDER_DECAY, decay, |
2061 | HPI_COMPANDER_DECAY, decay, index); | 2031 | index); |
2062 | } | 2032 | } |
2063 | 2033 | ||
2064 | u16 hpi_compander_get_decay_time_constant(const struct hpi_hsubsys *ph_subsys, | 2034 | u16 hpi_compander_get_decay_time_constant(u32 h_control, unsigned int index, |
2065 | u32 h_control, unsigned int index, u32 *decay) | 2035 | u32 *decay) |
2066 | { | 2036 | { |
2067 | return hpi_control_param_get(ph_subsys, h_control, | 2037 | return hpi_control_param_get(h_control, HPI_COMPANDER_DECAY, 0, index, |
2068 | HPI_COMPANDER_DECAY, 0, index, decay, NULL); | 2038 | decay, NULL); |
2069 | 2039 | ||
2070 | } | 2040 | } |
2071 | 2041 | ||
2072 | u16 hpi_compander_set_threshold(const struct hpi_hsubsys *ph_subsys, | 2042 | u16 hpi_compander_set_threshold(u32 h_control, unsigned int index, |
2073 | u32 h_control, unsigned int index, short threshold0_01dB) | 2043 | short threshold0_01dB) |
2074 | { | 2044 | { |
2075 | struct hpi_message hm; | 2045 | struct hpi_message hm; |
2076 | struct hpi_response hr; | 2046 | struct hpi_response hr; |
2077 | 2047 | ||
2078 | hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, | 2048 | hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, |
2079 | HPI_CONTROL_SET_STATE); | 2049 | HPI_CONTROL_SET_STATE); |
2080 | u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); | 2050 | if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index)) |
2051 | return HPI_ERROR_INVALID_HANDLE; | ||
2081 | hm.u.c.attribute = HPI_COMPANDER_THRESHOLD; | 2052 | hm.u.c.attribute = HPI_COMPANDER_THRESHOLD; |
2082 | hm.u.c.param2 = index; | 2053 | hm.u.c.param2 = index; |
2083 | hm.u.c.an_log_value[0] = threshold0_01dB; | 2054 | hm.u.c.an_log_value[0] = threshold0_01dB; |
@@ -2087,15 +2058,16 @@ u16 hpi_compander_set_threshold(const struct hpi_hsubsys *ph_subsys, | |||
2087 | return hr.error; | 2058 | return hr.error; |
2088 | } | 2059 | } |
2089 | 2060 | ||
2090 | u16 hpi_compander_get_threshold(const struct hpi_hsubsys *ph_subsys, | 2061 | u16 hpi_compander_get_threshold(u32 h_control, unsigned int index, |
2091 | u32 h_control, unsigned int index, short *threshold0_01dB) | 2062 | short *threshold0_01dB) |
2092 | { | 2063 | { |
2093 | struct hpi_message hm; | 2064 | struct hpi_message hm; |
2094 | struct hpi_response hr; | 2065 | struct hpi_response hr; |
2095 | 2066 | ||
2096 | hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, | 2067 | hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, |
2097 | HPI_CONTROL_GET_STATE); | 2068 | HPI_CONTROL_GET_STATE); |
2098 | u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); | 2069 | if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index)) |
2070 | return HPI_ERROR_INVALID_HANDLE; | ||
2099 | hm.u.c.attribute = HPI_COMPANDER_THRESHOLD; | 2071 | hm.u.c.attribute = HPI_COMPANDER_THRESHOLD; |
2100 | hm.u.c.param2 = index; | 2072 | hm.u.c.param2 = index; |
2101 | 2073 | ||
@@ -2105,29 +2077,28 @@ u16 hpi_compander_get_threshold(const struct hpi_hsubsys *ph_subsys, | |||
2105 | return hr.error; | 2077 | return hr.error; |
2106 | } | 2078 | } |
2107 | 2079 | ||
2108 | u16 hpi_compander_set_ratio(const struct hpi_hsubsys *ph_subsys, | 2080 | u16 hpi_compander_set_ratio(u32 h_control, u32 index, u32 ratio100) |
2109 | u32 h_control, u32 index, u32 ratio100) | ||
2110 | { | 2081 | { |
2111 | return hpi_control_param_set(ph_subsys, h_control, | 2082 | return hpi_control_param_set(h_control, HPI_COMPANDER_RATIO, ratio100, |
2112 | HPI_COMPANDER_RATIO, ratio100, index); | 2083 | index); |
2113 | } | 2084 | } |
2114 | 2085 | ||
2115 | u16 hpi_compander_get_ratio(const struct hpi_hsubsys *ph_subsys, | 2086 | u16 hpi_compander_get_ratio(u32 h_control, u32 index, u32 *ratio100) |
2116 | u32 h_control, u32 index, u32 *ratio100) | ||
2117 | { | 2087 | { |
2118 | return hpi_control_param_get(ph_subsys, h_control, | 2088 | return hpi_control_param_get(h_control, HPI_COMPANDER_RATIO, 0, index, |
2119 | HPI_COMPANDER_RATIO, 0, index, ratio100, NULL); | 2089 | ratio100, NULL); |
2120 | } | 2090 | } |
2121 | 2091 | ||
2122 | u16 hpi_level_query_range(const struct hpi_hsubsys *ph_subsys, u32 h_control, | 2092 | u16 hpi_level_query_range(u32 h_control, short *min_gain_01dB, |
2123 | short *min_gain_01dB, short *max_gain_01dB, short *step_gain_01dB) | 2093 | short *max_gain_01dB, short *step_gain_01dB) |
2124 | { | 2094 | { |
2125 | struct hpi_message hm; | 2095 | struct hpi_message hm; |
2126 | struct hpi_response hr; | 2096 | struct hpi_response hr; |
2127 | 2097 | ||
2128 | hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, | 2098 | hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, |
2129 | HPI_CONTROL_GET_STATE); | 2099 | HPI_CONTROL_GET_STATE); |
2130 | u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); | 2100 | if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index)) |
2101 | return HPI_ERROR_INVALID_HANDLE; | ||
2131 | hm.u.c.attribute = HPI_LEVEL_RANGE; | 2102 | hm.u.c.attribute = HPI_LEVEL_RANGE; |
2132 | 2103 | ||
2133 | hpi_send_recv(&hm, &hr); | 2104 | hpi_send_recv(&hm, &hr); |
@@ -2145,31 +2116,27 @@ u16 hpi_level_query_range(const struct hpi_hsubsys *ph_subsys, u32 h_control, | |||
2145 | return hr.error; | 2116 | return hr.error; |
2146 | } | 2117 | } |
2147 | 2118 | ||
2148 | u16 hpi_level_set_gain(const struct hpi_hsubsys *ph_subsys, u32 h_control, | 2119 | u16 hpi_level_set_gain(u32 h_control, short an_gain0_01dB[HPI_MAX_CHANNELS] |
2149 | short an_gain0_01dB[HPI_MAX_CHANNELS] | ||
2150 | ) | 2120 | ) |
2151 | { | 2121 | { |
2152 | return hpi_control_log_set2(h_control, HPI_LEVEL_GAIN, | 2122 | return hpi_control_log_set2(h_control, HPI_LEVEL_GAIN, |
2153 | an_gain0_01dB[0], an_gain0_01dB[1]); | 2123 | an_gain0_01dB[0], an_gain0_01dB[1]); |
2154 | } | 2124 | } |
2155 | 2125 | ||
2156 | u16 hpi_level_get_gain(const struct hpi_hsubsys *ph_subsys, u32 h_control, | 2126 | u16 hpi_level_get_gain(u32 h_control, short an_gain0_01dB[HPI_MAX_CHANNELS] |
2157 | short an_gain0_01dB[HPI_MAX_CHANNELS] | ||
2158 | ) | 2127 | ) |
2159 | { | 2128 | { |
2160 | return hpi_control_log_get2(ph_subsys, h_control, HPI_LEVEL_GAIN, | 2129 | return hpi_control_log_get2(h_control, HPI_LEVEL_GAIN, |
2161 | &an_gain0_01dB[0], &an_gain0_01dB[1]); | 2130 | &an_gain0_01dB[0], &an_gain0_01dB[1]); |
2162 | } | 2131 | } |
2163 | 2132 | ||
2164 | u16 hpi_meter_query_channels(const struct hpi_hsubsys *ph_subsys, | 2133 | u16 hpi_meter_query_channels(const u32 h_meter, u32 *p_channels) |
2165 | const u32 h_meter, u32 *p_channels) | ||
2166 | { | 2134 | { |
2167 | return hpi_control_query(ph_subsys, h_meter, HPI_METER_NUM_CHANNELS, | 2135 | return hpi_control_query(h_meter, HPI_METER_NUM_CHANNELS, 0, 0, |
2168 | 0, 0, p_channels); | 2136 | p_channels); |
2169 | } | 2137 | } |
2170 | 2138 | ||
2171 | u16 hpi_meter_get_peak(const struct hpi_hsubsys *ph_subsys, u32 h_control, | 2139 | u16 hpi_meter_get_peak(u32 h_control, short an_peakdB[HPI_MAX_CHANNELS] |
2172 | short an_peakdB[HPI_MAX_CHANNELS] | ||
2173 | ) | 2140 | ) |
2174 | { | 2141 | { |
2175 | short i = 0; | 2142 | short i = 0; |
@@ -2179,7 +2146,8 @@ u16 hpi_meter_get_peak(const struct hpi_hsubsys *ph_subsys, u32 h_control, | |||
2179 | 2146 | ||
2180 | hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, | 2147 | hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, |
2181 | HPI_CONTROL_GET_STATE); | 2148 | HPI_CONTROL_GET_STATE); |
2182 | u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); | 2149 | if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index)) |
2150 | return HPI_ERROR_INVALID_HANDLE; | ||
2183 | hm.obj_index = hm.obj_index; | 2151 | hm.obj_index = hm.obj_index; |
2184 | hm.u.c.attribute = HPI_METER_PEAK; | 2152 | hm.u.c.attribute = HPI_METER_PEAK; |
2185 | 2153 | ||
@@ -2194,8 +2162,7 @@ u16 hpi_meter_get_peak(const struct hpi_hsubsys *ph_subsys, u32 h_control, | |||
2194 | return hr.error; | 2162 | return hr.error; |
2195 | } | 2163 | } |
2196 | 2164 | ||
2197 | u16 hpi_meter_get_rms(const struct hpi_hsubsys *ph_subsys, u32 h_control, | 2165 | u16 hpi_meter_get_rms(u32 h_control, short an_rmsdB[HPI_MAX_CHANNELS] |
2198 | short an_rmsdB[HPI_MAX_CHANNELS] | ||
2199 | ) | 2166 | ) |
2200 | { | 2167 | { |
2201 | short i = 0; | 2168 | short i = 0; |
@@ -2205,7 +2172,8 @@ u16 hpi_meter_get_rms(const struct hpi_hsubsys *ph_subsys, u32 h_control, | |||
2205 | 2172 | ||
2206 | hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, | 2173 | hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, |
2207 | HPI_CONTROL_GET_STATE); | 2174 | HPI_CONTROL_GET_STATE); |
2208 | u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); | 2175 | if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index)) |
2176 | return HPI_ERROR_INVALID_HANDLE; | ||
2209 | hm.u.c.attribute = HPI_METER_RMS; | 2177 | hm.u.c.attribute = HPI_METER_RMS; |
2210 | 2178 | ||
2211 | hpi_send_recv(&hm, &hr); | 2179 | hpi_send_recv(&hm, &hr); |
@@ -2220,22 +2188,20 @@ u16 hpi_meter_get_rms(const struct hpi_hsubsys *ph_subsys, u32 h_control, | |||
2220 | return hr.error; | 2188 | return hr.error; |
2221 | } | 2189 | } |
2222 | 2190 | ||
2223 | u16 hpi_meter_set_rms_ballistics(const struct hpi_hsubsys *ph_subsys, | 2191 | u16 hpi_meter_set_rms_ballistics(u32 h_control, u16 attack, u16 decay) |
2224 | u32 h_control, u16 attack, u16 decay) | ||
2225 | { | 2192 | { |
2226 | return hpi_control_param_set(ph_subsys, h_control, | 2193 | return hpi_control_param_set(h_control, HPI_METER_RMS_BALLISTICS, |
2227 | HPI_METER_RMS_BALLISTICS, attack, decay); | 2194 | attack, decay); |
2228 | } | 2195 | } |
2229 | 2196 | ||
2230 | u16 hpi_meter_get_rms_ballistics(const struct hpi_hsubsys *ph_subsys, | 2197 | u16 hpi_meter_get_rms_ballistics(u32 h_control, u16 *pn_attack, u16 *pn_decay) |
2231 | u32 h_control, u16 *pn_attack, u16 *pn_decay) | ||
2232 | { | 2198 | { |
2233 | u32 attack; | 2199 | u32 attack; |
2234 | u32 decay; | 2200 | u32 decay; |
2235 | u16 error; | 2201 | u16 error; |
2236 | 2202 | ||
2237 | error = hpi_control_param2_get(ph_subsys, h_control, | 2203 | error = hpi_control_param2_get(h_control, HPI_METER_RMS_BALLISTICS, |
2238 | HPI_METER_RMS_BALLISTICS, &attack, &decay); | 2204 | &attack, &decay); |
2239 | 2205 | ||
2240 | if (pn_attack) | 2206 | if (pn_attack) |
2241 | *pn_attack = (unsigned short)attack; | 2207 | *pn_attack = (unsigned short)attack; |
@@ -2245,22 +2211,21 @@ u16 hpi_meter_get_rms_ballistics(const struct hpi_hsubsys *ph_subsys, | |||
2245 | return error; | 2211 | return error; |
2246 | } | 2212 | } |
2247 | 2213 | ||
2248 | u16 hpi_meter_set_peak_ballistics(const struct hpi_hsubsys *ph_subsys, | 2214 | u16 hpi_meter_set_peak_ballistics(u32 h_control, u16 attack, u16 decay) |
2249 | u32 h_control, u16 attack, u16 decay) | ||
2250 | { | 2215 | { |
2251 | return hpi_control_param_set(ph_subsys, h_control, | 2216 | return hpi_control_param_set(h_control, HPI_METER_PEAK_BALLISTICS, |
2252 | HPI_METER_PEAK_BALLISTICS, attack, decay); | 2217 | attack, decay); |
2253 | } | 2218 | } |
2254 | 2219 | ||
2255 | u16 hpi_meter_get_peak_ballistics(const struct hpi_hsubsys *ph_subsys, | 2220 | u16 hpi_meter_get_peak_ballistics(u32 h_control, u16 *pn_attack, |
2256 | u32 h_control, u16 *pn_attack, u16 *pn_decay) | 2221 | u16 *pn_decay) |
2257 | { | 2222 | { |
2258 | u32 attack; | 2223 | u32 attack; |
2259 | u32 decay; | 2224 | u32 decay; |
2260 | u16 error; | 2225 | u16 error; |
2261 | 2226 | ||
2262 | error = hpi_control_param2_get(ph_subsys, h_control, | 2227 | error = hpi_control_param2_get(h_control, HPI_METER_PEAK_BALLISTICS, |
2263 | HPI_METER_PEAK_BALLISTICS, &attack, &decay); | 2228 | &attack, &decay); |
2264 | 2229 | ||
2265 | if (pn_attack) | 2230 | if (pn_attack) |
2266 | *pn_attack = (short)attack; | 2231 | *pn_attack = (short)attack; |
@@ -2270,37 +2235,35 @@ u16 hpi_meter_get_peak_ballistics(const struct hpi_hsubsys *ph_subsys, | |||
2270 | return error; | 2235 | return error; |
2271 | } | 2236 | } |
2272 | 2237 | ||
2273 | u16 hpi_microphone_set_phantom_power(const struct hpi_hsubsys *ph_subsys, | 2238 | u16 hpi_microphone_set_phantom_power(u32 h_control, u16 on_off) |
2274 | u32 h_control, u16 on_off) | ||
2275 | { | 2239 | { |
2276 | return hpi_control_param_set(ph_subsys, h_control, | 2240 | return hpi_control_param_set(h_control, HPI_MICROPHONE_PHANTOM_POWER, |
2277 | HPI_MICROPHONE_PHANTOM_POWER, (u32)on_off, 0); | 2241 | (u32)on_off, 0); |
2278 | } | 2242 | } |
2279 | 2243 | ||
2280 | u16 hpi_microphone_get_phantom_power(const struct hpi_hsubsys *ph_subsys, | 2244 | u16 hpi_microphone_get_phantom_power(u32 h_control, u16 *pw_on_off) |
2281 | u32 h_control, u16 *pw_on_off) | ||
2282 | { | 2245 | { |
2283 | u16 error = 0; | 2246 | u16 error = 0; |
2284 | u32 on_off = 0; | 2247 | u32 on_off = 0; |
2285 | error = hpi_control_param1_get(ph_subsys, h_control, | 2248 | error = hpi_control_param1_get(h_control, |
2286 | HPI_MICROPHONE_PHANTOM_POWER, &on_off); | 2249 | HPI_MICROPHONE_PHANTOM_POWER, &on_off); |
2287 | if (pw_on_off) | 2250 | if (pw_on_off) |
2288 | *pw_on_off = (u16)on_off; | 2251 | *pw_on_off = (u16)on_off; |
2289 | return error; | 2252 | return error; |
2290 | } | 2253 | } |
2291 | 2254 | ||
2292 | u16 hpi_multiplexer_set_source(const struct hpi_hsubsys *ph_subsys, | 2255 | u16 hpi_multiplexer_set_source(u32 h_control, u16 source_node_type, |
2293 | u32 h_control, u16 source_node_type, u16 source_node_index) | 2256 | u16 source_node_index) |
2294 | { | 2257 | { |
2295 | return hpi_control_param_set(ph_subsys, h_control, | 2258 | return hpi_control_param_set(h_control, HPI_MULTIPLEXER_SOURCE, |
2296 | HPI_MULTIPLEXER_SOURCE, source_node_type, source_node_index); | 2259 | source_node_type, source_node_index); |
2297 | } | 2260 | } |
2298 | 2261 | ||
2299 | u16 hpi_multiplexer_get_source(const struct hpi_hsubsys *ph_subsys, | 2262 | u16 hpi_multiplexer_get_source(u32 h_control, u16 *source_node_type, |
2300 | u32 h_control, u16 *source_node_type, u16 *source_node_index) | 2263 | u16 *source_node_index) |
2301 | { | 2264 | { |
2302 | u32 node, index; | 2265 | u32 node, index; |
2303 | u16 error = hpi_control_param2_get(ph_subsys, h_control, | 2266 | u16 error = hpi_control_param2_get(h_control, |
2304 | HPI_MULTIPLEXER_SOURCE, &node, | 2267 | HPI_MULTIPLEXER_SOURCE, &node, |
2305 | &index); | 2268 | &index); |
2306 | if (source_node_type) | 2269 | if (source_node_type) |
@@ -2310,15 +2273,15 @@ u16 hpi_multiplexer_get_source(const struct hpi_hsubsys *ph_subsys, | |||
2310 | return error; | 2273 | return error; |
2311 | } | 2274 | } |
2312 | 2275 | ||
2313 | u16 hpi_multiplexer_query_source(const struct hpi_hsubsys *ph_subsys, | 2276 | u16 hpi_multiplexer_query_source(u32 h_control, u16 index, |
2314 | u32 h_control, u16 index, u16 *source_node_type, | 2277 | u16 *source_node_type, u16 *source_node_index) |
2315 | u16 *source_node_index) | ||
2316 | { | 2278 | { |
2317 | struct hpi_message hm; | 2279 | struct hpi_message hm; |
2318 | struct hpi_response hr; | 2280 | struct hpi_response hr; |
2319 | hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, | 2281 | hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, |
2320 | HPI_CONTROL_GET_STATE); | 2282 | HPI_CONTROL_GET_STATE); |
2321 | u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); | 2283 | if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index)) |
2284 | return HPI_ERROR_INVALID_HANDLE; | ||
2322 | hm.u.c.attribute = HPI_MULTIPLEXER_QUERYSOURCE; | 2285 | hm.u.c.attribute = HPI_MULTIPLEXER_QUERYSOURCE; |
2323 | hm.u.c.param1 = index; | 2286 | hm.u.c.param1 = index; |
2324 | 2287 | ||
@@ -2331,15 +2294,15 @@ u16 hpi_multiplexer_query_source(const struct hpi_hsubsys *ph_subsys, | |||
2331 | return hr.error; | 2294 | return hr.error; |
2332 | } | 2295 | } |
2333 | 2296 | ||
2334 | u16 hpi_parametricEQ__get_info(const struct hpi_hsubsys *ph_subsys, | 2297 | u16 hpi_parametric_eq_get_info(u32 h_control, u16 *pw_number_of_bands, |
2335 | u32 h_control, u16 *pw_number_of_bands, u16 *pw_on_off) | 2298 | u16 *pw_on_off) |
2336 | { | 2299 | { |
2337 | u32 oB = 0; | 2300 | u32 oB = 0; |
2338 | u32 oO = 0; | 2301 | u32 oO = 0; |
2339 | u16 error = 0; | 2302 | u16 error = 0; |
2340 | 2303 | ||
2341 | error = hpi_control_param2_get(ph_subsys, h_control, | 2304 | error = hpi_control_param2_get(h_control, HPI_EQUALIZER_NUM_FILTERS, |
2342 | HPI_EQUALIZER_NUM_FILTERS, &oO, &oB); | 2305 | &oO, &oB); |
2343 | if (pw_number_of_bands) | 2306 | if (pw_number_of_bands) |
2344 | *pw_number_of_bands = (u16)oB; | 2307 | *pw_number_of_bands = (u16)oB; |
2345 | if (pw_on_off) | 2308 | if (pw_on_off) |
@@ -2347,23 +2310,22 @@ u16 hpi_parametricEQ__get_info(const struct hpi_hsubsys *ph_subsys, | |||
2347 | return error; | 2310 | return error; |
2348 | } | 2311 | } |
2349 | 2312 | ||
2350 | u16 hpi_parametricEQ__set_state(const struct hpi_hsubsys *ph_subsys, | 2313 | u16 hpi_parametric_eq_set_state(u32 h_control, u16 on_off) |
2351 | u32 h_control, u16 on_off) | ||
2352 | { | 2314 | { |
2353 | return hpi_control_param_set(ph_subsys, h_control, | 2315 | return hpi_control_param_set(h_control, HPI_EQUALIZER_NUM_FILTERS, |
2354 | HPI_EQUALIZER_NUM_FILTERS, on_off, 0); | 2316 | on_off, 0); |
2355 | } | 2317 | } |
2356 | 2318 | ||
2357 | u16 hpi_parametricEQ__get_band(const struct hpi_hsubsys *ph_subsys, | 2319 | u16 hpi_parametric_eq_get_band(u32 h_control, u16 index, u16 *pn_type, |
2358 | u32 h_control, u16 index, u16 *pn_type, u32 *pfrequency_hz, | 2320 | u32 *pfrequency_hz, short *pnQ100, short *pn_gain0_01dB) |
2359 | short *pnQ100, short *pn_gain0_01dB) | ||
2360 | { | 2321 | { |
2361 | struct hpi_message hm; | 2322 | struct hpi_message hm; |
2362 | struct hpi_response hr; | 2323 | struct hpi_response hr; |
2363 | 2324 | ||
2364 | hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, | 2325 | hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, |
2365 | HPI_CONTROL_GET_STATE); | 2326 | HPI_CONTROL_GET_STATE); |
2366 | u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); | 2327 | if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index)) |
2328 | return HPI_ERROR_INVALID_HANDLE; | ||
2367 | hm.u.c.attribute = HPI_EQUALIZER_FILTER; | 2329 | hm.u.c.attribute = HPI_EQUALIZER_FILTER; |
2368 | hm.u.c.param2 = index; | 2330 | hm.u.c.param2 = index; |
2369 | 2331 | ||
@@ -2381,16 +2343,16 @@ u16 hpi_parametricEQ__get_band(const struct hpi_hsubsys *ph_subsys, | |||
2381 | return hr.error; | 2343 | return hr.error; |
2382 | } | 2344 | } |
2383 | 2345 | ||
2384 | u16 hpi_parametricEQ__set_band(const struct hpi_hsubsys *ph_subsys, | 2346 | u16 hpi_parametric_eq_set_band(u32 h_control, u16 index, u16 type, |
2385 | u32 h_control, u16 index, u16 type, u32 frequency_hz, short q100, | 2347 | u32 frequency_hz, short q100, short gain0_01dB) |
2386 | short gain0_01dB) | ||
2387 | { | 2348 | { |
2388 | struct hpi_message hm; | 2349 | struct hpi_message hm; |
2389 | struct hpi_response hr; | 2350 | struct hpi_response hr; |
2390 | 2351 | ||
2391 | hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, | 2352 | hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, |
2392 | HPI_CONTROL_SET_STATE); | 2353 | HPI_CONTROL_SET_STATE); |
2393 | u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); | 2354 | if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index)) |
2355 | return HPI_ERROR_INVALID_HANDLE; | ||
2394 | 2356 | ||
2395 | hm.u.c.param1 = frequency_hz; | 2357 | hm.u.c.param1 = frequency_hz; |
2396 | hm.u.c.param2 = (index & 0xFFFFL) + ((u32)type << 16); | 2358 | hm.u.c.param2 = (index & 0xFFFFL) + ((u32)type << 16); |
@@ -2403,8 +2365,7 @@ u16 hpi_parametricEQ__set_band(const struct hpi_hsubsys *ph_subsys, | |||
2403 | return hr.error; | 2365 | return hr.error; |
2404 | } | 2366 | } |
2405 | 2367 | ||
2406 | u16 hpi_parametricEQ__get_coeffs(const struct hpi_hsubsys *ph_subsys, | 2368 | u16 hpi_parametric_eq_get_coeffs(u32 h_control, u16 index, short coeffs[5] |
2407 | u32 h_control, u16 index, short coeffs[5] | ||
2408 | ) | 2369 | ) |
2409 | { | 2370 | { |
2410 | struct hpi_message hm; | 2371 | struct hpi_message hm; |
@@ -2412,7 +2373,8 @@ u16 hpi_parametricEQ__get_coeffs(const struct hpi_hsubsys *ph_subsys, | |||
2412 | 2373 | ||
2413 | hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, | 2374 | hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, |
2414 | HPI_CONTROL_GET_STATE); | 2375 | HPI_CONTROL_GET_STATE); |
2415 | u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); | 2376 | if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index)) |
2377 | return HPI_ERROR_INVALID_HANDLE; | ||
2416 | hm.u.c.attribute = HPI_EQUALIZER_COEFFICIENTS; | 2378 | hm.u.c.attribute = HPI_EQUALIZER_COEFFICIENTS; |
2417 | hm.u.c.param2 = index; | 2379 | hm.u.c.param2 = index; |
2418 | 2380 | ||
@@ -2427,64 +2389,59 @@ u16 hpi_parametricEQ__get_coeffs(const struct hpi_hsubsys *ph_subsys, | |||
2427 | return hr.error; | 2389 | return hr.error; |
2428 | } | 2390 | } |
2429 | 2391 | ||
2430 | u16 hpi_sample_clock_query_source(const struct hpi_hsubsys *ph_subsys, | 2392 | u16 hpi_sample_clock_query_source(const u32 h_clock, const u32 index, |
2431 | const u32 h_clock, const u32 index, u16 *pw_source) | 2393 | u16 *pw_source) |
2432 | { | 2394 | { |
2433 | u32 qr; | 2395 | u32 qr; |
2434 | u16 err; | 2396 | u16 err; |
2435 | 2397 | ||
2436 | err = hpi_control_query(ph_subsys, h_clock, HPI_SAMPLECLOCK_SOURCE, | 2398 | err = hpi_control_query(h_clock, HPI_SAMPLECLOCK_SOURCE, index, 0, |
2437 | index, 0, &qr); | 2399 | &qr); |
2438 | *pw_source = (u16)qr; | 2400 | *pw_source = (u16)qr; |
2439 | return err; | 2401 | return err; |
2440 | } | 2402 | } |
2441 | 2403 | ||
2442 | u16 hpi_sample_clock_set_source(const struct hpi_hsubsys *ph_subsys, | 2404 | u16 hpi_sample_clock_set_source(u32 h_control, u16 source) |
2443 | u32 h_control, u16 source) | ||
2444 | { | 2405 | { |
2445 | return hpi_control_param_set(ph_subsys, h_control, | 2406 | return hpi_control_param_set(h_control, HPI_SAMPLECLOCK_SOURCE, |
2446 | HPI_SAMPLECLOCK_SOURCE, source, 0); | 2407 | source, 0); |
2447 | } | 2408 | } |
2448 | 2409 | ||
2449 | u16 hpi_sample_clock_get_source(const struct hpi_hsubsys *ph_subsys, | 2410 | u16 hpi_sample_clock_get_source(u32 h_control, u16 *pw_source) |
2450 | u32 h_control, u16 *pw_source) | ||
2451 | { | 2411 | { |
2452 | u16 error = 0; | 2412 | u16 error = 0; |
2453 | u32 source = 0; | 2413 | u32 source = 0; |
2454 | error = hpi_control_param1_get(ph_subsys, h_control, | 2414 | error = hpi_control_param1_get(h_control, HPI_SAMPLECLOCK_SOURCE, |
2455 | HPI_SAMPLECLOCK_SOURCE, &source); | 2415 | &source); |
2456 | if (!error) | 2416 | if (!error) |
2457 | if (pw_source) | 2417 | if (pw_source) |
2458 | *pw_source = (u16)source; | 2418 | *pw_source = (u16)source; |
2459 | return error; | 2419 | return error; |
2460 | } | 2420 | } |
2461 | 2421 | ||
2462 | u16 hpi_sample_clock_query_source_index(const struct hpi_hsubsys *ph_subsys, | 2422 | u16 hpi_sample_clock_query_source_index(const u32 h_clock, const u32 index, |
2463 | const u32 h_clock, const u32 index, const u32 source, | 2423 | const u32 source, u16 *pw_source_index) |
2464 | u16 *pw_source_index) | ||
2465 | { | 2424 | { |
2466 | u32 qr; | 2425 | u32 qr; |
2467 | u16 err; | 2426 | u16 err; |
2468 | 2427 | ||
2469 | err = hpi_control_query(ph_subsys, h_clock, | 2428 | err = hpi_control_query(h_clock, HPI_SAMPLECLOCK_SOURCE_INDEX, index, |
2470 | HPI_SAMPLECLOCK_SOURCE_INDEX, index, source, &qr); | 2429 | source, &qr); |
2471 | *pw_source_index = (u16)qr; | 2430 | *pw_source_index = (u16)qr; |
2472 | return err; | 2431 | return err; |
2473 | } | 2432 | } |
2474 | 2433 | ||
2475 | u16 hpi_sample_clock_set_source_index(const struct hpi_hsubsys *ph_subsys, | 2434 | u16 hpi_sample_clock_set_source_index(u32 h_control, u16 source_index) |
2476 | u32 h_control, u16 source_index) | ||
2477 | { | 2435 | { |
2478 | return hpi_control_param_set(ph_subsys, h_control, | 2436 | return hpi_control_param_set(h_control, HPI_SAMPLECLOCK_SOURCE_INDEX, |
2479 | HPI_SAMPLECLOCK_SOURCE_INDEX, source_index, 0); | 2437 | source_index, 0); |
2480 | } | 2438 | } |
2481 | 2439 | ||
2482 | u16 hpi_sample_clock_get_source_index(const struct hpi_hsubsys *ph_subsys, | 2440 | u16 hpi_sample_clock_get_source_index(u32 h_control, u16 *pw_source_index) |
2483 | u32 h_control, u16 *pw_source_index) | ||
2484 | { | 2441 | { |
2485 | u16 error = 0; | 2442 | u16 error = 0; |
2486 | u32 source_index = 0; | 2443 | u32 source_index = 0; |
2487 | error = hpi_control_param1_get(ph_subsys, h_control, | 2444 | error = hpi_control_param1_get(h_control, |
2488 | HPI_SAMPLECLOCK_SOURCE_INDEX, &source_index); | 2445 | HPI_SAMPLECLOCK_SOURCE_INDEX, &source_index); |
2489 | if (!error) | 2446 | if (!error) |
2490 | if (pw_source_index) | 2447 | if (pw_source_index) |
@@ -2492,29 +2449,27 @@ u16 hpi_sample_clock_get_source_index(const struct hpi_hsubsys *ph_subsys, | |||
2492 | return error; | 2449 | return error; |
2493 | } | 2450 | } |
2494 | 2451 | ||
2495 | u16 hpi_sample_clock_query_local_rate(const struct hpi_hsubsys *ph_subsys, | 2452 | u16 hpi_sample_clock_query_local_rate(const u32 h_clock, const u32 index, |
2496 | const u32 h_clock, const u32 index, u32 *prate) | 2453 | u32 *prate) |
2497 | { | 2454 | { |
2498 | u16 err; | 2455 | u16 err; |
2499 | err = hpi_control_query(ph_subsys, h_clock, | 2456 | err = hpi_control_query(h_clock, HPI_SAMPLECLOCK_LOCAL_SAMPLERATE, |
2500 | HPI_SAMPLECLOCK_LOCAL_SAMPLERATE, index, 0, prate); | 2457 | index, 0, prate); |
2501 | 2458 | ||
2502 | return err; | 2459 | return err; |
2503 | } | 2460 | } |
2504 | 2461 | ||
2505 | u16 hpi_sample_clock_set_local_rate(const struct hpi_hsubsys *ph_subsys, | 2462 | u16 hpi_sample_clock_set_local_rate(u32 h_control, u32 sample_rate) |
2506 | u32 h_control, u32 sample_rate) | ||
2507 | { | 2463 | { |
2508 | return hpi_control_param_set(ph_subsys, h_control, | 2464 | return hpi_control_param_set(h_control, |
2509 | HPI_SAMPLECLOCK_LOCAL_SAMPLERATE, sample_rate, 0); | 2465 | HPI_SAMPLECLOCK_LOCAL_SAMPLERATE, sample_rate, 0); |
2510 | } | 2466 | } |
2511 | 2467 | ||
2512 | u16 hpi_sample_clock_get_local_rate(const struct hpi_hsubsys *ph_subsys, | 2468 | u16 hpi_sample_clock_get_local_rate(u32 h_control, u32 *psample_rate) |
2513 | u32 h_control, u32 *psample_rate) | ||
2514 | { | 2469 | { |
2515 | u16 error = 0; | 2470 | u16 error = 0; |
2516 | u32 sample_rate = 0; | 2471 | u32 sample_rate = 0; |
2517 | error = hpi_control_param1_get(ph_subsys, h_control, | 2472 | error = hpi_control_param1_get(h_control, |
2518 | HPI_SAMPLECLOCK_LOCAL_SAMPLERATE, &sample_rate); | 2473 | HPI_SAMPLECLOCK_LOCAL_SAMPLERATE, &sample_rate); |
2519 | if (!error) | 2474 | if (!error) |
2520 | if (psample_rate) | 2475 | if (psample_rate) |
@@ -2522,260 +2477,221 @@ u16 hpi_sample_clock_get_local_rate(const struct hpi_hsubsys *ph_subsys, | |||
2522 | return error; | 2477 | return error; |
2523 | } | 2478 | } |
2524 | 2479 | ||
2525 | u16 hpi_sample_clock_get_sample_rate(const struct hpi_hsubsys *ph_subsys, | 2480 | u16 hpi_sample_clock_get_sample_rate(u32 h_control, u32 *psample_rate) |
2526 | u32 h_control, u32 *psample_rate) | ||
2527 | { | 2481 | { |
2528 | u16 error = 0; | 2482 | u16 error = 0; |
2529 | u32 sample_rate = 0; | 2483 | u32 sample_rate = 0; |
2530 | error = hpi_control_param1_get(ph_subsys, h_control, | 2484 | error = hpi_control_param1_get(h_control, HPI_SAMPLECLOCK_SAMPLERATE, |
2531 | HPI_SAMPLECLOCK_SAMPLERATE, &sample_rate); | 2485 | &sample_rate); |
2532 | if (!error) | 2486 | if (!error) |
2533 | if (psample_rate) | 2487 | if (psample_rate) |
2534 | *psample_rate = sample_rate; | 2488 | *psample_rate = sample_rate; |
2535 | return error; | 2489 | return error; |
2536 | } | 2490 | } |
2537 | 2491 | ||
2538 | u16 hpi_sample_clock_set_auto(const struct hpi_hsubsys *ph_subsys, | 2492 | u16 hpi_sample_clock_set_auto(u32 h_control, u32 enable) |
2539 | u32 h_control, u32 enable) | ||
2540 | { | 2493 | { |
2541 | return hpi_control_param_set(ph_subsys, h_control, | 2494 | return hpi_control_param_set(h_control, HPI_SAMPLECLOCK_AUTO, enable, |
2542 | HPI_SAMPLECLOCK_AUTO, enable, 0); | 2495 | 0); |
2543 | } | 2496 | } |
2544 | 2497 | ||
2545 | u16 hpi_sample_clock_get_auto(const struct hpi_hsubsys *ph_subsys, | 2498 | u16 hpi_sample_clock_get_auto(u32 h_control, u32 *penable) |
2546 | u32 h_control, u32 *penable) | ||
2547 | { | 2499 | { |
2548 | return hpi_control_param1_get(ph_subsys, h_control, | 2500 | return hpi_control_param1_get(h_control, HPI_SAMPLECLOCK_AUTO, |
2549 | HPI_SAMPLECLOCK_AUTO, penable); | 2501 | penable); |
2550 | } | 2502 | } |
2551 | 2503 | ||
2552 | u16 hpi_sample_clock_set_local_rate_lock(const struct hpi_hsubsys *ph_subsys, | 2504 | u16 hpi_sample_clock_set_local_rate_lock(u32 h_control, u32 lock) |
2553 | u32 h_control, u32 lock) | ||
2554 | { | 2505 | { |
2555 | return hpi_control_param_set(ph_subsys, h_control, | 2506 | return hpi_control_param_set(h_control, HPI_SAMPLECLOCK_LOCAL_LOCK, |
2556 | HPI_SAMPLECLOCK_LOCAL_LOCK, lock, 0); | 2507 | lock, 0); |
2557 | } | 2508 | } |
2558 | 2509 | ||
2559 | u16 hpi_sample_clock_get_local_rate_lock(const struct hpi_hsubsys *ph_subsys, | 2510 | u16 hpi_sample_clock_get_local_rate_lock(u32 h_control, u32 *plock) |
2560 | u32 h_control, u32 *plock) | ||
2561 | { | 2511 | { |
2562 | return hpi_control_param1_get(ph_subsys, h_control, | 2512 | return hpi_control_param1_get(h_control, HPI_SAMPLECLOCK_LOCAL_LOCK, |
2563 | HPI_SAMPLECLOCK_LOCAL_LOCK, plock); | 2513 | plock); |
2564 | } | 2514 | } |
2565 | 2515 | ||
2566 | u16 hpi_tone_detector_get_frequency(const struct hpi_hsubsys *ph_subsys, | 2516 | u16 hpi_tone_detector_get_frequency(u32 h_control, u32 index, u32 *frequency) |
2567 | u32 h_control, u32 index, u32 *frequency) | ||
2568 | { | 2517 | { |
2569 | return hpi_control_param_get(ph_subsys, h_control, | 2518 | return hpi_control_param_get(h_control, HPI_TONEDETECTOR_FREQUENCY, |
2570 | HPI_TONEDETECTOR_FREQUENCY, index, 0, frequency, NULL); | 2519 | index, 0, frequency, NULL); |
2571 | } | 2520 | } |
2572 | 2521 | ||
2573 | u16 hpi_tone_detector_get_state(const struct hpi_hsubsys *ph_subsys, | 2522 | u16 hpi_tone_detector_get_state(u32 h_control, u32 *state) |
2574 | u32 h_control, u32 *state) | ||
2575 | { | 2523 | { |
2576 | return hpi_control_param1_get(ph_subsys, h_control, | 2524 | return hpi_control_param1_get(h_control, HPI_TONEDETECTOR_STATE, |
2577 | HPI_TONEDETECTOR_STATE, state); | 2525 | state); |
2578 | } | 2526 | } |
2579 | 2527 | ||
2580 | u16 hpi_tone_detector_set_enable(const struct hpi_hsubsys *ph_subsys, | 2528 | u16 hpi_tone_detector_set_enable(u32 h_control, u32 enable) |
2581 | u32 h_control, u32 enable) | ||
2582 | { | 2529 | { |
2583 | return hpi_control_param_set(ph_subsys, h_control, HPI_GENERIC_ENABLE, | 2530 | return hpi_control_param_set(h_control, HPI_GENERIC_ENABLE, enable, |
2584 | enable, 0); | 2531 | 0); |
2585 | } | 2532 | } |
2586 | 2533 | ||
2587 | u16 hpi_tone_detector_get_enable(const struct hpi_hsubsys *ph_subsys, | 2534 | u16 hpi_tone_detector_get_enable(u32 h_control, u32 *enable) |
2588 | u32 h_control, u32 *enable) | ||
2589 | { | 2535 | { |
2590 | return hpi_control_param1_get(ph_subsys, h_control, | 2536 | return hpi_control_param1_get(h_control, HPI_GENERIC_ENABLE, enable); |
2591 | HPI_GENERIC_ENABLE, enable); | ||
2592 | } | 2537 | } |
2593 | 2538 | ||
2594 | u16 hpi_tone_detector_set_event_enable(const struct hpi_hsubsys *ph_subsys, | 2539 | u16 hpi_tone_detector_set_event_enable(u32 h_control, u32 event_enable) |
2595 | u32 h_control, u32 event_enable) | ||
2596 | { | 2540 | { |
2597 | return hpi_control_param_set(ph_subsys, h_control, | 2541 | return hpi_control_param_set(h_control, HPI_GENERIC_EVENT_ENABLE, |
2598 | HPI_GENERIC_EVENT_ENABLE, (u32)event_enable, 0); | 2542 | (u32)event_enable, 0); |
2599 | } | 2543 | } |
2600 | 2544 | ||
2601 | u16 hpi_tone_detector_get_event_enable(const struct hpi_hsubsys *ph_subsys, | 2545 | u16 hpi_tone_detector_get_event_enable(u32 h_control, u32 *event_enable) |
2602 | u32 h_control, u32 *event_enable) | ||
2603 | { | 2546 | { |
2604 | return hpi_control_param1_get(ph_subsys, h_control, | 2547 | return hpi_control_param1_get(h_control, HPI_GENERIC_EVENT_ENABLE, |
2605 | HPI_GENERIC_EVENT_ENABLE, event_enable); | 2548 | event_enable); |
2606 | } | 2549 | } |
2607 | 2550 | ||
2608 | u16 hpi_tone_detector_set_threshold(const struct hpi_hsubsys *ph_subsys, | 2551 | u16 hpi_tone_detector_set_threshold(u32 h_control, int threshold) |
2609 | u32 h_control, int threshold) | ||
2610 | { | 2552 | { |
2611 | return hpi_control_param_set(ph_subsys, h_control, | 2553 | return hpi_control_param_set(h_control, HPI_TONEDETECTOR_THRESHOLD, |
2612 | HPI_TONEDETECTOR_THRESHOLD, (u32)threshold, 0); | 2554 | (u32)threshold, 0); |
2613 | } | 2555 | } |
2614 | 2556 | ||
2615 | u16 hpi_tone_detector_get_threshold(const struct hpi_hsubsys *ph_subsys, | 2557 | u16 hpi_tone_detector_get_threshold(u32 h_control, int *threshold) |
2616 | u32 h_control, int *threshold) | ||
2617 | { | 2558 | { |
2618 | return hpi_control_param1_get(ph_subsys, h_control, | 2559 | return hpi_control_param1_get(h_control, HPI_TONEDETECTOR_THRESHOLD, |
2619 | HPI_TONEDETECTOR_THRESHOLD, (u32 *)threshold); | 2560 | (u32 *)threshold); |
2620 | } | 2561 | } |
2621 | 2562 | ||
2622 | u16 hpi_silence_detector_get_state(const struct hpi_hsubsys *ph_subsys, | 2563 | u16 hpi_silence_detector_get_state(u32 h_control, u32 *state) |
2623 | u32 h_control, u32 *state) | ||
2624 | { | 2564 | { |
2625 | return hpi_control_param1_get(ph_subsys, h_control, | 2565 | return hpi_control_param1_get(h_control, HPI_SILENCEDETECTOR_STATE, |
2626 | HPI_SILENCEDETECTOR_STATE, state); | 2566 | state); |
2627 | } | 2567 | } |
2628 | 2568 | ||
2629 | u16 hpi_silence_detector_set_enable(const struct hpi_hsubsys *ph_subsys, | 2569 | u16 hpi_silence_detector_set_enable(u32 h_control, u32 enable) |
2630 | u32 h_control, u32 enable) | ||
2631 | { | 2570 | { |
2632 | return hpi_control_param_set(ph_subsys, h_control, HPI_GENERIC_ENABLE, | 2571 | return hpi_control_param_set(h_control, HPI_GENERIC_ENABLE, enable, |
2633 | enable, 0); | 2572 | 0); |
2634 | } | 2573 | } |
2635 | 2574 | ||
2636 | u16 hpi_silence_detector_get_enable(const struct hpi_hsubsys *ph_subsys, | 2575 | u16 hpi_silence_detector_get_enable(u32 h_control, u32 *enable) |
2637 | u32 h_control, u32 *enable) | ||
2638 | { | 2576 | { |
2639 | return hpi_control_param1_get(ph_subsys, h_control, | 2577 | return hpi_control_param1_get(h_control, HPI_GENERIC_ENABLE, enable); |
2640 | HPI_GENERIC_ENABLE, enable); | ||
2641 | } | 2578 | } |
2642 | 2579 | ||
2643 | u16 hpi_silence_detector_set_event_enable(const struct hpi_hsubsys *ph_subsys, | 2580 | u16 hpi_silence_detector_set_event_enable(u32 h_control, u32 event_enable) |
2644 | u32 h_control, u32 event_enable) | ||
2645 | { | 2581 | { |
2646 | return hpi_control_param_set(ph_subsys, h_control, | 2582 | return hpi_control_param_set(h_control, HPI_GENERIC_EVENT_ENABLE, |
2647 | HPI_GENERIC_EVENT_ENABLE, event_enable, 0); | 2583 | event_enable, 0); |
2648 | } | 2584 | } |
2649 | 2585 | ||
2650 | u16 hpi_silence_detector_get_event_enable(const struct hpi_hsubsys *ph_subsys, | 2586 | u16 hpi_silence_detector_get_event_enable(u32 h_control, u32 *event_enable) |
2651 | u32 h_control, u32 *event_enable) | ||
2652 | { | 2587 | { |
2653 | return hpi_control_param1_get(ph_subsys, h_control, | 2588 | return hpi_control_param1_get(h_control, HPI_GENERIC_EVENT_ENABLE, |
2654 | HPI_GENERIC_EVENT_ENABLE, event_enable); | 2589 | event_enable); |
2655 | } | 2590 | } |
2656 | 2591 | ||
2657 | u16 hpi_silence_detector_set_delay(const struct hpi_hsubsys *ph_subsys, | 2592 | u16 hpi_silence_detector_set_delay(u32 h_control, u32 delay) |
2658 | u32 h_control, u32 delay) | ||
2659 | { | 2593 | { |
2660 | return hpi_control_param_set(ph_subsys, h_control, | 2594 | return hpi_control_param_set(h_control, HPI_SILENCEDETECTOR_DELAY, |
2661 | HPI_SILENCEDETECTOR_DELAY, delay, 0); | 2595 | delay, 0); |
2662 | } | 2596 | } |
2663 | 2597 | ||
2664 | u16 hpi_silence_detector_get_delay(const struct hpi_hsubsys *ph_subsys, | 2598 | u16 hpi_silence_detector_get_delay(u32 h_control, u32 *delay) |
2665 | u32 h_control, u32 *delay) | ||
2666 | { | 2599 | { |
2667 | return hpi_control_param1_get(ph_subsys, h_control, | 2600 | return hpi_control_param1_get(h_control, HPI_SILENCEDETECTOR_DELAY, |
2668 | HPI_SILENCEDETECTOR_DELAY, delay); | 2601 | delay); |
2669 | } | 2602 | } |
2670 | 2603 | ||
2671 | u16 hpi_silence_detector_set_threshold(const struct hpi_hsubsys *ph_subsys, | 2604 | u16 hpi_silence_detector_set_threshold(u32 h_control, int threshold) |
2672 | u32 h_control, int threshold) | ||
2673 | { | 2605 | { |
2674 | return hpi_control_param_set(ph_subsys, h_control, | 2606 | return hpi_control_param_set(h_control, HPI_SILENCEDETECTOR_THRESHOLD, |
2675 | HPI_SILENCEDETECTOR_THRESHOLD, threshold, 0); | 2607 | threshold, 0); |
2676 | } | 2608 | } |
2677 | 2609 | ||
2678 | u16 hpi_silence_detector_get_threshold(const struct hpi_hsubsys *ph_subsys, | 2610 | u16 hpi_silence_detector_get_threshold(u32 h_control, int *threshold) |
2679 | u32 h_control, int *threshold) | ||
2680 | { | 2611 | { |
2681 | return hpi_control_param1_get(ph_subsys, h_control, | 2612 | return hpi_control_param1_get(h_control, |
2682 | HPI_SILENCEDETECTOR_THRESHOLD, (u32 *)threshold); | 2613 | HPI_SILENCEDETECTOR_THRESHOLD, (u32 *)threshold); |
2683 | } | 2614 | } |
2684 | 2615 | ||
2685 | u16 hpi_tuner_query_band(const struct hpi_hsubsys *ph_subsys, | 2616 | u16 hpi_tuner_query_band(const u32 h_tuner, const u32 index, u16 *pw_band) |
2686 | const u32 h_tuner, const u32 index, u16 *pw_band) | ||
2687 | { | 2617 | { |
2688 | u32 qr; | 2618 | u32 qr; |
2689 | u16 err; | 2619 | u16 err; |
2690 | 2620 | ||
2691 | err = hpi_control_query(ph_subsys, h_tuner, HPI_TUNER_BAND, index, 0, | 2621 | err = hpi_control_query(h_tuner, HPI_TUNER_BAND, index, 0, &qr); |
2692 | &qr); | ||
2693 | *pw_band = (u16)qr; | 2622 | *pw_band = (u16)qr; |
2694 | return err; | 2623 | return err; |
2695 | } | 2624 | } |
2696 | 2625 | ||
2697 | u16 hpi_tuner_set_band(const struct hpi_hsubsys *ph_subsys, u32 h_control, | 2626 | u16 hpi_tuner_set_band(u32 h_control, u16 band) |
2698 | u16 band) | ||
2699 | { | 2627 | { |
2700 | return hpi_control_param_set(ph_subsys, h_control, HPI_TUNER_BAND, | 2628 | return hpi_control_param_set(h_control, HPI_TUNER_BAND, band, 0); |
2701 | band, 0); | ||
2702 | } | 2629 | } |
2703 | 2630 | ||
2704 | u16 hpi_tuner_get_band(const struct hpi_hsubsys *ph_subsys, u32 h_control, | 2631 | u16 hpi_tuner_get_band(u32 h_control, u16 *pw_band) |
2705 | u16 *pw_band) | ||
2706 | { | 2632 | { |
2707 | u32 band = 0; | 2633 | u32 band = 0; |
2708 | u16 error = 0; | 2634 | u16 error = 0; |
2709 | 2635 | ||
2710 | error = hpi_control_param1_get(ph_subsys, h_control, HPI_TUNER_BAND, | 2636 | error = hpi_control_param1_get(h_control, HPI_TUNER_BAND, &band); |
2711 | &band); | ||
2712 | if (pw_band) | 2637 | if (pw_band) |
2713 | *pw_band = (u16)band; | 2638 | *pw_band = (u16)band; |
2714 | return error; | 2639 | return error; |
2715 | } | 2640 | } |
2716 | 2641 | ||
2717 | u16 hpi_tuner_query_frequency(const struct hpi_hsubsys *ph_subsys, | 2642 | u16 hpi_tuner_query_frequency(const u32 h_tuner, const u32 index, |
2718 | const u32 h_tuner, const u32 index, const u16 band, u32 *pfreq) | 2643 | const u16 band, u32 *pfreq) |
2719 | { | 2644 | { |
2720 | return hpi_control_query(ph_subsys, h_tuner, HPI_TUNER_FREQ, index, | 2645 | return hpi_control_query(h_tuner, HPI_TUNER_FREQ, index, band, pfreq); |
2721 | band, pfreq); | ||
2722 | } | 2646 | } |
2723 | 2647 | ||
2724 | u16 hpi_tuner_set_frequency(const struct hpi_hsubsys *ph_subsys, | 2648 | u16 hpi_tuner_set_frequency(u32 h_control, u32 freq_ink_hz) |
2725 | u32 h_control, u32 freq_ink_hz) | ||
2726 | { | 2649 | { |
2727 | return hpi_control_param_set(ph_subsys, h_control, HPI_TUNER_FREQ, | 2650 | return hpi_control_param_set(h_control, HPI_TUNER_FREQ, freq_ink_hz, |
2728 | freq_ink_hz, 0); | 2651 | 0); |
2729 | } | 2652 | } |
2730 | 2653 | ||
2731 | u16 hpi_tuner_get_frequency(const struct hpi_hsubsys *ph_subsys, | 2654 | u16 hpi_tuner_get_frequency(u32 h_control, u32 *pw_freq_ink_hz) |
2732 | u32 h_control, u32 *pw_freq_ink_hz) | ||
2733 | { | 2655 | { |
2734 | return hpi_control_param1_get(ph_subsys, h_control, HPI_TUNER_FREQ, | 2656 | return hpi_control_param1_get(h_control, HPI_TUNER_FREQ, |
2735 | pw_freq_ink_hz); | 2657 | pw_freq_ink_hz); |
2736 | } | 2658 | } |
2737 | 2659 | ||
2738 | u16 hpi_tuner_query_gain(const struct hpi_hsubsys *ph_subsys, | 2660 | u16 hpi_tuner_query_gain(const u32 h_tuner, const u32 index, u16 *pw_gain) |
2739 | const u32 h_tuner, const u32 index, u16 *pw_gain) | ||
2740 | { | 2661 | { |
2741 | u32 qr; | 2662 | u32 qr; |
2742 | u16 err; | 2663 | u16 err; |
2743 | 2664 | ||
2744 | err = hpi_control_query(ph_subsys, h_tuner, HPI_TUNER_BAND, index, 0, | 2665 | err = hpi_control_query(h_tuner, HPI_TUNER_BAND, index, 0, &qr); |
2745 | &qr); | ||
2746 | *pw_gain = (u16)qr; | 2666 | *pw_gain = (u16)qr; |
2747 | return err; | 2667 | return err; |
2748 | } | 2668 | } |
2749 | 2669 | ||
2750 | u16 hpi_tuner_set_gain(const struct hpi_hsubsys *ph_subsys, u32 h_control, | 2670 | u16 hpi_tuner_set_gain(u32 h_control, short gain) |
2751 | short gain) | ||
2752 | { | 2671 | { |
2753 | return hpi_control_param_set(ph_subsys, h_control, HPI_TUNER_GAIN, | 2672 | return hpi_control_param_set(h_control, HPI_TUNER_GAIN, gain, 0); |
2754 | gain, 0); | ||
2755 | } | 2673 | } |
2756 | 2674 | ||
2757 | u16 hpi_tuner_get_gain(const struct hpi_hsubsys *ph_subsys, u32 h_control, | 2675 | u16 hpi_tuner_get_gain(u32 h_control, short *pn_gain) |
2758 | short *pn_gain) | ||
2759 | { | 2676 | { |
2760 | u32 gain = 0; | 2677 | u32 gain = 0; |
2761 | u16 error = 0; | 2678 | u16 error = 0; |
2762 | 2679 | ||
2763 | error = hpi_control_param1_get(ph_subsys, h_control, HPI_TUNER_GAIN, | 2680 | error = hpi_control_param1_get(h_control, HPI_TUNER_GAIN, &gain); |
2764 | &gain); | ||
2765 | if (pn_gain) | 2681 | if (pn_gain) |
2766 | *pn_gain = (u16)gain; | 2682 | *pn_gain = (u16)gain; |
2767 | return error; | 2683 | return error; |
2768 | } | 2684 | } |
2769 | 2685 | ||
2770 | u16 hpi_tuner_getRF_level(const struct hpi_hsubsys *ph_subsys, u32 h_control, | 2686 | u16 hpi_tuner_get_rf_level(u32 h_control, short *pw_level) |
2771 | short *pw_level) | ||
2772 | { | 2687 | { |
2773 | struct hpi_message hm; | 2688 | struct hpi_message hm; |
2774 | struct hpi_response hr; | 2689 | struct hpi_response hr; |
2775 | 2690 | ||
2776 | hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, | 2691 | hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, |
2777 | HPI_CONTROL_GET_STATE); | 2692 | HPI_CONTROL_GET_STATE); |
2778 | u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); | 2693 | if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index)) |
2694 | return HPI_ERROR_INVALID_HANDLE; | ||
2779 | hm.u.cu.attribute = HPI_TUNER_LEVEL_AVG; | 2695 | hm.u.cu.attribute = HPI_TUNER_LEVEL_AVG; |
2780 | hpi_send_recv(&hm, &hr); | 2696 | hpi_send_recv(&hm, &hr); |
2781 | if (pw_level) | 2697 | if (pw_level) |
@@ -2783,15 +2699,15 @@ u16 hpi_tuner_getRF_level(const struct hpi_hsubsys *ph_subsys, u32 h_control, | |||
2783 | return hr.error; | 2699 | return hr.error; |
2784 | } | 2700 | } |
2785 | 2701 | ||
2786 | u16 hpi_tuner_get_rawRF_level(const struct hpi_hsubsys *ph_subsys, | 2702 | u16 hpi_tuner_get_raw_rf_level(u32 h_control, short *pw_level) |
2787 | u32 h_control, short *pw_level) | ||
2788 | { | 2703 | { |
2789 | struct hpi_message hm; | 2704 | struct hpi_message hm; |
2790 | struct hpi_response hr; | 2705 | struct hpi_response hr; |
2791 | 2706 | ||
2792 | hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, | 2707 | hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, |
2793 | HPI_CONTROL_GET_STATE); | 2708 | HPI_CONTROL_GET_STATE); |
2794 | u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); | 2709 | if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index)) |
2710 | return HPI_ERROR_INVALID_HANDLE; | ||
2795 | hm.u.cu.attribute = HPI_TUNER_LEVEL_RAW; | 2711 | hm.u.cu.attribute = HPI_TUNER_LEVEL_RAW; |
2796 | hpi_send_recv(&hm, &hr); | 2712 | hpi_send_recv(&hm, &hr); |
2797 | if (pw_level) | 2713 | if (pw_level) |
@@ -2799,70 +2715,62 @@ u16 hpi_tuner_get_rawRF_level(const struct hpi_hsubsys *ph_subsys, | |||
2799 | return hr.error; | 2715 | return hr.error; |
2800 | } | 2716 | } |
2801 | 2717 | ||
2802 | u16 hpi_tuner_query_deemphasis(const struct hpi_hsubsys *ph_subsys, | 2718 | u16 hpi_tuner_query_deemphasis(const u32 h_tuner, const u32 index, |
2803 | const u32 h_tuner, const u32 index, const u16 band, u32 *pdeemphasis) | 2719 | const u16 band, u32 *pdeemphasis) |
2804 | { | 2720 | { |
2805 | return hpi_control_query(ph_subsys, h_tuner, HPI_TUNER_DEEMPHASIS, | 2721 | return hpi_control_query(h_tuner, HPI_TUNER_DEEMPHASIS, index, band, |
2806 | index, band, pdeemphasis); | 2722 | pdeemphasis); |
2807 | } | 2723 | } |
2808 | 2724 | ||
2809 | u16 hpi_tuner_set_deemphasis(const struct hpi_hsubsys *ph_subsys, | 2725 | u16 hpi_tuner_set_deemphasis(u32 h_control, u32 deemphasis) |
2810 | u32 h_control, u32 deemphasis) | ||
2811 | { | 2726 | { |
2812 | return hpi_control_param_set(ph_subsys, h_control, | 2727 | return hpi_control_param_set(h_control, HPI_TUNER_DEEMPHASIS, |
2813 | HPI_TUNER_DEEMPHASIS, deemphasis, 0); | 2728 | deemphasis, 0); |
2814 | } | 2729 | } |
2815 | 2730 | ||
2816 | u16 hpi_tuner_get_deemphasis(const struct hpi_hsubsys *ph_subsys, | 2731 | u16 hpi_tuner_get_deemphasis(u32 h_control, u32 *pdeemphasis) |
2817 | u32 h_control, u32 *pdeemphasis) | ||
2818 | { | 2732 | { |
2819 | return hpi_control_param1_get(ph_subsys, h_control, | 2733 | return hpi_control_param1_get(h_control, HPI_TUNER_DEEMPHASIS, |
2820 | HPI_TUNER_DEEMPHASIS, pdeemphasis); | 2734 | pdeemphasis); |
2821 | } | 2735 | } |
2822 | 2736 | ||
2823 | u16 hpi_tuner_query_program(const struct hpi_hsubsys *ph_subsys, | 2737 | u16 hpi_tuner_query_program(const u32 h_tuner, u32 *pbitmap_program) |
2824 | const u32 h_tuner, u32 *pbitmap_program) | ||
2825 | { | 2738 | { |
2826 | return hpi_control_query(ph_subsys, h_tuner, HPI_TUNER_PROGRAM, 0, 0, | 2739 | return hpi_control_query(h_tuner, HPI_TUNER_PROGRAM, 0, 0, |
2827 | pbitmap_program); | 2740 | pbitmap_program); |
2828 | } | 2741 | } |
2829 | 2742 | ||
2830 | u16 hpi_tuner_set_program(const struct hpi_hsubsys *ph_subsys, u32 h_control, | 2743 | u16 hpi_tuner_set_program(u32 h_control, u32 program) |
2831 | u32 program) | ||
2832 | { | 2744 | { |
2833 | return hpi_control_param_set(ph_subsys, h_control, HPI_TUNER_PROGRAM, | 2745 | return hpi_control_param_set(h_control, HPI_TUNER_PROGRAM, program, |
2834 | program, 0); | 2746 | 0); |
2835 | } | 2747 | } |
2836 | 2748 | ||
2837 | u16 hpi_tuner_get_program(const struct hpi_hsubsys *ph_subsys, u32 h_control, | 2749 | u16 hpi_tuner_get_program(u32 h_control, u32 *pprogram) |
2838 | u32 *pprogram) | ||
2839 | { | 2750 | { |
2840 | return hpi_control_param1_get(ph_subsys, h_control, HPI_TUNER_PROGRAM, | 2751 | return hpi_control_param1_get(h_control, HPI_TUNER_PROGRAM, pprogram); |
2841 | pprogram); | ||
2842 | } | 2752 | } |
2843 | 2753 | ||
2844 | u16 hpi_tuner_get_hd_radio_dsp_version(const struct hpi_hsubsys *ph_subsys, | 2754 | u16 hpi_tuner_get_hd_radio_dsp_version(u32 h_control, char *psz_dsp_version, |
2845 | u32 h_control, char *psz_dsp_version, const u32 string_size) | 2755 | const u32 string_size) |
2846 | { | 2756 | { |
2847 | return hpi_control_get_string(h_control, | 2757 | return hpi_control_get_string(h_control, |
2848 | HPI_TUNER_HDRADIO_DSP_VERSION, psz_dsp_version, string_size); | 2758 | HPI_TUNER_HDRADIO_DSP_VERSION, psz_dsp_version, string_size); |
2849 | } | 2759 | } |
2850 | 2760 | ||
2851 | u16 hpi_tuner_get_hd_radio_sdk_version(const struct hpi_hsubsys *ph_subsys, | 2761 | u16 hpi_tuner_get_hd_radio_sdk_version(u32 h_control, char *psz_sdk_version, |
2852 | u32 h_control, char *psz_sdk_version, const u32 string_size) | 2762 | const u32 string_size) |
2853 | { | 2763 | { |
2854 | return hpi_control_get_string(h_control, | 2764 | return hpi_control_get_string(h_control, |
2855 | HPI_TUNER_HDRADIO_SDK_VERSION, psz_sdk_version, string_size); | 2765 | HPI_TUNER_HDRADIO_SDK_VERSION, psz_sdk_version, string_size); |
2856 | } | 2766 | } |
2857 | 2767 | ||
2858 | u16 hpi_tuner_get_status(const struct hpi_hsubsys *ph_subsys, u32 h_control, | 2768 | u16 hpi_tuner_get_status(u32 h_control, u16 *pw_status_mask, u16 *pw_status) |
2859 | u16 *pw_status_mask, u16 *pw_status) | ||
2860 | { | 2769 | { |
2861 | u32 status = 0; | 2770 | u32 status = 0; |
2862 | u16 error = 0; | 2771 | u16 error = 0; |
2863 | 2772 | ||
2864 | error = hpi_control_param1_get(ph_subsys, h_control, HPI_TUNER_STATUS, | 2773 | error = hpi_control_param1_get(h_control, HPI_TUNER_STATUS, &status); |
2865 | &status); | ||
2866 | if (pw_status) { | 2774 | if (pw_status) { |
2867 | if (!error) { | 2775 | if (!error) { |
2868 | *pw_status_mask = (u16)(status >> 16); | 2776 | *pw_status_mask = (u16)(status >> 16); |
@@ -2875,50 +2783,44 @@ u16 hpi_tuner_get_status(const struct hpi_hsubsys *ph_subsys, u32 h_control, | |||
2875 | return error; | 2783 | return error; |
2876 | } | 2784 | } |
2877 | 2785 | ||
2878 | u16 hpi_tuner_set_mode(const struct hpi_hsubsys *ph_subsys, u32 h_control, | 2786 | u16 hpi_tuner_set_mode(u32 h_control, u32 mode, u32 value) |
2879 | u32 mode, u32 value) | ||
2880 | { | 2787 | { |
2881 | return hpi_control_param_set(ph_subsys, h_control, HPI_TUNER_MODE, | 2788 | return hpi_control_param_set(h_control, HPI_TUNER_MODE, mode, value); |
2882 | mode, value); | ||
2883 | } | 2789 | } |
2884 | 2790 | ||
2885 | u16 hpi_tuner_get_mode(const struct hpi_hsubsys *ph_subsys, u32 h_control, | 2791 | u16 hpi_tuner_get_mode(u32 h_control, u32 mode, u32 *pn_value) |
2886 | u32 mode, u32 *pn_value) | ||
2887 | { | 2792 | { |
2888 | return hpi_control_param_get(ph_subsys, h_control, HPI_TUNER_MODE, | 2793 | return hpi_control_param_get(h_control, HPI_TUNER_MODE, mode, 0, |
2889 | mode, 0, pn_value, NULL); | 2794 | pn_value, NULL); |
2890 | } | 2795 | } |
2891 | 2796 | ||
2892 | u16 hpi_tuner_get_hd_radio_signal_quality(const struct hpi_hsubsys *ph_subsys, | 2797 | u16 hpi_tuner_get_hd_radio_signal_quality(u32 h_control, u32 *pquality) |
2893 | u32 h_control, u32 *pquality) | ||
2894 | { | 2798 | { |
2895 | return hpi_control_param1_get(ph_subsys, h_control, | 2799 | return hpi_control_param1_get(h_control, |
2896 | HPI_TUNER_HDRADIO_SIGNAL_QUALITY, pquality); | 2800 | HPI_TUNER_HDRADIO_SIGNAL_QUALITY, pquality); |
2897 | } | 2801 | } |
2898 | 2802 | ||
2899 | u16 hpi_tuner_get_hd_radio_signal_blend(const struct hpi_hsubsys *ph_subsys, | 2803 | u16 hpi_tuner_get_hd_radio_signal_blend(u32 h_control, u32 *pblend) |
2900 | u32 h_control, u32 *pblend) | ||
2901 | { | 2804 | { |
2902 | return hpi_control_param1_get(ph_subsys, h_control, | 2805 | return hpi_control_param1_get(h_control, HPI_TUNER_HDRADIO_BLEND, |
2903 | HPI_TUNER_HDRADIO_BLEND, pblend); | 2806 | pblend); |
2904 | } | 2807 | } |
2905 | 2808 | ||
2906 | u16 hpi_tuner_set_hd_radio_signal_blend(const struct hpi_hsubsys *ph_subsys, | 2809 | u16 hpi_tuner_set_hd_radio_signal_blend(u32 h_control, const u32 blend) |
2907 | u32 h_control, const u32 blend) | ||
2908 | { | 2810 | { |
2909 | return hpi_control_param_set(ph_subsys, h_control, | 2811 | return hpi_control_param_set(h_control, HPI_TUNER_HDRADIO_BLEND, |
2910 | HPI_TUNER_HDRADIO_BLEND, blend, 0); | 2812 | blend, 0); |
2911 | } | 2813 | } |
2912 | 2814 | ||
2913 | u16 hpi_tuner_getRDS(const struct hpi_hsubsys *ph_subsys, u32 h_control, | 2815 | u16 hpi_tuner_get_rds(u32 h_control, char *p_data) |
2914 | char *p_data) | ||
2915 | { | 2816 | { |
2916 | struct hpi_message hm; | 2817 | struct hpi_message hm; |
2917 | struct hpi_response hr; | 2818 | struct hpi_response hr; |
2918 | 2819 | ||
2919 | hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, | 2820 | hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, |
2920 | HPI_CONTROL_GET_STATE); | 2821 | HPI_CONTROL_GET_STATE); |
2921 | u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); | 2822 | if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index)) |
2823 | return HPI_ERROR_INVALID_HANDLE; | ||
2922 | hm.u.c.attribute = HPI_TUNER_RDS; | 2824 | hm.u.c.attribute = HPI_TUNER_RDS; |
2923 | hpi_send_recv(&hm, &hr); | 2825 | hpi_send_recv(&hm, &hr); |
2924 | if (p_data) { | 2826 | if (p_data) { |
@@ -2929,80 +2831,72 @@ u16 hpi_tuner_getRDS(const struct hpi_hsubsys *ph_subsys, u32 h_control, | |||
2929 | return hr.error; | 2831 | return hr.error; |
2930 | } | 2832 | } |
2931 | 2833 | ||
2932 | u16 HPI_PAD__get_channel_name(const struct hpi_hsubsys *ph_subsys, | 2834 | u16 hpi_pad_get_channel_name(u32 h_control, char *psz_string, |
2933 | u32 h_control, char *psz_string, const u32 data_length) | 2835 | const u32 data_length) |
2934 | { | 2836 | { |
2935 | return hpi_control_get_string(h_control, HPI_PAD_CHANNEL_NAME, | 2837 | return hpi_control_get_string(h_control, HPI_PAD_CHANNEL_NAME, |
2936 | psz_string, data_length); | 2838 | psz_string, data_length); |
2937 | } | 2839 | } |
2938 | 2840 | ||
2939 | u16 HPI_PAD__get_artist(const struct hpi_hsubsys *ph_subsys, u32 h_control, | 2841 | u16 hpi_pad_get_artist(u32 h_control, char *psz_string, const u32 data_length) |
2940 | char *psz_string, const u32 data_length) | ||
2941 | { | 2842 | { |
2942 | return hpi_control_get_string(h_control, HPI_PAD_ARTIST, psz_string, | 2843 | return hpi_control_get_string(h_control, HPI_PAD_ARTIST, psz_string, |
2943 | data_length); | 2844 | data_length); |
2944 | } | 2845 | } |
2945 | 2846 | ||
2946 | u16 HPI_PAD__get_title(const struct hpi_hsubsys *ph_subsys, u32 h_control, | 2847 | u16 hpi_pad_get_title(u32 h_control, char *psz_string, const u32 data_length) |
2947 | char *psz_string, const u32 data_length) | ||
2948 | { | 2848 | { |
2949 | return hpi_control_get_string(h_control, HPI_PAD_TITLE, psz_string, | 2849 | return hpi_control_get_string(h_control, HPI_PAD_TITLE, psz_string, |
2950 | data_length); | 2850 | data_length); |
2951 | } | 2851 | } |
2952 | 2852 | ||
2953 | u16 HPI_PAD__get_comment(const struct hpi_hsubsys *ph_subsys, u32 h_control, | 2853 | u16 hpi_pad_get_comment(u32 h_control, char *psz_string, |
2954 | char *psz_string, const u32 data_length) | 2854 | const u32 data_length) |
2955 | { | 2855 | { |
2956 | return hpi_control_get_string(h_control, HPI_PAD_COMMENT, psz_string, | 2856 | return hpi_control_get_string(h_control, HPI_PAD_COMMENT, psz_string, |
2957 | data_length); | 2857 | data_length); |
2958 | } | 2858 | } |
2959 | 2859 | ||
2960 | u16 HPI_PAD__get_program_type(const struct hpi_hsubsys *ph_subsys, | 2860 | u16 hpi_pad_get_program_type(u32 h_control, u32 *ppTY) |
2961 | u32 h_control, u32 *ppTY) | ||
2962 | { | 2861 | { |
2963 | return hpi_control_param1_get(ph_subsys, h_control, | 2862 | return hpi_control_param1_get(h_control, HPI_PAD_PROGRAM_TYPE, ppTY); |
2964 | HPI_PAD_PROGRAM_TYPE, ppTY); | ||
2965 | } | 2863 | } |
2966 | 2864 | ||
2967 | u16 HPI_PAD__get_rdsPI(const struct hpi_hsubsys *ph_subsys, u32 h_control, | 2865 | u16 hpi_pad_get_rdsPI(u32 h_control, u32 *ppI) |
2968 | u32 *ppI) | ||
2969 | { | 2866 | { |
2970 | return hpi_control_param1_get(ph_subsys, h_control, | 2867 | return hpi_control_param1_get(h_control, HPI_PAD_PROGRAM_ID, ppI); |
2971 | HPI_PAD_PROGRAM_ID, ppI); | ||
2972 | } | 2868 | } |
2973 | 2869 | ||
2974 | u16 hpi_volume_query_channels(const struct hpi_hsubsys *ph_subsys, | 2870 | u16 hpi_volume_query_channels(const u32 h_volume, u32 *p_channels) |
2975 | const u32 h_volume, u32 *p_channels) | ||
2976 | { | 2871 | { |
2977 | return hpi_control_query(ph_subsys, h_volume, HPI_VOLUME_NUM_CHANNELS, | 2872 | return hpi_control_query(h_volume, HPI_VOLUME_NUM_CHANNELS, 0, 0, |
2978 | 0, 0, p_channels); | 2873 | p_channels); |
2979 | } | 2874 | } |
2980 | 2875 | ||
2981 | u16 hpi_volume_set_gain(const struct hpi_hsubsys *ph_subsys, u32 h_control, | 2876 | u16 hpi_volume_set_gain(u32 h_control, short an_log_gain[HPI_MAX_CHANNELS] |
2982 | short an_log_gain[HPI_MAX_CHANNELS] | ||
2983 | ) | 2877 | ) |
2984 | { | 2878 | { |
2985 | return hpi_control_log_set2(h_control, HPI_VOLUME_GAIN, | 2879 | return hpi_control_log_set2(h_control, HPI_VOLUME_GAIN, |
2986 | an_log_gain[0], an_log_gain[1]); | 2880 | an_log_gain[0], an_log_gain[1]); |
2987 | } | 2881 | } |
2988 | 2882 | ||
2989 | u16 hpi_volume_get_gain(const struct hpi_hsubsys *ph_subsys, u32 h_control, | 2883 | u16 hpi_volume_get_gain(u32 h_control, short an_log_gain[HPI_MAX_CHANNELS] |
2990 | short an_log_gain[HPI_MAX_CHANNELS] | ||
2991 | ) | 2884 | ) |
2992 | { | 2885 | { |
2993 | return hpi_control_log_get2(ph_subsys, h_control, HPI_VOLUME_GAIN, | 2886 | return hpi_control_log_get2(h_control, HPI_VOLUME_GAIN, |
2994 | &an_log_gain[0], &an_log_gain[1]); | 2887 | &an_log_gain[0], &an_log_gain[1]); |
2995 | } | 2888 | } |
2996 | 2889 | ||
2997 | u16 hpi_volume_query_range(const struct hpi_hsubsys *ph_subsys, u32 h_control, | 2890 | u16 hpi_volume_query_range(u32 h_control, short *min_gain_01dB, |
2998 | short *min_gain_01dB, short *max_gain_01dB, short *step_gain_01dB) | 2891 | short *max_gain_01dB, short *step_gain_01dB) |
2999 | { | 2892 | { |
3000 | struct hpi_message hm; | 2893 | struct hpi_message hm; |
3001 | struct hpi_response hr; | 2894 | struct hpi_response hr; |
3002 | 2895 | ||
3003 | hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, | 2896 | hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, |
3004 | HPI_CONTROL_GET_STATE); | 2897 | HPI_CONTROL_GET_STATE); |
3005 | u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); | 2898 | if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index)) |
2899 | return HPI_ERROR_INVALID_HANDLE; | ||
3006 | hm.u.c.attribute = HPI_VOLUME_RANGE; | 2900 | hm.u.c.attribute = HPI_VOLUME_RANGE; |
3007 | 2901 | ||
3008 | hpi_send_recv(&hm, &hr); | 2902 | hpi_send_recv(&hm, &hr); |
@@ -3020,16 +2914,17 @@ u16 hpi_volume_query_range(const struct hpi_hsubsys *ph_subsys, u32 h_control, | |||
3020 | return hr.error; | 2914 | return hr.error; |
3021 | } | 2915 | } |
3022 | 2916 | ||
3023 | u16 hpi_volume_auto_fade_profile(const struct hpi_hsubsys *ph_subsys, | 2917 | u16 hpi_volume_auto_fade_profile(u32 h_control, |
3024 | u32 h_control, short an_stop_gain0_01dB[HPI_MAX_CHANNELS], | 2918 | short an_stop_gain0_01dB[HPI_MAX_CHANNELS], u32 duration_ms, |
3025 | u32 duration_ms, u16 profile) | 2919 | u16 profile) |
3026 | { | 2920 | { |
3027 | struct hpi_message hm; | 2921 | struct hpi_message hm; |
3028 | struct hpi_response hr; | 2922 | struct hpi_response hr; |
3029 | 2923 | ||
3030 | hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, | 2924 | hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, |
3031 | HPI_CONTROL_SET_STATE); | 2925 | HPI_CONTROL_SET_STATE); |
3032 | u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); | 2926 | if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index)) |
2927 | return HPI_ERROR_INVALID_HANDLE; | ||
3033 | 2928 | ||
3034 | memcpy(hm.u.c.an_log_value, an_stop_gain0_01dB, | 2929 | memcpy(hm.u.c.an_log_value, an_stop_gain0_01dB, |
3035 | sizeof(short) * HPI_MAX_CHANNELS); | 2930 | sizeof(short) * HPI_MAX_CHANNELS); |
@@ -3043,21 +2938,21 @@ u16 hpi_volume_auto_fade_profile(const struct hpi_hsubsys *ph_subsys, | |||
3043 | return hr.error; | 2938 | return hr.error; |
3044 | } | 2939 | } |
3045 | 2940 | ||
3046 | u16 hpi_volume_auto_fade(const struct hpi_hsubsys *ph_subsys, u32 h_control, | 2941 | u16 hpi_volume_auto_fade(u32 h_control, |
3047 | short an_stop_gain0_01dB[HPI_MAX_CHANNELS], u32 duration_ms) | 2942 | short an_stop_gain0_01dB[HPI_MAX_CHANNELS], u32 duration_ms) |
3048 | { | 2943 | { |
3049 | return hpi_volume_auto_fade_profile(ph_subsys, h_control, | 2944 | return hpi_volume_auto_fade_profile(h_control, an_stop_gain0_01dB, |
3050 | an_stop_gain0_01dB, duration_ms, HPI_VOLUME_AUTOFADE_LOG); | 2945 | duration_ms, HPI_VOLUME_AUTOFADE_LOG); |
3051 | } | 2946 | } |
3052 | 2947 | ||
3053 | u16 hpi_vox_set_threshold(const struct hpi_hsubsys *ph_subsys, u32 h_control, | 2948 | u16 hpi_vox_set_threshold(u32 h_control, short an_gain0_01dB) |
3054 | short an_gain0_01dB) | ||
3055 | { | 2949 | { |
3056 | struct hpi_message hm; | 2950 | struct hpi_message hm; |
3057 | struct hpi_response hr; | 2951 | struct hpi_response hr; |
3058 | hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, | 2952 | hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, |
3059 | HPI_CONTROL_SET_STATE); | 2953 | HPI_CONTROL_SET_STATE); |
3060 | u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); | 2954 | if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index)) |
2955 | return HPI_ERROR_INVALID_HANDLE; | ||
3061 | hm.u.c.attribute = HPI_VOX_THRESHOLD; | 2956 | hm.u.c.attribute = HPI_VOX_THRESHOLD; |
3062 | 2957 | ||
3063 | hm.u.c.an_log_value[0] = an_gain0_01dB; | 2958 | hm.u.c.an_log_value[0] = an_gain0_01dB; |
@@ -3067,14 +2962,14 @@ u16 hpi_vox_set_threshold(const struct hpi_hsubsys *ph_subsys, u32 h_control, | |||
3067 | return hr.error; | 2962 | return hr.error; |
3068 | } | 2963 | } |
3069 | 2964 | ||
3070 | u16 hpi_vox_get_threshold(const struct hpi_hsubsys *ph_subsys, u32 h_control, | 2965 | u16 hpi_vox_get_threshold(u32 h_control, short *an_gain0_01dB) |
3071 | short *an_gain0_01dB) | ||
3072 | { | 2966 | { |
3073 | struct hpi_message hm; | 2967 | struct hpi_message hm; |
3074 | struct hpi_response hr; | 2968 | struct hpi_response hr; |
3075 | hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, | 2969 | hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, |
3076 | HPI_CONTROL_GET_STATE); | 2970 | HPI_CONTROL_GET_STATE); |
3077 | u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); | 2971 | if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index)) |
2972 | return HPI_ERROR_INVALID_HANDLE; | ||
3078 | hm.u.c.attribute = HPI_VOX_THRESHOLD; | 2973 | hm.u.c.attribute = HPI_VOX_THRESHOLD; |
3079 | 2974 | ||
3080 | hpi_send_recv(&hm, &hr); | 2975 | hpi_send_recv(&hm, &hr); |