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 | |
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')
-rw-r--r-- | sound/pci/asihpi/asihpi.c | 429 | ||||
-rw-r--r-- | sound/pci/asihpi/hpi.h | 923 | ||||
-rw-r--r-- | sound/pci/asihpi/hpi_internal.h | 33 | ||||
-rw-r--r-- | sound/pci/asihpi/hpifunc.c | 1385 | ||||
-rw-r--r-- | sound/pci/asihpi/hpioctl.c | 2 |
5 files changed, 1270 insertions, 1502 deletions
diff --git a/sound/pci/asihpi/asihpi.c b/sound/pci/asihpi/asihpi.c index 31d7295f5c71..8dda81aac433 100644 --- a/sound/pci/asihpi/asihpi.c +++ b/sound/pci/asihpi/asihpi.c | |||
@@ -97,13 +97,14 @@ static const int mixer_dump; | |||
97 | #define DEFAULT_SAMPLERATE 44100 | 97 | #define DEFAULT_SAMPLERATE 44100 |
98 | static int adapter_fs = DEFAULT_SAMPLERATE; | 98 | static int adapter_fs = DEFAULT_SAMPLERATE; |
99 | 99 | ||
100 | static struct hpi_hsubsys *ss; /* handle to HPI audio subsystem */ | ||
101 | |||
102 | /* defaults */ | 100 | /* defaults */ |
103 | #define PERIODS_MIN 2 | 101 | #define PERIODS_MIN 2 |
104 | #define PERIOD_BYTES_MIN 2048 | 102 | #define PERIOD_BYTES_MIN 2048 |
105 | #define BUFFER_BYTES_MAX (512 * 1024) | 103 | #define BUFFER_BYTES_MAX (512 * 1024) |
106 | 104 | ||
105 | /* convert stream to character */ | ||
106 | #define SCHR(s) ((s == SNDRV_PCM_STREAM_PLAYBACK) ? 'P' : 'C') | ||
107 | |||
107 | /*#define TIMER_MILLISECONDS 20 | 108 | /*#define TIMER_MILLISECONDS 20 |
108 | #define FORCE_TIMER_JIFFIES ((TIMER_MILLISECONDS * HZ + 999)/1000) | 109 | #define FORCE_TIMER_JIFFIES ((TIMER_MILLISECONDS * HZ + 999)/1000) |
109 | */ | 110 | */ |
@@ -149,8 +150,8 @@ struct snd_card_asihpi_pcm { | |||
149 | struct timer_list timer; | 150 | struct timer_list timer; |
150 | unsigned int respawn_timer; | 151 | unsigned int respawn_timer; |
151 | unsigned int hpi_buffer_attached; | 152 | unsigned int hpi_buffer_attached; |
152 | unsigned int pcm_size; | 153 | unsigned int buffer_bytes; |
153 | unsigned int pcm_count; | 154 | unsigned int period_bytes; |
154 | unsigned int bytes_per_sec; | 155 | unsigned int bytes_per_sec; |
155 | unsigned int pcm_buf_host_rw_ofs; /* Host R/W pos */ | 156 | unsigned int pcm_buf_host_rw_ofs; /* Host R/W pos */ |
156 | unsigned int pcm_buf_dma_ofs; /* DMA R/W offset in buffer */ | 157 | unsigned int pcm_buf_dma_ofs; /* DMA R/W offset in buffer */ |
@@ -165,7 +166,6 @@ struct snd_card_asihpi_pcm { | |||
165 | /* Functions to allow driver to give a buffer to HPI for busmastering */ | 166 | /* Functions to allow driver to give a buffer to HPI for busmastering */ |
166 | 167 | ||
167 | static u16 hpi_stream_host_buffer_attach( | 168 | static u16 hpi_stream_host_buffer_attach( |
168 | struct hpi_hsubsys *hS, | ||
169 | u32 h_stream, /* handle to outstream. */ | 169 | u32 h_stream, /* handle to outstream. */ |
170 | u32 size_in_bytes, /* size in bytes of bus mastering buffer */ | 170 | u32 size_in_bytes, /* size in bytes of bus mastering buffer */ |
171 | u32 pci_address | 171 | u32 pci_address |
@@ -192,10 +192,7 @@ static u16 hpi_stream_host_buffer_attach( | |||
192 | return hr.error; | 192 | return hr.error; |
193 | } | 193 | } |
194 | 194 | ||
195 | static u16 hpi_stream_host_buffer_detach( | 195 | static u16 hpi_stream_host_buffer_detach(u32 h_stream) |
196 | struct hpi_hsubsys *hS, | ||
197 | u32 h_stream | ||
198 | ) | ||
199 | { | 196 | { |
200 | struct hpi_message hm; | 197 | struct hpi_message hm; |
201 | struct hpi_response hr; | 198 | struct hpi_response hr; |
@@ -216,24 +213,23 @@ static u16 hpi_stream_host_buffer_detach( | |||
216 | return hr.error; | 213 | return hr.error; |
217 | } | 214 | } |
218 | 215 | ||
219 | static inline u16 hpi_stream_start(struct hpi_hsubsys *hS, u32 h_stream) | 216 | static inline u16 hpi_stream_start(u32 h_stream) |
220 | { | 217 | { |
221 | if (hpi_handle_object(h_stream) == HPI_OBJ_OSTREAM) | 218 | if (hpi_handle_object(h_stream) == HPI_OBJ_OSTREAM) |
222 | return hpi_outstream_start(hS, h_stream); | 219 | return hpi_outstream_start(h_stream); |
223 | else | 220 | else |
224 | return hpi_instream_start(hS, h_stream); | 221 | return hpi_instream_start(h_stream); |
225 | } | 222 | } |
226 | 223 | ||
227 | static inline u16 hpi_stream_stop(struct hpi_hsubsys *hS, u32 h_stream) | 224 | static inline u16 hpi_stream_stop(u32 h_stream) |
228 | { | 225 | { |
229 | if (hpi_handle_object(h_stream) == HPI_OBJ_OSTREAM) | 226 | if (hpi_handle_object(h_stream) == HPI_OBJ_OSTREAM) |
230 | return hpi_outstream_stop(hS, h_stream); | 227 | return hpi_outstream_stop(h_stream); |
231 | else | 228 | else |
232 | return hpi_instream_stop(hS, h_stream); | 229 | return hpi_instream_stop(h_stream); |
233 | } | 230 | } |
234 | 231 | ||
235 | static inline u16 hpi_stream_get_info_ex( | 232 | static inline u16 hpi_stream_get_info_ex( |
236 | struct hpi_hsubsys *hS, | ||
237 | u32 h_stream, | 233 | u32 h_stream, |
238 | u16 *pw_state, | 234 | u16 *pw_state, |
239 | u32 *pbuffer_size, | 235 | u32 *pbuffer_size, |
@@ -244,42 +240,41 @@ static inline u16 hpi_stream_get_info_ex( | |||
244 | { | 240 | { |
245 | u16 e; | 241 | u16 e; |
246 | if (hpi_handle_object(h_stream) == HPI_OBJ_OSTREAM) | 242 | if (hpi_handle_object(h_stream) == HPI_OBJ_OSTREAM) |
247 | e = hpi_outstream_get_info_ex(hS, h_stream, pw_state, | 243 | e = hpi_outstream_get_info_ex(h_stream, pw_state, |
248 | pbuffer_size, pdata_in_buffer, | 244 | pbuffer_size, pdata_in_buffer, |
249 | psample_count, pauxiliary_data); | 245 | psample_count, pauxiliary_data); |
250 | else | 246 | else |
251 | e = hpi_instream_get_info_ex(hS, h_stream, pw_state, | 247 | e = hpi_instream_get_info_ex(h_stream, pw_state, |
252 | pbuffer_size, pdata_in_buffer, | 248 | pbuffer_size, pdata_in_buffer, |
253 | psample_count, pauxiliary_data); | 249 | psample_count, pauxiliary_data); |
254 | return e; | 250 | return e; |
255 | } | 251 | } |
256 | 252 | ||
257 | static inline u16 hpi_stream_group_add(struct hpi_hsubsys *hS, | 253 | static inline u16 hpi_stream_group_add( |
258 | u32 h_master, | 254 | u32 h_master, |
259 | u32 h_stream) | 255 | u32 h_stream) |
260 | { | 256 | { |
261 | if (hpi_handle_object(h_master) == HPI_OBJ_OSTREAM) | 257 | if (hpi_handle_object(h_master) == HPI_OBJ_OSTREAM) |
262 | return hpi_outstream_group_add(hS, h_master, h_stream); | 258 | return hpi_outstream_group_add(h_master, h_stream); |
263 | else | 259 | else |
264 | return hpi_instream_group_add(hS, h_master, h_stream); | 260 | return hpi_instream_group_add(h_master, h_stream); |
265 | } | 261 | } |
266 | 262 | ||
267 | static inline u16 hpi_stream_group_reset(struct hpi_hsubsys *hS, | 263 | static inline u16 hpi_stream_group_reset(u32 h_stream) |
268 | u32 h_stream) | ||
269 | { | 264 | { |
270 | if (hpi_handle_object(h_stream) == HPI_OBJ_OSTREAM) | 265 | if (hpi_handle_object(h_stream) == HPI_OBJ_OSTREAM) |
271 | return hpi_outstream_group_reset(hS, h_stream); | 266 | return hpi_outstream_group_reset(h_stream); |
272 | else | 267 | else |
273 | return hpi_instream_group_reset(hS, h_stream); | 268 | return hpi_instream_group_reset(h_stream); |
274 | } | 269 | } |
275 | 270 | ||
276 | static inline u16 hpi_stream_group_get_map(struct hpi_hsubsys *hS, | 271 | static inline u16 hpi_stream_group_get_map( |
277 | u32 h_stream, u32 *mo, u32 *mi) | 272 | u32 h_stream, u32 *mo, u32 *mi) |
278 | { | 273 | { |
279 | if (hpi_handle_object(h_stream) == HPI_OBJ_OSTREAM) | 274 | if (hpi_handle_object(h_stream) == HPI_OBJ_OSTREAM) |
280 | return hpi_outstream_group_get_map(hS, h_stream, mo, mi); | 275 | return hpi_outstream_group_get_map(h_stream, mo, mi); |
281 | else | 276 | else |
282 | return hpi_instream_group_get_map(hS, h_stream, mo, mi); | 277 | return hpi_instream_group_get_map(h_stream, mo, mi); |
283 | } | 278 | } |
284 | 279 | ||
285 | static u16 handle_error(u16 err, int line, char *filename) | 280 | static u16 handle_error(u16 err, int line, char *filename) |
@@ -335,7 +330,7 @@ static snd_pcm_format_t hpi_to_alsa_formats[] = { | |||
335 | */ | 330 | */ |
336 | -1 | 331 | -1 |
337 | #else | 332 | #else |
338 | /* SNDRV_PCM_FORMAT_S24_3LE */ /* { HPI_FORMAT_PCM24_SIGNED 15 */ | 333 | /* SNDRV_PCM_FORMAT_S24_3LE */ /* HPI_FORMAT_PCM24_SIGNED 15 */ |
339 | #endif | 334 | #endif |
340 | }; | 335 | }; |
341 | 336 | ||
@@ -378,7 +373,7 @@ static void snd_card_asihpi_pcm_samplerates(struct snd_card_asihpi *asihpi, | |||
378 | } else { | 373 | } else { |
379 | /* on cards without SRC, | 374 | /* on cards without SRC, |
380 | valid rates are determined by sampleclock */ | 375 | valid rates are determined by sampleclock */ |
381 | err = hpi_mixer_get_control(ss, asihpi->h_mixer, | 376 | err = hpi_mixer_get_control(asihpi->h_mixer, |
382 | HPI_SOURCENODE_CLOCK_SOURCE, 0, 0, 0, | 377 | HPI_SOURCENODE_CLOCK_SOURCE, 0, 0, 0, |
383 | HPI_CONTROL_SAMPLECLOCK, &h_control); | 378 | HPI_CONTROL_SAMPLECLOCK, &h_control); |
384 | if (err) { | 379 | if (err) { |
@@ -387,7 +382,7 @@ static void snd_card_asihpi_pcm_samplerates(struct snd_card_asihpi *asihpi, | |||
387 | } | 382 | } |
388 | 383 | ||
389 | for (idx = 0; idx < 100; idx++) { | 384 | for (idx = 0; idx < 100; idx++) { |
390 | if (hpi_sample_clock_query_local_rate(ss, | 385 | if (hpi_sample_clock_query_local_rate( |
391 | h_control, idx, &sample_rate)) { | 386 | h_control, idx, &sample_rate)) { |
392 | if (!idx) | 387 | if (!idx) |
393 | snd_printk(KERN_ERR | 388 | snd_printk(KERN_ERR |
@@ -480,10 +475,10 @@ static int snd_card_asihpi_pcm_hw_params(struct snd_pcm_substream *substream, | |||
480 | format, params_rate(params), 0, 0)); | 475 | format, params_rate(params), 0, 0)); |
481 | 476 | ||
482 | if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) { | 477 | if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) { |
483 | if (hpi_instream_reset(ss, dpcm->h_stream) != 0) | 478 | if (hpi_instream_reset(dpcm->h_stream) != 0) |
484 | return -EINVAL; | 479 | return -EINVAL; |
485 | 480 | ||
486 | if (hpi_instream_set_format(ss, | 481 | if (hpi_instream_set_format( |
487 | dpcm->h_stream, &dpcm->format) != 0) | 482 | dpcm->h_stream, &dpcm->format) != 0) |
488 | return -EINVAL; | 483 | return -EINVAL; |
489 | } | 484 | } |
@@ -491,10 +486,10 @@ static int snd_card_asihpi_pcm_hw_params(struct snd_pcm_substream *substream, | |||
491 | dpcm->hpi_buffer_attached = 0; | 486 | dpcm->hpi_buffer_attached = 0; |
492 | if (card->support_mmap) { | 487 | if (card->support_mmap) { |
493 | 488 | ||
494 | err = hpi_stream_host_buffer_attach(ss, dpcm->h_stream, | 489 | err = hpi_stream_host_buffer_attach(dpcm->h_stream, |
495 | params_buffer_bytes(params), runtime->dma_addr); | 490 | params_buffer_bytes(params), runtime->dma_addr); |
496 | if (err == 0) { | 491 | if (err == 0) { |
497 | snd_printd(KERN_INFO | 492 | VPRINTK1(KERN_INFO |
498 | "stream_host_buffer_attach succeeded %u %lu\n", | 493 | "stream_host_buffer_attach succeeded %u %lu\n", |
499 | params_buffer_bytes(params), | 494 | params_buffer_bytes(params), |
500 | (unsigned long)runtime->dma_addr); | 495 | (unsigned long)runtime->dma_addr); |
@@ -505,11 +500,11 @@ static int snd_card_asihpi_pcm_hw_params(struct snd_pcm_substream *substream, | |||
505 | return -ENOMEM; | 500 | return -ENOMEM; |
506 | } | 501 | } |
507 | 502 | ||
508 | err = hpi_stream_get_info_ex(ss, dpcm->h_stream, NULL, | 503 | err = hpi_stream_get_info_ex(dpcm->h_stream, NULL, |
509 | &dpcm->hpi_buffer_attached, | 504 | &dpcm->hpi_buffer_attached, |
510 | NULL, NULL, NULL); | 505 | NULL, NULL, NULL); |
511 | 506 | ||
512 | snd_printd(KERN_INFO "stream_host_buffer_attach status 0x%x\n", | 507 | VPRINTK1(KERN_INFO "stream_host_buffer_attach status 0x%x\n", |
513 | dpcm->hpi_buffer_attached); | 508 | dpcm->hpi_buffer_attached); |
514 | } | 509 | } |
515 | bytes_per_sec = params_rate(params) * params_channels(params); | 510 | bytes_per_sec = params_rate(params) * params_channels(params); |
@@ -520,10 +515,10 @@ static int snd_card_asihpi_pcm_hw_params(struct snd_pcm_substream *substream, | |||
520 | return -EINVAL; | 515 | return -EINVAL; |
521 | 516 | ||
522 | dpcm->bytes_per_sec = bytes_per_sec; | 517 | dpcm->bytes_per_sec = bytes_per_sec; |
523 | dpcm->pcm_size = params_buffer_bytes(params); | 518 | dpcm->buffer_bytes = params_buffer_bytes(params); |
524 | dpcm->pcm_count = params_period_bytes(params); | 519 | dpcm->period_bytes = params_period_bytes(params); |
525 | snd_printd(KERN_INFO "pcm_size=%d, pcm_count=%d, bps=%d\n", | 520 | VPRINTK1(KERN_INFO "buffer_bytes=%d, period_bytes=%d, bps=%d\n", |
526 | dpcm->pcm_size, dpcm->pcm_count, bytes_per_sec); | 521 | dpcm->buffer_bytes, dpcm->period_bytes, bytes_per_sec); |
527 | 522 | ||
528 | return 0; | 523 | return 0; |
529 | } | 524 | } |
@@ -534,7 +529,7 @@ snd_card_asihpi_hw_free(struct snd_pcm_substream *substream) | |||
534 | struct snd_pcm_runtime *runtime = substream->runtime; | 529 | struct snd_pcm_runtime *runtime = substream->runtime; |
535 | struct snd_card_asihpi_pcm *dpcm = runtime->private_data; | 530 | struct snd_card_asihpi_pcm *dpcm = runtime->private_data; |
536 | if (dpcm->hpi_buffer_attached) | 531 | if (dpcm->hpi_buffer_attached) |
537 | hpi_stream_host_buffer_detach(ss, dpcm->h_stream); | 532 | hpi_stream_host_buffer_detach(dpcm->h_stream); |
538 | 533 | ||
539 | snd_pcm_lib_free_pages(substream); | 534 | snd_pcm_lib_free_pages(substream); |
540 | return 0; | 535 | return 0; |
@@ -553,7 +548,8 @@ static void snd_card_asihpi_pcm_timer_start(struct snd_pcm_substream * | |||
553 | struct snd_card_asihpi_pcm *dpcm = runtime->private_data; | 548 | struct snd_card_asihpi_pcm *dpcm = runtime->private_data; |
554 | int expiry; | 549 | int expiry; |
555 | 550 | ||
556 | expiry = HZ / 100;; //? (dpcm->pcm_count * HZ / dpcm->bytes_per_sec); | 551 | expiry = HZ / 200; |
552 | /*? (dpcm->period_bytes * HZ / dpcm->bytes_per_sec); */ | ||
557 | expiry = max(expiry, 1); /* don't let it be zero! */ | 553 | expiry = max(expiry, 1); /* don't let it be zero! */ |
558 | dpcm->timer.expires = jiffies + expiry; | 554 | dpcm->timer.expires = jiffies + expiry; |
559 | dpcm->respawn_timer = 1; | 555 | dpcm->respawn_timer = 1; |
@@ -577,8 +573,8 @@ static int snd_card_asihpi_trigger(struct snd_pcm_substream *substream, | |||
577 | struct snd_pcm_substream *s; | 573 | struct snd_pcm_substream *s; |
578 | u16 e; | 574 | u16 e; |
579 | 575 | ||
580 | snd_printd("Trigger %dstream %d\n", | 576 | VPRINTK1(KERN_INFO "%c%d trigger\n", |
581 | substream->stream, substream->number); | 577 | SCHR(substream->stream), substream->number); |
582 | switch (cmd) { | 578 | switch (cmd) { |
583 | case SNDRV_PCM_TRIGGER_START: | 579 | case SNDRV_PCM_TRIGGER_START: |
584 | snd_pcm_group_for_each_entry(s, substream) { | 580 | snd_pcm_group_for_each_entry(s, substream) { |
@@ -588,6 +584,10 @@ static int snd_card_asihpi_trigger(struct snd_pcm_substream *substream, | |||
588 | if (snd_pcm_substream_chip(s) != card) | 584 | if (snd_pcm_substream_chip(s) != card) |
589 | continue; | 585 | continue; |
590 | 586 | ||
587 | /* don't link Cap and Play */ | ||
588 | if (substream->stream != s->stream) | ||
589 | continue; | ||
590 | |||
591 | if ((s->stream == SNDRV_PCM_STREAM_PLAYBACK) && | 591 | if ((s->stream == SNDRV_PCM_STREAM_PLAYBACK) && |
592 | (card->support_mmap)) { | 592 | (card->support_mmap)) { |
593 | /* How do I know how much valid data is present | 593 | /* How do I know how much valid data is present |
@@ -596,10 +596,10 @@ static int snd_card_asihpi_trigger(struct snd_pcm_substream *substream, | |||
596 | * buffer is bigger it may contain even more | 596 | * buffer is bigger it may contain even more |
597 | * data?? | 597 | * data?? |
598 | */ | 598 | */ |
599 | unsigned int preload = ds->pcm_count * 1; | 599 | unsigned int preload = ds->period_bytes * 1; |
600 | VPRINTK2("Preload x%x\n", preload); | 600 | VPRINTK2(KERN_INFO "%d preload x%x\n", s->number, preload); |
601 | hpi_handle_error(hpi_outstream_write_buf( | 601 | hpi_handle_error(hpi_outstream_write_buf( |
602 | ss, ds->h_stream, | 602 | ds->h_stream, |
603 | &runtime->dma_area[0], | 603 | &runtime->dma_area[0], |
604 | preload, | 604 | preload, |
605 | &ds->format)); | 605 | &ds->format)); |
@@ -607,9 +607,10 @@ static int snd_card_asihpi_trigger(struct snd_pcm_substream *substream, | |||
607 | } | 607 | } |
608 | 608 | ||
609 | if (card->support_grouping) { | 609 | if (card->support_grouping) { |
610 | VPRINTK1("\t_group %dstream %d\n", s->stream, | 610 | VPRINTK1(KERN_INFO "\t%c%d group\n", |
611 | SCHR(s->stream), | ||
611 | s->number); | 612 | s->number); |
612 | e = hpi_stream_group_add(ss, | 613 | e = hpi_stream_group_add( |
613 | dpcm->h_stream, | 614 | dpcm->h_stream, |
614 | ds->h_stream); | 615 | ds->h_stream); |
615 | if (!e) { | 616 | if (!e) { |
@@ -621,10 +622,11 @@ static int snd_card_asihpi_trigger(struct snd_pcm_substream *substream, | |||
621 | } else | 622 | } else |
622 | break; | 623 | break; |
623 | } | 624 | } |
624 | snd_printd("Start\n"); | 625 | VPRINTK1(KERN_INFO "start\n"); |
625 | /* start the master stream */ | 626 | /* start the master stream */ |
626 | snd_card_asihpi_pcm_timer_start(substream); | 627 | snd_card_asihpi_pcm_timer_start(substream); |
627 | hpi_handle_error(hpi_stream_start(ss, dpcm->h_stream)); | 628 | if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) |
629 | hpi_handle_error(hpi_stream_start(dpcm->h_stream)); | ||
628 | break; | 630 | break; |
629 | 631 | ||
630 | case SNDRV_PCM_TRIGGER_STOP: | 632 | case SNDRV_PCM_TRIGGER_STOP: |
@@ -632,43 +634,46 @@ static int snd_card_asihpi_trigger(struct snd_pcm_substream *substream, | |||
632 | snd_pcm_group_for_each_entry(s, substream) { | 634 | snd_pcm_group_for_each_entry(s, substream) { |
633 | if (snd_pcm_substream_chip(s) != card) | 635 | if (snd_pcm_substream_chip(s) != card) |
634 | continue; | 636 | continue; |
637 | /* don't link Cap and Play */ | ||
638 | if (substream->stream != s->stream) | ||
639 | continue; | ||
635 | 640 | ||
636 | /*? workaround linked streams don't | 641 | /*? workaround linked streams don't |
637 | transition to SETUP 20070706*/ | 642 | transition to SETUP 20070706*/ |
638 | s->runtime->status->state = SNDRV_PCM_STATE_SETUP; | 643 | s->runtime->status->state = SNDRV_PCM_STATE_SETUP; |
639 | 644 | ||
640 | if (card->support_grouping) { | 645 | if (card->support_grouping) { |
641 | VPRINTK1("\t_group %dstream %d\n", s->stream, | 646 | VPRINTK1(KERN_INFO "\t%c%d group\n", |
647 | SCHR(s->stream), | ||
642 | s->number); | 648 | s->number); |
643 | snd_pcm_trigger_done(s, substream); | 649 | snd_pcm_trigger_done(s, substream); |
644 | } else | 650 | } else |
645 | break; | 651 | break; |
646 | } | 652 | } |
647 | snd_printd("Stop\n"); | 653 | VPRINTK1(KERN_INFO "stop\n"); |
648 | 654 | ||
649 | /* _prepare and _hwparams reset the stream */ | 655 | /* _prepare and _hwparams reset the stream */ |
650 | hpi_handle_error(hpi_stream_stop(ss, dpcm->h_stream)); | 656 | hpi_handle_error(hpi_stream_stop(dpcm->h_stream)); |
651 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | 657 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
652 | hpi_handle_error( | 658 | hpi_handle_error( |
653 | hpi_outstream_reset(ss, dpcm->h_stream)); | 659 | hpi_outstream_reset(dpcm->h_stream)); |
654 | 660 | ||
655 | if (card->support_grouping) | 661 | if (card->support_grouping) |
656 | hpi_handle_error(hpi_stream_group_reset(ss, | 662 | hpi_handle_error(hpi_stream_group_reset(dpcm->h_stream)); |
657 | dpcm->h_stream)); | ||
658 | break; | 663 | break; |
659 | 664 | ||
660 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: | 665 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: |
661 | snd_printd("Pause release\n"); | 666 | VPRINTK1(KERN_INFO "pause release\n"); |
662 | hpi_handle_error(hpi_stream_start(ss, dpcm->h_stream)); | 667 | hpi_handle_error(hpi_stream_start(dpcm->h_stream)); |
663 | snd_card_asihpi_pcm_timer_start(substream); | 668 | snd_card_asihpi_pcm_timer_start(substream); |
664 | break; | 669 | break; |
665 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: | 670 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: |
666 | snd_printd("Pause\n"); | 671 | VPRINTK1(KERN_INFO "pause\n"); |
667 | snd_card_asihpi_pcm_timer_stop(substream); | 672 | snd_card_asihpi_pcm_timer_stop(substream); |
668 | hpi_handle_error(hpi_stream_stop(ss, dpcm->h_stream)); | 673 | hpi_handle_error(hpi_stream_stop(dpcm->h_stream)); |
669 | break; | 674 | break; |
670 | default: | 675 | default: |
671 | snd_printd("\tINVALID\n"); | 676 | snd_printd(KERN_ERR "\tINVALID\n"); |
672 | return -EINVAL; | 677 | return -EINVAL; |
673 | } | 678 | } |
674 | 679 | ||
@@ -683,19 +688,19 @@ static int snd_card_asihpi_trigger(struct snd_pcm_substream *substream, | |||
683 | pcm_buf_dma_ofs=get_buf_pos(s); | 688 | pcm_buf_dma_ofs=get_buf_pos(s); |
684 | for_each_linked_stream(s) { | 689 | for_each_linked_stream(s) { |
685 | pcm_buf_dma_ofs=get_buf_pos(s); | 690 | pcm_buf_dma_ofs=get_buf_pos(s); |
686 | min_buf_pos = modulo_min(min_buf_pos, pcm_buf_dma_ofs, pcm_size) | 691 | min_buf_pos = modulo_min(min_buf_pos, pcm_buf_dma_ofs, buffer_bytes) |
687 | new_data = min(new_data, calc_new_data(pcm_buf_dma_ofs,irq_pos) | 692 | new_data = min(new_data, calc_new_data(pcm_buf_dma_ofs,irq_pos) |
688 | } | 693 | } |
689 | timer.expires = jiffies + predict_next_period_ready(min_buf_pos); | 694 | timer.expires = jiffies + predict_next_period_ready(min_buf_pos); |
690 | for_each_linked_stream(s) { | 695 | for_each_linked_stream(s) { |
691 | s->pcm_buf_dma_ofs = min_buf_pos; | 696 | s->pcm_buf_dma_ofs = min_buf_pos; |
692 | if (new_data > pcm_count) { | 697 | if (new_data > period_bytes) { |
693 | if (mmap) { | 698 | if (mmap) { |
694 | irq_pos = (irq_pos + pcm_count) % pcm_size; | 699 | irq_pos = (irq_pos + period_bytes) % buffer_bytes; |
695 | if (playback) { | 700 | if (playback) { |
696 | write(pcm_count); | 701 | write(period_bytes); |
697 | } else { | 702 | } else { |
698 | read(pcm_count); | 703 | read(period_bytes); |
699 | } | 704 | } |
700 | } | 705 | } |
701 | snd_pcm_period_elapsed(s); | 706 | snd_pcm_period_elapsed(s); |
@@ -723,25 +728,34 @@ static inline unsigned int modulo_min(unsigned int a, unsigned int b, | |||
723 | static void snd_card_asihpi_timer_function(unsigned long data) | 728 | static void snd_card_asihpi_timer_function(unsigned long data) |
724 | { | 729 | { |
725 | struct snd_card_asihpi_pcm *dpcm = (struct snd_card_asihpi_pcm *)data; | 730 | struct snd_card_asihpi_pcm *dpcm = (struct snd_card_asihpi_pcm *)data; |
726 | struct snd_card_asihpi *card = snd_pcm_substream_chip(dpcm->substream); | 731 | struct snd_pcm_substream *substream = dpcm->substream; |
732 | struct snd_card_asihpi *card = snd_pcm_substream_chip(substream); | ||
727 | struct snd_pcm_runtime *runtime; | 733 | struct snd_pcm_runtime *runtime; |
728 | struct snd_pcm_substream *s; | 734 | struct snd_pcm_substream *s; |
729 | unsigned int newdata = 0; | 735 | unsigned int newdata = 0; |
730 | unsigned int pcm_buf_dma_ofs, min_buf_pos = 0; | 736 | unsigned int pcm_buf_dma_ofs, min_buf_pos = 0; |
731 | unsigned int remdata, xfercount, next_jiffies; | 737 | unsigned int remdata, xfercount, next_jiffies; |
732 | int first = 1; | 738 | int first = 1; |
739 | int loops = 0; | ||
733 | u16 state; | 740 | u16 state; |
734 | u32 buffer_size, bytes_avail, samples_played, on_card_bytes; | 741 | u32 buffer_size, bytes_avail, samples_played, on_card_bytes; |
735 | 742 | ||
743 | VPRINTK1(KERN_INFO "%c%d snd_card_asihpi_timer_function\n", | ||
744 | SCHR(substream->stream), substream->number); | ||
745 | |||
736 | /* find minimum newdata and buffer pos in group */ | 746 | /* find minimum newdata and buffer pos in group */ |
737 | snd_pcm_group_for_each_entry(s, dpcm->substream) { | 747 | snd_pcm_group_for_each_entry(s, substream) { |
738 | struct snd_card_asihpi_pcm *ds = s->runtime->private_data; | 748 | struct snd_card_asihpi_pcm *ds = s->runtime->private_data; |
739 | runtime = s->runtime; | 749 | runtime = s->runtime; |
740 | 750 | ||
741 | if (snd_pcm_substream_chip(s) != card) | 751 | if (snd_pcm_substream_chip(s) != card) |
742 | continue; | 752 | continue; |
743 | 753 | ||
744 | hpi_handle_error(hpi_stream_get_info_ex(ss, | 754 | /* don't link Cap and Play */ |
755 | if (substream->stream != s->stream) | ||
756 | continue; | ||
757 | |||
758 | hpi_handle_error(hpi_stream_get_info_ex( | ||
745 | ds->h_stream, &state, | 759 | ds->h_stream, &state, |
746 | &buffer_size, &bytes_avail, | 760 | &buffer_size, &bytes_avail, |
747 | &samples_played, &on_card_bytes)); | 761 | &samples_played, &on_card_bytes)); |
@@ -749,86 +763,96 @@ static void snd_card_asihpi_timer_function(unsigned long data) | |||
749 | /* number of bytes in on-card buffer */ | 763 | /* number of bytes in on-card buffer */ |
750 | runtime->delay = on_card_bytes; | 764 | runtime->delay = on_card_bytes; |
751 | 765 | ||
752 | if (state == HPI_STATE_DRAINED) { | 766 | if (s->stream == SNDRV_PCM_STREAM_PLAYBACK) { |
753 | snd_printd(KERN_WARNING "outstream %d drained\n", | ||
754 | s->number); | ||
755 | //snd_pcm_stop(s, SNDRV_PCM_STATE_XRUN); | ||
756 | //return; | ||
757 | } | ||
758 | |||
759 | if (s->stream == SNDRV_PCM_STREAM_PLAYBACK) | ||
760 | pcm_buf_dma_ofs = ds->pcm_buf_host_rw_ofs - bytes_avail; | 767 | pcm_buf_dma_ofs = ds->pcm_buf_host_rw_ofs - bytes_avail; |
761 | else | 768 | if (state == HPI_STATE_STOPPED) { |
769 | if ((bytes_avail == 0) && | ||
770 | (on_card_bytes < ds->pcm_buf_host_rw_ofs)) { | ||
771 | hpi_handle_error(hpi_stream_start(ds->h_stream)); | ||
772 | VPRINTK1(KERN_INFO "P%d start\n", s->number); | ||
773 | } | ||
774 | } else if (state == HPI_STATE_DRAINED) { | ||
775 | VPRINTK1(KERN_WARNING "P%d drained\n", | ||
776 | s->number); | ||
777 | /*snd_pcm_stop(s, SNDRV_PCM_STATE_XRUN); | ||
778 | continue; */ | ||
779 | } | ||
780 | } else | ||
762 | pcm_buf_dma_ofs = bytes_avail + ds->pcm_buf_host_rw_ofs; | 781 | pcm_buf_dma_ofs = bytes_avail + ds->pcm_buf_host_rw_ofs; |
763 | 782 | ||
764 | if (first) { | 783 | if (first) { |
765 | /* can't statically init min when wrap is involved */ | 784 | /* can't statically init min when wrap is involved */ |
766 | min_buf_pos = pcm_buf_dma_ofs; | 785 | min_buf_pos = pcm_buf_dma_ofs; |
767 | newdata = (pcm_buf_dma_ofs - ds->pcm_buf_elapsed_dma_ofs) % ds->pcm_size; | 786 | newdata = (pcm_buf_dma_ofs - ds->pcm_buf_elapsed_dma_ofs) % ds->buffer_bytes; |
768 | first = 0; | 787 | first = 0; |
769 | } else { | 788 | } else { |
770 | min_buf_pos = | 789 | min_buf_pos = |
771 | modulo_min(min_buf_pos, pcm_buf_dma_ofs, UINT_MAX+1L); | 790 | modulo_min(min_buf_pos, pcm_buf_dma_ofs, UINT_MAX+1L); |
772 | newdata = min( | 791 | newdata = min( |
773 | (pcm_buf_dma_ofs - ds->pcm_buf_elapsed_dma_ofs) % ds->pcm_size, | 792 | (pcm_buf_dma_ofs - ds->pcm_buf_elapsed_dma_ofs) % ds->buffer_bytes, |
774 | newdata); | 793 | newdata); |
775 | } | 794 | } |
776 | 795 | ||
777 | VPRINTK1("PB timer hw_ptr x%04lX, appl_ptr x%04lX\n", | 796 | VPRINTK1(KERN_INFO "PB timer hw_ptr x%04lX, appl_ptr x%04lX\n", |
778 | (unsigned long)frames_to_bytes(runtime, | 797 | (unsigned long)frames_to_bytes(runtime, |
779 | runtime->status->hw_ptr), | 798 | runtime->status->hw_ptr), |
780 | (unsigned long)frames_to_bytes(runtime, | 799 | (unsigned long)frames_to_bytes(runtime, |
781 | runtime->control->appl_ptr)); | 800 | runtime->control->appl_ptr)); |
782 | 801 | ||
783 | VPRINTK1("%d S=%d, irq=%04X, pos=x%04X, left=x%04X," | 802 | VPRINTK1(KERN_INFO "%d %c%d S=%d, rw=%04X, dma=x%04X, left=x%04X," |
784 | " aux=x%04X space=x%04X\n", s->number, | 803 | " aux=x%04X space=x%04X\n", |
804 | loops, SCHR(s->stream), s->number, | ||
785 | state, ds->pcm_buf_host_rw_ofs, pcm_buf_dma_ofs, (int)bytes_avail, | 805 | state, ds->pcm_buf_host_rw_ofs, pcm_buf_dma_ofs, (int)bytes_avail, |
786 | (int)on_card_bytes, buffer_size-bytes_avail); | 806 | (int)on_card_bytes, buffer_size-bytes_avail); |
807 | loops++; | ||
787 | } | 808 | } |
788 | pcm_buf_dma_ofs = min_buf_pos; | 809 | pcm_buf_dma_ofs = min_buf_pos; |
789 | 810 | ||
790 | remdata = newdata % dpcm->pcm_count; | 811 | remdata = newdata % dpcm->period_bytes; |
791 | xfercount = newdata - remdata; /* a multiple of pcm_count */ | 812 | xfercount = newdata - remdata; /* a multiple of period_bytes */ |
792 | /* come back when on_card_bytes has decreased enough to allow | 813 | /* come back when on_card_bytes has decreased enough to allow |
793 | write to happen, or when data has been consumed to make another | 814 | write to happen, or when data has been consumed to make another |
794 | period | 815 | period |
795 | */ | 816 | */ |
796 | if (xfercount && (on_card_bytes > dpcm->pcm_count)) | 817 | if (xfercount && (on_card_bytes > dpcm->period_bytes)) |
797 | next_jiffies = ((on_card_bytes - dpcm->pcm_count) * HZ / dpcm->bytes_per_sec); | 818 | next_jiffies = ((on_card_bytes - dpcm->period_bytes) * HZ / dpcm->bytes_per_sec); |
798 | else | 819 | else |
799 | next_jiffies = ((dpcm->pcm_count - remdata) * HZ / dpcm->bytes_per_sec); | 820 | next_jiffies = ((dpcm->period_bytes - remdata) * HZ / dpcm->bytes_per_sec); |
800 | 821 | ||
801 | next_jiffies = max(next_jiffies, 1U); | 822 | next_jiffies = max(next_jiffies, 1U); |
802 | dpcm->timer.expires = jiffies + next_jiffies; | 823 | dpcm->timer.expires = jiffies + next_jiffies; |
803 | VPRINTK1("jif %d buf pos x%04X newdata x%04X xfer x%04X\n", | 824 | VPRINTK1(KERN_INFO "jif %d buf pos x%04X newdata x%04X xfer x%04X\n", |
804 | next_jiffies, pcm_buf_dma_ofs, newdata, xfercount); | 825 | next_jiffies, pcm_buf_dma_ofs, newdata, xfercount); |
805 | 826 | ||
806 | 827 | snd_pcm_group_for_each_entry(s, substream) { | |
807 | snd_pcm_group_for_each_entry(s, dpcm->substream) { | ||
808 | struct snd_card_asihpi_pcm *ds = s->runtime->private_data; | 828 | struct snd_card_asihpi_pcm *ds = s->runtime->private_data; |
809 | 829 | ||
830 | /* don't link Cap and Play */ | ||
831 | if (substream->stream != s->stream) | ||
832 | continue; | ||
833 | |||
810 | ds->pcm_buf_dma_ofs = pcm_buf_dma_ofs; | 834 | ds->pcm_buf_dma_ofs = pcm_buf_dma_ofs; |
811 | 835 | ||
812 | if (xfercount && (on_card_bytes <= ds->pcm_count)) { | 836 | if (xfercount && (on_card_bytes <= ds->period_bytes)) { |
813 | if (card->support_mmap) { | 837 | if (card->support_mmap) { |
814 | if (s->stream == SNDRV_PCM_STREAM_PLAYBACK) { | 838 | if (s->stream == SNDRV_PCM_STREAM_PLAYBACK) { |
815 | VPRINTK2("Write OS%d x%04x\n", | 839 | VPRINTK2(KERN_INFO "P%d write x%04x\n", |
816 | s->number, | 840 | s->number, |
817 | ds->pcm_count); | 841 | ds->period_bytes); |
818 | hpi_handle_error( | 842 | hpi_handle_error( |
819 | hpi_outstream_write_buf( | 843 | hpi_outstream_write_buf( |
820 | ss, ds->h_stream, | 844 | ds->h_stream, |
821 | &s->runtime-> | 845 | &s->runtime-> |
822 | dma_area[0], | 846 | dma_area[0], |
823 | xfercount, | 847 | xfercount, |
824 | &ds->format)); | 848 | &ds->format)); |
825 | } else { | 849 | } else { |
826 | VPRINTK2("Read IS%d x%04x\n", | 850 | VPRINTK2(KERN_INFO "C%d read x%04x\n", |
827 | s->number, | 851 | s->number, |
828 | xfercount); | 852 | xfercount); |
829 | hpi_handle_error( | 853 | hpi_handle_error( |
830 | hpi_instream_read_buf( | 854 | hpi_instream_read_buf( |
831 | ss, ds->h_stream, | 855 | ds->h_stream, |
832 | NULL, xfercount)); | 856 | NULL, xfercount)); |
833 | } | 857 | } |
834 | ds->pcm_buf_host_rw_ofs = ds->pcm_buf_host_rw_ofs + xfercount; | 858 | ds->pcm_buf_host_rw_ofs = ds->pcm_buf_host_rw_ofs + xfercount; |
@@ -856,9 +880,9 @@ static int snd_card_asihpi_playback_prepare(struct snd_pcm_substream * | |||
856 | struct snd_pcm_runtime *runtime = substream->runtime; | 880 | struct snd_pcm_runtime *runtime = substream->runtime; |
857 | struct snd_card_asihpi_pcm *dpcm = runtime->private_data; | 881 | struct snd_card_asihpi_pcm *dpcm = runtime->private_data; |
858 | 882 | ||
859 | snd_printd(KERN_INFO "playback prepare %d\n", substream->number); | 883 | VPRINTK1(KERN_INFO "playback prepare %d\n", substream->number); |
860 | 884 | ||
861 | hpi_handle_error(hpi_outstream_reset(ss, dpcm->h_stream)); | 885 | hpi_handle_error(hpi_outstream_reset(dpcm->h_stream)); |
862 | dpcm->pcm_buf_host_rw_ofs = 0; | 886 | dpcm->pcm_buf_host_rw_ofs = 0; |
863 | dpcm->pcm_buf_dma_ofs = 0; | 887 | dpcm->pcm_buf_dma_ofs = 0; |
864 | dpcm->pcm_buf_elapsed_dma_ofs = 0; | 888 | dpcm->pcm_buf_elapsed_dma_ofs = 0; |
@@ -872,8 +896,8 @@ snd_card_asihpi_playback_pointer(struct snd_pcm_substream *substream) | |||
872 | struct snd_card_asihpi_pcm *dpcm = runtime->private_data; | 896 | struct snd_card_asihpi_pcm *dpcm = runtime->private_data; |
873 | snd_pcm_uframes_t ptr; | 897 | snd_pcm_uframes_t ptr; |
874 | 898 | ||
875 | ptr = bytes_to_frames(runtime, dpcm->pcm_buf_dma_ofs % dpcm->pcm_size); | 899 | ptr = bytes_to_frames(runtime, dpcm->pcm_buf_dma_ofs % dpcm->buffer_bytes); |
876 | //VPRINTK2("playback_pointer=x%04lx\n", (unsigned long)ptr); | 900 | /* VPRINTK2(KERN_INFO "playback_pointer=x%04lx\n", (unsigned long)ptr); */ |
877 | return ptr; | 901 | return ptr; |
878 | } | 902 | } |
879 | 903 | ||
@@ -890,12 +914,12 @@ static void snd_card_asihpi_playback_format(struct snd_card_asihpi *asihpi, | |||
890 | /* on cards without SRC, must query at valid rate, | 914 | /* on cards without SRC, must query at valid rate, |
891 | * maybe set by external sync | 915 | * maybe set by external sync |
892 | */ | 916 | */ |
893 | err = hpi_mixer_get_control(ss, asihpi->h_mixer, | 917 | err = hpi_mixer_get_control(asihpi->h_mixer, |
894 | HPI_SOURCENODE_CLOCK_SOURCE, 0, 0, 0, | 918 | HPI_SOURCENODE_CLOCK_SOURCE, 0, 0, 0, |
895 | HPI_CONTROL_SAMPLECLOCK, &h_control); | 919 | HPI_CONTROL_SAMPLECLOCK, &h_control); |
896 | 920 | ||
897 | if (!err) | 921 | if (!err) |
898 | err = hpi_sample_clock_get_sample_rate(ss, h_control, | 922 | err = hpi_sample_clock_get_sample_rate(h_control, |
899 | &sample_rate); | 923 | &sample_rate); |
900 | 924 | ||
901 | for (format = HPI_FORMAT_PCM8_UNSIGNED; | 925 | for (format = HPI_FORMAT_PCM8_UNSIGNED; |
@@ -903,7 +927,7 @@ static void snd_card_asihpi_playback_format(struct snd_card_asihpi *asihpi, | |||
903 | err = hpi_format_create(&hpi_format, | 927 | err = hpi_format_create(&hpi_format, |
904 | 2, format, sample_rate, 128000, 0); | 928 | 2, format, sample_rate, 128000, 0); |
905 | if (!err) | 929 | if (!err) |
906 | err = hpi_outstream_query_format(ss, h_stream, | 930 | err = hpi_outstream_query_format(h_stream, |
907 | &hpi_format); | 931 | &hpi_format); |
908 | if (!err && (hpi_to_alsa_formats[format] != -1)) | 932 | if (!err && (hpi_to_alsa_formats[format] != -1)) |
909 | pcmhw->formats |= | 933 | pcmhw->formats |= |
@@ -934,7 +958,7 @@ static int snd_card_asihpi_playback_open(struct snd_pcm_substream *substream) | |||
934 | return -ENOMEM; | 958 | return -ENOMEM; |
935 | 959 | ||
936 | err = | 960 | err = |
937 | hpi_outstream_open(ss, card->adapter_index, | 961 | hpi_outstream_open(card->adapter_index, |
938 | substream->number, &dpcm->h_stream); | 962 | substream->number, &dpcm->h_stream); |
939 | hpi_handle_error(err); | 963 | hpi_handle_error(err); |
940 | if (err) | 964 | if (err) |
@@ -994,7 +1018,7 @@ static int snd_card_asihpi_playback_open(struct snd_pcm_substream *substream) | |||
994 | 1018 | ||
995 | snd_pcm_set_sync(substream); | 1019 | snd_pcm_set_sync(substream); |
996 | 1020 | ||
997 | snd_printd(KERN_INFO "playback open\n"); | 1021 | VPRINTK1(KERN_INFO "playback open\n"); |
998 | 1022 | ||
999 | return 0; | 1023 | return 0; |
1000 | } | 1024 | } |
@@ -1004,8 +1028,8 @@ static int snd_card_asihpi_playback_close(struct snd_pcm_substream *substream) | |||
1004 | struct snd_pcm_runtime *runtime = substream->runtime; | 1028 | struct snd_pcm_runtime *runtime = substream->runtime; |
1005 | struct snd_card_asihpi_pcm *dpcm = runtime->private_data; | 1029 | struct snd_card_asihpi_pcm *dpcm = runtime->private_data; |
1006 | 1030 | ||
1007 | hpi_handle_error(hpi_outstream_close(ss, dpcm->h_stream)); | 1031 | hpi_handle_error(hpi_outstream_close(dpcm->h_stream)); |
1008 | snd_printd(KERN_INFO "playback close\n"); | 1032 | VPRINTK1(KERN_INFO "playback close\n"); |
1009 | 1033 | ||
1010 | return 0; | 1034 | return 0; |
1011 | } | 1035 | } |
@@ -1028,7 +1052,7 @@ static int snd_card_asihpi_playback_copy(struct snd_pcm_substream *substream, | |||
1028 | VPRINTK2(KERN_DEBUG "playback copy%d %u bytes\n", | 1052 | VPRINTK2(KERN_DEBUG "playback copy%d %u bytes\n", |
1029 | substream->number, len); | 1053 | substream->number, len); |
1030 | 1054 | ||
1031 | hpi_handle_error(hpi_outstream_write_buf(ss, dpcm->h_stream, | 1055 | hpi_handle_error(hpi_outstream_write_buf(dpcm->h_stream, |
1032 | runtime->dma_area, len, &dpcm->format)); | 1056 | runtime->dma_area, len, &dpcm->format)); |
1033 | 1057 | ||
1034 | dpcm->pcm_buf_host_rw_ofs = dpcm->pcm_buf_host_rw_ofs + len; | 1058 | dpcm->pcm_buf_host_rw_ofs = dpcm->pcm_buf_host_rw_ofs + len; |
@@ -1046,10 +1070,10 @@ static int snd_card_asihpi_playback_silence(struct snd_pcm_substream * | |||
1046 | struct snd_card_asihpi_pcm *dpcm = runtime->private_data; | 1070 | struct snd_card_asihpi_pcm *dpcm = runtime->private_data; |
1047 | 1071 | ||
1048 | len = frames_to_bytes(runtime, count); | 1072 | len = frames_to_bytes(runtime, count); |
1049 | snd_printd(KERN_INFO "playback silence %u bytes\n", len); | 1073 | VPRINTK1(KERN_INFO "playback silence %u bytes\n", len); |
1050 | 1074 | ||
1051 | memset(runtime->dma_area, 0, len); | 1075 | memset(runtime->dma_area, 0, len); |
1052 | hpi_handle_error(hpi_outstream_write_buf(ss, dpcm->h_stream, | 1076 | hpi_handle_error(hpi_outstream_write_buf(dpcm->h_stream, |
1053 | runtime->dma_area, len, &dpcm->format)); | 1077 | runtime->dma_area, len, &dpcm->format)); |
1054 | return 0; | 1078 | return 0; |
1055 | } | 1079 | } |
@@ -1085,13 +1109,13 @@ snd_card_asihpi_capture_pointer(struct snd_pcm_substream *substream) | |||
1085 | struct snd_pcm_runtime *runtime = substream->runtime; | 1109 | struct snd_pcm_runtime *runtime = substream->runtime; |
1086 | struct snd_card_asihpi_pcm *dpcm = runtime->private_data; | 1110 | struct snd_card_asihpi_pcm *dpcm = runtime->private_data; |
1087 | 1111 | ||
1088 | VPRINTK2("Capture pointer %d=%d\n", | 1112 | VPRINTK2(KERN_INFO "capture pointer %d=%d\n", |
1089 | substream->number, dpcm->pcm_buf_dma_ofs); | 1113 | substream->number, dpcm->pcm_buf_dma_ofs); |
1090 | /* NOTE Unlike playback can't use actual samples_played | 1114 | /* NOTE Unlike playback can't use actual samples_played |
1091 | for the capture position, because those samples aren't yet in | 1115 | for the capture position, because those samples aren't yet in |
1092 | the local buffer available for reading. | 1116 | the local buffer available for reading. |
1093 | */ | 1117 | */ |
1094 | return bytes_to_frames(runtime, dpcm->pcm_buf_dma_ofs % dpcm->pcm_size); | 1118 | return bytes_to_frames(runtime, dpcm->pcm_buf_dma_ofs % dpcm->buffer_bytes); |
1095 | } | 1119 | } |
1096 | 1120 | ||
1097 | static int snd_card_asihpi_capture_ioctl(struct snd_pcm_substream *substream, | 1121 | static int snd_card_asihpi_capture_ioctl(struct snd_pcm_substream *substream, |
@@ -1105,12 +1129,12 @@ static int snd_card_asihpi_capture_prepare(struct snd_pcm_substream *substream) | |||
1105 | struct snd_pcm_runtime *runtime = substream->runtime; | 1129 | struct snd_pcm_runtime *runtime = substream->runtime; |
1106 | struct snd_card_asihpi_pcm *dpcm = runtime->private_data; | 1130 | struct snd_card_asihpi_pcm *dpcm = runtime->private_data; |
1107 | 1131 | ||
1108 | hpi_handle_error(hpi_instream_reset(ss, dpcm->h_stream)); | 1132 | hpi_handle_error(hpi_instream_reset(dpcm->h_stream)); |
1109 | dpcm->pcm_buf_host_rw_ofs = 0; | 1133 | dpcm->pcm_buf_host_rw_ofs = 0; |
1110 | dpcm->pcm_buf_dma_ofs = 0; | 1134 | dpcm->pcm_buf_dma_ofs = 0; |
1111 | dpcm->pcm_buf_elapsed_dma_ofs = 0; | 1135 | dpcm->pcm_buf_elapsed_dma_ofs = 0; |
1112 | 1136 | ||
1113 | snd_printd("Capture Prepare %d\n", substream->number); | 1137 | VPRINTK1("Capture Prepare %d\n", substream->number); |
1114 | return 0; | 1138 | return 0; |
1115 | } | 1139 | } |
1116 | 1140 | ||
@@ -1128,12 +1152,12 @@ static void snd_card_asihpi_capture_format(struct snd_card_asihpi *asihpi, | |||
1128 | 1152 | ||
1129 | /* on cards without SRC, must query at valid rate, | 1153 | /* on cards without SRC, must query at valid rate, |
1130 | maybe set by external sync */ | 1154 | maybe set by external sync */ |
1131 | err = hpi_mixer_get_control(ss, asihpi->h_mixer, | 1155 | err = hpi_mixer_get_control(asihpi->h_mixer, |
1132 | HPI_SOURCENODE_CLOCK_SOURCE, 0, 0, 0, | 1156 | HPI_SOURCENODE_CLOCK_SOURCE, 0, 0, 0, |
1133 | HPI_CONTROL_SAMPLECLOCK, &h_control); | 1157 | HPI_CONTROL_SAMPLECLOCK, &h_control); |
1134 | 1158 | ||
1135 | if (!err) | 1159 | if (!err) |
1136 | err = hpi_sample_clock_get_sample_rate(ss, h_control, | 1160 | err = hpi_sample_clock_get_sample_rate(h_control, |
1137 | &sample_rate); | 1161 | &sample_rate); |
1138 | 1162 | ||
1139 | for (format = HPI_FORMAT_PCM8_UNSIGNED; | 1163 | for (format = HPI_FORMAT_PCM8_UNSIGNED; |
@@ -1142,7 +1166,7 @@ static void snd_card_asihpi_capture_format(struct snd_card_asihpi *asihpi, | |||
1142 | err = hpi_format_create(&hpi_format, 2, format, | 1166 | err = hpi_format_create(&hpi_format, 2, format, |
1143 | sample_rate, 128000, 0); | 1167 | sample_rate, 128000, 0); |
1144 | if (!err) | 1168 | if (!err) |
1145 | err = hpi_instream_query_format(ss, h_stream, | 1169 | err = hpi_instream_query_format(h_stream, |
1146 | &hpi_format); | 1170 | &hpi_format); |
1147 | if (!err) | 1171 | if (!err) |
1148 | pcmhw->formats |= | 1172 | pcmhw->formats |= |
@@ -1173,11 +1197,11 @@ static int snd_card_asihpi_capture_open(struct snd_pcm_substream *substream) | |||
1173 | if (dpcm == NULL) | 1197 | if (dpcm == NULL) |
1174 | return -ENOMEM; | 1198 | return -ENOMEM; |
1175 | 1199 | ||
1176 | snd_printd("hpi_instream_open adapter %d stream %d\n", | 1200 | VPRINTK1("hpi_instream_open adapter %d stream %d\n", |
1177 | card->adapter_index, substream->number); | 1201 | card->adapter_index, substream->number); |
1178 | 1202 | ||
1179 | err = hpi_handle_error( | 1203 | err = hpi_handle_error( |
1180 | hpi_instream_open(ss, card->adapter_index, | 1204 | hpi_instream_open(card->adapter_index, |
1181 | substream->number, &dpcm->h_stream)); | 1205 | substream->number, &dpcm->h_stream)); |
1182 | if (err) | 1206 | if (err) |
1183 | kfree(dpcm); | 1207 | kfree(dpcm); |
@@ -1229,7 +1253,7 @@ static int snd_card_asihpi_capture_close(struct snd_pcm_substream *substream) | |||
1229 | { | 1253 | { |
1230 | struct snd_card_asihpi_pcm *dpcm = substream->runtime->private_data; | 1254 | struct snd_card_asihpi_pcm *dpcm = substream->runtime->private_data; |
1231 | 1255 | ||
1232 | hpi_handle_error(hpi_instream_close(ss, dpcm->h_stream)); | 1256 | hpi_handle_error(hpi_instream_close(dpcm->h_stream)); |
1233 | return 0; | 1257 | return 0; |
1234 | } | 1258 | } |
1235 | 1259 | ||
@@ -1243,8 +1267,8 @@ static int snd_card_asihpi_capture_copy(struct snd_pcm_substream *substream, | |||
1243 | 1267 | ||
1244 | len = frames_to_bytes(runtime, count); | 1268 | len = frames_to_bytes(runtime, count); |
1245 | 1269 | ||
1246 | VPRINTK2("Capture copy%d %d bytes\n", substream->number, len); | 1270 | VPRINTK2(KERN_INFO "capture copy%d %d bytes\n", substream->number, len); |
1247 | hpi_handle_error(hpi_instream_read_buf(ss, dpcm->h_stream, | 1271 | hpi_handle_error(hpi_instream_read_buf(dpcm->h_stream, |
1248 | runtime->dma_area, len)); | 1272 | runtime->dma_area, len)); |
1249 | 1273 | ||
1250 | dpcm->pcm_buf_host_rw_ofs = dpcm->pcm_buf_host_rw_ofs + len; | 1274 | dpcm->pcm_buf_host_rw_ofs = dpcm->pcm_buf_host_rw_ofs + len; |
@@ -1327,8 +1351,7 @@ struct hpi_control { | |||
1327 | char name[44]; /* copied to snd_ctl_elem_id.name[44]; */ | 1351 | char name[44]; /* copied to snd_ctl_elem_id.name[44]; */ |
1328 | }; | 1352 | }; |
1329 | 1353 | ||
1330 | static const char * const asihpi_tuner_band_names[] = | 1354 | static const char * const asihpi_tuner_band_names[] = { |
1331 | { | ||
1332 | "invalid", | 1355 | "invalid", |
1333 | "AM", | 1356 | "AM", |
1334 | "FM mono", | 1357 | "FM mono", |
@@ -1346,8 +1369,7 @@ compile_time_assert( | |||
1346 | (HPI_TUNER_BAND_LAST+1)), | 1369 | (HPI_TUNER_BAND_LAST+1)), |
1347 | assert_tuner_band_names_size); | 1370 | assert_tuner_band_names_size); |
1348 | 1371 | ||
1349 | static const char * const asihpi_src_names[] = | 1372 | static const char * const asihpi_src_names[] = { |
1350 | { | ||
1351 | "no source", | 1373 | "no source", |
1352 | "PCM", | 1374 | "PCM", |
1353 | "Line", | 1375 | "Line", |
@@ -1367,8 +1389,7 @@ compile_time_assert( | |||
1367 | (HPI_SOURCENODE_LAST_INDEX-HPI_SOURCENODE_NONE+1)), | 1389 | (HPI_SOURCENODE_LAST_INDEX-HPI_SOURCENODE_NONE+1)), |
1368 | assert_src_names_size); | 1390 | assert_src_names_size); |
1369 | 1391 | ||
1370 | static const char * const asihpi_dst_names[] = | 1392 | static const char * const asihpi_dst_names[] = { |
1371 | { | ||
1372 | "no destination", | 1393 | "no destination", |
1373 | "PCM", | 1394 | "PCM", |
1374 | "Line", | 1395 | "Line", |
@@ -1415,7 +1436,8 @@ static void asihpi_ctl_init(struct snd_kcontrol_new *snd_control, | |||
1415 | else if ((hpi_ctl->src_node_type + HPI_SOURCENODE_NONE != HPI_SOURCENODE_OSTREAM) && | 1436 | else if ((hpi_ctl->src_node_type + HPI_SOURCENODE_NONE != HPI_SOURCENODE_OSTREAM) && |
1416 | (!hpi_ctl->dst_node_type)) | 1437 | (!hpi_ctl->dst_node_type)) |
1417 | dir = "Capture "; /* On a source node that is not PCM playback */ | 1438 | dir = "Capture "; /* On a source node that is not PCM playback */ |
1418 | else if ((hpi_ctl->src_node_type + HPI_SOURCENODE_NONE != HPI_SOURCENODE_OSTREAM) && | 1439 | else if (hpi_ctl->src_node_type && |
1440 | (hpi_ctl->src_node_type + HPI_SOURCENODE_NONE != HPI_SOURCENODE_OSTREAM) && | ||
1419 | (hpi_ctl->dst_node_type)) | 1441 | (hpi_ctl->dst_node_type)) |
1420 | dir = "Monitor Playback "; /* Between an input and an output */ | 1442 | dir = "Monitor Playback "; /* Between an input and an output */ |
1421 | else | 1443 | else |
@@ -1439,7 +1461,8 @@ static void asihpi_ctl_init(struct snd_kcontrol_new *snd_control, | |||
1439 | hpi_ctl->src_node_index, | 1461 | hpi_ctl->src_node_index, |
1440 | dir, name); | 1462 | dir, name); |
1441 | } | 1463 | } |
1442 | // printk(KERN_INFO "adding %s %d to %d ", hpi_ctl->name, hpi_ctl->src_node_type, hpi_ctl->dst_node_type); | 1464 | /* printk(KERN_INFO "Adding %s %d to %d ", hpi_ctl->name, |
1465 | hpi_ctl->wSrcNodeType, hpi_ctl->wDstNodeType); */ | ||
1443 | } | 1466 | } |
1444 | 1467 | ||
1445 | /*------------------------------------------------------------ | 1468 | /*------------------------------------------------------------ |
@@ -1456,7 +1479,7 @@ static int snd_asihpi_volume_info(struct snd_kcontrol *kcontrol, | |||
1456 | short max_gain_mB; | 1479 | short max_gain_mB; |
1457 | short step_gain_mB; | 1480 | short step_gain_mB; |
1458 | 1481 | ||
1459 | err = hpi_volume_query_range(ss, h_control, | 1482 | err = hpi_volume_query_range(h_control, |
1460 | &min_gain_mB, &max_gain_mB, &step_gain_mB); | 1483 | &min_gain_mB, &max_gain_mB, &step_gain_mB); |
1461 | if (err) { | 1484 | if (err) { |
1462 | max_gain_mB = 0; | 1485 | max_gain_mB = 0; |
@@ -1478,7 +1501,7 @@ static int snd_asihpi_volume_get(struct snd_kcontrol *kcontrol, | |||
1478 | u32 h_control = kcontrol->private_value; | 1501 | u32 h_control = kcontrol->private_value; |
1479 | short an_gain_mB[HPI_MAX_CHANNELS]; | 1502 | short an_gain_mB[HPI_MAX_CHANNELS]; |
1480 | 1503 | ||
1481 | hpi_handle_error(hpi_volume_get_gain(ss, h_control, an_gain_mB)); | 1504 | hpi_handle_error(hpi_volume_get_gain(h_control, an_gain_mB)); |
1482 | ucontrol->value.integer.value[0] = an_gain_mB[0] / VOL_STEP_mB; | 1505 | ucontrol->value.integer.value[0] = an_gain_mB[0] / VOL_STEP_mB; |
1483 | ucontrol->value.integer.value[1] = an_gain_mB[1] / VOL_STEP_mB; | 1506 | ucontrol->value.integer.value[1] = an_gain_mB[1] / VOL_STEP_mB; |
1484 | 1507 | ||
@@ -1500,7 +1523,7 @@ static int snd_asihpi_volume_put(struct snd_kcontrol *kcontrol, | |||
1500 | asihpi->mixer_volume[addr][1] != right; | 1523 | asihpi->mixer_volume[addr][1] != right; |
1501 | */ | 1524 | */ |
1502 | change = 1; | 1525 | change = 1; |
1503 | hpi_handle_error(hpi_volume_set_gain(ss, h_control, an_gain_mB)); | 1526 | hpi_handle_error(hpi_volume_set_gain(h_control, an_gain_mB)); |
1504 | return change; | 1527 | return change; |
1505 | } | 1528 | } |
1506 | 1529 | ||
@@ -1536,7 +1559,7 @@ static int snd_asihpi_level_info(struct snd_kcontrol *kcontrol, | |||
1536 | short step_gain_mB; | 1559 | short step_gain_mB; |
1537 | 1560 | ||
1538 | err = | 1561 | err = |
1539 | hpi_level_query_range(ss, h_control, &min_gain_mB, | 1562 | hpi_level_query_range(h_control, &min_gain_mB, |
1540 | &max_gain_mB, &step_gain_mB); | 1563 | &max_gain_mB, &step_gain_mB); |
1541 | if (err) { | 1564 | if (err) { |
1542 | max_gain_mB = 2400; | 1565 | max_gain_mB = 2400; |
@@ -1558,7 +1581,7 @@ static int snd_asihpi_level_get(struct snd_kcontrol *kcontrol, | |||
1558 | u32 h_control = kcontrol->private_value; | 1581 | u32 h_control = kcontrol->private_value; |
1559 | short an_gain_mB[HPI_MAX_CHANNELS]; | 1582 | short an_gain_mB[HPI_MAX_CHANNELS]; |
1560 | 1583 | ||
1561 | hpi_handle_error(hpi_level_get_gain(ss, h_control, an_gain_mB)); | 1584 | hpi_handle_error(hpi_level_get_gain(h_control, an_gain_mB)); |
1562 | ucontrol->value.integer.value[0] = | 1585 | ucontrol->value.integer.value[0] = |
1563 | an_gain_mB[0] / HPI_UNITS_PER_dB; | 1586 | an_gain_mB[0] / HPI_UNITS_PER_dB; |
1564 | ucontrol->value.integer.value[1] = | 1587 | ucontrol->value.integer.value[1] = |
@@ -1582,7 +1605,7 @@ static int snd_asihpi_level_put(struct snd_kcontrol *kcontrol, | |||
1582 | asihpi->mixer_level[addr][1] != right; | 1605 | asihpi->mixer_level[addr][1] != right; |
1583 | */ | 1606 | */ |
1584 | change = 1; | 1607 | change = 1; |
1585 | hpi_handle_error(hpi_level_set_gain(ss, h_control, an_gain_mB)); | 1608 | hpi_handle_error(hpi_level_set_gain(h_control, an_gain_mB)); |
1586 | return change; | 1609 | return change; |
1587 | } | 1610 | } |
1588 | 1611 | ||
@@ -1611,12 +1634,8 @@ static int __devinit snd_asihpi_level_add(struct snd_card_asihpi *asihpi, | |||
1611 | ------------------------------------------------------------*/ | 1634 | ------------------------------------------------------------*/ |
1612 | 1635 | ||
1613 | /* AESEBU format */ | 1636 | /* AESEBU format */ |
1614 | static const char * const asihpi_aesebu_format_names[] = | 1637 | static const char * const asihpi_aesebu_format_names[] = { |
1615 | { | 1638 | "N/A", "S/PDIF", "AES/EBU" }; |
1616 | "N/A", | ||
1617 | "S/PDIF", | ||
1618 | "AES/EBU", | ||
1619 | }; | ||
1620 | 1639 | ||
1621 | static int snd_asihpi_aesebu_format_info(struct snd_kcontrol *kcontrol, | 1640 | static int snd_asihpi_aesebu_format_info(struct snd_kcontrol *kcontrol, |
1622 | struct snd_ctl_elem_info *uinfo) | 1641 | struct snd_ctl_elem_info *uinfo) |
@@ -1637,12 +1656,12 @@ static int snd_asihpi_aesebu_format_info(struct snd_kcontrol *kcontrol, | |||
1637 | 1656 | ||
1638 | static int snd_asihpi_aesebu_format_get(struct snd_kcontrol *kcontrol, | 1657 | static int snd_asihpi_aesebu_format_get(struct snd_kcontrol *kcontrol, |
1639 | struct snd_ctl_elem_value *ucontrol, | 1658 | struct snd_ctl_elem_value *ucontrol, |
1640 | u16 (*func)(const struct hpi_hsubsys *, u32, u16 *)) | 1659 | u16 (*func)(u32, u16 *)) |
1641 | { | 1660 | { |
1642 | u32 h_control = kcontrol->private_value; | 1661 | u32 h_control = kcontrol->private_value; |
1643 | u16 source, err; | 1662 | u16 source, err; |
1644 | 1663 | ||
1645 | err = func(ss, h_control, &source); | 1664 | err = func(h_control, &source); |
1646 | 1665 | ||
1647 | /* default to N/A */ | 1666 | /* default to N/A */ |
1648 | ucontrol->value.enumerated.item[0] = 0; | 1667 | ucontrol->value.enumerated.item[0] = 0; |
@@ -1659,7 +1678,7 @@ static int snd_asihpi_aesebu_format_get(struct snd_kcontrol *kcontrol, | |||
1659 | 1678 | ||
1660 | static int snd_asihpi_aesebu_format_put(struct snd_kcontrol *kcontrol, | 1679 | static int snd_asihpi_aesebu_format_put(struct snd_kcontrol *kcontrol, |
1661 | struct snd_ctl_elem_value *ucontrol, | 1680 | struct snd_ctl_elem_value *ucontrol, |
1662 | u16 (*func)(const struct hpi_hsubsys *, u32, u16)) | 1681 | u16 (*func)(u32, u16)) |
1663 | { | 1682 | { |
1664 | u32 h_control = kcontrol->private_value; | 1683 | u32 h_control = kcontrol->private_value; |
1665 | 1684 | ||
@@ -1671,7 +1690,7 @@ static int snd_asihpi_aesebu_format_put(struct snd_kcontrol *kcontrol, | |||
1671 | if (ucontrol->value.enumerated.item[0] == 2) | 1690 | if (ucontrol->value.enumerated.item[0] == 2) |
1672 | source = HPI_AESEBU_FORMAT_AESEBU; | 1691 | source = HPI_AESEBU_FORMAT_AESEBU; |
1673 | 1692 | ||
1674 | if (func(ss, h_control, source) != 0) | 1693 | if (func(h_control, source) != 0) |
1675 | return -EINVAL; | 1694 | return -EINVAL; |
1676 | 1695 | ||
1677 | return 1; | 1696 | return 1; |
@@ -1680,13 +1699,13 @@ static int snd_asihpi_aesebu_format_put(struct snd_kcontrol *kcontrol, | |||
1680 | static int snd_asihpi_aesebu_rx_format_get(struct snd_kcontrol *kcontrol, | 1699 | static int snd_asihpi_aesebu_rx_format_get(struct snd_kcontrol *kcontrol, |
1681 | struct snd_ctl_elem_value *ucontrol) { | 1700 | struct snd_ctl_elem_value *ucontrol) { |
1682 | return snd_asihpi_aesebu_format_get(kcontrol, ucontrol, | 1701 | return snd_asihpi_aesebu_format_get(kcontrol, ucontrol, |
1683 | HPI_AESEBU__receiver_get_format); | 1702 | hpi_aesebu_receiver_get_format); |
1684 | } | 1703 | } |
1685 | 1704 | ||
1686 | static int snd_asihpi_aesebu_rx_format_put(struct snd_kcontrol *kcontrol, | 1705 | static int snd_asihpi_aesebu_rx_format_put(struct snd_kcontrol *kcontrol, |
1687 | struct snd_ctl_elem_value *ucontrol) { | 1706 | struct snd_ctl_elem_value *ucontrol) { |
1688 | return snd_asihpi_aesebu_format_put(kcontrol, ucontrol, | 1707 | return snd_asihpi_aesebu_format_put(kcontrol, ucontrol, |
1689 | HPI_AESEBU__receiver_set_format); | 1708 | hpi_aesebu_receiver_set_format); |
1690 | } | 1709 | } |
1691 | 1710 | ||
1692 | static int snd_asihpi_aesebu_rxstatus_info(struct snd_kcontrol *kcontrol, | 1711 | static int snd_asihpi_aesebu_rxstatus_info(struct snd_kcontrol *kcontrol, |
@@ -1708,8 +1727,8 @@ static int snd_asihpi_aesebu_rxstatus_get(struct snd_kcontrol *kcontrol, | |||
1708 | u32 h_control = kcontrol->private_value; | 1727 | u32 h_control = kcontrol->private_value; |
1709 | u16 status; | 1728 | u16 status; |
1710 | 1729 | ||
1711 | hpi_handle_error(HPI_AESEBU__receiver_get_error_status( | 1730 | hpi_handle_error(hpi_aesebu_receiver_get_error_status( |
1712 | ss, h_control, &status)); | 1731 | h_control, &status)); |
1713 | ucontrol->value.integer.value[0] = status; | 1732 | ucontrol->value.integer.value[0] = status; |
1714 | return 0; | 1733 | return 0; |
1715 | } | 1734 | } |
@@ -1742,13 +1761,13 @@ static int __devinit snd_asihpi_aesebu_rx_add(struct snd_card_asihpi *asihpi, | |||
1742 | static int snd_asihpi_aesebu_tx_format_get(struct snd_kcontrol *kcontrol, | 1761 | static int snd_asihpi_aesebu_tx_format_get(struct snd_kcontrol *kcontrol, |
1743 | struct snd_ctl_elem_value *ucontrol) { | 1762 | struct snd_ctl_elem_value *ucontrol) { |
1744 | return snd_asihpi_aesebu_format_get(kcontrol, ucontrol, | 1763 | return snd_asihpi_aesebu_format_get(kcontrol, ucontrol, |
1745 | HPI_AESEBU__transmitter_get_format); | 1764 | hpi_aesebu_transmitter_get_format); |
1746 | } | 1765 | } |
1747 | 1766 | ||
1748 | static int snd_asihpi_aesebu_tx_format_put(struct snd_kcontrol *kcontrol, | 1767 | static int snd_asihpi_aesebu_tx_format_put(struct snd_kcontrol *kcontrol, |
1749 | struct snd_ctl_elem_value *ucontrol) { | 1768 | struct snd_ctl_elem_value *ucontrol) { |
1750 | return snd_asihpi_aesebu_format_put(kcontrol, ucontrol, | 1769 | return snd_asihpi_aesebu_format_put(kcontrol, ucontrol, |
1751 | HPI_AESEBU__transmitter_set_format); | 1770 | hpi_aesebu_transmitter_set_format); |
1752 | } | 1771 | } |
1753 | 1772 | ||
1754 | 1773 | ||
@@ -1782,7 +1801,7 @@ static int snd_asihpi_tuner_gain_info(struct snd_kcontrol *kcontrol, | |||
1782 | u16 gain_range[3]; | 1801 | u16 gain_range[3]; |
1783 | 1802 | ||
1784 | for (idx = 0; idx < 3; idx++) { | 1803 | for (idx = 0; idx < 3; idx++) { |
1785 | err = hpi_tuner_query_gain(ss, h_control, | 1804 | err = hpi_tuner_query_gain(h_control, |
1786 | idx, &gain_range[idx]); | 1805 | idx, &gain_range[idx]); |
1787 | if (err != 0) | 1806 | if (err != 0) |
1788 | return err; | 1807 | return err; |
@@ -1805,7 +1824,7 @@ static int snd_asihpi_tuner_gain_get(struct snd_kcontrol *kcontrol, | |||
1805 | u32 h_control = kcontrol->private_value; | 1824 | u32 h_control = kcontrol->private_value; |
1806 | short gain; | 1825 | short gain; |
1807 | 1826 | ||
1808 | hpi_handle_error(hpi_tuner_get_gain(ss, h_control, &gain)); | 1827 | hpi_handle_error(hpi_tuner_get_gain(h_control, &gain)); |
1809 | ucontrol->value.integer.value[0] = gain / HPI_UNITS_PER_dB; | 1828 | ucontrol->value.integer.value[0] = gain / HPI_UNITS_PER_dB; |
1810 | 1829 | ||
1811 | return 0; | 1830 | return 0; |
@@ -1821,7 +1840,7 @@ static int snd_asihpi_tuner_gain_put(struct snd_kcontrol *kcontrol, | |||
1821 | short gain; | 1840 | short gain; |
1822 | 1841 | ||
1823 | gain = (ucontrol->value.integer.value[0]) * HPI_UNITS_PER_dB; | 1842 | gain = (ucontrol->value.integer.value[0]) * HPI_UNITS_PER_dB; |
1824 | hpi_handle_error(hpi_tuner_set_gain(ss, h_control, gain)); | 1843 | hpi_handle_error(hpi_tuner_set_gain(h_control, gain)); |
1825 | 1844 | ||
1826 | return 1; | 1845 | return 1; |
1827 | } | 1846 | } |
@@ -1835,7 +1854,7 @@ static int asihpi_tuner_band_query(struct snd_kcontrol *kcontrol, | |||
1835 | u32 i; | 1854 | u32 i; |
1836 | 1855 | ||
1837 | for (i = 0; i < len; i++) { | 1856 | for (i = 0; i < len; i++) { |
1838 | err = hpi_tuner_query_band(ss, | 1857 | err = hpi_tuner_query_band( |
1839 | h_control, i, &band_list[i]); | 1858 | h_control, i, &band_list[i]); |
1840 | if (err != 0) | 1859 | if (err != 0) |
1841 | break; | 1860 | break; |
@@ -1891,7 +1910,7 @@ static int snd_asihpi_tuner_band_get(struct snd_kcontrol *kcontrol, | |||
1891 | num_bands = asihpi_tuner_band_query(kcontrol, tuner_bands, | 1910 | num_bands = asihpi_tuner_band_query(kcontrol, tuner_bands, |
1892 | HPI_TUNER_BAND_LAST); | 1911 | HPI_TUNER_BAND_LAST); |
1893 | 1912 | ||
1894 | hpi_handle_error(hpi_tuner_get_band(ss, h_control, &band)); | 1913 | hpi_handle_error(hpi_tuner_get_band(h_control, &band)); |
1895 | 1914 | ||
1896 | ucontrol->value.enumerated.item[0] = -1; | 1915 | ucontrol->value.enumerated.item[0] = -1; |
1897 | for (idx = 0; idx < HPI_TUNER_BAND_LAST; idx++) | 1916 | for (idx = 0; idx < HPI_TUNER_BAND_LAST; idx++) |
@@ -1918,7 +1937,7 @@ static int snd_asihpi_tuner_band_put(struct snd_kcontrol *kcontrol, | |||
1918 | HPI_TUNER_BAND_LAST); | 1937 | HPI_TUNER_BAND_LAST); |
1919 | 1938 | ||
1920 | band = tuner_bands[ucontrol->value.enumerated.item[0]]; | 1939 | band = tuner_bands[ucontrol->value.enumerated.item[0]]; |
1921 | hpi_handle_error(hpi_tuner_set_band(ss, h_control, band)); | 1940 | hpi_handle_error(hpi_tuner_set_band(h_control, band)); |
1922 | 1941 | ||
1923 | return 1; | 1942 | return 1; |
1924 | } | 1943 | } |
@@ -1943,7 +1962,7 @@ static int snd_asihpi_tuner_freq_info(struct snd_kcontrol *kcontrol, | |||
1943 | 1962 | ||
1944 | for (band_iter = 0; band_iter < num_bands; band_iter++) { | 1963 | for (band_iter = 0; band_iter < num_bands; band_iter++) { |
1945 | for (idx = 0; idx < 3; idx++) { | 1964 | for (idx = 0; idx < 3; idx++) { |
1946 | err = hpi_tuner_query_frequency(ss, h_control, | 1965 | err = hpi_tuner_query_frequency(h_control, |
1947 | idx, tuner_bands[band_iter], | 1966 | idx, tuner_bands[band_iter], |
1948 | &temp_freq_range[idx]); | 1967 | &temp_freq_range[idx]); |
1949 | if (err != 0) | 1968 | if (err != 0) |
@@ -1976,7 +1995,7 @@ static int snd_asihpi_tuner_freq_get(struct snd_kcontrol *kcontrol, | |||
1976 | u32 h_control = kcontrol->private_value; | 1995 | u32 h_control = kcontrol->private_value; |
1977 | u32 freq; | 1996 | u32 freq; |
1978 | 1997 | ||
1979 | hpi_handle_error(hpi_tuner_get_frequency(ss, h_control, &freq)); | 1998 | hpi_handle_error(hpi_tuner_get_frequency(h_control, &freq)); |
1980 | ucontrol->value.integer.value[0] = freq; | 1999 | ucontrol->value.integer.value[0] = freq; |
1981 | 2000 | ||
1982 | return 0; | 2001 | return 0; |
@@ -1989,7 +2008,7 @@ static int snd_asihpi_tuner_freq_put(struct snd_kcontrol *kcontrol, | |||
1989 | u32 freq; | 2008 | u32 freq; |
1990 | 2009 | ||
1991 | freq = ucontrol->value.integer.value[0]; | 2010 | freq = ucontrol->value.integer.value[0]; |
1992 | hpi_handle_error(hpi_tuner_set_frequency(ss, h_control, freq)); | 2011 | hpi_handle_error(hpi_tuner_set_frequency(h_control, freq)); |
1993 | 2012 | ||
1994 | return 1; | 2013 | return 1; |
1995 | } | 2014 | } |
@@ -2004,7 +2023,7 @@ static int __devinit snd_asihpi_tuner_add(struct snd_card_asihpi *asihpi, | |||
2004 | snd_control.private_value = hpi_ctl->h_control; | 2023 | snd_control.private_value = hpi_ctl->h_control; |
2005 | snd_control.access = SNDRV_CTL_ELEM_ACCESS_READWRITE; | 2024 | snd_control.access = SNDRV_CTL_ELEM_ACCESS_READWRITE; |
2006 | 2025 | ||
2007 | if (!hpi_tuner_get_gain(ss, hpi_ctl->h_control, NULL)) { | 2026 | if (!hpi_tuner_get_gain(hpi_ctl->h_control, NULL)) { |
2008 | asihpi_ctl_init(&snd_control, hpi_ctl, "Gain"); | 2027 | asihpi_ctl_init(&snd_control, hpi_ctl, "Gain"); |
2009 | snd_control.info = snd_asihpi_tuner_gain_info; | 2028 | snd_control.info = snd_asihpi_tuner_gain_info; |
2010 | snd_control.get = snd_asihpi_tuner_gain_get; | 2029 | snd_control.get = snd_asihpi_tuner_gain_get; |
@@ -2073,7 +2092,7 @@ static int snd_asihpi_meter_get(struct snd_kcontrol *kcontrol, | |||
2073 | short an_gain_mB[HPI_MAX_CHANNELS], i; | 2092 | short an_gain_mB[HPI_MAX_CHANNELS], i; |
2074 | u16 err; | 2093 | u16 err; |
2075 | 2094 | ||
2076 | err = hpi_meter_get_peak(ss, h_control, an_gain_mB); | 2095 | err = hpi_meter_get_peak(h_control, an_gain_mB); |
2077 | 2096 | ||
2078 | for (i = 0; i < HPI_MAX_CHANNELS; i++) { | 2097 | for (i = 0; i < HPI_MAX_CHANNELS; i++) { |
2079 | if (err) { | 2098 | if (err) { |
@@ -2118,7 +2137,7 @@ static int snd_card_asihpi_mux_count_sources(struct snd_kcontrol *snd_control) | |||
2118 | struct hpi_control hpi_ctl; | 2137 | struct hpi_control hpi_ctl; |
2119 | int s, err; | 2138 | int s, err; |
2120 | for (s = 0; s < 32; s++) { | 2139 | for (s = 0; s < 32; s++) { |
2121 | err = hpi_multiplexer_query_source(ss, h_control, s, | 2140 | err = hpi_multiplexer_query_source(h_control, s, |
2122 | &hpi_ctl. | 2141 | &hpi_ctl. |
2123 | src_node_type, | 2142 | src_node_type, |
2124 | &hpi_ctl. | 2143 | &hpi_ctl. |
@@ -2146,7 +2165,7 @@ static int snd_asihpi_mux_info(struct snd_kcontrol *kcontrol, | |||
2146 | uinfo->value.enumerated.items - 1; | 2165 | uinfo->value.enumerated.items - 1; |
2147 | 2166 | ||
2148 | err = | 2167 | err = |
2149 | hpi_multiplexer_query_source(ss, h_control, | 2168 | hpi_multiplexer_query_source(h_control, |
2150 | uinfo->value.enumerated.item, | 2169 | uinfo->value.enumerated.item, |
2151 | &src_node_type, &src_node_index); | 2170 | &src_node_type, &src_node_index); |
2152 | 2171 | ||
@@ -2164,11 +2183,11 @@ static int snd_asihpi_mux_get(struct snd_kcontrol *kcontrol, | |||
2164 | u16 src_node_type, src_node_index; | 2183 | u16 src_node_type, src_node_index; |
2165 | int s; | 2184 | int s; |
2166 | 2185 | ||
2167 | hpi_handle_error(hpi_multiplexer_get_source(ss, h_control, | 2186 | hpi_handle_error(hpi_multiplexer_get_source(h_control, |
2168 | &source_type, &source_index)); | 2187 | &source_type, &source_index)); |
2169 | /* Should cache this search result! */ | 2188 | /* Should cache this search result! */ |
2170 | for (s = 0; s < 256; s++) { | 2189 | for (s = 0; s < 256; s++) { |
2171 | if (hpi_multiplexer_query_source(ss, h_control, s, | 2190 | if (hpi_multiplexer_query_source(h_control, s, |
2172 | &src_node_type, &src_node_index)) | 2191 | &src_node_type, &src_node_index)) |
2173 | break; | 2192 | break; |
2174 | 2193 | ||
@@ -2195,12 +2214,12 @@ static int snd_asihpi_mux_put(struct snd_kcontrol *kcontrol, | |||
2195 | 2214 | ||
2196 | change = 1; | 2215 | change = 1; |
2197 | 2216 | ||
2198 | e = hpi_multiplexer_query_source(ss, h_control, | 2217 | e = hpi_multiplexer_query_source(h_control, |
2199 | ucontrol->value.enumerated.item[0], | 2218 | ucontrol->value.enumerated.item[0], |
2200 | &source_type, &source_index); | 2219 | &source_type, &source_index); |
2201 | if (!e) | 2220 | if (!e) |
2202 | hpi_handle_error( | 2221 | hpi_handle_error( |
2203 | hpi_multiplexer_set_source(ss, h_control, | 2222 | hpi_multiplexer_set_source(h_control, |
2204 | source_type, source_index)); | 2223 | source_type, source_index)); |
2205 | return change; | 2224 | return change; |
2206 | } | 2225 | } |
@@ -2246,7 +2265,7 @@ static int snd_asihpi_cmode_info(struct snd_kcontrol *kcontrol, | |||
2246 | */ | 2265 | */ |
2247 | for (i = 0; i < HPI_CHANNEL_MODE_LAST; i++) | 2266 | for (i = 0; i < HPI_CHANNEL_MODE_LAST; i++) |
2248 | if (!hpi_channel_mode_query_mode( | 2267 | if (!hpi_channel_mode_query_mode( |
2249 | ss, h_control, i, &mode)) { | 2268 | h_control, i, &mode)) { |
2250 | mode_map[valid_modes] = mode; | 2269 | mode_map[valid_modes] = mode; |
2251 | valid_modes++; | 2270 | valid_modes++; |
2252 | } | 2271 | } |
@@ -2270,7 +2289,7 @@ static int snd_asihpi_cmode_get(struct snd_kcontrol *kcontrol, | |||
2270 | u32 h_control = kcontrol->private_value; | 2289 | u32 h_control = kcontrol->private_value; |
2271 | u16 mode; | 2290 | u16 mode; |
2272 | 2291 | ||
2273 | if (hpi_channel_mode_get(ss, h_control, &mode)) | 2292 | if (hpi_channel_mode_get(h_control, &mode)) |
2274 | mode = 1; | 2293 | mode = 1; |
2275 | 2294 | ||
2276 | ucontrol->value.enumerated.item[0] = mode - 1; | 2295 | ucontrol->value.enumerated.item[0] = mode - 1; |
@@ -2286,7 +2305,7 @@ static int snd_asihpi_cmode_put(struct snd_kcontrol *kcontrol, | |||
2286 | 2305 | ||
2287 | change = 1; | 2306 | change = 1; |
2288 | 2307 | ||
2289 | hpi_handle_error(hpi_channel_mode_set(ss, h_control, | 2308 | hpi_handle_error(hpi_channel_mode_set(h_control, |
2290 | ucontrol->value.enumerated.item[0] + 1)); | 2309 | ucontrol->value.enumerated.item[0] + 1)); |
2291 | return change; | 2310 | return change; |
2292 | } | 2311 | } |
@@ -2310,12 +2329,12 @@ static int __devinit snd_asihpi_cmode_add(struct snd_card_asihpi *asihpi, | |||
2310 | /*------------------------------------------------------------ | 2329 | /*------------------------------------------------------------ |
2311 | Sampleclock source controls | 2330 | Sampleclock source controls |
2312 | ------------------------------------------------------------*/ | 2331 | ------------------------------------------------------------*/ |
2313 | static char *sampleclock_sources[MAX_CLOCKSOURCES] = | 2332 | static char *sampleclock_sources[MAX_CLOCKSOURCES] = { |
2314 | { "N/A", "Local PLL", "Digital Sync", "Word External", "Word Header", | 2333 | "N/A", "Local PLL", "Digital Sync", "Word External", "Word Header", |
2315 | "SMPTE", "Digital1", "Auto", "Network", "Invalid", | 2334 | "SMPTE", "Digital1", "Auto", "Network", "Invalid", |
2316 | "Prev Module", | 2335 | "Prev Module", |
2317 | "Digital2", "Digital3", "Digital4", "Digital5", | 2336 | "Digital2", "Digital3", "Digital4", "Digital5", |
2318 | "Digital6", "Digital7", "Digital8"}; | 2337 | "Digital6", "Digital7", "Digital8"}; |
2319 | 2338 | ||
2320 | static int snd_asihpi_clksrc_info(struct snd_kcontrol *kcontrol, | 2339 | static int snd_asihpi_clksrc_info(struct snd_kcontrol *kcontrol, |
2321 | struct snd_ctl_elem_info *uinfo) | 2340 | struct snd_ctl_elem_info *uinfo) |
@@ -2347,11 +2366,11 @@ static int snd_asihpi_clksrc_get(struct snd_kcontrol *kcontrol, | |||
2347 | int i; | 2366 | int i; |
2348 | 2367 | ||
2349 | ucontrol->value.enumerated.item[0] = 0; | 2368 | ucontrol->value.enumerated.item[0] = 0; |
2350 | if (hpi_sample_clock_get_source(ss, h_control, &source)) | 2369 | if (hpi_sample_clock_get_source(h_control, &source)) |
2351 | source = 0; | 2370 | source = 0; |
2352 | 2371 | ||
2353 | if (source == HPI_SAMPLECLOCK_SOURCE_AESEBU_INPUT) | 2372 | if (source == HPI_SAMPLECLOCK_SOURCE_AESEBU_INPUT) |
2354 | if (hpi_sample_clock_get_source_index(ss, h_control, &srcindex)) | 2373 | if (hpi_sample_clock_get_source_index(h_control, &srcindex)) |
2355 | srcindex = 0; | 2374 | srcindex = 0; |
2356 | 2375 | ||
2357 | for (i = 0; i < clkcache->count; i++) | 2376 | for (i = 0; i < clkcache->count; i++) |
@@ -2378,11 +2397,11 @@ static int snd_asihpi_clksrc_put(struct snd_kcontrol *kcontrol, | |||
2378 | if (item >= clkcache->count) | 2397 | if (item >= clkcache->count) |
2379 | item = clkcache->count-1; | 2398 | item = clkcache->count-1; |
2380 | 2399 | ||
2381 | hpi_handle_error(hpi_sample_clock_set_source(ss, | 2400 | hpi_handle_error(hpi_sample_clock_set_source( |
2382 | h_control, clkcache->s[item].source)); | 2401 | h_control, clkcache->s[item].source)); |
2383 | 2402 | ||
2384 | if (clkcache->s[item].source == HPI_SAMPLECLOCK_SOURCE_AESEBU_INPUT) | 2403 | if (clkcache->s[item].source == HPI_SAMPLECLOCK_SOURCE_AESEBU_INPUT) |
2385 | hpi_handle_error(hpi_sample_clock_set_source_index(ss, | 2404 | hpi_handle_error(hpi_sample_clock_set_source_index( |
2386 | h_control, clkcache->s[item].index)); | 2405 | h_control, clkcache->s[item].index)); |
2387 | return change; | 2406 | return change; |
2388 | } | 2407 | } |
@@ -2410,7 +2429,7 @@ static int snd_asihpi_clklocal_get(struct snd_kcontrol *kcontrol, | |||
2410 | u32 rate; | 2429 | u32 rate; |
2411 | u16 e; | 2430 | u16 e; |
2412 | 2431 | ||
2413 | e = hpi_sample_clock_get_local_rate(ss, h_control, &rate); | 2432 | e = hpi_sample_clock_get_local_rate(h_control, &rate); |
2414 | if (!e) | 2433 | if (!e) |
2415 | ucontrol->value.integer.value[0] = rate; | 2434 | ucontrol->value.integer.value[0] = rate; |
2416 | else | 2435 | else |
@@ -2428,7 +2447,7 @@ static int snd_asihpi_clklocal_put(struct snd_kcontrol *kcontrol, | |||
2428 | asihpi->mixer_clkrate[addr][1] != right; | 2447 | asihpi->mixer_clkrate[addr][1] != right; |
2429 | */ | 2448 | */ |
2430 | change = 1; | 2449 | change = 1; |
2431 | hpi_handle_error(hpi_sample_clock_set_local_rate(ss, h_control, | 2450 | hpi_handle_error(hpi_sample_clock_set_local_rate(h_control, |
2432 | ucontrol->value.integer.value[0])); | 2451 | ucontrol->value.integer.value[0])); |
2433 | return change; | 2452 | return change; |
2434 | } | 2453 | } |
@@ -2452,7 +2471,7 @@ static int snd_asihpi_clkrate_get(struct snd_kcontrol *kcontrol, | |||
2452 | u32 rate; | 2471 | u32 rate; |
2453 | u16 e; | 2472 | u16 e; |
2454 | 2473 | ||
2455 | e = hpi_sample_clock_get_sample_rate(ss, h_control, &rate); | 2474 | e = hpi_sample_clock_get_sample_rate(h_control, &rate); |
2456 | if (!e) | 2475 | if (!e) |
2457 | ucontrol->value.integer.value[0] = rate; | 2476 | ucontrol->value.integer.value[0] = rate; |
2458 | else | 2477 | else |
@@ -2477,7 +2496,7 @@ static int __devinit snd_asihpi_sampleclock_add(struct snd_card_asihpi *asihpi, | |||
2477 | clkcache->has_local = 0; | 2496 | clkcache->has_local = 0; |
2478 | 2497 | ||
2479 | for (i = 0; i <= HPI_SAMPLECLOCK_SOURCE_LAST; i++) { | 2498 | for (i = 0; i <= HPI_SAMPLECLOCK_SOURCE_LAST; i++) { |
2480 | if (hpi_sample_clock_query_source(ss, hSC, | 2499 | if (hpi_sample_clock_query_source(hSC, |
2481 | i, &source)) | 2500 | i, &source)) |
2482 | break; | 2501 | break; |
2483 | clkcache->s[i].source = source; | 2502 | clkcache->s[i].source = source; |
@@ -2491,7 +2510,7 @@ static int __devinit snd_asihpi_sampleclock_add(struct snd_card_asihpi *asihpi, | |||
2491 | if (has_aes_in) | 2510 | if (has_aes_in) |
2492 | /* already will have picked up index 0 above */ | 2511 | /* already will have picked up index 0 above */ |
2493 | for (j = 1; j < 8; j++) { | 2512 | for (j = 1; j < 8; j++) { |
2494 | if (hpi_sample_clock_query_source_index(ss, hSC, | 2513 | if (hpi_sample_clock_query_source_index(hSC, |
2495 | j, HPI_SAMPLECLOCK_SOURCE_AESEBU_INPUT, | 2514 | j, HPI_SAMPLECLOCK_SOURCE_AESEBU_INPUT, |
2496 | &source)) | 2515 | &source)) |
2497 | break; | 2516 | break; |
@@ -2550,7 +2569,7 @@ static int __devinit snd_card_asihpi_mixer_new(struct snd_card_asihpi *asihpi) | |||
2550 | strcpy(card->mixername, "Asihpi Mixer"); | 2569 | strcpy(card->mixername, "Asihpi Mixer"); |
2551 | 2570 | ||
2552 | err = | 2571 | err = |
2553 | hpi_mixer_open(ss, asihpi->adapter_index, | 2572 | hpi_mixer_open(asihpi->adapter_index, |
2554 | &asihpi->h_mixer); | 2573 | &asihpi->h_mixer); |
2555 | hpi_handle_error(err); | 2574 | hpi_handle_error(err); |
2556 | if (err) | 2575 | if (err) |
@@ -2561,7 +2580,7 @@ static int __devinit snd_card_asihpi_mixer_new(struct snd_card_asihpi *asihpi) | |||
2561 | 2580 | ||
2562 | for (idx = 0; idx < 2000; idx++) { | 2581 | for (idx = 0; idx < 2000; idx++) { |
2563 | err = hpi_mixer_get_control_by_index( | 2582 | err = hpi_mixer_get_control_by_index( |
2564 | ss, asihpi->h_mixer, | 2583 | asihpi->h_mixer, |
2565 | idx, | 2584 | idx, |
2566 | &hpi_ctl.src_node_type, | 2585 | &hpi_ctl.src_node_type, |
2567 | &hpi_ctl.src_node_index, | 2586 | &hpi_ctl.src_node_index, |
@@ -2688,14 +2707,14 @@ snd_asihpi_proc_read(struct snd_info_entry *entry, | |||
2688 | version & 0x7, | 2707 | version & 0x7, |
2689 | ((version >> 13) * 100) + ((version >> 7) & 0x3f)); | 2708 | ((version >> 13) * 100) + ((version >> 7) & 0x3f)); |
2690 | 2709 | ||
2691 | err = hpi_mixer_get_control(ss, asihpi->h_mixer, | 2710 | err = hpi_mixer_get_control(asihpi->h_mixer, |
2692 | HPI_SOURCENODE_CLOCK_SOURCE, 0, 0, 0, | 2711 | HPI_SOURCENODE_CLOCK_SOURCE, 0, 0, 0, |
2693 | HPI_CONTROL_SAMPLECLOCK, &h_control); | 2712 | HPI_CONTROL_SAMPLECLOCK, &h_control); |
2694 | 2713 | ||
2695 | if (!err) { | 2714 | if (!err) { |
2696 | err = hpi_sample_clock_get_sample_rate(ss, | 2715 | err = hpi_sample_clock_get_sample_rate( |
2697 | h_control, &rate); | 2716 | h_control, &rate); |
2698 | err += hpi_sample_clock_get_source(ss, h_control, &source); | 2717 | err += hpi_sample_clock_get_source(h_control, &source); |
2699 | 2718 | ||
2700 | if (!err) | 2719 | if (!err) |
2701 | snd_iprintf(buffer, "sample_clock=%d_hz, source %s\n", | 2720 | snd_iprintf(buffer, "sample_clock=%d_hz, source %s\n", |
@@ -2825,7 +2844,7 @@ static int __devinit snd_asihpi_probe(struct pci_dev *pci_dev, | |||
2825 | asihpi->card = card; | 2844 | asihpi->card = card; |
2826 | asihpi->pci = hpi_card->pci; | 2845 | asihpi->pci = hpi_card->pci; |
2827 | asihpi->adapter_index = hpi_card->index; | 2846 | asihpi->adapter_index = hpi_card->index; |
2828 | hpi_handle_error(hpi_adapter_get_info(ss, | 2847 | hpi_handle_error(hpi_adapter_get_info( |
2829 | asihpi->adapter_index, | 2848 | asihpi->adapter_index, |
2830 | &asihpi->num_outstreams, | 2849 | &asihpi->num_outstreams, |
2831 | &asihpi->num_instreams, | 2850 | &asihpi->num_instreams, |
@@ -2847,33 +2866,33 @@ static int __devinit snd_asihpi_probe(struct pci_dev *pci_dev, | |||
2847 | if (pcm_substreams < asihpi->num_instreams) | 2866 | if (pcm_substreams < asihpi->num_instreams) |
2848 | pcm_substreams = asihpi->num_instreams; | 2867 | pcm_substreams = asihpi->num_instreams; |
2849 | 2868 | ||
2850 | err = hpi_adapter_get_property(ss, asihpi->adapter_index, | 2869 | err = hpi_adapter_get_property(asihpi->adapter_index, |
2851 | HPI_ADAPTER_PROPERTY_CAPS1, | 2870 | HPI_ADAPTER_PROPERTY_CAPS1, |
2852 | NULL, &asihpi->support_grouping); | 2871 | NULL, &asihpi->support_grouping); |
2853 | if (err) | 2872 | if (err) |
2854 | asihpi->support_grouping = 0; | 2873 | asihpi->support_grouping = 0; |
2855 | 2874 | ||
2856 | err = hpi_adapter_get_property(ss, asihpi->adapter_index, | 2875 | err = hpi_adapter_get_property(asihpi->adapter_index, |
2857 | HPI_ADAPTER_PROPERTY_CAPS2, | 2876 | HPI_ADAPTER_PROPERTY_CAPS2, |
2858 | &asihpi->support_mrx, NULL); | 2877 | &asihpi->support_mrx, NULL); |
2859 | if (err) | 2878 | if (err) |
2860 | asihpi->support_mrx = 0; | 2879 | asihpi->support_mrx = 0; |
2861 | 2880 | ||
2862 | err = hpi_adapter_get_property(ss, asihpi->adapter_index, | 2881 | err = hpi_adapter_get_property(asihpi->adapter_index, |
2863 | HPI_ADAPTER_PROPERTY_INTERVAL, | 2882 | HPI_ADAPTER_PROPERTY_INTERVAL, |
2864 | NULL, &asihpi->update_interval_frames); | 2883 | NULL, &asihpi->update_interval_frames); |
2865 | if (err) | 2884 | if (err) |
2866 | asihpi->update_interval_frames = 512; | 2885 | asihpi->update_interval_frames = 512; |
2867 | 2886 | ||
2868 | hpi_handle_error(hpi_instream_open(ss, asihpi->adapter_index, | 2887 | hpi_handle_error(hpi_instream_open(asihpi->adapter_index, |
2869 | 0, &h_stream)); | 2888 | 0, &h_stream)); |
2870 | 2889 | ||
2871 | err = hpi_instream_host_buffer_free(ss, h_stream); | 2890 | err = hpi_instream_host_buffer_free(h_stream); |
2872 | asihpi->support_mmap = (!err); | 2891 | asihpi->support_mmap = (!err); |
2873 | 2892 | ||
2874 | hpi_handle_error(hpi_instream_close(ss, h_stream)); | 2893 | hpi_handle_error(hpi_instream_close(h_stream)); |
2875 | 2894 | ||
2876 | err = hpi_adapter_get_property(ss, asihpi->adapter_index, | 2895 | err = hpi_adapter_get_property(asihpi->adapter_index, |
2877 | HPI_ADAPTER_PROPERTY_CURCHANNELS, | 2896 | HPI_ADAPTER_PROPERTY_CURCHANNELS, |
2878 | &asihpi->in_max_chans, &asihpi->out_max_chans); | 2897 | &asihpi->in_max_chans, &asihpi->out_max_chans); |
2879 | if (err) { | 2898 | if (err) { |
@@ -2899,13 +2918,13 @@ static int __devinit snd_asihpi_probe(struct pci_dev *pci_dev, | |||
2899 | goto __nodev; | 2918 | goto __nodev; |
2900 | } | 2919 | } |
2901 | 2920 | ||
2902 | err = hpi_mixer_get_control(ss, asihpi->h_mixer, | 2921 | err = hpi_mixer_get_control(asihpi->h_mixer, |
2903 | HPI_SOURCENODE_CLOCK_SOURCE, 0, 0, 0, | 2922 | HPI_SOURCENODE_CLOCK_SOURCE, 0, 0, 0, |
2904 | HPI_CONTROL_SAMPLECLOCK, &h_control); | 2923 | HPI_CONTROL_SAMPLECLOCK, &h_control); |
2905 | 2924 | ||
2906 | if (!err) | 2925 | if (!err) |
2907 | err = hpi_sample_clock_set_local_rate( | 2926 | err = hpi_sample_clock_set_local_rate( |
2908 | ss, h_control, adapter_fs); | 2927 | h_control, adapter_fs); |
2909 | 2928 | ||
2910 | snd_asihpi_proc_init(asihpi); | 2929 | snd_asihpi_proc_init(asihpi); |
2911 | 2930 | ||
diff --git a/sound/pci/asihpi/hpi.h b/sound/pci/asihpi/hpi.h index 4fb42c6b42e3..efed0c166bf3 100644 --- a/sound/pci/asihpi/hpi.h +++ b/sound/pci/asihpi/hpi.h | |||
@@ -24,17 +24,10 @@ | |||
24 | 24 | ||
25 | The HPI is a low-level hardware abstraction layer to all | 25 | The HPI is a low-level hardware abstraction layer to all |
26 | AudioScience digital audio adapters | 26 | AudioScience digital audio adapters |
27 | */ | ||
28 | /* | ||
29 | You must define one operating system that the HPI is to be compiled under | ||
30 | HPI_OS_WIN32_USER 32bit Windows | ||
31 | HPI_OS_DSP_C6000 DSP TI C6000 (automatically set) | ||
32 | HPI_OS_WDM Windows WDM kernel driver | ||
33 | HPI_OS_LINUX Linux userspace | ||
34 | HPI_OS_LINUX_KERNEL Linux kernel (automatically set) | ||
35 | 27 | ||
36 | (C) Copyright AudioScience Inc. 1998-2010 | 28 | (C) Copyright AudioScience Inc. 1998-2010 |
37 | ******************************************************************************/ | 29 | */ |
30 | |||
38 | #ifndef _HPI_H_ | 31 | #ifndef _HPI_H_ |
39 | #define _HPI_H_ | 32 | #define _HPI_H_ |
40 | /* HPI Version | 33 | /* HPI Version |
@@ -50,8 +43,8 @@ i.e 3.05.02 is a development version | |||
50 | #define HPI_VER_RELEASE(v) ((int)(v & 0xFF)) | 43 | #define HPI_VER_RELEASE(v) ((int)(v & 0xFF)) |
51 | 44 | ||
52 | /* Use single digits for versions less that 10 to avoid octal. */ | 45 | /* Use single digits for versions less that 10 to avoid octal. */ |
53 | #define HPI_VER HPI_VERSION_CONSTRUCTOR(4L, 5, 14) | 46 | #define HPI_VER HPI_VERSION_CONSTRUCTOR(4L, 5, 17) |
54 | #define HPI_VER_STRING "4.05.14" | 47 | #define HPI_VER_STRING "4.05.17" |
55 | 48 | ||
56 | /* Library version as documented in hpi-api-versions.txt */ | 49 | /* Library version as documented in hpi-api-versions.txt */ |
57 | #define HPI_LIB_VER HPI_VERSION_CONSTRUCTOR(9, 0, 0) | 50 | #define HPI_LIB_VER HPI_VERSION_CONSTRUCTOR(9, 0, 0) |
@@ -60,10 +53,8 @@ i.e 3.05.02 is a development version | |||
60 | #define HPI_EXCLUDE_DEPRECATED | 53 | #define HPI_EXCLUDE_DEPRECATED |
61 | 54 | ||
62 | /******************************************************************************/ | 55 | /******************************************************************************/ |
63 | /******************************************************************************/ | ||
64 | /******** HPI API DEFINITIONS *****/ | 56 | /******** HPI API DEFINITIONS *****/ |
65 | /******************************************************************************/ | 57 | /******************************************************************************/ |
66 | /******************************************************************************/ | ||
67 | 58 | ||
68 | /*******************************************/ | 59 | /*******************************************/ |
69 | /** Audio format types | 60 | /** Audio format types |
@@ -175,7 +166,6 @@ The range is +1.0 to -1.0, which corresponds to digital fullscale. | |||
175 | HPI_FORMAT_UNDEFINED = 0xffff | 166 | HPI_FORMAT_UNDEFINED = 0xffff |
176 | }; | 167 | }; |
177 | 168 | ||
178 | /******************************************* in/out Stream states */ | ||
179 | /*******************************************/ | 169 | /*******************************************/ |
180 | /** Stream States | 170 | /** Stream States |
181 | \ingroup stream | 171 | \ingroup stream |
@@ -195,7 +185,7 @@ enum HPI_STREAM_STATES { | |||
195 | cards to be ready. */ | 185 | cards to be ready. */ |
196 | HPI_STATE_WAIT = 6 | 186 | HPI_STATE_WAIT = 6 |
197 | }; | 187 | }; |
198 | /******************************************* mixer source node types */ | 188 | /*******************************************/ |
199 | /** Source node types | 189 | /** Source node types |
200 | \ingroup mixer | 190 | \ingroup mixer |
201 | */ | 191 | */ |
@@ -225,7 +215,7 @@ enum HPI_SOURCENODES { | |||
225 | /* AX6 max sourcenode types = 15 */ | 215 | /* AX6 max sourcenode types = 15 */ |
226 | }; | 216 | }; |
227 | 217 | ||
228 | /******************************************* mixer dest node types */ | 218 | /*******************************************/ |
229 | /** Destination node types | 219 | /** Destination node types |
230 | \ingroup mixer | 220 | \ingroup mixer |
231 | */ | 221 | */ |
@@ -263,7 +253,7 @@ enum HPI_CONTROLS { | |||
263 | HPI_CONTROL_MUTE = 4, /*mute control - not used at present. */ | 253 | HPI_CONTROL_MUTE = 4, /*mute control - not used at present. */ |
264 | HPI_CONTROL_MULTIPLEXER = 5, /**< multiplexer control. */ | 254 | HPI_CONTROL_MULTIPLEXER = 5, /**< multiplexer control. */ |
265 | 255 | ||
266 | HPI_CONTROL_AESEBU_TRANSMITTER = 6, /**< AES/EBU transmitter control. */ | 256 | HPI_CONTROL_AESEBU_TRANSMITTER = 6, /**< AES/EBU transmitter control */ |
267 | HPI_CONTROL_AESEBUTX = 6, /* HPI_CONTROL_AESEBU_TRANSMITTER */ | 257 | HPI_CONTROL_AESEBUTX = 6, /* HPI_CONTROL_AESEBU_TRANSMITTER */ |
268 | 258 | ||
269 | HPI_CONTROL_AESEBU_RECEIVER = 7, /**< AES/EBU receiver control. */ | 259 | HPI_CONTROL_AESEBU_RECEIVER = 7, /**< AES/EBU receiver control. */ |
@@ -297,10 +287,7 @@ enum HPI_CONTROLS { | |||
297 | /* WARNING types 256 or greater impact bit packing in all AX6 DSP code */ | 287 | /* WARNING types 256 or greater impact bit packing in all AX6 DSP code */ |
298 | }; | 288 | }; |
299 | 289 | ||
300 | /* Shorthand names that match attribute names */ | 290 | /*******************************************/ |
301 | |||
302 | /******************************************* ADAPTER ATTRIBUTES ****/ | ||
303 | |||
304 | /** Adapter properties | 291 | /** Adapter properties |
305 | These are used in HPI_AdapterSetProperty() and HPI_AdapterGetProperty() | 292 | These are used in HPI_AdapterSetProperty() and HPI_AdapterGetProperty() |
306 | \ingroup adapter | 293 | \ingroup adapter |
@@ -331,9 +318,9 @@ by the driver and is not passed on to the DSP at all. | |||
331 | Indicates the state of the adapter's SSX2 setting. This setting is stored in | 318 | Indicates the state of the adapter's SSX2 setting. This setting is stored in |
332 | non-volatile memory on the adapter. A typical call sequence would be to use | 319 | non-volatile memory on the adapter. A typical call sequence would be to use |
333 | HPI_ADAPTER_PROPERTY_SSX2_SETTING to set SSX2 on the adapter and then to reload | 320 | HPI_ADAPTER_PROPERTY_SSX2_SETTING to set SSX2 on the adapter and then to reload |
334 | the driver. The driver would query HPI_ADAPTER_PROPERTY_SSX2_SETTING during startup | 321 | the driver. The driver would query HPI_ADAPTER_PROPERTY_SSX2_SETTING during |
335 | and if SSX2 is set, it would then call HPI_ADAPTER_PROPERTY_ENABLE_SSX2 to enable | 322 | startup and if SSX2 is set, it would then call HPI_ADAPTER_PROPERTY_ENABLE_SSX2 |
336 | SSX2 stream mapping within the kernel level of the driver. | 323 | to enable SSX2 stream mapping within the kernel level of the driver. |
337 | */ | 324 | */ |
338 | HPI_ADAPTER_PROPERTY_SSX2_SETTING = 4, | 325 | HPI_ADAPTER_PROPERTY_SSX2_SETTING = 4, |
339 | 326 | ||
@@ -455,7 +442,7 @@ enum HPI_ADAPTER_MODE_CMDS { | |||
455 | }; | 442 | }; |
456 | 443 | ||
457 | /** Adapter Modes | 444 | /** Adapter Modes |
458 | These are used by HPI_AdapterSetModeEx() | 445 | These are used by HPI_AdapterSetModeEx() |
459 | 446 | ||
460 | \warning - more than 16 possible modes breaks | 447 | \warning - more than 16 possible modes breaks |
461 | a bitmask in the Windows WAVE DLL | 448 | a bitmask in the Windows WAVE DLL |
@@ -630,10 +617,13 @@ enum HPI_MIXER_STORE_COMMAND { | |||
630 | HPI_MIXER_STORE_SAVE_SINGLE = 6 | 617 | HPI_MIXER_STORE_SAVE_SINGLE = 6 |
631 | }; | 618 | }; |
632 | 619 | ||
633 | /************************************* CONTROL ATTRIBUTE VALUES ****/ | 620 | /****************************/ |
621 | /* CONTROL ATTRIBUTE VALUES */ | ||
622 | /****************************/ | ||
623 | |||
634 | /** Used by mixer plugin enable functions | 624 | /** Used by mixer plugin enable functions |
635 | 625 | ||
636 | E.g. HPI_ParametricEQ_SetState() | 626 | E.g. HPI_ParametricEq_SetState() |
637 | \ingroup mixer | 627 | \ingroup mixer |
638 | */ | 628 | */ |
639 | enum HPI_SWITCH_STATES { | 629 | enum HPI_SWITCH_STATES { |
@@ -642,6 +632,7 @@ enum HPI_SWITCH_STATES { | |||
642 | }; | 632 | }; |
643 | 633 | ||
644 | /* Volume control special gain values */ | 634 | /* Volume control special gain values */ |
635 | |||
645 | /** volumes units are 100ths of a dB | 636 | /** volumes units are 100ths of a dB |
646 | \ingroup volume | 637 | \ingroup volume |
647 | */ | 638 | */ |
@@ -668,7 +659,7 @@ enum HPI_VOLUME_AUTOFADES { | |||
668 | 659 | ||
669 | /** The physical encoding format of the AESEBU I/O. | 660 | /** The physical encoding format of the AESEBU I/O. |
670 | 661 | ||
671 | Used in HPI_AESEBU_Transmitter_SetFormat(), HPI_AESEBU_Receiver_SetFormat() | 662 | Used in HPI_Aesebu_Transmitter_SetFormat(), HPI_Aesebu_Receiver_SetFormat() |
672 | along with related Get and Query functions | 663 | along with related Get and Query functions |
673 | \ingroup aestx | 664 | \ingroup aestx |
674 | */ | 665 | */ |
@@ -681,7 +672,7 @@ enum HPI_AESEBU_FORMATS { | |||
681 | 672 | ||
682 | /** AES/EBU error status bits | 673 | /** AES/EBU error status bits |
683 | 674 | ||
684 | Returned by HPI_AESEBU_Receiver_GetErrorStatus() | 675 | Returned by HPI_Aesebu_Receiver_GetErrorStatus() |
685 | \ingroup aesrx | 676 | \ingroup aesrx |
686 | */ | 677 | */ |
687 | enum HPI_AESEBU_ERRORS { | 678 | enum HPI_AESEBU_ERRORS { |
@@ -832,7 +823,7 @@ enum HPI_SAMPLECLOCK_SOURCES { | |||
832 | HPI_SAMPLECLOCK_SOURCE_LAST = 10 | 823 | HPI_SAMPLECLOCK_SOURCE_LAST = 10 |
833 | }; | 824 | }; |
834 | 825 | ||
835 | /** Equalizer filter types. Used by HPI_ParametricEQ_SetBand() | 826 | /** Equalizer filter types. Used by HPI_ParametricEq_SetBand() |
836 | \ingroup parmeq | 827 | \ingroup parmeq |
837 | */ | 828 | */ |
838 | enum HPI_FILTER_TYPE { | 829 | enum HPI_FILTER_TYPE { |
@@ -875,7 +866,7 @@ enum HPI_ERROR_CODES { | |||
875 | HPI_ERROR_INVALID_OBJ = 101, | 866 | HPI_ERROR_INVALID_OBJ = 101, |
876 | /** Function does not exist. */ | 867 | /** Function does not exist. */ |
877 | HPI_ERROR_INVALID_FUNC = 102, | 868 | HPI_ERROR_INVALID_FUNC = 102, |
878 | /** The specified object (adapter/Stream) does not exist. */ | 869 | /** The specified object does not exist. */ |
879 | HPI_ERROR_INVALID_OBJ_INDEX = 103, | 870 | HPI_ERROR_INVALID_OBJ_INDEX = 103, |
880 | /** Trying to access an object that has not been opened yet. */ | 871 | /** Trying to access an object that has not been opened yet. */ |
881 | HPI_ERROR_OBJ_NOT_OPEN = 104, | 872 | HPI_ERROR_OBJ_NOT_OPEN = 104, |
@@ -883,8 +874,8 @@ enum HPI_ERROR_CODES { | |||
883 | HPI_ERROR_OBJ_ALREADY_OPEN = 105, | 874 | HPI_ERROR_OBJ_ALREADY_OPEN = 105, |
884 | /** PCI, ISA resource not valid. */ | 875 | /** PCI, ISA resource not valid. */ |
885 | HPI_ERROR_INVALID_RESOURCE = 106, | 876 | HPI_ERROR_INVALID_RESOURCE = 106, |
886 | /** GetInfo call from SubSysFindAdapters failed. */ | 877 | /* GetInfo call from SubSysFindAdapters failed. */ |
887 | HPI_ERROR_SUBSYSFINDADAPTERS_GETINFO = 107, | 878 | /*HPI_ERROR_SUBSYSFINDADAPTERS_GETINFO= 107, */ |
888 | /** Default response was never updated with actual error code. */ | 879 | /** Default response was never updated with actual error code. */ |
889 | HPI_ERROR_INVALID_RESPONSE = 108, | 880 | HPI_ERROR_INVALID_RESPONSE = 108, |
890 | /** wSize field of response was not updated, | 881 | /** wSize field of response was not updated, |
@@ -892,40 +883,47 @@ enum HPI_ERROR_CODES { | |||
892 | HPI_ERROR_PROCESSING_MESSAGE = 109, | 883 | HPI_ERROR_PROCESSING_MESSAGE = 109, |
893 | /** The network did not respond in a timely manner. */ | 884 | /** The network did not respond in a timely manner. */ |
894 | HPI_ERROR_NETWORK_TIMEOUT = 110, | 885 | HPI_ERROR_NETWORK_TIMEOUT = 110, |
895 | /** An HPI handle is invalid (uninitialised?). */ | 886 | /* An HPI handle is invalid (uninitialised?). */ |
896 | HPI_ERROR_INVALID_HANDLE = 111, | 887 | HPI_ERROR_INVALID_HANDLE = 111, |
897 | /** A function or attribute has not been implemented yet. */ | 888 | /** A function or attribute has not been implemented yet. */ |
898 | HPI_ERROR_UNIMPLEMENTED = 112, | 889 | HPI_ERROR_UNIMPLEMENTED = 112, |
899 | /** There are too many clients attempting to access a network resource. */ | 890 | /** There are too many clients attempting |
891 | to access a network resource. */ | ||
900 | HPI_ERROR_NETWORK_TOO_MANY_CLIENTS = 113, | 892 | HPI_ERROR_NETWORK_TOO_MANY_CLIENTS = 113, |
901 | /** Response buffer passed to HPI_Message was smaller than returned response */ | 893 | /** Response buffer passed to HPI_Message |
894 | was smaller than returned response. | ||
895 | wSpecificError field of hpi response contains the required size. | ||
896 | */ | ||
902 | HPI_ERROR_RESPONSE_BUFFER_TOO_SMALL = 114, | 897 | HPI_ERROR_RESPONSE_BUFFER_TOO_SMALL = 114, |
903 | /** The returned response did not match the sent message */ | 898 | /** The returned response did not match the sent message */ |
904 | HPI_ERROR_RESPONSE_MISMATCH = 115, | 899 | HPI_ERROR_RESPONSE_MISMATCH = 115, |
905 | /** A control setting that should have been cached was not. */ | 900 | /** A control setting that should have been cached was not. */ |
906 | HPI_ERROR_CONTROL_CACHING = 116, | 901 | HPI_ERROR_CONTROL_CACHING = 116, |
902 | /** A message buffer in the path to the adapter was smaller | ||
903 | than the message size. | ||
904 | wSpecificError field of hpi response contains the actual size. | ||
905 | */ | ||
906 | HPI_ERROR_MESSAGE_BUFFER_TOO_SMALL = 117, | ||
907 | 907 | ||
908 | /** Too many adapters.*/ | 908 | /* Too many adapters. */ |
909 | HPI_ERROR_TOO_MANY_ADAPTERS = 200, | 909 | /* HPI_ERROR_TOO_MANY_ADAPTERS= 200, */ |
910 | /** Bad adpater. */ | 910 | /** Bad adpater. */ |
911 | HPI_ERROR_BAD_ADAPTER = 201, | 911 | HPI_ERROR_BAD_ADAPTER = 201, |
912 | /** Adapter number out of range or not set properly. */ | 912 | /** Adapter number out of range or not set properly. */ |
913 | HPI_ERROR_BAD_ADAPTER_NUMBER = 202, | 913 | HPI_ERROR_BAD_ADAPTER_NUMBER = 202, |
914 | /** 2 adapters with the same adapter number. */ | 914 | /** 2 adapters with the same adapter number. */ |
915 | HPI_DUPLICATE_ADAPTER_NUMBER = 203, | 915 | HPI_DUPLICATE_ADAPTER_NUMBER = 203, |
916 | /** DSP code failed to bootload. */ | 916 | /** DSP code failed to bootload. (unused?) */ |
917 | HPI_ERROR_DSP_BOOTLOAD = 204, | 917 | HPI_ERROR_DSP_BOOTLOAD = 204, |
918 | /** Adapter failed DSP code self test. */ | 918 | /** Adapter failed DSP code self test. (unused?) */ |
919 | HPI_ERROR_DSP_SELFTEST = 205, | 919 | HPI_ERROR_DSP_SELFTEST = 205, |
920 | /** Couldn't find or open the DSP code file. */ | 920 | /** Couldn't find or open the DSP code file. */ |
921 | HPI_ERROR_DSP_FILE_NOT_FOUND = 206, | 921 | HPI_ERROR_DSP_FILE_NOT_FOUND = 206, |
922 | /** Internal DSP hardware error. */ | 922 | /** Internal DSP hardware error. */ |
923 | HPI_ERROR_DSP_HARDWARE = 207, | 923 | HPI_ERROR_DSP_HARDWARE = 207, |
924 | /** Could not allocate memory in DOS. */ | ||
925 | HPI_ERROR_DOS_MEMORY_ALLOC = 208, | ||
926 | /** Could not allocate memory */ | 924 | /** Could not allocate memory */ |
927 | HPI_ERROR_MEMORY_ALLOC = 208, | 925 | HPI_ERROR_MEMORY_ALLOC = 208, |
928 | /** Failed to correctly load/config PLD .*/ | 926 | /** Failed to correctly load/config PLD. (unused?) */ |
929 | HPI_ERROR_PLD_LOAD = 209, | 927 | HPI_ERROR_PLD_LOAD = 209, |
930 | /** Unexpected end of file, block length too big etc. */ | 928 | /** Unexpected end of file, block length too big etc. */ |
931 | HPI_ERROR_DSP_FILE_FORMAT = 210, | 929 | HPI_ERROR_DSP_FILE_FORMAT = 210, |
@@ -934,8 +932,8 @@ enum HPI_ERROR_CODES { | |||
934 | HPI_ERROR_DSP_FILE_ACCESS_DENIED = 211, | 932 | HPI_ERROR_DSP_FILE_ACCESS_DENIED = 211, |
935 | /** First DSP code section header not found in DSP file. */ | 933 | /** First DSP code section header not found in DSP file. */ |
936 | HPI_ERROR_DSP_FILE_NO_HEADER = 212, | 934 | HPI_ERROR_DSP_FILE_NO_HEADER = 212, |
937 | /** File read operation on DSP code file failed. */ | 935 | /* File read operation on DSP code file failed. */ |
938 | HPI_ERROR_DSP_FILE_READ_ERROR = 213, | 936 | /*HPI_ERROR_DSP_FILE_READ_ERROR= 213, */ |
939 | /** DSP code for adapter family not found. */ | 937 | /** DSP code for adapter family not found. */ |
940 | HPI_ERROR_DSP_SECTION_NOT_FOUND = 214, | 938 | HPI_ERROR_DSP_SECTION_NOT_FOUND = 214, |
941 | /** Other OS specific error opening DSP file. */ | 939 | /** Other OS specific error opening DSP file. */ |
@@ -945,8 +943,8 @@ enum HPI_ERROR_CODES { | |||
945 | /** DSP code section header had size == 0. */ | 943 | /** DSP code section header had size == 0. */ |
946 | HPI_ERROR_DSP_FILE_NULL_HEADER = 217, | 944 | HPI_ERROR_DSP_FILE_NULL_HEADER = 217, |
947 | 945 | ||
948 | /** Base number for flash errors. */ | 946 | /* Base number for flash errors. */ |
949 | HPI_ERROR_FLASH = 220, | 947 | /* HPI_ERROR_FLASH = 220, */ |
950 | 948 | ||
951 | /** Flash has bad checksum */ | 949 | /** Flash has bad checksum */ |
952 | HPI_ERROR_BAD_CHECKSUM = 221, | 950 | HPI_ERROR_BAD_CHECKSUM = 221, |
@@ -960,8 +958,8 @@ enum HPI_ERROR_CODES { | |||
960 | /** Reserved for OEMs. */ | 958 | /** Reserved for OEMs. */ |
961 | HPI_ERROR_RESERVED_1 = 290, | 959 | HPI_ERROR_RESERVED_1 = 290, |
962 | 960 | ||
963 | /** Stream does not exist. */ | 961 | /* Stream does not exist. */ |
964 | HPI_ERROR_INVALID_STREAM = 300, | 962 | /*HPI_ERROR_INVALID_STREAM= 300, // use HPI_ERROR_INVALID_OBJ_INDEX */ |
965 | /** Invalid compression format. */ | 963 | /** Invalid compression format. */ |
966 | HPI_ERROR_INVALID_FORMAT = 301, | 964 | HPI_ERROR_INVALID_FORMAT = 301, |
967 | /** Invalid format samplerate */ | 965 | /** Invalid format samplerate */ |
@@ -972,21 +970,21 @@ enum HPI_ERROR_CODES { | |||
972 | HPI_ERROR_INVALID_BITRATE = 304, | 970 | HPI_ERROR_INVALID_BITRATE = 304, |
973 | /** Invalid datasize used for stream read/write. */ | 971 | /** Invalid datasize used for stream read/write. */ |
974 | HPI_ERROR_INVALID_DATASIZE = 305, | 972 | HPI_ERROR_INVALID_DATASIZE = 305, |
975 | /** Stream buffer is full during stream write. */ | 973 | /* Stream buffer is full during stream write. */ |
976 | HPI_ERROR_BUFFER_FULL = 306, | 974 | /*HPI_ERROR_BUFFER_FULL = 306, // USE HPI_ERROR_INVALID_DATASIZE */ |
977 | /** Stream buffer is empty during stream read. */ | 975 | /* Stream buffer is empty during stream read. */ |
978 | HPI_ERROR_BUFFER_EMPTY = 307, | 976 | /*HPI_ERROR_BUFFER_EMPTY = 307, // USE HPI_ERROR_INVALID_DATASIZE */ |
979 | /** Invalid datasize used for stream read/write. */ | 977 | /** Null data pointer used for stream read/write. */ |
980 | HPI_ERROR_INVALID_DATA_TRANSFER = 308, | 978 | HPI_ERROR_INVALID_DATA_POINTER = 308, |
981 | /** Packet ordering error for stream read/write. */ | 979 | /** Packet ordering error for stream read/write. */ |
982 | HPI_ERROR_INVALID_PACKET_ORDER = 309, | 980 | HPI_ERROR_INVALID_PACKET_ORDER = 309, |
983 | 981 | ||
984 | /** Object can't do requested operation in its current | 982 | /** Object can't do requested operation in its current |
985 | state, eg set format, change rec mux state while recording.*/ | 983 | state, eg set format, change rec mux state while recording.*/ |
986 | HPI_ERROR_INVALID_OPERATION = 310, | 984 | HPI_ERROR_INVALID_OPERATION = 310, |
987 | 985 | ||
988 | /** Where an SRG is shared amongst streams, an incompatible samplerate is one | 986 | /** Where a SRG is shared amongst streams, an incompatible samplerate |
989 | that is different to any currently playing or recording stream. */ | 987 | is one that is different to any currently active stream. */ |
990 | HPI_ERROR_INCOMPATIBLE_SAMPLERATE = 311, | 988 | HPI_ERROR_INCOMPATIBLE_SAMPLERATE = 311, |
991 | /** Adapter mode is illegal.*/ | 989 | /** Adapter mode is illegal.*/ |
992 | HPI_ERROR_BAD_ADAPTER_MODE = 312, | 990 | HPI_ERROR_BAD_ADAPTER_MODE = 312, |
@@ -1068,7 +1066,7 @@ enum HPI_ERROR_CODES { | |||
1068 | 1066 | ||
1069 | /**\}*/ | 1067 | /**\}*/ |
1070 | 1068 | ||
1071 | /* ////////////////////////////////////////////////////////////////////// */ | 1069 | /**************/ |
1072 | /* STRUCTURES */ | 1070 | /* STRUCTURES */ |
1073 | #ifndef DISABLE_PRAGMA_PACK1 | 1071 | #ifndef DISABLE_PRAGMA_PACK1 |
1074 | #pragma pack(push, 1) | 1072 | #pragma pack(push, 1) |
@@ -1116,724 +1114,573 @@ struct hpi_async_event { | |||
1116 | /* skip host side function declarations for | 1114 | /* skip host side function declarations for |
1117 | DSP compile and documentation extraction */ | 1115 | DSP compile and documentation extraction */ |
1118 | 1116 | ||
1119 | struct hpi_hsubsys { | ||
1120 | int not_really_used; | ||
1121 | }; | ||
1122 | |||
1123 | #ifndef DISABLE_PRAGMA_PACK1 | 1117 | #ifndef DISABLE_PRAGMA_PACK1 |
1124 | #pragma pack(pop) | 1118 | #pragma pack(pop) |
1125 | #endif | 1119 | #endif |
1126 | 1120 | ||
1127 | /*////////////////////////////////////////////////////////////////////////// */ | 1121 | /*****************/ |
1128 | /* HPI FUNCTIONS */ | 1122 | /* HPI FUNCTIONS */ |
1123 | /*****************/ | ||
1129 | 1124 | ||
1130 | /*/////////////////////////// */ | 1125 | /* Stream */ |
1131 | /* DATA and FORMAT and STREAM */ | ||
1132 | |||
1133 | u16 hpi_stream_estimate_buffer_size(struct hpi_format *pF, | 1126 | u16 hpi_stream_estimate_buffer_size(struct hpi_format *pF, |
1134 | u32 host_polling_rate_in_milli_seconds, u32 *recommended_buffer_size); | 1127 | u32 host_polling_rate_in_milli_seconds, u32 *recommended_buffer_size); |
1135 | 1128 | ||
1136 | /*/////////// */ | 1129 | /*************/ |
1137 | /* SUB SYSTEM */ | 1130 | /* SubSystem */ |
1138 | struct hpi_hsubsys *hpi_subsys_create(void); | 1131 | /*************/ |
1139 | 1132 | ||
1140 | void hpi_subsys_free(const struct hpi_hsubsys *ph_subsys); | 1133 | u16 hpi_subsys_get_version_ex(u32 *pversion_ex); |
1141 | 1134 | ||
1142 | u16 hpi_subsys_get_version_ex(const struct hpi_hsubsys *ph_subsys, | 1135 | u16 hpi_subsys_get_num_adapters(int *pn_num_adapters); |
1143 | u32 *pversion_ex); | ||
1144 | 1136 | ||
1145 | u16 hpi_subsys_get_num_adapters(const struct hpi_hsubsys *ph_subsys, | 1137 | u16 hpi_subsys_get_adapter(int iterator, u32 *padapter_index, |
1146 | int *pn_num_adapters); | 1138 | u16 *pw_adapter_type); |
1147 | 1139 | ||
1148 | u16 hpi_subsys_get_adapter(const struct hpi_hsubsys *ph_subsys, int iterator, | 1140 | /***********/ |
1149 | u32 *padapter_index, u16 *pw_adapter_type); | 1141 | /* Adapter */ |
1142 | /***********/ | ||
1150 | 1143 | ||
1151 | /*///////// */ | 1144 | u16 hpi_adapter_open(u16 adapter_index); |
1152 | /* ADAPTER */ | ||
1153 | 1145 | ||
1154 | u16 hpi_adapter_open(const struct hpi_hsubsys *ph_subsys, u16 adapter_index); | 1146 | u16 hpi_adapter_close(u16 adapter_index); |
1155 | 1147 | ||
1156 | u16 hpi_adapter_close(const struct hpi_hsubsys *ph_subsys, u16 adapter_index); | 1148 | u16 hpi_adapter_get_info(u16 adapter_index, u16 *pw_num_outstreams, |
1149 | u16 *pw_num_instreams, u16 *pw_version, u32 *pserial_number, | ||
1150 | u16 *pw_adapter_type); | ||
1157 | 1151 | ||
1158 | u16 hpi_adapter_get_info(const struct hpi_hsubsys *ph_subsys, | 1152 | u16 hpi_adapter_get_module_by_index(u16 adapter_index, u16 module_index, |
1159 | u16 adapter_index, u16 *pw_num_outstreams, u16 *pw_num_instreams, | 1153 | u16 *pw_num_outputs, u16 *pw_num_inputs, u16 *pw_version, |
1160 | u16 *pw_version, u32 *pserial_number, u16 *pw_adapter_type); | 1154 | u32 *pserial_number, u16 *pw_module_type, u32 *ph_module); |
1161 | 1155 | ||
1162 | u16 hpi_adapter_get_module_by_index(const struct hpi_hsubsys *ph_subsys, | 1156 | u16 hpi_adapter_set_mode(u16 adapter_index, u32 adapter_mode); |
1163 | u16 adapter_index, u16 module_index, u16 *pw_num_outputs, | ||
1164 | u16 *pw_num_inputs, u16 *pw_version, u32 *pserial_number, | ||
1165 | u16 *pw_module_type, u32 *ph_module); | ||
1166 | 1157 | ||
1167 | u16 hpi_adapter_set_mode(const struct hpi_hsubsys *ph_subsys, | 1158 | u16 hpi_adapter_set_mode_ex(u16 adapter_index, u32 adapter_mode, |
1168 | u16 adapter_index, u32 adapter_mode); | 1159 | u16 query_or_set); |
1169 | 1160 | ||
1170 | u16 hpi_adapter_set_mode_ex(const struct hpi_hsubsys *ph_subsys, | 1161 | u16 hpi_adapter_get_mode(u16 adapter_index, u32 *padapter_mode); |
1171 | u16 adapter_index, u32 adapter_mode, u16 query_or_set); | ||
1172 | 1162 | ||
1173 | u16 hpi_adapter_get_mode(const struct hpi_hsubsys *ph_subsys, | 1163 | u16 hpi_adapter_get_assert2(u16 adapter_index, u16 *p_assert_count, |
1174 | u16 adapter_index, u32 *padapter_mode); | 1164 | char *psz_assert, u32 *p_param1, u32 *p_param2, |
1165 | u32 *p_dsp_string_addr, u16 *p_processor_id); | ||
1175 | 1166 | ||
1176 | u16 hpi_adapter_get_assert2(const struct hpi_hsubsys *ph_subsys, | 1167 | u16 hpi_adapter_test_assert(u16 adapter_index, u16 assert_id); |
1177 | u16 adapter_index, u16 *p_assert_count, char *psz_assert, | ||
1178 | u32 *p_param1, u32 *p_param2, u32 *p_dsp_string_addr, | ||
1179 | u16 *p_processor_id); | ||
1180 | 1168 | ||
1181 | u16 hpi_adapter_test_assert(const struct hpi_hsubsys *ph_subsys, | 1169 | u16 hpi_adapter_enable_capability(u16 adapter_index, u16 capability, u32 key); |
1182 | u16 adapter_index, u16 assert_id); | ||
1183 | 1170 | ||
1184 | u16 hpi_adapter_enable_capability(const struct hpi_hsubsys *ph_subsys, | 1171 | u16 hpi_adapter_self_test(u16 adapter_index); |
1185 | u16 adapter_index, u16 capability, u32 key); | ||
1186 | 1172 | ||
1187 | u16 hpi_adapter_self_test(const struct hpi_hsubsys *ph_subsys, | 1173 | u16 hpi_adapter_debug_read(u16 adapter_index, u32 dsp_address, char *p_bytes, |
1188 | u16 adapter_index); | 1174 | int *count_bytes); |
1189 | 1175 | ||
1190 | u16 hpi_adapter_debug_read(const struct hpi_hsubsys *ph_subsys, | 1176 | u16 hpi_adapter_set_property(u16 adapter_index, u16 property, u16 paramter1, |
1191 | u16 adapter_index, u32 dsp_address, char *p_bytes, int *count_bytes); | 1177 | u16 paramter2); |
1192 | 1178 | ||
1193 | u16 hpi_adapter_set_property(const struct hpi_hsubsys *ph_subsys, | 1179 | u16 hpi_adapter_get_property(u16 adapter_index, u16 property, |
1194 | u16 adapter_index, u16 property, u16 paramter1, u16 paramter2); | 1180 | u16 *pw_paramter1, u16 *pw_paramter2); |
1195 | 1181 | ||
1196 | u16 hpi_adapter_get_property(const struct hpi_hsubsys *ph_subsys, | 1182 | u16 hpi_adapter_enumerate_property(u16 adapter_index, u16 index, |
1197 | u16 adapter_index, u16 property, u16 *pw_paramter1, | 1183 | u16 what_to_enumerate, u16 property_index, u32 *psetting); |
1198 | u16 *pw_paramter2); | 1184 | /*************/ |
1185 | /* OutStream */ | ||
1186 | /*************/ | ||
1187 | u16 hpi_outstream_open(u16 adapter_index, u16 outstream_index, | ||
1188 | u32 *ph_outstream); | ||
1199 | 1189 | ||
1200 | u16 hpi_adapter_enumerate_property(const struct hpi_hsubsys *ph_subsys, | 1190 | u16 hpi_outstream_close(u32 h_outstream); |
1201 | u16 adapter_index, u16 index, u16 what_to_enumerate, | ||
1202 | u16 property_index, u32 *psetting); | ||
1203 | /**************/ | ||
1204 | /* OUT STREAM */ | ||
1205 | /**************/ | ||
1206 | u16 hpi_outstream_open(const struct hpi_hsubsys *ph_subsys, u16 adapter_index, | ||
1207 | u16 outstream_index, u32 *ph_outstream); | ||
1208 | 1191 | ||
1209 | u16 hpi_outstream_close(const struct hpi_hsubsys *ph_subsys, u32 h_outstream); | 1192 | u16 hpi_outstream_get_info_ex(u32 h_outstream, u16 *pw_state, |
1193 | u32 *pbuffer_size, u32 *pdata_to_play, u32 *psamples_played, | ||
1194 | u32 *pauxiliary_data_to_play); | ||
1210 | 1195 | ||
1211 | u16 hpi_outstream_get_info_ex(const struct hpi_hsubsys *ph_subsys, | 1196 | u16 hpi_outstream_write_buf(u32 h_outstream, const u8 *pb_write_buf, |
1212 | u32 h_outstream, u16 *pw_state, u32 *pbuffer_size, u32 *pdata_to_play, | 1197 | u32 bytes_to_write, const struct hpi_format *p_format); |
1213 | u32 *psamples_played, u32 *pauxiliary_data_to_play); | ||
1214 | 1198 | ||
1215 | u16 hpi_outstream_write_buf(const struct hpi_hsubsys *ph_subsys, | 1199 | u16 hpi_outstream_start(u32 h_outstream); |
1216 | u32 h_outstream, const u8 *pb_write_buf, u32 bytes_to_write, | ||
1217 | const struct hpi_format *p_format); | ||
1218 | |||
1219 | u16 hpi_outstream_start(const struct hpi_hsubsys *ph_subsys, u32 h_outstream); | ||
1220 | 1200 | ||
1221 | u16 hpi_outstream_wait_start(const struct hpi_hsubsys *ph_subsys, | 1201 | u16 hpi_outstream_wait_start(u32 h_outstream); |
1222 | u32 h_outstream); | ||
1223 | 1202 | ||
1224 | u16 hpi_outstream_stop(const struct hpi_hsubsys *ph_subsys, u32 h_outstream); | 1203 | u16 hpi_outstream_stop(u32 h_outstream); |
1225 | 1204 | ||
1226 | u16 hpi_outstream_sinegen(const struct hpi_hsubsys *ph_subsys, | 1205 | u16 hpi_outstream_sinegen(u32 h_outstream); |
1227 | u32 h_outstream); | ||
1228 | 1206 | ||
1229 | u16 hpi_outstream_reset(const struct hpi_hsubsys *ph_subsys, u32 h_outstream); | 1207 | u16 hpi_outstream_reset(u32 h_outstream); |
1230 | 1208 | ||
1231 | u16 hpi_outstream_query_format(const struct hpi_hsubsys *ph_subsys, | 1209 | u16 hpi_outstream_query_format(u32 h_outstream, struct hpi_format *p_format); |
1232 | u32 h_outstream, struct hpi_format *p_format); | ||
1233 | 1210 | ||
1234 | u16 hpi_outstream_set_format(const struct hpi_hsubsys *ph_subsys, | 1211 | u16 hpi_outstream_set_format(u32 h_outstream, struct hpi_format *p_format); |
1235 | u32 h_outstream, struct hpi_format *p_format); | ||
1236 | 1212 | ||
1237 | u16 hpi_outstream_set_punch_in_out(const struct hpi_hsubsys *ph_subsys, | 1213 | u16 hpi_outstream_set_punch_in_out(u32 h_outstream, u32 punch_in_sample, |
1238 | u32 h_outstream, u32 punch_in_sample, u32 punch_out_sample); | 1214 | u32 punch_out_sample); |
1239 | 1215 | ||
1240 | u16 hpi_outstream_set_velocity(const struct hpi_hsubsys *ph_subsys, | 1216 | u16 hpi_outstream_set_velocity(u32 h_outstream, short velocity); |
1241 | u32 h_outstream, short velocity); | ||
1242 | 1217 | ||
1243 | u16 hpi_outstream_ancillary_reset(const struct hpi_hsubsys *ph_subsys, | 1218 | u16 hpi_outstream_ancillary_reset(u32 h_outstream, u16 mode); |
1244 | u32 h_outstream, u16 mode); | ||
1245 | 1219 | ||
1246 | u16 hpi_outstream_ancillary_get_info(const struct hpi_hsubsys *ph_subsys, | 1220 | u16 hpi_outstream_ancillary_get_info(u32 h_outstream, u32 *pframes_available); |
1247 | u32 h_outstream, u32 *pframes_available); | ||
1248 | 1221 | ||
1249 | u16 hpi_outstream_ancillary_read(const struct hpi_hsubsys *ph_subsys, | 1222 | u16 hpi_outstream_ancillary_read(u32 h_outstream, |
1250 | u32 h_outstream, struct hpi_anc_frame *p_anc_frame_buffer, | 1223 | struct hpi_anc_frame *p_anc_frame_buffer, |
1251 | u32 anc_frame_buffer_size_in_bytes, | 1224 | u32 anc_frame_buffer_size_in_bytes, |
1252 | u32 number_of_ancillary_frames_to_read); | 1225 | u32 number_of_ancillary_frames_to_read); |
1253 | 1226 | ||
1254 | u16 hpi_outstream_set_time_scale(const struct hpi_hsubsys *ph_subsys, | 1227 | u16 hpi_outstream_set_time_scale(u32 h_outstream, u32 time_scaleX10000); |
1255 | u32 h_outstream, u32 time_scaleX10000); | ||
1256 | 1228 | ||
1257 | u16 hpi_outstream_host_buffer_allocate(const struct hpi_hsubsys *ph_subsys, | 1229 | u16 hpi_outstream_host_buffer_allocate(u32 h_outstream, u32 size_in_bytes); |
1258 | u32 h_outstream, u32 size_in_bytes); | ||
1259 | 1230 | ||
1260 | u16 hpi_outstream_host_buffer_free(const struct hpi_hsubsys *ph_subsys, | 1231 | u16 hpi_outstream_host_buffer_free(u32 h_outstream); |
1261 | u32 h_outstream); | ||
1262 | 1232 | ||
1263 | u16 hpi_outstream_group_add(const struct hpi_hsubsys *ph_subsys, | 1233 | u16 hpi_outstream_group_add(u32 h_outstream, u32 h_stream); |
1264 | u32 h_outstream, u32 h_stream); | ||
1265 | 1234 | ||
1266 | u16 hpi_outstream_group_get_map(const struct hpi_hsubsys *ph_subsys, | 1235 | u16 hpi_outstream_group_get_map(u32 h_outstream, u32 *poutstream_map, |
1267 | u32 h_outstream, u32 *poutstream_map, u32 *pinstream_map); | 1236 | u32 *pinstream_map); |
1268 | 1237 | ||
1269 | u16 hpi_outstream_group_reset(const struct hpi_hsubsys *ph_subsys, | 1238 | u16 hpi_outstream_group_reset(u32 h_outstream); |
1270 | u32 h_outstream); | ||
1271 | 1239 | ||
1272 | /*////////// */ | 1240 | /************/ |
1273 | /* IN_STREAM */ | 1241 | /* InStream */ |
1274 | u16 hpi_instream_open(const struct hpi_hsubsys *ph_subsys, u16 adapter_index, | 1242 | /************/ |
1275 | u16 instream_index, u32 *ph_instream); | 1243 | u16 hpi_instream_open(u16 adapter_index, u16 instream_index, |
1244 | u32 *ph_instream); | ||
1276 | 1245 | ||
1277 | u16 hpi_instream_close(const struct hpi_hsubsys *ph_subsys, u32 h_instream); | 1246 | u16 hpi_instream_close(u32 h_instream); |
1278 | 1247 | ||
1279 | u16 hpi_instream_query_format(const struct hpi_hsubsys *ph_subsys, | 1248 | u16 hpi_instream_query_format(u32 h_instream, |
1280 | u32 h_instream, const struct hpi_format *p_format); | 1249 | const struct hpi_format *p_format); |
1281 | 1250 | ||
1282 | u16 hpi_instream_set_format(const struct hpi_hsubsys *ph_subsys, | 1251 | u16 hpi_instream_set_format(u32 h_instream, |
1283 | u32 h_instream, const struct hpi_format *p_format); | 1252 | const struct hpi_format *p_format); |
1284 | 1253 | ||
1285 | u16 hpi_instream_read_buf(const struct hpi_hsubsys *ph_subsys, u32 h_instream, | 1254 | u16 hpi_instream_read_buf(u32 h_instream, u8 *pb_read_buf, u32 bytes_to_read); |
1286 | u8 *pb_read_buf, u32 bytes_to_read); | ||
1287 | 1255 | ||
1288 | u16 hpi_instream_start(const struct hpi_hsubsys *ph_subsys, u32 h_instream); | 1256 | u16 hpi_instream_start(u32 h_instream); |
1289 | 1257 | ||
1290 | u16 hpi_instream_wait_start(const struct hpi_hsubsys *ph_subsys, | 1258 | u16 hpi_instream_wait_start(u32 h_instream); |
1291 | u32 h_instream); | ||
1292 | 1259 | ||
1293 | u16 hpi_instream_stop(const struct hpi_hsubsys *ph_subsys, u32 h_instream); | 1260 | u16 hpi_instream_stop(u32 h_instream); |
1294 | 1261 | ||
1295 | u16 hpi_instream_reset(const struct hpi_hsubsys *ph_subsys, u32 h_instream); | 1262 | u16 hpi_instream_reset(u32 h_instream); |
1296 | 1263 | ||
1297 | u16 hpi_instream_get_info_ex(const struct hpi_hsubsys *ph_subsys, | 1264 | u16 hpi_instream_get_info_ex(u32 h_instream, u16 *pw_state, u32 *pbuffer_size, |
1298 | u32 h_instream, u16 *pw_state, u32 *pbuffer_size, u32 *pdata_recorded, | 1265 | u32 *pdata_recorded, u32 *psamples_recorded, |
1299 | u32 *psamples_recorded, u32 *pauxiliary_data_recorded); | 1266 | u32 *pauxiliary_data_recorded); |
1300 | 1267 | ||
1301 | u16 hpi_instream_ancillary_reset(const struct hpi_hsubsys *ph_subsys, | 1268 | u16 hpi_instream_ancillary_reset(u32 h_instream, u16 bytes_per_frame, |
1302 | u32 h_instream, u16 bytes_per_frame, u16 mode, u16 alignment, | 1269 | u16 mode, u16 alignment, u16 idle_bit); |
1303 | u16 idle_bit); | ||
1304 | 1270 | ||
1305 | u16 hpi_instream_ancillary_get_info(const struct hpi_hsubsys *ph_subsys, | 1271 | u16 hpi_instream_ancillary_get_info(u32 h_instream, u32 *pframe_space); |
1306 | u32 h_instream, u32 *pframe_space); | ||
1307 | 1272 | ||
1308 | u16 hpi_instream_ancillary_write(const struct hpi_hsubsys *ph_subsys, | 1273 | u16 hpi_instream_ancillary_write(u32 h_instream, |
1309 | u32 h_instream, const struct hpi_anc_frame *p_anc_frame_buffer, | 1274 | const struct hpi_anc_frame *p_anc_frame_buffer, |
1310 | u32 anc_frame_buffer_size_in_bytes, | 1275 | u32 anc_frame_buffer_size_in_bytes, |
1311 | u32 number_of_ancillary_frames_to_write); | 1276 | u32 number_of_ancillary_frames_to_write); |
1312 | 1277 | ||
1313 | u16 hpi_instream_host_buffer_allocate(const struct hpi_hsubsys *ph_subsys, | 1278 | u16 hpi_instream_host_buffer_allocate(u32 h_instream, u32 size_in_bytes); |
1314 | u32 h_instream, u32 size_in_bytes); | ||
1315 | 1279 | ||
1316 | u16 hpi_instream_host_buffer_free(const struct hpi_hsubsys *ph_subsys, | 1280 | u16 hpi_instream_host_buffer_free(u32 h_instream); |
1317 | u32 h_instream); | ||
1318 | 1281 | ||
1319 | u16 hpi_instream_group_add(const struct hpi_hsubsys *ph_subsys, | 1282 | u16 hpi_instream_group_add(u32 h_instream, u32 h_stream); |
1320 | u32 h_instream, u32 h_stream); | ||
1321 | 1283 | ||
1322 | u16 hpi_instream_group_get_map(const struct hpi_hsubsys *ph_subsys, | 1284 | u16 hpi_instream_group_get_map(u32 h_instream, u32 *poutstream_map, |
1323 | u32 h_instream, u32 *poutstream_map, u32 *pinstream_map); | 1285 | u32 *pinstream_map); |
1324 | 1286 | ||
1325 | u16 hpi_instream_group_reset(const struct hpi_hsubsys *ph_subsys, | 1287 | u16 hpi_instream_group_reset(u32 h_instream); |
1326 | u32 h_instream); | ||
1327 | 1288 | ||
1328 | /*********/ | 1289 | /*********/ |
1329 | /* MIXER */ | 1290 | /* Mixer */ |
1330 | /*********/ | 1291 | /*********/ |
1331 | u16 hpi_mixer_open(const struct hpi_hsubsys *ph_subsys, u16 adapter_index, | 1292 | u16 hpi_mixer_open(u16 adapter_index, u32 *ph_mixer); |
1332 | u32 *ph_mixer); | 1293 | |
1333 | 1294 | u16 hpi_mixer_close(u32 h_mixer); | |
1334 | u16 hpi_mixer_close(const struct hpi_hsubsys *ph_subsys, u32 h_mixer); | 1295 | |
1335 | 1296 | u16 hpi_mixer_get_control(u32 h_mixer, u16 src_node_type, | |
1336 | u16 hpi_mixer_get_control(const struct hpi_hsubsys *ph_subsys, u32 h_mixer, | 1297 | u16 src_node_type_index, u16 dst_node_type, u16 dst_node_type_index, |
1337 | u16 src_node_type, u16 src_node_type_index, u16 dst_node_type, | 1298 | u16 control_type, u32 *ph_control); |
1338 | u16 dst_node_type_index, u16 control_type, u32 *ph_control); | 1299 | |
1339 | 1300 | u16 hpi_mixer_get_control_by_index(u32 h_mixer, u16 control_index, | |
1340 | u16 hpi_mixer_get_control_by_index(const struct hpi_hsubsys *ph_subsys, | 1301 | u16 *pw_src_node_type, u16 *pw_src_node_index, u16 *pw_dst_node_type, |
1341 | u32 h_mixer, u16 control_index, u16 *pw_src_node_type, | 1302 | u16 *pw_dst_node_index, u16 *pw_control_type, u32 *ph_control); |
1342 | u16 *pw_src_node_index, u16 *pw_dst_node_type, u16 *pw_dst_node_index, | 1303 | |
1343 | u16 *pw_control_type, u32 *ph_control); | 1304 | u16 hpi_mixer_store(u32 h_mixer, enum HPI_MIXER_STORE_COMMAND command, |
1344 | 1305 | u16 index); | |
1345 | u16 hpi_mixer_store(const struct hpi_hsubsys *ph_subsys, u32 h_mixer, | 1306 | /************/ |
1346 | enum HPI_MIXER_STORE_COMMAND command, u16 index); | 1307 | /* Controls */ |
1347 | /*************************/ | 1308 | /************/ |
1348 | /* mixer CONTROLS */ | 1309 | /******************/ |
1349 | /*************************/ | 1310 | /* Volume control */ |
1350 | /*************************/ | 1311 | /******************/ |
1351 | /* volume control */ | 1312 | u16 hpi_volume_set_gain(u32 h_control, short an_gain0_01dB[HPI_MAX_CHANNELS] |
1352 | /*************************/ | ||
1353 | u16 hpi_volume_set_gain(const struct hpi_hsubsys *ph_subsys, u32 h_control, | ||
1354 | short an_gain0_01dB[HPI_MAX_CHANNELS] | ||
1355 | ); | 1313 | ); |
1356 | 1314 | ||
1357 | u16 hpi_volume_get_gain(const struct hpi_hsubsys *ph_subsys, u32 h_control, | 1315 | u16 hpi_volume_get_gain(u32 h_control, |
1358 | short an_gain0_01dB_out[HPI_MAX_CHANNELS] | 1316 | short an_gain0_01dB_out[HPI_MAX_CHANNELS] |
1359 | ); | 1317 | ); |
1360 | 1318 | ||
1361 | #define hpi_volume_get_range hpi_volume_query_range | 1319 | #define hpi_volume_get_range hpi_volume_query_range |
1362 | u16 hpi_volume_query_range(const struct hpi_hsubsys *ph_subsys, u32 h_control, | 1320 | u16 hpi_volume_query_range(u32 h_control, short *min_gain_01dB, |
1363 | short *min_gain_01dB, short *max_gain_01dB, short *step_gain_01dB); | 1321 | short *max_gain_01dB, short *step_gain_01dB); |
1364 | 1322 | ||
1365 | u16 hpi_volume_query_channels(const struct hpi_hsubsys *ph_subsys, | 1323 | u16 hpi_volume_query_channels(const u32 h_volume, u32 *p_channels); |
1366 | const u32 h_volume, u32 *p_channels); | ||
1367 | 1324 | ||
1368 | u16 hpi_volume_auto_fade(const struct hpi_hsubsys *ph_subsys, u32 h_control, | 1325 | u16 hpi_volume_auto_fade(u32 h_control, |
1369 | short an_stop_gain0_01dB[HPI_MAX_CHANNELS], u32 duration_ms); | 1326 | short an_stop_gain0_01dB[HPI_MAX_CHANNELS], u32 duration_ms); |
1370 | 1327 | ||
1371 | u16 hpi_volume_auto_fade_profile(const struct hpi_hsubsys *ph_subsys, | 1328 | u16 hpi_volume_auto_fade_profile(u32 h_control, |
1372 | u32 h_control, short an_stop_gain0_01dB[HPI_MAX_CHANNELS], | 1329 | short an_stop_gain0_01dB[HPI_MAX_CHANNELS], u32 duration_ms, |
1373 | u32 duration_ms, u16 profile); | 1330 | u16 profile); |
1374 | 1331 | ||
1375 | /*************************/ | 1332 | /*****************/ |
1376 | /* level control */ | 1333 | /* Level control */ |
1377 | /*************************/ | 1334 | /*****************/ |
1378 | u16 hpi_level_query_range(const struct hpi_hsubsys *ph_subsys, u32 h_control, | 1335 | u16 hpi_level_query_range(u32 h_control, short *min_gain_01dB, |
1379 | short *min_gain_01dB, short *max_gain_01dB, short *step_gain_01dB); | 1336 | short *max_gain_01dB, short *step_gain_01dB); |
1380 | 1337 | ||
1381 | u16 hpi_level_set_gain(const struct hpi_hsubsys *ph_subsys, u32 h_control, | 1338 | u16 hpi_level_set_gain(u32 h_control, short an_gain0_01dB[HPI_MAX_CHANNELS] |
1382 | short an_gain0_01dB[HPI_MAX_CHANNELS] | ||
1383 | ); | 1339 | ); |
1384 | 1340 | ||
1385 | u16 hpi_level_get_gain(const struct hpi_hsubsys *ph_subsys, u32 h_control, | 1341 | u16 hpi_level_get_gain(u32 h_control, |
1386 | short an_gain0_01dB_out[HPI_MAX_CHANNELS] | 1342 | short an_gain0_01dB_out[HPI_MAX_CHANNELS] |
1387 | ); | 1343 | ); |
1388 | 1344 | ||
1389 | /*************************/ | 1345 | /*****************/ |
1390 | /* meter control */ | 1346 | /* Meter control */ |
1391 | /*************************/ | 1347 | /*****************/ |
1392 | u16 hpi_meter_query_channels(const struct hpi_hsubsys *ph_subsys, | 1348 | u16 hpi_meter_query_channels(const u32 h_meter, u32 *p_channels); |
1393 | const u32 h_meter, u32 *p_channels); | ||
1394 | 1349 | ||
1395 | u16 hpi_meter_get_peak(const struct hpi_hsubsys *ph_subsys, u32 h_control, | 1350 | u16 hpi_meter_get_peak(u32 h_control, |
1396 | short an_peak0_01dB_out[HPI_MAX_CHANNELS] | 1351 | short an_peak0_01dB_out[HPI_MAX_CHANNELS] |
1397 | ); | 1352 | ); |
1398 | 1353 | ||
1399 | u16 hpi_meter_get_rms(const struct hpi_hsubsys *ph_subsys, u32 h_control, | 1354 | u16 hpi_meter_get_rms(u32 h_control, short an_peak0_01dB_out[HPI_MAX_CHANNELS] |
1400 | short an_peak0_01dB_out[HPI_MAX_CHANNELS] | ||
1401 | ); | 1355 | ); |
1402 | 1356 | ||
1403 | u16 hpi_meter_set_peak_ballistics(const struct hpi_hsubsys *ph_subsys, | 1357 | u16 hpi_meter_set_peak_ballistics(u32 h_control, u16 attack, u16 decay); |
1404 | u32 h_control, u16 attack, u16 decay); | ||
1405 | 1358 | ||
1406 | u16 hpi_meter_set_rms_ballistics(const struct hpi_hsubsys *ph_subsys, | 1359 | u16 hpi_meter_set_rms_ballistics(u32 h_control, u16 attack, u16 decay); |
1407 | u32 h_control, u16 attack, u16 decay); | ||
1408 | 1360 | ||
1409 | u16 hpi_meter_get_peak_ballistics(const struct hpi_hsubsys *ph_subsys, | 1361 | u16 hpi_meter_get_peak_ballistics(u32 h_control, u16 *attack, u16 *decay); |
1410 | u32 h_control, u16 *attack, u16 *decay); | ||
1411 | 1362 | ||
1412 | u16 hpi_meter_get_rms_ballistics(const struct hpi_hsubsys *ph_subsys, | 1363 | u16 hpi_meter_get_rms_ballistics(u32 h_control, u16 *attack, u16 *decay); |
1413 | u32 h_control, u16 *attack, u16 *decay); | ||
1414 | 1364 | ||
1415 | /*************************/ | 1365 | /************************/ |
1416 | /* channel mode control */ | 1366 | /* ChannelMode control */ |
1417 | /*************************/ | 1367 | /************************/ |
1418 | u16 hpi_channel_mode_query_mode(const struct hpi_hsubsys *ph_subsys, | 1368 | u16 hpi_channel_mode_query_mode(const u32 h_mode, const u32 index, |
1419 | const u32 h_mode, const u32 index, u16 *pw_mode); | 1369 | u16 *pw_mode); |
1420 | 1370 | ||
1421 | u16 hpi_channel_mode_set(const struct hpi_hsubsys *ph_subsys, u32 h_control, | 1371 | u16 hpi_channel_mode_set(u32 h_control, u16 mode); |
1422 | u16 mode); | ||
1423 | 1372 | ||
1424 | u16 hpi_channel_mode_get(const struct hpi_hsubsys *ph_subsys, u32 h_control, | 1373 | u16 hpi_channel_mode_get(u32 h_control, u16 *mode); |
1425 | u16 *mode); | ||
1426 | 1374 | ||
1427 | /*************************/ | 1375 | /*****************/ |
1428 | /* Tuner control */ | 1376 | /* Tuner control */ |
1429 | /*************************/ | 1377 | /*****************/ |
1430 | u16 hpi_tuner_query_band(const struct hpi_hsubsys *ph_subsys, | 1378 | u16 hpi_tuner_query_band(const u32 h_tuner, const u32 index, u16 *pw_band); |
1431 | const u32 h_tuner, const u32 index, u16 *pw_band); | ||
1432 | 1379 | ||
1433 | u16 hpi_tuner_set_band(const struct hpi_hsubsys *ph_subsys, u32 h_control, | 1380 | u16 hpi_tuner_set_band(u32 h_control, u16 band); |
1434 | u16 band); | ||
1435 | 1381 | ||
1436 | u16 hpi_tuner_get_band(const struct hpi_hsubsys *ph_subsys, u32 h_control, | 1382 | u16 hpi_tuner_get_band(u32 h_control, u16 *pw_band); |
1437 | u16 *pw_band); | ||
1438 | 1383 | ||
1439 | u16 hpi_tuner_query_frequency(const struct hpi_hsubsys *ph_subsys, | 1384 | u16 hpi_tuner_query_frequency(const u32 h_tuner, const u32 index, |
1440 | const u32 h_tuner, const u32 index, const u16 band, u32 *pfreq); | 1385 | const u16 band, u32 *pfreq); |
1441 | 1386 | ||
1442 | u16 hpi_tuner_set_frequency(const struct hpi_hsubsys *ph_subsys, | 1387 | u16 hpi_tuner_set_frequency(u32 h_control, u32 freq_ink_hz); |
1443 | u32 h_control, u32 freq_ink_hz); | ||
1444 | 1388 | ||
1445 | u16 hpi_tuner_get_frequency(const struct hpi_hsubsys *ph_subsys, | 1389 | u16 hpi_tuner_get_frequency(u32 h_control, u32 *pw_freq_ink_hz); |
1446 | u32 h_control, u32 *pw_freq_ink_hz); | ||
1447 | 1390 | ||
1448 | u16 hpi_tuner_getRF_level(const struct hpi_hsubsys *ph_subsys, u32 h_control, | 1391 | u16 hpi_tuner_get_rf_level(u32 h_control, short *pw_level); |
1449 | short *pw_level); | ||
1450 | 1392 | ||
1451 | u16 hpi_tuner_get_rawRF_level(const struct hpi_hsubsys *ph_subsys, | 1393 | u16 hpi_tuner_get_raw_rf_level(u32 h_control, short *pw_level); |
1452 | u32 h_control, short *pw_level); | ||
1453 | 1394 | ||
1454 | u16 hpi_tuner_query_gain(const struct hpi_hsubsys *ph_subsys, | 1395 | u16 hpi_tuner_query_gain(const u32 h_tuner, const u32 index, u16 *pw_gain); |
1455 | const u32 h_tuner, const u32 index, u16 *pw_gain); | ||
1456 | 1396 | ||
1457 | u16 hpi_tuner_set_gain(const struct hpi_hsubsys *ph_subsys, u32 h_control, | 1397 | u16 hpi_tuner_set_gain(u32 h_control, short gain); |
1458 | short gain); | ||
1459 | 1398 | ||
1460 | u16 hpi_tuner_get_gain(const struct hpi_hsubsys *ph_subsys, u32 h_control, | 1399 | u16 hpi_tuner_get_gain(u32 h_control, short *pn_gain); |
1461 | short *pn_gain); | ||
1462 | 1400 | ||
1463 | u16 hpi_tuner_get_status(const struct hpi_hsubsys *ph_subsys, u32 h_control, | 1401 | u16 hpi_tuner_get_status(u32 h_control, u16 *pw_status_mask, u16 *pw_status); |
1464 | u16 *pw_status_mask, u16 *pw_status); | ||
1465 | 1402 | ||
1466 | u16 hpi_tuner_set_mode(const struct hpi_hsubsys *ph_subsys, u32 h_control, | 1403 | u16 hpi_tuner_set_mode(u32 h_control, u32 mode, u32 value); |
1467 | u32 mode, u32 value); | ||
1468 | 1404 | ||
1469 | u16 hpi_tuner_get_mode(const struct hpi_hsubsys *ph_subsys, u32 h_control, | 1405 | u16 hpi_tuner_get_mode(u32 h_control, u32 mode, u32 *pn_value); |
1470 | u32 mode, u32 *pn_value); | ||
1471 | 1406 | ||
1472 | u16 hpi_tuner_getRDS(const struct hpi_hsubsys *ph_subsys, u32 h_control, | 1407 | u16 hpi_tuner_get_rds(u32 h_control, char *p_rds_data); |
1473 | char *p_rds_data); | ||
1474 | 1408 | ||
1475 | u16 hpi_tuner_query_deemphasis(const struct hpi_hsubsys *ph_subsys, | 1409 | u16 hpi_tuner_query_deemphasis(const u32 h_tuner, const u32 index, |
1476 | const u32 h_tuner, const u32 index, const u16 band, u32 *pdeemphasis); | 1410 | const u16 band, u32 *pdeemphasis); |
1477 | 1411 | ||
1478 | u16 hpi_tuner_set_deemphasis(const struct hpi_hsubsys *ph_subsys, | 1412 | u16 hpi_tuner_set_deemphasis(u32 h_control, u32 deemphasis); |
1479 | u32 h_control, u32 deemphasis); | 1413 | u16 hpi_tuner_get_deemphasis(u32 h_control, u32 *pdeemphasis); |
1480 | u16 hpi_tuner_get_deemphasis(const struct hpi_hsubsys *ph_subsys, | ||
1481 | u32 h_control, u32 *pdeemphasis); | ||
1482 | 1414 | ||
1483 | u16 hpi_tuner_query_program(const struct hpi_hsubsys *ph_subsys, | 1415 | u16 hpi_tuner_query_program(const u32 h_tuner, u32 *pbitmap_program); |
1484 | const u32 h_tuner, u32 *pbitmap_program); | ||
1485 | 1416 | ||
1486 | u16 hpi_tuner_set_program(const struct hpi_hsubsys *ph_subsys, u32 h_control, | 1417 | u16 hpi_tuner_set_program(u32 h_control, u32 program); |
1487 | u32 program); | ||
1488 | 1418 | ||
1489 | u16 hpi_tuner_get_program(const struct hpi_hsubsys *ph_subsys, u32 h_control, | 1419 | u16 hpi_tuner_get_program(u32 h_control, u32 *pprogram); |
1490 | u32 *pprogram); | ||
1491 | 1420 | ||
1492 | u16 hpi_tuner_get_hd_radio_dsp_version(const struct hpi_hsubsys *ph_subsys, | 1421 | u16 hpi_tuner_get_hd_radio_dsp_version(u32 h_control, char *psz_dsp_version, |
1493 | u32 h_control, char *psz_dsp_version, const u32 string_size); | 1422 | const u32 string_size); |
1494 | 1423 | ||
1495 | u16 hpi_tuner_get_hd_radio_sdk_version(const struct hpi_hsubsys *ph_subsys, | 1424 | u16 hpi_tuner_get_hd_radio_sdk_version(u32 h_control, char *psz_sdk_version, |
1496 | u32 h_control, char *psz_sdk_version, const u32 string_size); | 1425 | const u32 string_size); |
1497 | 1426 | ||
1498 | u16 hpi_tuner_get_hd_radio_signal_quality(const struct hpi_hsubsys *ph_subsys, | 1427 | u16 hpi_tuner_get_hd_radio_signal_quality(u32 h_control, u32 *pquality); |
1499 | u32 h_control, u32 *pquality); | ||
1500 | 1428 | ||
1501 | u16 hpi_tuner_get_hd_radio_signal_blend(const struct hpi_hsubsys *ph_subsys, | 1429 | u16 hpi_tuner_get_hd_radio_signal_blend(u32 h_control, u32 *pblend); |
1502 | u32 h_control, u32 *pblend); | ||
1503 | 1430 | ||
1504 | u16 hpi_tuner_set_hd_radio_signal_blend(const struct hpi_hsubsys *ph_subsys, | 1431 | u16 hpi_tuner_set_hd_radio_signal_blend(u32 h_control, const u32 blend); |
1505 | u32 h_control, const u32 blend); | ||
1506 | 1432 | ||
1507 | /****************************/ | 1433 | /***************/ |
1508 | /* PADs control */ | 1434 | /* PAD control */ |
1509 | /****************************/ | 1435 | /***************/ |
1510 | 1436 | ||
1511 | u16 HPI_PAD__get_channel_name(const struct hpi_hsubsys *ph_subsys, | 1437 | u16 hpi_pad_get_channel_name(u32 h_control, char *psz_string, |
1512 | u32 h_control, char *psz_string, const u32 string_length); | 1438 | const u32 string_length); |
1513 | 1439 | ||
1514 | u16 HPI_PAD__get_artist(const struct hpi_hsubsys *ph_subsys, u32 h_control, | 1440 | u16 hpi_pad_get_artist(u32 h_control, char *psz_string, |
1515 | char *psz_string, const u32 string_length); | 1441 | const u32 string_length); |
1516 | 1442 | ||
1517 | u16 HPI_PAD__get_title(const struct hpi_hsubsys *ph_subsys, u32 h_control, | 1443 | u16 hpi_pad_get_title(u32 h_control, char *psz_string, |
1518 | char *psz_string, const u32 string_length); | 1444 | const u32 string_length); |
1519 | 1445 | ||
1520 | u16 HPI_PAD__get_comment(const struct hpi_hsubsys *ph_subsys, u32 h_control, | 1446 | u16 hpi_pad_get_comment(u32 h_control, char *psz_string, |
1521 | char *psz_string, const u32 string_length); | 1447 | const u32 string_length); |
1522 | 1448 | ||
1523 | u16 HPI_PAD__get_program_type(const struct hpi_hsubsys *ph_subsys, | 1449 | u16 hpi_pad_get_program_type(u32 h_control, u32 *ppTY); |
1524 | u32 h_control, u32 *ppTY); | ||
1525 | 1450 | ||
1526 | u16 HPI_PAD__get_rdsPI(const struct hpi_hsubsys *ph_subsys, u32 h_control, | 1451 | u16 hpi_pad_get_rdsPI(u32 h_control, u32 *ppI); |
1527 | u32 *ppI); | ||
1528 | 1452 | ||
1529 | u16 HPI_PAD__get_program_type_string(const struct hpi_hsubsys *ph_subsys, | 1453 | u16 hpi_pad_get_program_type_string(u32 h_control, const u32 data_type, |
1530 | u32 h_control, const u32 data_type, const u32 pTY, char *psz_string, | 1454 | const u32 pTY, char *psz_string, const u32 string_length); |
1531 | const u32 string_length); | ||
1532 | 1455 | ||
1533 | /****************************/ | 1456 | /****************************/ |
1534 | /* AES/EBU Receiver control */ | 1457 | /* AES/EBU Receiver control */ |
1535 | /****************************/ | 1458 | /****************************/ |
1536 | u16 HPI_AESEBU__receiver_query_format(const struct hpi_hsubsys *ph_subsys, | 1459 | u16 hpi_aesebu_receiver_query_format(const u32 h_aes_rx, const u32 index, |
1537 | const u32 h_aes_rx, const u32 index, u16 *pw_format); | 1460 | u16 *pw_format); |
1538 | 1461 | ||
1539 | u16 HPI_AESEBU__receiver_set_format(const struct hpi_hsubsys *ph_subsys, | 1462 | u16 hpi_aesebu_receiver_set_format(u32 h_control, u16 source); |
1540 | u32 h_control, u16 source); | ||
1541 | 1463 | ||
1542 | u16 HPI_AESEBU__receiver_get_format(const struct hpi_hsubsys *ph_subsys, | 1464 | u16 hpi_aesebu_receiver_get_format(u32 h_control, u16 *pw_source); |
1543 | u32 h_control, u16 *pw_source); | ||
1544 | 1465 | ||
1545 | u16 HPI_AESEBU__receiver_get_sample_rate(const struct hpi_hsubsys *ph_subsys, | 1466 | u16 hpi_aesebu_receiver_get_sample_rate(u32 h_control, u32 *psample_rate); |
1546 | u32 h_control, u32 *psample_rate); | ||
1547 | 1467 | ||
1548 | u16 HPI_AESEBU__receiver_get_user_data(const struct hpi_hsubsys *ph_subsys, | 1468 | u16 hpi_aesebu_receiver_get_user_data(u32 h_control, u16 index, u16 *pw_data); |
1549 | u32 h_control, u16 index, u16 *pw_data); | ||
1550 | 1469 | ||
1551 | u16 HPI_AESEBU__receiver_get_channel_status(const struct hpi_hsubsys | 1470 | u16 hpi_aesebu_receiver_get_channel_status(u32 h_control, u16 index, |
1552 | *ph_subsys, u32 h_control, u16 index, u16 *pw_data); | 1471 | u16 *pw_data); |
1553 | 1472 | ||
1554 | u16 HPI_AESEBU__receiver_get_error_status(const struct hpi_hsubsys *ph_subsys, | 1473 | u16 hpi_aesebu_receiver_get_error_status(u32 h_control, u16 *pw_error_data); |
1555 | u32 h_control, u16 *pw_error_data); | ||
1556 | 1474 | ||
1557 | /*******************************/ | 1475 | /*******************************/ |
1558 | /* AES/EBU Transmitter control */ | 1476 | /* AES/EBU Transmitter control */ |
1559 | /*******************************/ | 1477 | /*******************************/ |
1560 | u16 HPI_AESEBU__transmitter_set_sample_rate(const struct hpi_hsubsys | 1478 | u16 hpi_aesebu_transmitter_set_sample_rate(u32 h_control, u32 sample_rate); |
1561 | *ph_subsys, u32 h_control, u32 sample_rate); | ||
1562 | 1479 | ||
1563 | u16 HPI_AESEBU__transmitter_set_user_data(const struct hpi_hsubsys *ph_subsys, | 1480 | u16 hpi_aesebu_transmitter_set_user_data(u32 h_control, u16 index, u16 data); |
1564 | u32 h_control, u16 index, u16 data); | ||
1565 | 1481 | ||
1566 | u16 HPI_AESEBU__transmitter_set_channel_status(const struct hpi_hsubsys | 1482 | u16 hpi_aesebu_transmitter_set_channel_status(u32 h_control, u16 index, |
1567 | *ph_subsys, u32 h_control, u16 index, u16 data); | 1483 | u16 data); |
1568 | 1484 | ||
1569 | u16 HPI_AESEBU__transmitter_get_channel_status(const struct hpi_hsubsys | 1485 | u16 hpi_aesebu_transmitter_get_channel_status(u32 h_control, u16 index, |
1570 | *ph_subsys, u32 h_control, u16 index, u16 *pw_data); | 1486 | u16 *pw_data); |
1571 | 1487 | ||
1572 | u16 HPI_AESEBU__transmitter_query_format(const struct hpi_hsubsys *ph_subsys, | 1488 | u16 hpi_aesebu_transmitter_query_format(const u32 h_aes_tx, const u32 index, |
1573 | const u32 h_aes_tx, const u32 index, u16 *pw_format); | 1489 | u16 *pw_format); |
1574 | 1490 | ||
1575 | u16 HPI_AESEBU__transmitter_set_format(const struct hpi_hsubsys *ph_subsys, | 1491 | u16 hpi_aesebu_transmitter_set_format(u32 h_control, u16 output_format); |
1576 | u32 h_control, u16 output_format); | ||
1577 | 1492 | ||
1578 | u16 HPI_AESEBU__transmitter_get_format(const struct hpi_hsubsys *ph_subsys, | 1493 | u16 hpi_aesebu_transmitter_get_format(u32 h_control, u16 *pw_output_format); |
1579 | u32 h_control, u16 *pw_output_format); | ||
1580 | 1494 | ||
1581 | /***********************/ | 1495 | /***********************/ |
1582 | /* multiplexer control */ | 1496 | /* Multiplexer control */ |
1583 | /***********************/ | 1497 | /***********************/ |
1584 | u16 hpi_multiplexer_set_source(const struct hpi_hsubsys *ph_subsys, | 1498 | u16 hpi_multiplexer_set_source(u32 h_control, u16 source_node_type, |
1585 | u32 h_control, u16 source_node_type, u16 source_node_index); | 1499 | u16 source_node_index); |
1586 | 1500 | ||
1587 | u16 hpi_multiplexer_get_source(const struct hpi_hsubsys *ph_subsys, | 1501 | u16 hpi_multiplexer_get_source(u32 h_control, u16 *source_node_type, |
1588 | u32 h_control, u16 *source_node_type, u16 *source_node_index); | ||
1589 | |||
1590 | u16 hpi_multiplexer_query_source(const struct hpi_hsubsys *ph_subsys, | ||
1591 | u32 h_control, u16 index, u16 *source_node_type, | ||
1592 | u16 *source_node_index); | 1502 | u16 *source_node_index); |
1593 | 1503 | ||
1504 | u16 hpi_multiplexer_query_source(u32 h_control, u16 index, | ||
1505 | u16 *source_node_type, u16 *source_node_index); | ||
1506 | |||
1594 | /***************/ | 1507 | /***************/ |
1595 | /* VOX control */ | 1508 | /* Vox control */ |
1596 | /***************/ | 1509 | /***************/ |
1597 | u16 hpi_vox_set_threshold(const struct hpi_hsubsys *ph_subsys, u32 h_control, | 1510 | u16 hpi_vox_set_threshold(u32 h_control, short an_gain0_01dB); |
1598 | short an_gain0_01dB); | ||
1599 | 1511 | ||
1600 | u16 hpi_vox_get_threshold(const struct hpi_hsubsys *ph_subsys, u32 h_control, | 1512 | u16 hpi_vox_get_threshold(u32 h_control, short *an_gain0_01dB); |
1601 | short *an_gain0_01dB); | ||
1602 | 1513 | ||
1603 | /*********************/ | 1514 | /*********************/ |
1604 | /* Bitstream control */ | 1515 | /* Bitstream control */ |
1605 | /*********************/ | 1516 | /*********************/ |
1606 | u16 hpi_bitstream_set_clock_edge(const struct hpi_hsubsys *ph_subsys, | 1517 | u16 hpi_bitstream_set_clock_edge(u32 h_control, u16 edge_type); |
1607 | u32 h_control, u16 edge_type); | ||
1608 | 1518 | ||
1609 | u16 hpi_bitstream_set_data_polarity(const struct hpi_hsubsys *ph_subsys, | 1519 | u16 hpi_bitstream_set_data_polarity(u32 h_control, u16 polarity); |
1610 | u32 h_control, u16 polarity); | ||
1611 | 1520 | ||
1612 | u16 hpi_bitstream_get_activity(const struct hpi_hsubsys *ph_subsys, | 1521 | u16 hpi_bitstream_get_activity(u32 h_control, u16 *pw_clk_activity, |
1613 | u32 h_control, u16 *pw_clk_activity, u16 *pw_data_activity); | 1522 | u16 *pw_data_activity); |
1614 | 1523 | ||
1615 | /***********************/ | 1524 | /***********************/ |
1616 | /* SampleClock control */ | 1525 | /* SampleClock control */ |
1617 | /***********************/ | 1526 | /***********************/ |
1618 | 1527 | ||
1619 | u16 hpi_sample_clock_query_source(const struct hpi_hsubsys *ph_subsys, | 1528 | u16 hpi_sample_clock_query_source(const u32 h_clock, const u32 index, |
1620 | const u32 h_clock, const u32 index, u16 *pw_source); | 1529 | u16 *pw_source); |
1621 | 1530 | ||
1622 | u16 hpi_sample_clock_set_source(const struct hpi_hsubsys *ph_subsys, | 1531 | u16 hpi_sample_clock_set_source(u32 h_control, u16 source); |
1623 | u32 h_control, u16 source); | ||
1624 | 1532 | ||
1625 | u16 hpi_sample_clock_get_source(const struct hpi_hsubsys *ph_subsys, | 1533 | u16 hpi_sample_clock_get_source(u32 h_control, u16 *pw_source); |
1626 | u32 h_control, u16 *pw_source); | ||
1627 | 1534 | ||
1628 | u16 hpi_sample_clock_query_source_index(const struct hpi_hsubsys *ph_subsys, | 1535 | u16 hpi_sample_clock_query_source_index(const u32 h_clock, const u32 index, |
1629 | const u32 h_clock, const u32 index, const u32 source, | 1536 | const u32 source, u16 *pw_source_index); |
1630 | u16 *pw_source_index); | ||
1631 | 1537 | ||
1632 | u16 hpi_sample_clock_set_source_index(const struct hpi_hsubsys *ph_subsys, | 1538 | u16 hpi_sample_clock_set_source_index(u32 h_control, u16 source_index); |
1633 | u32 h_control, u16 source_index); | ||
1634 | 1539 | ||
1635 | u16 hpi_sample_clock_get_source_index(const struct hpi_hsubsys *ph_subsys, | 1540 | u16 hpi_sample_clock_get_source_index(u32 h_control, u16 *pw_source_index); |
1636 | u32 h_control, u16 *pw_source_index); | ||
1637 | 1541 | ||
1638 | u16 hpi_sample_clock_get_sample_rate(const struct hpi_hsubsys *ph_subsys, | 1542 | u16 hpi_sample_clock_get_sample_rate(u32 h_control, u32 *psample_rate); |
1639 | u32 h_control, u32 *psample_rate); | ||
1640 | 1543 | ||
1641 | u16 hpi_sample_clock_query_local_rate(const struct hpi_hsubsys *ph_subsys, | 1544 | u16 hpi_sample_clock_query_local_rate(const u32 h_clock, const u32 index, |
1642 | const u32 h_clock, const u32 index, u32 *psource); | 1545 | u32 *psource); |
1643 | 1546 | ||
1644 | u16 hpi_sample_clock_set_local_rate(const struct hpi_hsubsys *ph_subsys, | 1547 | u16 hpi_sample_clock_set_local_rate(u32 h_control, u32 sample_rate); |
1645 | u32 h_control, u32 sample_rate); | ||
1646 | 1548 | ||
1647 | u16 hpi_sample_clock_get_local_rate(const struct hpi_hsubsys *ph_subsys, | 1549 | u16 hpi_sample_clock_get_local_rate(u32 h_control, u32 *psample_rate); |
1648 | u32 h_control, u32 *psample_rate); | ||
1649 | 1550 | ||
1650 | u16 hpi_sample_clock_set_auto(const struct hpi_hsubsys *ph_subsys, | 1551 | u16 hpi_sample_clock_set_auto(u32 h_control, u32 enable); |
1651 | u32 h_control, u32 enable); | ||
1652 | 1552 | ||
1653 | u16 hpi_sample_clock_get_auto(const struct hpi_hsubsys *ph_subsys, | 1553 | u16 hpi_sample_clock_get_auto(u32 h_control, u32 *penable); |
1654 | u32 h_control, u32 *penable); | ||
1655 | 1554 | ||
1656 | u16 hpi_sample_clock_set_local_rate_lock(const struct hpi_hsubsys *ph_subsys, | 1555 | u16 hpi_sample_clock_set_local_rate_lock(u32 h_control, u32 lock); |
1657 | u32 h_control, u32 lock); | ||
1658 | 1556 | ||
1659 | u16 hpi_sample_clock_get_local_rate_lock(const struct hpi_hsubsys *ph_subsys, | 1557 | u16 hpi_sample_clock_get_local_rate_lock(u32 h_control, u32 *plock); |
1660 | u32 h_control, u32 *plock); | ||
1661 | 1558 | ||
1662 | /***********************/ | 1559 | /***********************/ |
1663 | /* Microphone control */ | 1560 | /* Microphone control */ |
1664 | /***********************/ | 1561 | /***********************/ |
1665 | u16 hpi_microphone_set_phantom_power(const struct hpi_hsubsys *ph_subsys, | 1562 | u16 hpi_microphone_set_phantom_power(u32 h_control, u16 on_off); |
1666 | u32 h_control, u16 on_off); | ||
1667 | 1563 | ||
1668 | u16 hpi_microphone_get_phantom_power(const struct hpi_hsubsys *ph_subsys, | 1564 | u16 hpi_microphone_get_phantom_power(u32 h_control, u16 *pw_on_off); |
1669 | u32 h_control, u16 *pw_on_off); | ||
1670 | 1565 | ||
1671 | /******************************* | 1566 | /********************************/ |
1672 | Parametric Equalizer control | 1567 | /* Parametric Equalizer control */ |
1673 | *******************************/ | 1568 | /********************************/ |
1674 | u16 hpi_parametricEQ__get_info(const struct hpi_hsubsys *ph_subsys, | 1569 | u16 hpi_parametric_eq_get_info(u32 h_control, u16 *pw_number_of_bands, |
1675 | u32 h_control, u16 *pw_number_of_bands, u16 *pw_enabled); | 1570 | u16 *pw_enabled); |
1676 | 1571 | ||
1677 | u16 hpi_parametricEQ__set_state(const struct hpi_hsubsys *ph_subsys, | 1572 | u16 hpi_parametric_eq_set_state(u32 h_control, u16 on_off); |
1678 | u32 h_control, u16 on_off); | ||
1679 | 1573 | ||
1680 | u16 hpi_parametricEQ__set_band(const struct hpi_hsubsys *ph_subsys, | 1574 | u16 hpi_parametric_eq_set_band(u32 h_control, u16 index, u16 type, |
1681 | u32 h_control, u16 index, u16 type, u32 frequency_hz, short q100, | 1575 | u32 frequency_hz, short q100, short gain0_01dB); |
1682 | short gain0_01dB); | ||
1683 | 1576 | ||
1684 | u16 hpi_parametricEQ__get_band(const struct hpi_hsubsys *ph_subsys, | 1577 | u16 hpi_parametric_eq_get_band(u32 h_control, u16 index, u16 *pn_type, |
1685 | u32 h_control, u16 index, u16 *pn_type, u32 *pfrequency_hz, | 1578 | u32 *pfrequency_hz, short *pnQ100, short *pn_gain0_01dB); |
1686 | short *pnQ100, short *pn_gain0_01dB); | ||
1687 | 1579 | ||
1688 | u16 hpi_parametricEQ__get_coeffs(const struct hpi_hsubsys *ph_subsys, | 1580 | u16 hpi_parametric_eq_get_coeffs(u32 h_control, u16 index, short coeffs[5] |
1689 | u32 h_control, u16 index, short coeffs[5] | ||
1690 | ); | 1581 | ); |
1691 | 1582 | ||
1692 | /******************************* | 1583 | /*******************************/ |
1693 | Compressor Expander control | 1584 | /* Compressor Expander control */ |
1694 | *******************************/ | 1585 | /*******************************/ |
1695 | 1586 | ||
1696 | u16 hpi_compander_set_enable(const struct hpi_hsubsys *ph_subsys, | 1587 | u16 hpi_compander_set_enable(u32 h_control, u32 on); |
1697 | u32 h_control, u32 on); | ||
1698 | 1588 | ||
1699 | u16 hpi_compander_get_enable(const struct hpi_hsubsys *ph_subsys, | 1589 | u16 hpi_compander_get_enable(u32 h_control, u32 *pon); |
1700 | u32 h_control, u32 *pon); | ||
1701 | 1590 | ||
1702 | u16 hpi_compander_set_makeup_gain(const struct hpi_hsubsys *ph_subsys, | 1591 | u16 hpi_compander_set_makeup_gain(u32 h_control, short makeup_gain0_01dB); |
1703 | u32 h_control, short makeup_gain0_01dB); | ||
1704 | 1592 | ||
1705 | u16 hpi_compander_get_makeup_gain(const struct hpi_hsubsys *ph_subsys, | 1593 | u16 hpi_compander_get_makeup_gain(u32 h_control, short *pn_makeup_gain0_01dB); |
1706 | u32 h_control, short *pn_makeup_gain0_01dB); | ||
1707 | 1594 | ||
1708 | u16 hpi_compander_set_attack_time_constant(const struct hpi_hsubsys | 1595 | u16 hpi_compander_set_attack_time_constant(u32 h_control, u32 index, |
1709 | *ph_subsys, u32 h_control, u32 index, u32 attack); | 1596 | u32 attack); |
1710 | 1597 | ||
1711 | u16 hpi_compander_get_attack_time_constant(const struct hpi_hsubsys | 1598 | u16 hpi_compander_get_attack_time_constant(u32 h_control, u32 index, |
1712 | *ph_subsys, u32 h_control, u32 index, u32 *pw_attack); | 1599 | u32 *pw_attack); |
1713 | 1600 | ||
1714 | u16 hpi_compander_set_decay_time_constant(const struct hpi_hsubsys *ph_subsys, | 1601 | u16 hpi_compander_set_decay_time_constant(u32 h_control, u32 index, |
1715 | u32 h_control, u32 index, u32 decay); | 1602 | u32 decay); |
1716 | 1603 | ||
1717 | u16 hpi_compander_get_decay_time_constant(const struct hpi_hsubsys *ph_subsys, | 1604 | u16 hpi_compander_get_decay_time_constant(u32 h_control, u32 index, |
1718 | u32 h_control, u32 index, u32 *pw_decay); | 1605 | u32 *pw_decay); |
1719 | 1606 | ||
1720 | u16 hpi_compander_set_threshold(const struct hpi_hsubsys *ph_subsys, | 1607 | u16 hpi_compander_set_threshold(u32 h_control, u32 index, |
1721 | u32 h_control, u32 index, short threshold0_01dB); | 1608 | short threshold0_01dB); |
1722 | 1609 | ||
1723 | u16 hpi_compander_get_threshold(const struct hpi_hsubsys *ph_subsys, | 1610 | u16 hpi_compander_get_threshold(u32 h_control, u32 index, |
1724 | u32 h_control, u32 index, short *pn_threshold0_01dB); | 1611 | short *pn_threshold0_01dB); |
1725 | 1612 | ||
1726 | u16 hpi_compander_set_ratio(const struct hpi_hsubsys *ph_subsys, | 1613 | u16 hpi_compander_set_ratio(u32 h_control, u32 index, u32 ratio100); |
1727 | u32 h_control, u32 index, u32 ratio100); | ||
1728 | 1614 | ||
1729 | u16 hpi_compander_get_ratio(const struct hpi_hsubsys *ph_subsys, | 1615 | u16 hpi_compander_get_ratio(u32 h_control, u32 index, u32 *pw_ratio100); |
1730 | u32 h_control, u32 index, u32 *pw_ratio100); | ||
1731 | 1616 | ||
1732 | /******************************* | 1617 | /********************/ |
1733 | Cobranet HMI control | 1618 | /* Cobranet control */ |
1734 | *******************************/ | 1619 | /********************/ |
1735 | u16 hpi_cobranet_hmi_write(const struct hpi_hsubsys *ph_subsys, u32 h_control, | 1620 | u16 hpi_cobranet_hmi_write(u32 h_control, u32 hmi_address, u32 byte_count, |
1736 | u32 hmi_address, u32 byte_count, u8 *pb_data); | 1621 | u8 *pb_data); |
1737 | 1622 | ||
1738 | u16 hpi_cobranet_hmi_read(const struct hpi_hsubsys *ph_subsys, u32 h_control, | 1623 | u16 hpi_cobranet_hmi_read(u32 h_control, u32 hmi_address, u32 max_byte_count, |
1739 | u32 hmi_address, u32 max_byte_count, u32 *pbyte_count, u8 *pb_data); | 1624 | u32 *pbyte_count, u8 *pb_data); |
1740 | 1625 | ||
1741 | u16 hpi_cobranet_hmi_get_status(const struct hpi_hsubsys *ph_subsys, | 1626 | u16 hpi_cobranet_hmi_get_status(u32 h_control, u32 *pstatus, |
1742 | u32 h_control, u32 *pstatus, u32 *preadable_size, | 1627 | u32 *preadable_size, u32 *pwriteable_size); |
1743 | u32 *pwriteable_size); | ||
1744 | 1628 | ||
1745 | /*Read the current IP address | 1629 | u16 hpi_cobranet_get_ip_address(u32 h_control, u32 *pdw_ip_address); |
1746 | */ | ||
1747 | u16 hpi_cobranet_getI_paddress(const struct hpi_hsubsys *ph_subsys, | ||
1748 | u32 h_control, u32 *pi_paddress); | ||
1749 | 1630 | ||
1750 | /* Write the current IP address | 1631 | u16 hpi_cobranet_set_ip_address(u32 h_control, u32 dw_ip_address); |
1751 | */ | ||
1752 | u16 hpi_cobranet_setI_paddress(const struct hpi_hsubsys *ph_subsys, | ||
1753 | u32 h_control, u32 i_paddress); | ||
1754 | 1632 | ||
1755 | /* Read the static IP address | 1633 | u16 hpi_cobranet_get_static_ip_address(u32 h_control, u32 *pdw_ip_address); |
1756 | */ | ||
1757 | u16 hpi_cobranet_get_staticI_paddress(const struct hpi_hsubsys *ph_subsys, | ||
1758 | u32 h_control, u32 *pi_paddress); | ||
1759 | 1634 | ||
1760 | /* Write the static IP address | 1635 | u16 hpi_cobranet_set_static_ip_address(u32 h_control, u32 dw_ip_address); |
1761 | */ | ||
1762 | u16 hpi_cobranet_set_staticI_paddress(const struct hpi_hsubsys *ph_subsys, | ||
1763 | u32 h_control, u32 i_paddress); | ||
1764 | 1636 | ||
1765 | /* Read the MAC address | 1637 | u16 hpi_cobranet_get_macaddress(u32 h_control, u32 *pmAC_MS_bs, |
1766 | */ | 1638 | u32 *pmAC_LS_bs); |
1767 | u16 hpi_cobranet_getMA_caddress(const struct hpi_hsubsys *ph_subsys, | ||
1768 | u32 h_control, u32 *pmAC_MS_bs, u32 *pmAC_LS_bs); | ||
1769 | 1639 | ||
1770 | /******************************* | 1640 | /*************************/ |
1771 | Tone Detector control | 1641 | /* Tone Detector control */ |
1772 | *******************************/ | 1642 | /*************************/ |
1773 | u16 hpi_tone_detector_get_state(const struct hpi_hsubsys *ph_subsys, u32 hC, | 1643 | u16 hpi_tone_detector_get_state(u32 hC, u32 *state); |
1774 | u32 *state); | ||
1775 | 1644 | ||
1776 | u16 hpi_tone_detector_set_enable(const struct hpi_hsubsys *ph_subsys, u32 hC, | 1645 | u16 hpi_tone_detector_set_enable(u32 hC, u32 enable); |
1777 | u32 enable); | ||
1778 | 1646 | ||
1779 | u16 hpi_tone_detector_get_enable(const struct hpi_hsubsys *ph_subsys, u32 hC, | 1647 | u16 hpi_tone_detector_get_enable(u32 hC, u32 *enable); |
1780 | u32 *enable); | ||
1781 | 1648 | ||
1782 | u16 hpi_tone_detector_set_event_enable(const struct hpi_hsubsys *ph_subsys, | 1649 | u16 hpi_tone_detector_set_event_enable(u32 hC, u32 event_enable); |
1783 | u32 hC, u32 event_enable); | ||
1784 | 1650 | ||
1785 | u16 hpi_tone_detector_get_event_enable(const struct hpi_hsubsys *ph_subsys, | 1651 | u16 hpi_tone_detector_get_event_enable(u32 hC, u32 *event_enable); |
1786 | u32 hC, u32 *event_enable); | ||
1787 | 1652 | ||
1788 | u16 hpi_tone_detector_set_threshold(const struct hpi_hsubsys *ph_subsys, | 1653 | u16 hpi_tone_detector_set_threshold(u32 hC, int threshold); |
1789 | u32 hC, int threshold); | ||
1790 | 1654 | ||
1791 | u16 hpi_tone_detector_get_threshold(const struct hpi_hsubsys *ph_subsys, | 1655 | u16 hpi_tone_detector_get_threshold(u32 hC, int *threshold); |
1792 | u32 hC, int *threshold); | ||
1793 | 1656 | ||
1794 | u16 hpi_tone_detector_get_frequency(const struct hpi_hsubsys *ph_subsys, | 1657 | u16 hpi_tone_detector_get_frequency(u32 hC, u32 index, u32 *frequency); |
1795 | u32 hC, u32 index, u32 *frequency); | ||
1796 | 1658 | ||
1797 | /******************************* | 1659 | /****************************/ |
1798 | Silence Detector control | 1660 | /* Silence Detector control */ |
1799 | *******************************/ | 1661 | /****************************/ |
1800 | u16 hpi_silence_detector_get_state(const struct hpi_hsubsys *ph_subsys, | 1662 | u16 hpi_silence_detector_get_state(u32 hC, u32 *state); |
1801 | u32 hC, u32 *state); | ||
1802 | 1663 | ||
1803 | u16 hpi_silence_detector_set_enable(const struct hpi_hsubsys *ph_subsys, | 1664 | u16 hpi_silence_detector_set_enable(u32 hC, u32 enable); |
1804 | u32 hC, u32 enable); | ||
1805 | 1665 | ||
1806 | u16 hpi_silence_detector_get_enable(const struct hpi_hsubsys *ph_subsys, | 1666 | u16 hpi_silence_detector_get_enable(u32 hC, u32 *enable); |
1807 | u32 hC, u32 *enable); | ||
1808 | 1667 | ||
1809 | u16 hpi_silence_detector_set_event_enable(const struct hpi_hsubsys *ph_subsys, | 1668 | u16 hpi_silence_detector_set_event_enable(u32 hC, u32 event_enable); |
1810 | u32 hC, u32 event_enable); | ||
1811 | 1669 | ||
1812 | u16 hpi_silence_detector_get_event_enable(const struct hpi_hsubsys *ph_subsys, | 1670 | u16 hpi_silence_detector_get_event_enable(u32 hC, u32 *event_enable); |
1813 | u32 hC, u32 *event_enable); | ||
1814 | 1671 | ||
1815 | u16 hpi_silence_detector_set_delay(const struct hpi_hsubsys *ph_subsys, | 1672 | u16 hpi_silence_detector_set_delay(u32 hC, u32 delay); |
1816 | u32 hC, u32 delay); | ||
1817 | 1673 | ||
1818 | u16 hpi_silence_detector_get_delay(const struct hpi_hsubsys *ph_subsys, | 1674 | u16 hpi_silence_detector_get_delay(u32 hC, u32 *delay); |
1819 | u32 hC, u32 *delay); | ||
1820 | 1675 | ||
1821 | u16 hpi_silence_detector_set_threshold(const struct hpi_hsubsys *ph_subsys, | 1676 | u16 hpi_silence_detector_set_threshold(u32 hC, int threshold); |
1822 | u32 hC, int threshold); | ||
1823 | 1677 | ||
1824 | u16 hpi_silence_detector_get_threshold(const struct hpi_hsubsys *ph_subsys, | 1678 | u16 hpi_silence_detector_get_threshold(u32 hC, int *threshold); |
1825 | u32 hC, int *threshold); | 1679 | /*********************/ |
1826 | /*//////////////////// */ | 1680 | /* Utility functions */ |
1827 | /* UTILITY functions */ | 1681 | /*********************/ |
1828 | 1682 | ||
1829 | u16 hpi_format_create(struct hpi_format *p_format, u16 channels, u16 format, | 1683 | u16 hpi_format_create(struct hpi_format *p_format, u16 channels, u16 format, |
1830 | u32 sample_rate, u32 bit_rate, u32 attributes); | 1684 | u32 sample_rate, u32 bit_rate, u32 attributes); |
1831 | 1685 | ||
1832 | /* Until it's verified, this function is for Windows OSs only */ | 1686 | #endif /*_HPI_H_ */ |
1833 | |||
1834 | #endif /*_H_HPI_ */ | ||
1835 | /* | ||
1836 | /////////////////////////////////////////////////////////////////////////////// | ||
1837 | // See CVS for history. Last complete set in rev 1.146 | ||
1838 | //////////////////////////////////////////////////////////////////////////////// | ||
1839 | */ | ||
diff --git a/sound/pci/asihpi/hpi_internal.h b/sound/pci/asihpi/hpi_internal.h index 0d500841f1a5..a99aa9abe3da 100644 --- a/sound/pci/asihpi/hpi_internal.h +++ b/sound/pci/asihpi/hpi_internal.h | |||
@@ -104,6 +104,16 @@ enum HPI_BUSES { | |||
104 | HPI_BUS_NET = 4 | 104 | HPI_BUS_NET = 4 |
105 | }; | 105 | }; |
106 | 106 | ||
107 | enum HPI_SUBSYS_OPTIONS { | ||
108 | /* 0, 256 are invalid, 1..255 reserved for global options */ | ||
109 | HPI_SUBSYS_OPT_NET_ENABLE = 257, | ||
110 | HPI_SUBSYS_OPT_NET_BROADCAST = 258, | ||
111 | HPI_SUBSYS_OPT_NET_UNICAST = 259, | ||
112 | HPI_SUBSYS_OPT_NET_ADDR = 260, | ||
113 | HPI_SUBSYS_OPT_NET_MASK = 261, | ||
114 | HPI_SUBSYS_OPT_NET_ADAPTER_ADDRESS_ADD = 262 | ||
115 | }; | ||
116 | |||
107 | /******************************************* CONTROL ATTRIBUTES ****/ | 117 | /******************************************* CONTROL ATTRIBUTES ****/ |
108 | /* (in order of control type ID */ | 118 | /* (in order of control type ID */ |
109 | 119 | ||
@@ -365,7 +375,8 @@ enum HPI_OBJECT_TYPES { | |||
365 | }; | 375 | }; |
366 | 376 | ||
367 | #define HPI_OBJ_FUNCTION_SPACING 0x100 | 377 | #define HPI_OBJ_FUNCTION_SPACING 0x100 |
368 | #define HPI_FUNC_ID(obj, index) (HPI_OBJ_##obj * HPI_OBJ_FUNCTION_SPACING + index) | 378 | #define HPI_FUNC_ID(obj, index) \ |
379 | (HPI_OBJ_##obj * HPI_OBJ_FUNCTION_SPACING + index) | ||
369 | 380 | ||
370 | #define HPI_EXTRACT_INDEX(fn) (fn & 0xff) | 381 | #define HPI_EXTRACT_INDEX(fn) (fn & 0xff) |
371 | 382 | ||
@@ -1171,7 +1182,7 @@ struct hpi_response { | |||
1171 | sizeof(struct hpi_response_header) + sizeof(struct hpi_async_res) \ | 1182 | sizeof(struct hpi_response_header) + sizeof(struct hpi_async_res) \ |
1172 | } | 1183 | } |
1173 | 1184 | ||
1174 | /*********************** version 1 message/response *****************************/ | 1185 | /*********************** version 1 message/response **************************/ |
1175 | #define HPINET_ETHERNET_DATA_SIZE (1500) | 1186 | #define HPINET_ETHERNET_DATA_SIZE (1500) |
1176 | #define HPINET_IP_HDR_SIZE (20) | 1187 | #define HPINET_IP_HDR_SIZE (20) |
1177 | #define HPINET_IP_DATA_SIZE (HPINET_ETHERNET_DATA_SIZE - HPINET_IP_HDR_SIZE) | 1188 | #define HPINET_IP_DATA_SIZE (HPINET_ETHERNET_DATA_SIZE - HPINET_IP_HDR_SIZE) |
@@ -1484,8 +1495,7 @@ struct hpi_control_cache_pad { | |||
1484 | u32 traffic_anouncement; | 1495 | u32 traffic_anouncement; |
1485 | }; | 1496 | }; |
1486 | 1497 | ||
1487 | /*/////////////////////////////////////////////////////////////////////////// */ | 1498 | /* 2^N sized FIFO buffer (internal to HPI<->DSP interaction) */ |
1488 | /* declarations for 2^N sized FIFO buffer (internal to HPI<->DSP interaction) */ | ||
1489 | struct hpi_fifo_buffer { | 1499 | struct hpi_fifo_buffer { |
1490 | u32 size; | 1500 | u32 size; |
1491 | u32 dSP_index; | 1501 | u32 dSP_index; |
@@ -1510,25 +1520,22 @@ u32 hpi_indexes_to_handle(const char c_object, const u16 adapter_index, | |||
1510 | /*////////////////////////////////////////////////////////////////////////// */ | 1520 | /*////////////////////////////////////////////////////////////////////////// */ |
1511 | 1521 | ||
1512 | /* main HPI entry point */ | 1522 | /* main HPI entry point */ |
1513 | hpi_handler_func hpi_send_recv; | 1523 | void hpi_send_recv(struct hpi_message *phm, struct hpi_response *phr); |
1514 | 1524 | ||
1515 | /* UDP message */ | 1525 | /* UDP message */ |
1516 | void hpi_send_recvUDP(struct hpi_message *phm, struct hpi_response *phr, | 1526 | void hpi_send_recvUDP(struct hpi_message *phm, struct hpi_response *phr, |
1517 | const unsigned int timeout); | 1527 | const unsigned int timeout); |
1518 | 1528 | ||
1519 | /* used in PnP OS/driver */ | 1529 | /* used in PnP OS/driver */ |
1520 | u16 hpi_subsys_create_adapter(const struct hpi_hsubsys *ph_subsys, | 1530 | u16 hpi_subsys_create_adapter(const struct hpi_resource *p_resource, |
1521 | const struct hpi_resource *p_resource, u16 *pw_adapter_index); | 1531 | u16 *pw_adapter_index); |
1522 | 1532 | ||
1523 | u16 hpi_subsys_delete_adapter(const struct hpi_hsubsys *ph_subsys, | 1533 | u16 hpi_subsys_delete_adapter(u16 adapter_index); |
1524 | u16 adapter_index); | ||
1525 | 1534 | ||
1526 | u16 hpi_outstream_host_buffer_get_info(const struct hpi_hsubsys *ph_subsys, | 1535 | u16 hpi_outstream_host_buffer_get_info(u32 h_outstream, u8 **pp_buffer, |
1527 | u32 h_outstream, u8 **pp_buffer, | ||
1528 | struct hpi_hostbuffer_status **pp_status); | 1536 | struct hpi_hostbuffer_status **pp_status); |
1529 | 1537 | ||
1530 | u16 hpi_instream_host_buffer_get_info(const struct hpi_hsubsys *ph_subsys, | 1538 | u16 hpi_instream_host_buffer_get_info(u32 h_instream, u8 **pp_buffer, |
1531 | u32 h_instream, u8 **pp_buffer, | ||
1532 | struct hpi_hostbuffer_status **pp_status); | 1539 | struct hpi_hostbuffer_status **pp_status); |
1533 | 1540 | ||
1534 | u16 hpi_adapter_restart(u16 adapter_index); | 1541 | u16 hpi_adapter_restart(u16 adapter_index); |
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); |
diff --git a/sound/pci/asihpi/hpioctl.c b/sound/pci/asihpi/hpioctl.c index dd8cadf1e686..4bd32782ad9d 100644 --- a/sound/pci/asihpi/hpioctl.c +++ b/sound/pci/asihpi/hpioctl.c | |||
@@ -392,7 +392,7 @@ int __devinit asihpi_adapter_probe(struct pci_dev *pci_dev, | |||
392 | adapter.type = hr.u.s.aw_adapter_list[adapter.index]; | 392 | adapter.type = hr.u.s.aw_adapter_list[adapter.index]; |
393 | hm.adapter_index = adapter.index; | 393 | hm.adapter_index = adapter.index; |
394 | 394 | ||
395 | err = hpi_adapter_open(NULL, adapter.index); | 395 | err = hpi_adapter_open(adapter.index); |
396 | if (err) | 396 | if (err) |
397 | goto err; | 397 | goto err; |
398 | 398 | ||