21 const u16 object_index)
25 handle.
h.adapter_index = adapter_index;
27 handle.
h.read_only = 0;
28 handle.
h.obj_type = c_object;
29 handle.
h.obj_index = object_index;
41 *p1 = (
u16)uhandle.h.adapter_index;
43 *p2 = (
u16)uhandle.h.obj_index;
51 hpi_handle_indexes(handle, pw_adapter_index, pw_object_index);
58 return (
char)uhandle.
h.obj_type;
71 static void hpi_msg_to_format(
struct hpi_format *pF,
104 *pversion_ex = hr.
u.
s.data;
115 *pn_num_adapters = (
int)hr.
u.
s.num_adapters;
120 u16 *pw_adapter_type)
128 *padapter_index = (
int)hr.
u.
s.adapter_index;
129 *pw_adapter_type = hr.
u.
s.adapter_type;
176 hm.
u.
ax.
mode.adapter_mode = adapter_mode;
177 hm.
u.
ax.
mode.query_or_set = query_or_set;
191 *padapter_mode = hr.
u.
ax.
mode.adapter_mode;
196 u16 *pw_num_instreams,
u16 *pw_version,
u32 *pserial_number,
197 u16 *pw_adapter_type)
207 *pw_adapter_type = hr.
u.
ax.
info.adapter_type;
208 *pw_num_outstreams = hr.
u.
ax.
info.num_outstreams;
209 *pw_num_instreams = hr.
u.
ax.
info.num_instreams;
210 *pw_version = hr.
u.
ax.
info.version;
211 *pserial_number = hr.
u.
ax.
info.serial_number;
216 u16 *pw_num_outputs,
u16 *pw_num_inputs,
u16 *pw_version,
217 u32 *pserial_number,
u16 *pw_module_type,
u32 *ph_module)
229 *pw_module_type = hr.
u.
ax.
info.adapter_type;
230 *pw_num_outputs = hr.
u.
ax.
info.num_outstreams;
231 *pw_num_inputs = hr.
u.
ax.
info.num_instreams;
232 *pw_version = hr.
u.
ax.
info.version;
233 *pserial_number = hr.
u.
ax.
info.serial_number;
257 u16 *pw_parameter1,
u16 *pw_parameter2)
278 u16 what_to_enumerate,
u16 property_index,
u32 *psetting)
327 if (sample_rate < 8000
L) {
331 if (sample_rate > 200000
L) {
333 sample_rate = 200000
L;
345 fmt.
bit_rate = channels * sample_rate * 2;
349 fmt.
bit_rate = channels * sample_rate * 4;
374 hpi_msg_to_format(p_format, &fmt);
379 u32 host_polling_rate_in_milli_seconds,
u32 *recommended_buffer_size)
382 u32 bytes_per_second;
411 bytes_per_second = 256000
L / 8
L;
416 size = (bytes_per_second * host_polling_rate_in_milli_seconds * 2) /
419 *recommended_buffer_size =
471 u32 *pbuffer_size,
u32 *pdata_to_play,
u32 *psamples_played,
472 u32 *pauxiliary_data_to_play)
484 *pw_state = hr.
u.
d.u.stream_info.state;
486 *pbuffer_size = hr.
u.
d.u.stream_info.buffer_size;
488 *pdata_to_play = hr.
u.
d.u.stream_info.data_available;
490 *psamples_played = hr.
u.
d.u.stream_info.samples_transferred;
491 if (pauxiliary_data_to_play)
492 *pauxiliary_data_to_play =
493 hr.
u.
d.u.stream_info.auxiliary_data_available;
506 hm.
u.
d.u.data.pb_data = (
u8 *)pb_data;
507 hm.
u.
d.u.data.data_size = bytes_to_write;
629 hm.
u.
d.u.velocity = velocity;
637 u32 punch_out_sample)
647 hm.
u.
d.u.pio.punch_in_sample = punch_in_sample;
648 hm.
u.
d.u.pio.punch_out_sample = punch_out_sample;
664 hm.
u.
d.u.data.format.channels =
mode;
680 if (pframes_available)
682 hr.
u.
d.u.stream_info.data_available /
690 u32 anc_frame_buffer_size_in_bytes,
691 u32 number_of_ancillary_frames_to_read)
700 hm.
u.
d.u.data.pb_data = (
u8 *)p_anc_frame_buffer;
701 hm.
u.
d.u.data.data_size =
702 number_of_ancillary_frames_to_read *
704 if (hm.
u.
d.u.data.data_size <= anc_frame_buffer_size_in_bytes)
721 hm.
u.
d.u.time_scale = time_scale;
737 hm.
u.
d.u.data.data_size = size_in_bytes;
756 *pp_buffer = hr.
u.
d.u.hostbuffer_info.p_buffer;
758 *pp_status = hr.
u.
d.u.hostbuffer_info.p_status;
789 if (hpi_handle_indexes(h_stream, &adapter,
790 &hm.
u.
d.u.stream.stream_index))
794 switch (c_obj_type) {
797 hm.
u.
d.u.stream.object_type = c_obj_type;
822 *poutstream_map = hr.
u.
d.u.group_info.outstream_group_map;
824 *pinstream_map = hr.
u.
d.u.group_info.instream_group_map;
930 hm.
u.
d.u.data.data_size = bytes_to_read;
931 hm.
u.
d.u.data.pb_data = pb_data;
999 u32 *pdata_recorded,
u32 *psamples_recorded,
1000 u32 *pauxiliary_data_recorded)
1012 *pw_state = hr.
u.
d.u.stream_info.state;
1014 *pbuffer_size = hr.
u.
d.u.stream_info.buffer_size;
1016 *pdata_recorded = hr.
u.
d.u.stream_info.data_available;
1017 if (psamples_recorded)
1018 *psamples_recorded = hr.
u.
d.u.stream_info.samples_transferred;
1019 if (pauxiliary_data_recorded)
1020 *pauxiliary_data_recorded =
1021 hr.
u.
d.u.stream_info.auxiliary_data_available;
1035 hm.
u.
d.u.data.format.format = (mode << 8) | (alignment & 0xff);
1036 hm.
u.
d.u.data.format.channels = idle_bit;
1052 (hr.
u.
d.u.stream_info.buffer_size -
1053 hr.
u.
d.u.stream_info.data_available) /
1060 u32 anc_frame_buffer_size_in_bytes,
1061 u32 number_of_ancillary_frames_to_write)
1070 hm.
u.
d.u.data.pb_data = (
u8 *)p_anc_frame_buffer;
1071 hm.
u.
d.u.data.data_size =
1072 number_of_ancillary_frames_to_write *
1074 if (hm.
u.
d.u.data.data_size <= anc_frame_buffer_size_in_bytes)
1091 hm.
u.
d.u.data.data_size = size_in_bytes;
1108 if (hr.
error == 0) {
1110 *pp_buffer = hr.
u.
d.u.hostbuffer_info.p_buffer;
1112 *pp_status = hr.
u.
d.u.hostbuffer_info.p_status;
1145 if (hpi_handle_indexes(h_stream, &adapter,
1146 &hm.
u.
d.u.stream.stream_index))
1151 switch (c_obj_type) {
1154 hm.
u.
d.u.stream.object_type = c_obj_type;
1180 *poutstream_map = hr.
u.
d.u.group_info.outstream_group_map;
1182 *pinstream_map = hr.
u.
d.u.group_info.instream_group_map;
1232 u16 src_node_type_index,
u16 dst_node_type,
u16 dst_node_type_index,
1233 u16 control_type,
u32 *ph_control)
1241 hm.
u.
m.node_type1 = src_node_type;
1242 hm.
u.
m.node_index1 = src_node_type_index;
1243 hm.
u.
m.node_type2 = dst_node_type;
1244 hm.
u.
m.node_index2 = dst_node_type_index;
1245 hm.
u.
m.control_type = control_type;
1259 u16 *pw_src_node_type,
u16 *pw_src_node_index,
u16 *pw_dst_node_type,
1260 u16 *pw_dst_node_index,
u16 *pw_control_type,
u32 *ph_control)
1268 hm.
u.
m.control_index = control_index;
1271 if (pw_src_node_type) {
1274 *pw_src_node_index = hr.
u.
m.src_node_index;
1276 *pw_dst_node_index = hr.
u.
m.dst_node_index;
1278 if (pw_control_type)
1279 *pw_control_type = hr.
u.
m.control_index;
1307 u16 hpi_control_param_set(
const u32 h_control,
const u16 attrib,
1315 if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index))
1317 hm.u.c.attribute = attrib;
1319 hm.u.c.param2 = param2;
1324 static u16 hpi_control_log_set2(
u32 h_control,
u16 attrib,
short sv0,
1332 if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index))
1334 hm.u.c.attribute = attrib;
1335 hm.u.c.an_log_value[0] = sv0;
1336 hm.u.c.an_log_value[1] = sv1;
1342 u16 hpi_control_param_get(
const u32 h_control,
const u16 attrib,
u32 param1,
1350 if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index))
1352 hm.u.c.attribute = attrib;
1354 hm.u.c.param2 = param2;
1357 *pparam1 = hr.u.c.param1;
1359 *pparam2 = hr.u.c.param2;
1364 #define hpi_control_param1_get(h, a, p1) \
1365 hpi_control_param_get(h, a, 0, 0, p1, NULL)
1366 #define hpi_control_param2_get(h, a, p1, p2) \
1367 hpi_control_param_get(h, a, 0, 0, p1, p2)
1369 static u16 hpi_control_log_get2(
u32 h_control,
u16 attrib,
short *sv0,
1378 hm.
u.
c.attribute = attrib;
1381 *sv0 = hr.
u.
c.an_log_value[0];
1383 *sv1 = hr.
u.
c.an_log_value[1];
1396 if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index))
1399 hm.u.c.attribute = attrib;
1400 hm.u.c.param1 =
index;
1401 hm.u.c.param2 =
param;
1404 *psetting = hr.u.c.param1;
1410 char *psz_string,
const u32 string_length)
1412 unsigned int sub_string_index = 0,
j = 0;
1417 if ((string_length < 1) || (string_length > 256))
1419 for (sub_string_index = 0; sub_string_index < string_length;
1420 sub_string_index += 8) {
1426 if (hpi_handle_indexes(h_control, &hm.adapter_index,
1430 hm.u.c.param1 = sub_string_index;
1434 if (sub_string_index == 0
1435 && (hr.u.cu.chars8.remaining_chars + 8) >
1443 for (
j = 0;
j < 8;
j++) {
1444 c = hr.u.cu.chars8.sz_data[
j];
1445 psz_string[sub_string_index +
j] =
c;
1447 if (n >= string_length) {
1448 psz_string[string_length - 1] = 0;
1456 if ((hr.u.cu.chars8.remaining_chars == 0)
1457 && ((sub_string_index +
j) < string_length)
1460 psz_string[sub_string_index +
j] =
c;
1475 *pw_format = (
u16)qr;
1491 if (!err && pw_format)
1492 *pw_format = (
u16)param;
1517 *pw_data = (
u16)hr.
u.
c.param2;
1536 *pw_data = (
u16)hr.
u.
c.param2;
1548 *pw_error_data = (
u16)error_data;
1584 *pw_format = (
u16)qr;
1600 if (!err && pw_output_format)
1601 *pw_output_format = (
u16)param;
1619 u16 *pw_data_activity)
1629 if (pw_clk_activity)
1630 *pw_clk_activity = (
u16)hr.
u.
c.param1;
1631 if (pw_data_activity)
1632 *pw_data_activity = (
u16)hr.
u.
c.param2;
1659 *mode = (
u16)mode32;
1672 if (hpi_handle_indexes(h_control, &hm.
h.adapter_index,
1676 if (byte_count >
sizeof(hm.
bytes))
1680 hm.
p.byte_count = byte_count;
1681 hm.
p.hmi_address = hmi_address;
1683 hm.
h.size = (
u16)(
sizeof(hm.
h) +
sizeof(hm.
p) + byte_count);
1685 hpi_send_recvV1(&hm.
h, &hr);
1690 u32 *pbyte_count,
u8 *pb_data)
1698 if (hpi_handle_indexes(h_control, &hm.
h.adapter_index,
1702 if (max_byte_count >
sizeof(hr.
bytes))
1706 hm.
p.byte_count = max_byte_count;
1707 hm.
p.hmi_address = hmi_address;
1709 hpi_send_recvV1(&hm.
h, &hr.
h);
1711 if (!hr.
h.error && pb_data) {
1719 max_byte_count = *pbyte_count;
1727 u32 *preadable_size,
u32 *pwriteable_size)
1746 if (pwriteable_size)
1764 ((iP & 0xff000000) >> 8) | ((iP & 0x00ff0000) << 8) | ((iP &
1765 0x0000ff00) >> 8) | ((iP & 0x000000ff) << 8);
1768 *pdw_ip_address = 0;
1779 iP = ((dw_ip_address & 0xff000000) >> 8) | ((dw_ip_address &
1780 0x00ff0000) << 8) | ((dw_ip_address & 0x0000ff00) >>
1781 8) | ((dw_ip_address & 0x000000ff) << 8);
1800 ((iP & 0xff000000) >> 8) | ((iP & 0x00ff0000) << 8) | ((iP &
1801 0x0000ff00) >> 8) | ((iP & 0x000000ff) << 8);
1804 *pdw_ip_address = 0;
1815 iP = ((dw_ip_address & 0xff000000) >> 8) | ((dw_ip_address &
1816 0x00ff0000) << 8) | ((dw_ip_address & 0x0000ff00) >>
1817 8) | ((dw_ip_address & 0x000000ff) << 8);
1839 ((mac & 0xff000000) >> 8) | ((mac & 0x00ff0000) << 8)
1840 | ((mac & 0x0000ff00) >> 8) | ((mac & 0x000000ff) <<
1845 &byte_count, (
u8 *)&mac);
1850 ((mac & 0xff000000) >> 8) | ((mac & 0x00ff0000) << 8)
1851 | ((mac & 0x0000ff00) >> 8) | ((mac & 0x000000ff) <<
1875 makeup_gain0_01dB, 0);
1881 makeup_gain0_01dB,
NULL);
1895 index, attack,
NULL);
1914 short threshold0_01dB)
1925 hm.
u.
c.an_log_value[0] = threshold0_01dB;
1933 short *threshold0_01dB)
1946 *threshold0_01dB = hr.
u.
c.an_log_value[0];
1964 short *max_gain_01dB,
short *step_gain_01dB)
1977 hr.
u.
c.an_log_value[0] = 0;
1978 hr.
u.
c.an_log_value[1] = 0;
1982 *min_gain_01dB = hr.
u.
c.an_log_value[0];
1984 *max_gain_01dB = hr.
u.
c.an_log_value[1];
1986 *step_gain_01dB = (
short)hr.
u.
c.param1;
1994 an_gain0_01dB[0], an_gain0_01dB[1]);
2001 &an_gain0_01dB[0], &an_gain0_01dB[1]);
2028 memcpy(an_peakdB, hr.
u.
c.an_log_value,
2029 sizeof(
short) * HPI_MAX_CHANNELS);
2053 memcpy(an_rmsdB, hr.
u.
c.an_log_value,
2054 sizeof(
short) * HPI_MAX_CHANNELS);
2078 *pn_attack = (
unsigned short)attack;
2080 *pn_decay = (
unsigned short)decay;
2102 *pn_attack = (
short)attack;
2104 *pn_decay = (
short)decay;
2122 *pw_on_off = (
u16)on_off;
2127 u16 source_node_index)
2130 source_node_type, source_node_index);
2134 u16 *source_node_index)
2140 if (source_node_type)
2141 *source_node_type = (
u16)node;
2142 if (source_node_index)
2143 *source_node_index = (
u16)index;
2148 u16 *source_node_type,
u16 *source_node_index)
2161 if (source_node_type)
2162 *source_node_type = (
u16)hr.
u.
c.param1;
2163 if (source_node_index)
2164 *source_node_index = (
u16)hr.
u.
c.param2;
2177 if (pw_number_of_bands)
2178 *pw_number_of_bands = (
u16)oB;
2180 *pw_on_off = (
u16)oO;
2191 u32 *pfrequency_hz,
short *pnQ100,
short *pn_gain0_01dB)
2206 *pfrequency_hz = hr.
u.
c.param1;
2208 *pn_type = (
u16)(hr.
u.
c.param2 >> 16);
2210 *pnQ100 = hr.
u.
c.an_log_value[1];
2212 *pn_gain0_01dB = hr.
u.
c.an_log_value[0];
2218 u32 frequency_hz,
short q100,
short gain0_01dB)
2228 hm.
u.
c.param1 = frequency_hz;
2229 hm.
u.
c.param2 = (index & 0xFFFF
L) + ((
u32)type << 16);
2230 hm.
u.
c.an_log_value[0] = gain0_01dB;
2231 hm.
u.
c.an_log_value[1] = q100;
2254 coeffs[0] = (
short)hr.
u.
c.an_log_value[0];
2255 coeffs[1] = (
short)hr.
u.
c.an_log_value[1];
2256 coeffs[2] = (
short)hr.
u.
c.param1;
2257 coeffs[3] = (
short)(hr.
u.
c.param1 >> 16);
2258 coeffs[4] = (
short)hr.
u.
c.param2;
2271 *pw_source = (
u16)qr;
2289 *pw_source = (
u16)source;
2301 *pw_source_index = (
u16)qr;
2314 u32 source_index = 0;
2318 if (pw_source_index)
2319 *pw_source_index = (
u16)source_index;
2335 return hpi_control_param_set(h_control,
2347 *psample_rate = sample_rate;
2359 *psample_rate = sample_rate;
2390 index, 0, frequency,
NULL);
2413 (
u32)event_enable, 0);
2499 return hpi_control_param_set(h_control,
HPI_TUNER_BAND, band, 0);
2509 *pw_band = (
u16)band;
2514 const u16 band,
u32 *pfreq)
2516 return hpi_control_query(h_tuner,
HPI_TUNER_FREQ, index, band, pfreq);
2521 return hpi_control_param_set(h_control,
HPI_TUNER_FREQ, freq_ink_hz,
2543 return hpi_control_param_set(h_control,
HPI_TUNER_GAIN, gain, 0);
2553 *pn_gain = (
u16)gain;
2590 const u16 band,
u32 *pdeemphasis)
2628 return hpi_control_get_string(h_control,
2635 return hpi_control_get_string(h_control,
2647 *pw_status_mask = (
u16)(status >> 16);
2648 *pw_status = (
u16)(status & 0xFFFF);
2650 *pw_status_mask = 0;
2659 return hpi_control_param_set(h_control,
HPI_TUNER_MODE, mode, value);
2709 psz_string, data_length);
2714 return hpi_control_get_string(h_control,
HPI_PAD_ARTIST, psz_string,
2720 return hpi_control_get_string(h_control,
HPI_PAD_TITLE, psz_string,
2751 an_log_gain[0], an_log_gain[1]);
2758 &an_log_gain[0], &an_log_gain[1]);
2772 short *max_gain_01dB,
short *step_gain_01dB)
2785 hr.
u.
c.an_log_value[0] = 0;
2786 hr.
u.
c.an_log_value[1] = 0;
2790 *min_gain_01dB = hr.
u.
c.an_log_value[0];
2792 *max_gain_01dB = hr.
u.
c.an_log_value[1];
2794 *step_gain_01dB = (
short)hr.
u.
c.param1;
2810 memcpy(hm.
u.
c.an_log_value, an_stop_gain0_01dB,
2811 sizeof(
short) * HPI_MAX_CHANNELS);
2849 hm.
u.
c.an_log_value[0] = an_gain0_01dB;
2868 *an_gain0_01dB = hr.
u.
c.an_log_value[0];