Commit ba94455c authored by Eliot Blennerhassett's avatar Eliot Blennerhassett Committed by Takashi Iwai

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: default avatarEliot Blennerhassett <eblennerhassett@audioscience.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent deb21a23
...@@ -97,13 +97,14 @@ static const int mixer_dump; ...@@ -97,13 +97,14 @@ static const int mixer_dump;
#define DEFAULT_SAMPLERATE 44100 #define DEFAULT_SAMPLERATE 44100
static int adapter_fs = DEFAULT_SAMPLERATE; static int adapter_fs = DEFAULT_SAMPLERATE;
static struct hpi_hsubsys *ss; /* handle to HPI audio subsystem */
/* defaults */ /* defaults */
#define PERIODS_MIN 2 #define PERIODS_MIN 2
#define PERIOD_BYTES_MIN 2048 #define PERIOD_BYTES_MIN 2048
#define BUFFER_BYTES_MAX (512 * 1024) #define BUFFER_BYTES_MAX (512 * 1024)
/* convert stream to character */
#define SCHR(s) ((s == SNDRV_PCM_STREAM_PLAYBACK) ? 'P' : 'C')
/*#define TIMER_MILLISECONDS 20 /*#define TIMER_MILLISECONDS 20
#define FORCE_TIMER_JIFFIES ((TIMER_MILLISECONDS * HZ + 999)/1000) #define FORCE_TIMER_JIFFIES ((TIMER_MILLISECONDS * HZ + 999)/1000)
*/ */
...@@ -149,8 +150,8 @@ struct snd_card_asihpi_pcm { ...@@ -149,8 +150,8 @@ struct snd_card_asihpi_pcm {
struct timer_list timer; struct timer_list timer;
unsigned int respawn_timer; unsigned int respawn_timer;
unsigned int hpi_buffer_attached; unsigned int hpi_buffer_attached;
unsigned int pcm_size; unsigned int buffer_bytes;
unsigned int pcm_count; unsigned int period_bytes;
unsigned int bytes_per_sec; unsigned int bytes_per_sec;
unsigned int pcm_buf_host_rw_ofs; /* Host R/W pos */ unsigned int pcm_buf_host_rw_ofs; /* Host R/W pos */
unsigned int pcm_buf_dma_ofs; /* DMA R/W offset in buffer */ unsigned int pcm_buf_dma_ofs; /* DMA R/W offset in buffer */
...@@ -165,7 +166,6 @@ struct snd_card_asihpi_pcm { ...@@ -165,7 +166,6 @@ struct snd_card_asihpi_pcm {
/* Functions to allow driver to give a buffer to HPI for busmastering */ /* Functions to allow driver to give a buffer to HPI for busmastering */
static u16 hpi_stream_host_buffer_attach( static u16 hpi_stream_host_buffer_attach(
struct hpi_hsubsys *hS,
u32 h_stream, /* handle to outstream. */ u32 h_stream, /* handle to outstream. */
u32 size_in_bytes, /* size in bytes of bus mastering buffer */ u32 size_in_bytes, /* size in bytes of bus mastering buffer */
u32 pci_address u32 pci_address
...@@ -192,10 +192,7 @@ static u16 hpi_stream_host_buffer_attach( ...@@ -192,10 +192,7 @@ static u16 hpi_stream_host_buffer_attach(
return hr.error; return hr.error;
} }
static u16 hpi_stream_host_buffer_detach( static u16 hpi_stream_host_buffer_detach(u32 h_stream)
struct hpi_hsubsys *hS,
u32 h_stream
)
{ {
struct hpi_message hm; struct hpi_message hm;
struct hpi_response hr; struct hpi_response hr;
...@@ -216,24 +213,23 @@ static u16 hpi_stream_host_buffer_detach( ...@@ -216,24 +213,23 @@ static u16 hpi_stream_host_buffer_detach(
return hr.error; return hr.error;
} }
static inline u16 hpi_stream_start(struct hpi_hsubsys *hS, u32 h_stream) static inline u16 hpi_stream_start(u32 h_stream)
{ {
if (hpi_handle_object(h_stream) == HPI_OBJ_OSTREAM) if (hpi_handle_object(h_stream) == HPI_OBJ_OSTREAM)
return hpi_outstream_start(hS, h_stream); return hpi_outstream_start(h_stream);
else else
return hpi_instream_start(hS, h_stream); return hpi_instream_start(h_stream);
} }
static inline u16 hpi_stream_stop(struct hpi_hsubsys *hS, u32 h_stream) static inline u16 hpi_stream_stop(u32 h_stream)
{ {
if (hpi_handle_object(h_stream) == HPI_OBJ_OSTREAM) if (hpi_handle_object(h_stream) == HPI_OBJ_OSTREAM)
return hpi_outstream_stop(hS, h_stream); return hpi_outstream_stop(h_stream);
else else
return hpi_instream_stop(hS, h_stream); return hpi_instream_stop(h_stream);
} }
static inline u16 hpi_stream_get_info_ex( static inline u16 hpi_stream_get_info_ex(
struct hpi_hsubsys *hS,
u32 h_stream, u32 h_stream,
u16 *pw_state, u16 *pw_state,
u32 *pbuffer_size, u32 *pbuffer_size,
...@@ -244,42 +240,41 @@ static inline u16 hpi_stream_get_info_ex( ...@@ -244,42 +240,41 @@ static inline u16 hpi_stream_get_info_ex(
{ {
u16 e; u16 e;
if (hpi_handle_object(h_stream) == HPI_OBJ_OSTREAM) if (hpi_handle_object(h_stream) == HPI_OBJ_OSTREAM)
e = hpi_outstream_get_info_ex(hS, h_stream, pw_state, e = hpi_outstream_get_info_ex(h_stream, pw_state,
pbuffer_size, pdata_in_buffer, pbuffer_size, pdata_in_buffer,
psample_count, pauxiliary_data); psample_count, pauxiliary_data);
else else
e = hpi_instream_get_info_ex(hS, h_stream, pw_state, e = hpi_instream_get_info_ex(h_stream, pw_state,
pbuffer_size, pdata_in_buffer, pbuffer_size, pdata_in_buffer,
psample_count, pauxiliary_data); psample_count, pauxiliary_data);
return e; return e;
} }
static inline u16 hpi_stream_group_add(struct hpi_hsubsys *hS, static inline u16 hpi_stream_group_add(
u32 h_master, u32 h_master,
u32 h_stream) u32 h_stream)
{ {
if (hpi_handle_object(h_master) == HPI_OBJ_OSTREAM) if (hpi_handle_object(h_master) == HPI_OBJ_OSTREAM)
return hpi_outstream_group_add(hS, h_master, h_stream); return hpi_outstream_group_add(h_master, h_stream);
else else
return hpi_instream_group_add(hS, h_master, h_stream); return hpi_instream_group_add(h_master, h_stream);
} }
static inline u16 hpi_stream_group_reset(struct hpi_hsubsys *hS, static inline u16 hpi_stream_group_reset(u32 h_stream)
u32 h_stream)
{ {
if (hpi_handle_object(h_stream) == HPI_OBJ_OSTREAM) if (hpi_handle_object(h_stream) == HPI_OBJ_OSTREAM)
return hpi_outstream_group_reset(hS, h_stream); return hpi_outstream_group_reset(h_stream);
else else
return hpi_instream_group_reset(hS, h_stream); return hpi_instream_group_reset(h_stream);
} }
static inline u16 hpi_stream_group_get_map(struct hpi_hsubsys *hS, static inline u16 hpi_stream_group_get_map(
u32 h_stream, u32 *mo, u32 *mi) u32 h_stream, u32 *mo, u32 *mi)
{ {
if (hpi_handle_object(h_stream) == HPI_OBJ_OSTREAM) if (hpi_handle_object(h_stream) == HPI_OBJ_OSTREAM)
return hpi_outstream_group_get_map(hS, h_stream, mo, mi); return hpi_outstream_group_get_map(h_stream, mo, mi);
else else
return hpi_instream_group_get_map(hS, h_stream, mo, mi); return hpi_instream_group_get_map(h_stream, mo, mi);
} }
static u16 handle_error(u16 err, int line, char *filename) static u16 handle_error(u16 err, int line, char *filename)
...@@ -335,7 +330,7 @@ static snd_pcm_format_t hpi_to_alsa_formats[] = { ...@@ -335,7 +330,7 @@ static snd_pcm_format_t hpi_to_alsa_formats[] = {
*/ */
-1 -1
#else #else
/* SNDRV_PCM_FORMAT_S24_3LE */ /* { HPI_FORMAT_PCM24_SIGNED 15 */ /* SNDRV_PCM_FORMAT_S24_3LE */ /* HPI_FORMAT_PCM24_SIGNED 15 */
#endif #endif
}; };
...@@ -378,7 +373,7 @@ static void snd_card_asihpi_pcm_samplerates(struct snd_card_asihpi *asihpi, ...@@ -378,7 +373,7 @@ static void snd_card_asihpi_pcm_samplerates(struct snd_card_asihpi *asihpi,
} else { } else {
/* on cards without SRC, /* on cards without SRC,
valid rates are determined by sampleclock */ valid rates are determined by sampleclock */
err = hpi_mixer_get_control(ss, asihpi->h_mixer, err = hpi_mixer_get_control(asihpi->h_mixer,
HPI_SOURCENODE_CLOCK_SOURCE, 0, 0, 0, HPI_SOURCENODE_CLOCK_SOURCE, 0, 0, 0,
HPI_CONTROL_SAMPLECLOCK, &h_control); HPI_CONTROL_SAMPLECLOCK, &h_control);
if (err) { if (err) {
...@@ -387,7 +382,7 @@ static void snd_card_asihpi_pcm_samplerates(struct snd_card_asihpi *asihpi, ...@@ -387,7 +382,7 @@ static void snd_card_asihpi_pcm_samplerates(struct snd_card_asihpi *asihpi,
} }
for (idx = 0; idx < 100; idx++) { for (idx = 0; idx < 100; idx++) {
if (hpi_sample_clock_query_local_rate(ss, if (hpi_sample_clock_query_local_rate(
h_control, idx, &sample_rate)) { h_control, idx, &sample_rate)) {
if (!idx) if (!idx)
snd_printk(KERN_ERR snd_printk(KERN_ERR
...@@ -480,10 +475,10 @@ static int snd_card_asihpi_pcm_hw_params(struct snd_pcm_substream *substream, ...@@ -480,10 +475,10 @@ static int snd_card_asihpi_pcm_hw_params(struct snd_pcm_substream *substream,
format, params_rate(params), 0, 0)); format, params_rate(params), 0, 0));
if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) { if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
if (hpi_instream_reset(ss, dpcm->h_stream) != 0) if (hpi_instream_reset(dpcm->h_stream) != 0)
return -EINVAL; return -EINVAL;
if (hpi_instream_set_format(ss, if (hpi_instream_set_format(
dpcm->h_stream, &dpcm->format) != 0) dpcm->h_stream, &dpcm->format) != 0)
return -EINVAL; return -EINVAL;
} }
...@@ -491,10 +486,10 @@ static int snd_card_asihpi_pcm_hw_params(struct snd_pcm_substream *substream, ...@@ -491,10 +486,10 @@ static int snd_card_asihpi_pcm_hw_params(struct snd_pcm_substream *substream,
dpcm->hpi_buffer_attached = 0; dpcm->hpi_buffer_attached = 0;
if (card->support_mmap) { if (card->support_mmap) {
err = hpi_stream_host_buffer_attach(ss, dpcm->h_stream, err = hpi_stream_host_buffer_attach(dpcm->h_stream,
params_buffer_bytes(params), runtime->dma_addr); params_buffer_bytes(params), runtime->dma_addr);
if (err == 0) { if (err == 0) {
snd_printd(KERN_INFO VPRINTK1(KERN_INFO
"stream_host_buffer_attach succeeded %u %lu\n", "stream_host_buffer_attach succeeded %u %lu\n",
params_buffer_bytes(params), params_buffer_bytes(params),
(unsigned long)runtime->dma_addr); (unsigned long)runtime->dma_addr);
...@@ -505,11 +500,11 @@ static int snd_card_asihpi_pcm_hw_params(struct snd_pcm_substream *substream, ...@@ -505,11 +500,11 @@ static int snd_card_asihpi_pcm_hw_params(struct snd_pcm_substream *substream,
return -ENOMEM; return -ENOMEM;
} }
err = hpi_stream_get_info_ex(ss, dpcm->h_stream, NULL, err = hpi_stream_get_info_ex(dpcm->h_stream, NULL,
&dpcm->hpi_buffer_attached, &dpcm->hpi_buffer_attached,
NULL, NULL, NULL); NULL, NULL, NULL);
snd_printd(KERN_INFO "stream_host_buffer_attach status 0x%x\n", VPRINTK1(KERN_INFO "stream_host_buffer_attach status 0x%x\n",
dpcm->hpi_buffer_attached); dpcm->hpi_buffer_attached);
} }
bytes_per_sec = params_rate(params) * params_channels(params); 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,10 +515,10 @@ static int snd_card_asihpi_pcm_hw_params(struct snd_pcm_substream *substream,
return -EINVAL; return -EINVAL;
dpcm->bytes_per_sec = bytes_per_sec; dpcm->bytes_per_sec = bytes_per_sec;
dpcm->pcm_size = params_buffer_bytes(params); dpcm->buffer_bytes = params_buffer_bytes(params);
dpcm->pcm_count = params_period_bytes(params); dpcm->period_bytes = params_period_bytes(params);
snd_printd(KERN_INFO "pcm_size=%d, pcm_count=%d, bps=%d\n", VPRINTK1(KERN_INFO "buffer_bytes=%d, period_bytes=%d, bps=%d\n",
dpcm->pcm_size, dpcm->pcm_count, bytes_per_sec); dpcm->buffer_bytes, dpcm->period_bytes, bytes_per_sec);
return 0; return 0;
} }
...@@ -534,7 +529,7 @@ snd_card_asihpi_hw_free(struct snd_pcm_substream *substream) ...@@ -534,7 +529,7 @@ snd_card_asihpi_hw_free(struct snd_pcm_substream *substream)
struct snd_pcm_runtime *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_card_asihpi_pcm *dpcm = runtime->private_data; struct snd_card_asihpi_pcm *dpcm = runtime->private_data;
if (dpcm->hpi_buffer_attached) if (dpcm->hpi_buffer_attached)
hpi_stream_host_buffer_detach(ss, dpcm->h_stream); hpi_stream_host_buffer_detach(dpcm->h_stream);
snd_pcm_lib_free_pages(substream); snd_pcm_lib_free_pages(substream);
return 0; return 0;
...@@ -553,7 +548,8 @@ static void snd_card_asihpi_pcm_timer_start(struct snd_pcm_substream * ...@@ -553,7 +548,8 @@ static void snd_card_asihpi_pcm_timer_start(struct snd_pcm_substream *
struct snd_card_asihpi_pcm *dpcm = runtime->private_data; struct snd_card_asihpi_pcm *dpcm = runtime->private_data;
int expiry; int expiry;
expiry = HZ / 100;; //? (dpcm->pcm_count * HZ / dpcm->bytes_per_sec); expiry = HZ / 200;
/*? (dpcm->period_bytes * HZ / dpcm->bytes_per_sec); */
expiry = max(expiry, 1); /* don't let it be zero! */ expiry = max(expiry, 1); /* don't let it be zero! */
dpcm->timer.expires = jiffies + expiry; dpcm->timer.expires = jiffies + expiry;
dpcm->respawn_timer = 1; dpcm->respawn_timer = 1;
...@@ -577,8 +573,8 @@ static int snd_card_asihpi_trigger(struct snd_pcm_substream *substream, ...@@ -577,8 +573,8 @@ static int snd_card_asihpi_trigger(struct snd_pcm_substream *substream,
struct snd_pcm_substream *s; struct snd_pcm_substream *s;
u16 e; u16 e;
snd_printd("Trigger %dstream %d\n", VPRINTK1(KERN_INFO "%c%d trigger\n",
substream->stream, substream->number); SCHR(substream->stream), substream->number);
switch (cmd) { switch (cmd) {
case SNDRV_PCM_TRIGGER_START: case SNDRV_PCM_TRIGGER_START:
snd_pcm_group_for_each_entry(s, substream) { snd_pcm_group_for_each_entry(s, substream) {
...@@ -588,6 +584,10 @@ static int snd_card_asihpi_trigger(struct snd_pcm_substream *substream, ...@@ -588,6 +584,10 @@ static int snd_card_asihpi_trigger(struct snd_pcm_substream *substream,
if (snd_pcm_substream_chip(s) != card) if (snd_pcm_substream_chip(s) != card)
continue; continue;
/* don't link Cap and Play */
if (substream->stream != s->stream)
continue;
if ((s->stream == SNDRV_PCM_STREAM_PLAYBACK) && if ((s->stream == SNDRV_PCM_STREAM_PLAYBACK) &&
(card->support_mmap)) { (card->support_mmap)) {
/* How do I know how much valid data is present /* 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,10 +596,10 @@ static int snd_card_asihpi_trigger(struct snd_pcm_substream *substream,
* buffer is bigger it may contain even more * buffer is bigger it may contain even more
* data?? * data??
*/ */
unsigned int preload = ds->pcm_count * 1; unsigned int preload = ds->period_bytes * 1;
VPRINTK2("Preload x%x\n", preload); VPRINTK2(KERN_INFO "%d preload x%x\n", s->number, preload);
hpi_handle_error(hpi_outstream_write_buf( hpi_handle_error(hpi_outstream_write_buf(
ss, ds->h_stream, ds->h_stream,
&runtime->dma_area[0], &runtime->dma_area[0],
preload, preload,
&ds->format)); &ds->format));
...@@ -607,9 +607,10 @@ static int snd_card_asihpi_trigger(struct snd_pcm_substream *substream, ...@@ -607,9 +607,10 @@ static int snd_card_asihpi_trigger(struct snd_pcm_substream *substream,
} }
if (card->support_grouping) { if (card->support_grouping) {
VPRINTK1("\t_group %dstream %d\n", s->stream, VPRINTK1(KERN_INFO "\t%c%d group\n",
SCHR(s->stream),
s->number); s->number);
e = hpi_stream_group_add(ss, e = hpi_stream_group_add(
dpcm->h_stream, dpcm->h_stream,
ds->h_stream); ds->h_stream);
if (!e) { if (!e) {
...@@ -621,10 +622,11 @@ static int snd_card_asihpi_trigger(struct snd_pcm_substream *substream, ...@@ -621,10 +622,11 @@ static int snd_card_asihpi_trigger(struct snd_pcm_substream *substream,
} else } else
break; break;
} }
snd_printd("Start\n"); VPRINTK1(KERN_INFO "start\n");
/* start the master stream */ /* start the master stream */
snd_card_asihpi_pcm_timer_start(substream); snd_card_asihpi_pcm_timer_start(substream);
hpi_handle_error(hpi_stream_start(ss, dpcm->h_stream)); if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
hpi_handle_error(hpi_stream_start(dpcm->h_stream));
break; break;
case SNDRV_PCM_TRIGGER_STOP: case SNDRV_PCM_TRIGGER_STOP:
...@@ -632,43 +634,46 @@ static int snd_card_asihpi_trigger(struct snd_pcm_substream *substream, ...@@ -632,43 +634,46 @@ static int snd_card_asihpi_trigger(struct snd_pcm_substream *substream,
snd_pcm_group_for_each_entry(s, substream) { snd_pcm_group_for_each_entry(s, substream) {
if (snd_pcm_substream_chip(s) != card) if (snd_pcm_substream_chip(s) != card)
continue; continue;
/* don't link Cap and Play */
if (substream->stream != s->stream)
continue;
/*? workaround linked streams don't /*? workaround linked streams don't
transition to SETUP 20070706*/ transition to SETUP 20070706*/
s->runtime->status->state = SNDRV_PCM_STATE_SETUP; s->runtime->status->state = SNDRV_PCM_STATE_SETUP;
if (card->support_grouping) { if (card->support_grouping) {
VPRINTK1("\t_group %dstream %d\n", s->stream, VPRINTK1(KERN_INFO "\t%c%d group\n",
SCHR(s->stream),
s->number); s->number);
snd_pcm_trigger_done(s, substream); snd_pcm_trigger_done(s, substream);
} else } else
break; break;
} }
snd_printd("Stop\n"); VPRINTK1(KERN_INFO "stop\n");
/* _prepare and _hwparams reset the stream */ /* _prepare and _hwparams reset the stream */
hpi_handle_error(hpi_stream_stop(ss, dpcm->h_stream)); hpi_handle_error(hpi_stream_stop(dpcm->h_stream));
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
hpi_handle_error( hpi_handle_error(
hpi_outstream_reset(ss, dpcm->h_stream)); hpi_outstream_reset(dpcm->h_stream));
if (card->support_grouping) if (card->support_grouping)
hpi_handle_error(hpi_stream_group_reset(ss, hpi_handle_error(hpi_stream_group_reset(dpcm->h_stream));
dpcm->h_stream));
break; break;
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
snd_printd("Pause release\n"); VPRINTK1(KERN_INFO "pause release\n");
hpi_handle_error(hpi_stream_start(ss, dpcm->h_stream)); hpi_handle_error(hpi_stream_start(dpcm->h_stream));
snd_card_asihpi_pcm_timer_start(substream); snd_card_asihpi_pcm_timer_start(substream);
break; break;
case SNDRV_PCM_TRIGGER_PAUSE_PUSH: case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
snd_printd("Pause\n"); VPRINTK1(KERN_INFO "pause\n");
snd_card_asihpi_pcm_timer_stop(substream); snd_card_asihpi_pcm_timer_stop(substream);
hpi_handle_error(hpi_stream_stop(ss, dpcm->h_stream)); hpi_handle_error(hpi_stream_stop(dpcm->h_stream));
break; break;
default: default:
snd_printd("\tINVALID\n"); snd_printd(KERN_ERR "\tINVALID\n");
return -EINVAL; return -EINVAL;
} }
...@@ -683,19 +688,19 @@ static int snd_card_asihpi_trigger(struct snd_pcm_substream *substream, ...@@ -683,19 +688,19 @@ static int snd_card_asihpi_trigger(struct snd_pcm_substream *substream,
pcm_buf_dma_ofs=get_buf_pos(s); pcm_buf_dma_ofs=get_buf_pos(s);
for_each_linked_stream(s) { for_each_linked_stream(s) {
pcm_buf_dma_ofs=get_buf_pos(s); pcm_buf_dma_ofs=get_buf_pos(s);
min_buf_pos = modulo_min(min_buf_pos, pcm_buf_dma_ofs, pcm_size) min_buf_pos = modulo_min(min_buf_pos, pcm_buf_dma_ofs, buffer_bytes)
new_data = min(new_data, calc_new_data(pcm_buf_dma_ofs,irq_pos) new_data = min(new_data, calc_new_data(pcm_buf_dma_ofs,irq_pos)
} }
timer.expires = jiffies + predict_next_period_ready(min_buf_pos); timer.expires = jiffies + predict_next_period_ready(min_buf_pos);
for_each_linked_stream(s) { for_each_linked_stream(s) {
s->pcm_buf_dma_ofs = min_buf_pos; s->pcm_buf_dma_ofs = min_buf_pos;
if (new_data > pcm_count) { if (new_data > period_bytes) {
if (mmap) { if (mmap) {
irq_pos = (irq_pos + pcm_count) % pcm_size; irq_pos = (irq_pos + period_bytes) % buffer_bytes;
if (playback) { if (playback) {
write(pcm_count); write(period_bytes);
} else { } else {
read(pcm_count); read(period_bytes);
} }
} }
snd_pcm_period_elapsed(s); snd_pcm_period_elapsed(s);
...@@ -723,25 +728,34 @@ static inline unsigned int modulo_min(unsigned int a, unsigned int b, ...@@ -723,25 +728,34 @@ static inline unsigned int modulo_min(unsigned int a, unsigned int b,
static void snd_card_asihpi_timer_function(unsigned long data) static void snd_card_asihpi_timer_function(unsigned long data)
{ {
struct snd_card_asihpi_pcm *dpcm = (struct snd_card_asihpi_pcm *)data; struct snd_card_asihpi_pcm *dpcm = (struct snd_card_asihpi_pcm *)data;
struct snd_card_asihpi *card = snd_pcm_substream_chip(dpcm->substream); struct snd_pcm_substream *substream = dpcm->substream;
struct snd_card_asihpi *card = snd_pcm_substream_chip(substream);
struct snd_pcm_runtime *runtime; struct snd_pcm_runtime *runtime;
struct snd_pcm_substream *s; struct snd_pcm_substream *s;
unsigned int newdata = 0; unsigned int newdata = 0;
unsigned int pcm_buf_dma_ofs, min_buf_pos = 0; unsigned int pcm_buf_dma_ofs, min_buf_pos = 0;
unsigned int remdata, xfercount, next_jiffies; unsigned int remdata, xfercount, next_jiffies;
int first = 1; int first = 1;
int loops = 0;
u16 state; u16 state;
u32 buffer_size, bytes_avail, samples_played, on_card_bytes; u32 buffer_size, bytes_avail, samples_played, on_card_bytes;
VPRINTK1(KERN_INFO "%c%d snd_card_asihpi_timer_function\n",
SCHR(substream->stream), substream->number);
/* find minimum newdata and buffer pos in group */ /* find minimum newdata and buffer pos in group */
snd_pcm_group_for_each_entry(s, dpcm->substream) { snd_pcm_group_for_each_entry(s, substream) {
struct snd_card_asihpi_pcm *ds = s->runtime->private_data; struct snd_card_asihpi_pcm *ds = s->runtime->private_data;
runtime = s->runtime; runtime = s->runtime;
if (snd_pcm_substream_chip(s) != card) if (snd_pcm_substream_chip(s) != card)
continue; continue;
hpi_handle_error(hpi_stream_get_info_ex(ss, /* don't link Cap and Play */
if (substream->stream != s->stream)
continue;
hpi_handle_error(hpi_stream_get_info_ex(
ds->h_stream, &state, ds->h_stream, &state,
&buffer_size, &bytes_avail, &buffer_size, &bytes_avail,
&samples_played, &on_card_bytes)); &samples_played, &on_card_bytes));
...@@ -749,86 +763,96 @@ static void snd_card_asihpi_timer_function(unsigned long data) ...@@ -749,86 +763,96 @@ static void snd_card_asihpi_timer_function(unsigned long data)
/* number of bytes in on-card buffer */ /* number of bytes in on-card buffer */
runtime->delay = on_card_bytes; runtime->delay = on_card_bytes;
if (state == HPI_STATE_DRAINED) { if (s->stream == SNDRV_PCM_STREAM_PLAYBACK) {
snd_printd(KERN_WARNING "outstream %d drained\n",
s->number);
//snd_pcm_stop(s, SNDRV_PCM_STATE_XRUN);
//return;
}
if (s->stream == SNDRV_PCM_STREAM_PLAYBACK)
pcm_buf_dma_ofs = ds->pcm_buf_host_rw_ofs - bytes_avail; pcm_buf_dma_ofs = ds->pcm_buf_host_rw_ofs - bytes_avail;
else if (state == HPI_STATE_STOPPED) {
if ((bytes_avail == 0) &&
(on_card_bytes < ds->pcm_buf_host_rw_ofs)) {
hpi_handle_error(hpi_stream_start(ds->h_stream));
VPRINTK1(KERN_INFO "P%d start\n", s->number);
}
} else if (state == HPI_STATE_DRAINED) {
VPRINTK1(KERN_WARNING "P%d drained\n",
s->number);
/*snd_pcm_stop(s, SNDRV_PCM_STATE_XRUN);
continue; */
}
} else
pcm_buf_dma_ofs = bytes_avail + ds->pcm_buf_host_rw_ofs; pcm_buf_dma_ofs = bytes_avail + ds->pcm_buf_host_rw_ofs;
if (first) { if (first) {
/* can't statically init min when wrap is involved */ /* can't statically init min when wrap is involved */
min_buf_pos = pcm_buf_dma_ofs; min_buf_pos = pcm_buf_dma_ofs;
newdata = (pcm_buf_dma_ofs - ds->pcm_buf_elapsed_dma_ofs) % ds->pcm_size; newdata = (pcm_buf_dma_ofs - ds->pcm_buf_elapsed_dma_ofs) % ds->buffer_bytes;
first = 0; first = 0;
} else { } else {
min_buf_pos = min_buf_pos =
modulo_min(min_buf_pos, pcm_buf_dma_ofs, UINT_MAX+1L); modulo_min(min_buf_pos, pcm_buf_dma_ofs, UINT_MAX+1L);
newdata = min( newdata = min(
(pcm_buf_dma_ofs - ds->pcm_buf_elapsed_dma_ofs) % ds->pcm_size, (pcm_buf_dma_ofs - ds->pcm_buf_elapsed_dma_ofs) % ds->buffer_bytes,
newdata); newdata);
} }
VPRINTK1("PB timer hw_ptr x%04lX, appl_ptr x%04lX\n", VPRINTK1(KERN_INFO "PB timer hw_ptr x%04lX, appl_ptr x%04lX\n",
(unsigned long)frames_to_bytes(runtime, (unsigned long)frames_to_bytes(runtime,
runtime->status->hw_ptr), runtime->status->hw_ptr),
(unsigned long)frames_to_bytes(runtime, (unsigned long)frames_to_bytes(runtime,
runtime->control->appl_ptr)); runtime->control->appl_ptr));
VPRINTK1("%d S=%d, irq=%04X, pos=x%04X, left=x%04X," VPRINTK1(KERN_INFO "%d %c%d S=%d, rw=%04X, dma=x%04X, left=x%04X,"
" aux=x%04X space=x%04X\n", s->number, " aux=x%04X space=x%04X\n",
loops, SCHR(s->stream), s->number,
state, ds->pcm_buf_host_rw_ofs, pcm_buf_dma_ofs, (int)bytes_avail, state, ds->pcm_buf_host_rw_ofs, pcm_buf_dma_ofs, (int)bytes_avail,
(int)on_card_bytes, buffer_size-bytes_avail); (int)on_card_bytes, buffer_size-bytes_avail);
loops++;
} }
pcm_buf_dma_ofs = min_buf_pos; pcm_buf_dma_ofs = min_buf_pos;
remdata = newdata % dpcm->pcm_count; remdata = newdata % dpcm->period_bytes;
xfercount = newdata - remdata; /* a multiple of pcm_count */ xfercount = newdata - remdata; /* a multiple of period_bytes */
/* come back when on_card_bytes has decreased enough to allow /* come back when on_card_bytes has decreased enough to allow
write to happen, or when data has been consumed to make another write to happen, or when data has been consumed to make another
period period
*/ */
if (xfercount && (on_card_bytes > dpcm->pcm_count)) if (xfercount && (on_card_bytes > dpcm->period_bytes))
next_jiffies = ((on_card_bytes - dpcm->pcm_count) * HZ / dpcm->bytes_per_sec); next_jiffies = ((on_card_bytes - dpcm->period_bytes) * HZ / dpcm->bytes_per_sec);
else else
next_jiffies = ((dpcm->pcm_count - remdata) * HZ / dpcm->bytes_per_sec); next_jiffies = ((dpcm->period_bytes - remdata) * HZ / dpcm->bytes_per_sec);
next_jiffies = max(next_jiffies, 1U); next_jiffies = max(next_jiffies, 1U);
dpcm->timer.expires = jiffies + next_jiffies; dpcm->timer.expires = jiffies + next_jiffies;
VPRINTK1("jif %d buf pos x%04X newdata x%04X xfer x%04X\n", VPRINTK1(KERN_INFO "jif %d buf pos x%04X newdata x%04X xfer x%04X\n",
next_jiffies, pcm_buf_dma_ofs, newdata, xfercount); next_jiffies, pcm_buf_dma_ofs, newdata, xfercount);
snd_pcm_group_for_each_entry(s, substream) {
snd_pcm_group_for_each_entry(s, dpcm->substream) {
struct snd_card_asihpi_pcm *ds = s->runtime->private_data; struct snd_card_asihpi_pcm *ds = s->runtime->private_data;
/* don't link Cap and Play */
if (substream->stream != s->stream)
continue;
ds->pcm_buf_dma_ofs = pcm_buf_dma_ofs; ds->pcm_buf_dma_ofs = pcm_buf_dma_ofs;
if (xfercount && (on_card_bytes <= ds->pcm_count)) { if (xfercount && (on_card_bytes <= ds->period_bytes)) {
if (card->support_mmap) { if (card->support_mmap) {
if (s->stream == SNDRV_PCM_STREAM_PLAYBACK) { if (s->stream == SNDRV_PCM_STREAM_PLAYBACK) {
VPRINTK2("Write OS%d x%04x\n", VPRINTK2(KERN_INFO "P%d write x%04x\n",
s->number, s->number,
ds->pcm_count); ds->period_bytes);
hpi_handle_error( hpi_handle_error(
hpi_outstream_write_buf( hpi_outstream_write_buf(
ss, ds->h_stream, ds->h_stream,
&s->runtime-> &s->runtime->
dma_area[0], dma_area[0],
xfercount, xfercount,
&ds->format)); &ds->format));
} else { } else {
VPRINTK2("Read IS%d x%04x\n", VPRINTK2(KERN_INFO "C%d read x%04x\n",
s->number, s->number,
xfercount); xfercount);
hpi_handle_error( hpi_handle_error(
hpi_instream_read_buf( hpi_instream_read_buf(
ss, ds->h_stream, ds->h_stream,
NULL, xfercount)); NULL, xfercount));
} }
ds->pcm_buf_host_rw_ofs = ds->pcm_buf_host_rw_ofs + xfercount; 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,9 +880,9 @@ static int snd_card_asihpi_playback_prepare(struct snd_pcm_substream *
struct snd_pcm_runtime *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_card_asihpi_pcm *dpcm = runtime->private_data; struct snd_card_asihpi_pcm *dpcm = runtime->private_data;
snd_printd(KERN_INFO "playback prepare %d\n", substream->number); VPRINTK1(KERN_INFO "playback prepare %d\n", substream->number);
hpi_handle_error(hpi_outstream_reset(ss, dpcm->h_stream)); hpi_handle_error(hpi_outstream_reset(dpcm->h_stream));
dpcm->pcm_buf_host_rw_ofs = 0; dpcm->pcm_buf_host_rw_ofs = 0;
dpcm->pcm_buf_dma_ofs = 0; dpcm->pcm_buf_dma_ofs = 0;
dpcm->pcm_buf_elapsed_dma_ofs = 0; dpcm->pcm_buf_elapsed_dma_ofs = 0;
...@@ -872,8 +896,8 @@ snd_card_asihpi_playback_pointer(struct snd_pcm_substream *substream) ...@@ -872,8 +896,8 @@ snd_card_asihpi_playback_pointer(struct snd_pcm_substream *substream)
struct snd_card_asihpi_pcm *dpcm = runtime->private_data; struct snd_card_asihpi_pcm *dpcm = runtime->private_data;
snd_pcm_uframes_t ptr; snd_pcm_uframes_t ptr;
ptr = bytes_to_frames(runtime, dpcm->pcm_buf_dma_ofs % dpcm->pcm_size); ptr = bytes_to_frames(runtime, dpcm->pcm_buf_dma_ofs % dpcm->buffer_bytes);
//VPRINTK2("playback_pointer=x%04lx\n", (unsigned long)ptr); /* VPRINTK2(KERN_INFO "playback_pointer=x%04lx\n", (unsigned long)ptr); */
return ptr; return ptr;
} }
...@@ -890,12 +914,12 @@ static void snd_card_asihpi_playback_format(struct snd_card_asihpi *asihpi, ...@@ -890,12 +914,12 @@ static void snd_card_asihpi_playback_format(struct snd_card_asihpi *asihpi,
/* on cards without SRC, must query at valid rate, /* on cards without SRC, must query at valid rate,
* maybe set by external sync * maybe set by external sync
*/ */
err = hpi_mixer_get_control(ss, asihpi->h_mixer, err = hpi_mixer_get_control(asihpi->h_mixer,
HPI_SOURCENODE_CLOCK_SOURCE, 0, 0, 0, HPI_SOURCENODE_CLOCK_SOURCE, 0, 0, 0,
HPI_CONTROL_SAMPLECLOCK, &h_control); HPI_CONTROL_SAMPLECLOCK, &h_control);
if (!err) if (!err)
err = hpi_sample_clock_get_sample_rate(ss, h_control, err = hpi_sample_clock_get_sample_rate(h_control,
&sample_rate); &sample_rate);
for (format = HPI_FORMAT_PCM8_UNSIGNED; for (format = HPI_FORMAT_PCM8_UNSIGNED;
...@@ -903,7 +927,7 @@ static void snd_card_asihpi_playback_format(struct snd_card_asihpi *asihpi, ...@@ -903,7 +927,7 @@ static void snd_card_asihpi_playback_format(struct snd_card_asihpi *asihpi,
err = hpi_format_create(&hpi_format, err = hpi_format_create(&hpi_format,
2, format, sample_rate, 128000, 0); 2, format, sample_rate, 128000, 0);
if (!err) if (!err)
err = hpi_outstream_query_format(ss, h_stream, err = hpi_outstream_query_format(h_stream,
&hpi_format); &hpi_format);
if (!err && (hpi_to_alsa_formats[format] != -1)) if (!err && (hpi_to_alsa_formats[format] != -1))
pcmhw->formats |= pcmhw->formats |=
...@@ -934,7 +958,7 @@ static int snd_card_asihpi_playback_open(struct snd_pcm_substream *substream) ...@@ -934,7 +958,7 @@ static int snd_card_asihpi_playback_open(struct snd_pcm_substream *substream)
return -ENOMEM; return -ENOMEM;
err = err =
hpi_outstream_open(ss, card->adapter_index, hpi_outstream_open(card->adapter_index,
substream->number, &dpcm->h_stream); substream->number, &dpcm->h_stream);
hpi_handle_error(err); hpi_handle_error(err);
if (err) if (err)
...@@ -994,7 +1018,7 @@ static int snd_card_asihpi_playback_open(struct snd_pcm_substream *substream) ...@@ -994,7 +1018,7 @@ static int snd_card_asihpi_playback_open(struct snd_pcm_substream *substream)
snd_pcm_set_sync(substream); snd_pcm_set_sync(substream);
snd_printd(KERN_INFO "playback open\n"); VPRINTK1(KERN_INFO "playback open\n");
return 0; return 0;
} }
...@@ -1004,8 +1028,8 @@ static int snd_card_asihpi_playback_close(struct snd_pcm_substream *substream) ...@@ -1004,8 +1028,8 @@ static int snd_card_asihpi_playback_close(struct snd_pcm_substream *substream)
struct snd_pcm_runtime *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_card_asihpi_pcm *dpcm = runtime->private_data; struct snd_card_asihpi_pcm *dpcm = runtime->private_data;
hpi_handle_error(hpi_outstream_close(ss, dpcm->h_stream)); hpi_handle_error(hpi_outstream_close(dpcm->h_stream));
snd_printd(KERN_INFO "playback close\n"); VPRINTK1(KERN_INFO "playback close\n");
return 0; return 0;
} }
...@@ -1028,7 +1052,7 @@ static int snd_card_asihpi_playback_copy(struct snd_pcm_substream *substream, ...@@ -1028,7 +1052,7 @@ static int snd_card_asihpi_playback_copy(struct snd_pcm_substream *substream,
VPRINTK2(KERN_DEBUG "playback copy%d %u bytes\n", VPRINTK2(KERN_DEBUG "playback copy%d %u bytes\n",
substream->number, len); substream->number, len);
hpi_handle_error(hpi_outstream_write_buf(ss, dpcm->h_stream, hpi_handle_error(hpi_outstream_write_buf(dpcm->h_stream,
runtime->dma_area, len, &dpcm->format)); runtime->dma_area, len, &dpcm->format));
dpcm->pcm_buf_host_rw_ofs = dpcm->pcm_buf_host_rw_ofs + len; 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,10 +1070,10 @@ static int snd_card_asihpi_playback_silence(struct snd_pcm_substream *
struct snd_card_asihpi_pcm *dpcm = runtime->private_data; struct snd_card_asihpi_pcm *dpcm = runtime->private_data;
len = frames_to_bytes(runtime, count); len = frames_to_bytes(runtime, count);
snd_printd(KERN_INFO "playback silence %u bytes\n", len); VPRINTK1(KERN_INFO "playback silence %u bytes\n", len);
memset(runtime->dma_area, 0, len); memset(runtime->dma_area, 0, len);
hpi_handle_error(hpi_outstream_write_buf(ss, dpcm->h_stream, hpi_handle_error(hpi_outstream_write_buf(dpcm->h_stream,
runtime->dma_area, len, &dpcm->format)); runtime->dma_area, len, &dpcm->format));
return 0; return 0;
} }
...@@ -1085,13 +1109,13 @@ snd_card_asihpi_capture_pointer(struct snd_pcm_substream *substream) ...@@ -1085,13 +1109,13 @@ snd_card_asihpi_capture_pointer(struct snd_pcm_substream *substream)
struct snd_pcm_runtime *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_card_asihpi_pcm *dpcm = runtime->private_data; struct snd_card_asihpi_pcm *dpcm = runtime->private_data;
VPRINTK2("Capture pointer %d=%d\n", VPRINTK2(KERN_INFO "capture pointer %d=%d\n",
substream->number, dpcm->pcm_buf_dma_ofs); substream->number, dpcm->pcm_buf_dma_ofs);
/* NOTE Unlike playback can't use actual samples_played /* NOTE Unlike playback can't use actual samples_played
for the capture position, because those samples aren't yet in for the capture position, because those samples aren't yet in
the local buffer available for reading. the local buffer available for reading.
*/ */
return bytes_to_frames(runtime, dpcm->pcm_buf_dma_ofs % dpcm->pcm_size); return bytes_to_frames(runtime, dpcm->pcm_buf_dma_ofs % dpcm->buffer_bytes);
} }
static int snd_card_asihpi_capture_ioctl(struct snd_pcm_substream *substream, 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,12 +1129,12 @@ static int snd_card_asihpi_capture_prepare(struct snd_pcm_substream *substream)
struct snd_pcm_runtime *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_card_asihpi_pcm *dpcm = runtime->private_data; struct snd_card_asihpi_pcm *dpcm = runtime->private_data;
hpi_handle_error(hpi_instream_reset(ss, dpcm->h_stream)); hpi_handle_error(hpi_instream_reset(dpcm->h_stream));
dpcm->pcm_buf_host_rw_ofs = 0; dpcm->pcm_buf_host_rw_ofs = 0;
dpcm->pcm_buf_dma_ofs = 0; dpcm->pcm_buf_dma_ofs = 0;
dpcm->pcm_buf_elapsed_dma_ofs = 0; dpcm->pcm_buf_elapsed_dma_ofs = 0;
snd_printd("Capture Prepare %d\n", substream->number); VPRINTK1("Capture Prepare %d\n", substream->number);
return 0; return 0;
} }
...@@ -1128,12 +1152,12 @@ static void snd_card_asihpi_capture_format(struct snd_card_asihpi *asihpi, ...@@ -1128,12 +1152,12 @@ static void snd_card_asihpi_capture_format(struct snd_card_asihpi *asihpi,
/* on cards without SRC, must query at valid rate, /* on cards without SRC, must query at valid rate,
maybe set by external sync */ maybe set by external sync */
err = hpi_mixer_get_control(ss, asihpi->h_mixer, err = hpi_mixer_get_control(asihpi->h_mixer,
HPI_SOURCENODE_CLOCK_SOURCE, 0, 0, 0, HPI_SOURCENODE_CLOCK_SOURCE, 0, 0, 0,
HPI_CONTROL_SAMPLECLOCK, &h_control); HPI_CONTROL_SAMPLECLOCK, &h_control);
if (!err) if (!err)
err = hpi_sample_clock_get_sample_rate(ss, h_control, err = hpi_sample_clock_get_sample_rate(h_control,
&sample_rate); &sample_rate);
for (format = HPI_FORMAT_PCM8_UNSIGNED; for (format = HPI_FORMAT_PCM8_UNSIGNED;
...@@ -1142,7 +1166,7 @@ static void snd_card_asihpi_capture_format(struct snd_card_asihpi *asihpi, ...@@ -1142,7 +1166,7 @@ static void snd_card_asihpi_capture_format(struct snd_card_asihpi *asihpi,
err = hpi_format_create(&hpi_format, 2, format, err = hpi_format_create(&hpi_format, 2, format,
sample_rate, 128000, 0); sample_rate, 128000, 0);
if (!err) if (!err)
err = hpi_instream_query_format(ss, h_stream, err = hpi_instream_query_format(h_stream,
&hpi_format); &hpi_format);
if (!err) if (!err)
pcmhw->formats |= pcmhw->formats |=
...@@ -1173,11 +1197,11 @@ static int snd_card_asihpi_capture_open(struct snd_pcm_substream *substream) ...@@ -1173,11 +1197,11 @@ static int snd_card_asihpi_capture_open(struct snd_pcm_substream *substream)
if (dpcm == NULL) if (dpcm == NULL)
return -ENOMEM; return -ENOMEM;
snd_printd("hpi_instream_open adapter %d stream %d\n", VPRINTK1("hpi_instream_open adapter %d stream %d\n",
card->adapter_index, substream->number); card->adapter_index, substream->number);
err = hpi_handle_error( err = hpi_handle_error(
hpi_instream_open(ss, card->adapter_index, hpi_instream_open(card->adapter_index,
substream->number, &dpcm->h_stream)); substream->number, &dpcm->h_stream));
if (err) if (err)
kfree(dpcm); kfree(dpcm);
...@@ -1229,7 +1253,7 @@ static int snd_card_asihpi_capture_close(struct snd_pcm_substream *substream) ...@@ -1229,7 +1253,7 @@ static int snd_card_asihpi_capture_close(struct snd_pcm_substream *substream)
{ {
struct snd_card_asihpi_pcm *dpcm = substream->runtime->private_data; struct snd_card_asihpi_pcm *dpcm = substream->runtime->private_data;
hpi_handle_error(hpi_instream_close(ss, dpcm->h_stream)); hpi_handle_error(hpi_instream_close(dpcm->h_stream));
return 0; return 0;
} }
...@@ -1243,8 +1267,8 @@ static int snd_card_asihpi_capture_copy(struct snd_pcm_substream *substream, ...@@ -1243,8 +1267,8 @@ static int snd_card_asihpi_capture_copy(struct snd_pcm_substream *substream,
len = frames_to_bytes(runtime, count); len = frames_to_bytes(runtime, count);
VPRINTK2("Capture copy%d %d bytes\n", substream->number, len); VPRINTK2(KERN_INFO "capture copy%d %d bytes\n", substream->number, len);
hpi_handle_error(hpi_instream_read_buf(ss, dpcm->h_stream, hpi_handle_error(hpi_instream_read_buf(dpcm->h_stream,
runtime->dma_area, len)); runtime->dma_area, len));
dpcm->pcm_buf_host_rw_ofs = dpcm->pcm_buf_host_rw_ofs + len; dpcm->pcm_buf_host_rw_ofs = dpcm->pcm_buf_host_rw_ofs + len;
...@@ -1327,8 +1351,7 @@ struct hpi_control { ...@@ -1327,8 +1351,7 @@ struct hpi_control {
char name[44]; /* copied to snd_ctl_elem_id.name[44]; */ char name[44]; /* copied to snd_ctl_elem_id.name[44]; */
}; };
static const char * const asihpi_tuner_band_names[] = static const char * const asihpi_tuner_band_names[] = {
{
"invalid", "invalid",
"AM", "AM",
"FM mono", "FM mono",
...@@ -1346,8 +1369,7 @@ compile_time_assert( ...@@ -1346,8 +1369,7 @@ compile_time_assert(
(HPI_TUNER_BAND_LAST+1)), (HPI_TUNER_BAND_LAST+1)),
assert_tuner_band_names_size); assert_tuner_band_names_size);
static const char * const asihpi_src_names[] = static const char * const asihpi_src_names[] = {
{
"no source", "no source",
"PCM", "PCM",
"Line", "Line",
...@@ -1367,8 +1389,7 @@ compile_time_assert( ...@@ -1367,8 +1389,7 @@ compile_time_assert(
(HPI_SOURCENODE_LAST_INDEX-HPI_SOURCENODE_NONE+1)), (HPI_SOURCENODE_LAST_INDEX-HPI_SOURCENODE_NONE+1)),
assert_src_names_size); assert_src_names_size);
static const char * const asihpi_dst_names[] = static const char * const asihpi_dst_names[] = {
{
"no destination", "no destination",
"PCM", "PCM",
"Line", "Line",
...@@ -1415,7 +1436,8 @@ static void asihpi_ctl_init(struct snd_kcontrol_new *snd_control, ...@@ -1415,7 +1436,8 @@ static void asihpi_ctl_init(struct snd_kcontrol_new *snd_control,
else if ((hpi_ctl->src_node_type + HPI_SOURCENODE_NONE != HPI_SOURCENODE_OSTREAM) && else if ((hpi_ctl->src_node_type + HPI_SOURCENODE_NONE != HPI_SOURCENODE_OSTREAM) &&
(!hpi_ctl->dst_node_type)) (!hpi_ctl->dst_node_type))
dir = "Capture "; /* On a source node that is not PCM playback */ dir = "Capture "; /* On a source node that is not PCM playback */
else if ((hpi_ctl->src_node_type + HPI_SOURCENODE_NONE != HPI_SOURCENODE_OSTREAM) && else if (hpi_ctl->src_node_type &&
(hpi_ctl->src_node_type + HPI_SOURCENODE_NONE != HPI_SOURCENODE_OSTREAM) &&
(hpi_ctl->dst_node_type)) (hpi_ctl->dst_node_type))
dir = "Monitor Playback "; /* Between an input and an output */ dir = "Monitor Playback "; /* Between an input and an output */
else else
...@@ -1439,7 +1461,8 @@ static void asihpi_ctl_init(struct snd_kcontrol_new *snd_control, ...@@ -1439,7 +1461,8 @@ static void asihpi_ctl_init(struct snd_kcontrol_new *snd_control,
hpi_ctl->src_node_index, hpi_ctl->src_node_index,
dir, name); dir, name);
} }
// printk(KERN_INFO "adding %s %d to %d ", hpi_ctl->name, hpi_ctl->src_node_type, hpi_ctl->dst_node_type); /* printk(KERN_INFO "Adding %s %d to %d ", hpi_ctl->name,
hpi_ctl->wSrcNodeType, hpi_ctl->wDstNodeType); */
} }
/*------------------------------------------------------------ /*------------------------------------------------------------
...@@ -1456,7 +1479,7 @@ static int snd_asihpi_volume_info(struct snd_kcontrol *kcontrol, ...@@ -1456,7 +1479,7 @@ static int snd_asihpi_volume_info(struct snd_kcontrol *kcontrol,
short max_gain_mB; short max_gain_mB;
short step_gain_mB; short step_gain_mB;
err = hpi_volume_query_range(ss, h_control, err = hpi_volume_query_range(h_control,
&min_gain_mB, &max_gain_mB, &step_gain_mB); &min_gain_mB, &max_gain_mB, &step_gain_mB);
if (err) { if (err) {
max_gain_mB = 0; max_gain_mB = 0;
...@@ -1478,7 +1501,7 @@ static int snd_asihpi_volume_get(struct snd_kcontrol *kcontrol, ...@@ -1478,7 +1501,7 @@ static int snd_asihpi_volume_get(struct snd_kcontrol *kcontrol,
u32 h_control = kcontrol->private_value; u32 h_control = kcontrol->private_value;
short an_gain_mB[HPI_MAX_CHANNELS]; short an_gain_mB[HPI_MAX_CHANNELS];
hpi_handle_error(hpi_volume_get_gain(ss, h_control, an_gain_mB)); hpi_handle_error(hpi_volume_get_gain(h_control, an_gain_mB));
ucontrol->value.integer.value[0] = an_gain_mB[0] / VOL_STEP_mB; ucontrol->value.integer.value[0] = an_gain_mB[0] / VOL_STEP_mB;
ucontrol->value.integer.value[1] = an_gain_mB[1] / VOL_STEP_mB; ucontrol->value.integer.value[1] = an_gain_mB[1] / VOL_STEP_mB;
...@@ -1500,7 +1523,7 @@ static int snd_asihpi_volume_put(struct snd_kcontrol *kcontrol, ...@@ -1500,7 +1523,7 @@ static int snd_asihpi_volume_put(struct snd_kcontrol *kcontrol,
asihpi->mixer_volume[addr][1] != right; asihpi->mixer_volume[addr][1] != right;
*/ */
change = 1; change = 1;
hpi_handle_error(hpi_volume_set_gain(ss, h_control, an_gain_mB)); hpi_handle_error(hpi_volume_set_gain(h_control, an_gain_mB));
return change; return change;
} }
...@@ -1536,7 +1559,7 @@ static int snd_asihpi_level_info(struct snd_kcontrol *kcontrol, ...@@ -1536,7 +1559,7 @@ static int snd_asihpi_level_info(struct snd_kcontrol *kcontrol,
short step_gain_mB; short step_gain_mB;
err = err =
hpi_level_query_range(ss, h_control, &min_gain_mB, hpi_level_query_range(h_control, &min_gain_mB,
&max_gain_mB, &step_gain_mB); &max_gain_mB, &step_gain_mB);
if (err) { if (err) {
max_gain_mB = 2400; max_gain_mB = 2400;
...@@ -1558,7 +1581,7 @@ static int snd_asihpi_level_get(struct snd_kcontrol *kcontrol, ...@@ -1558,7 +1581,7 @@ static int snd_asihpi_level_get(struct snd_kcontrol *kcontrol,
u32 h_control = kcontrol->private_value; u32 h_control = kcontrol->private_value;
short an_gain_mB[HPI_MAX_CHANNELS]; short an_gain_mB[HPI_MAX_CHANNELS];
hpi_handle_error(hpi_level_get_gain(ss, h_control, an_gain_mB)); hpi_handle_error(hpi_level_get_gain(h_control, an_gain_mB));
ucontrol->value.integer.value[0] = ucontrol->value.integer.value[0] =
an_gain_mB[0] / HPI_UNITS_PER_dB; an_gain_mB[0] / HPI_UNITS_PER_dB;
ucontrol->value.integer.value[1] = ucontrol->value.integer.value[1] =
...@@ -1582,7 +1605,7 @@ static int snd_asihpi_level_put(struct snd_kcontrol *kcontrol, ...@@ -1582,7 +1605,7 @@ static int snd_asihpi_level_put(struct snd_kcontrol *kcontrol,
asihpi->mixer_level[addr][1] != right; asihpi->mixer_level[addr][1] != right;
*/ */
change = 1; change = 1;
hpi_handle_error(hpi_level_set_gain(ss, h_control, an_gain_mB)); hpi_handle_error(hpi_level_set_gain(h_control, an_gain_mB));
return change; return change;
} }
...@@ -1611,12 +1634,8 @@ static int __devinit snd_asihpi_level_add(struct snd_card_asihpi *asihpi, ...@@ -1611,12 +1634,8 @@ static int __devinit snd_asihpi_level_add(struct snd_card_asihpi *asihpi,
------------------------------------------------------------*/ ------------------------------------------------------------*/
/* AESEBU format */ /* AESEBU format */
static const char * const asihpi_aesebu_format_names[] = static const char * const asihpi_aesebu_format_names[] = {
{ "N/A", "S/PDIF", "AES/EBU" };
"N/A",
"S/PDIF",
"AES/EBU",
};
static int snd_asihpi_aesebu_format_info(struct snd_kcontrol *kcontrol, static int snd_asihpi_aesebu_format_info(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo) struct snd_ctl_elem_info *uinfo)
...@@ -1637,12 +1656,12 @@ static int snd_asihpi_aesebu_format_info(struct snd_kcontrol *kcontrol, ...@@ -1637,12 +1656,12 @@ static int snd_asihpi_aesebu_format_info(struct snd_kcontrol *kcontrol,
static int snd_asihpi_aesebu_format_get(struct snd_kcontrol *kcontrol, static int snd_asihpi_aesebu_format_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol, struct snd_ctl_elem_value *ucontrol,
u16 (*func)(const struct hpi_hsubsys *, u32, u16 *)) u16 (*func)(u32, u16 *))
{ {
u32 h_control = kcontrol->private_value; u32 h_control = kcontrol->private_value;
u16 source, err; u16 source, err;
err = func(ss, h_control, &source); err = func(h_control, &source);
/* default to N/A */ /* default to N/A */
ucontrol->value.enumerated.item[0] = 0; ucontrol->value.enumerated.item[0] = 0;
...@@ -1659,7 +1678,7 @@ static int snd_asihpi_aesebu_format_get(struct snd_kcontrol *kcontrol, ...@@ -1659,7 +1678,7 @@ static int snd_asihpi_aesebu_format_get(struct snd_kcontrol *kcontrol,
static int snd_asihpi_aesebu_format_put(struct snd_kcontrol *kcontrol, static int snd_asihpi_aesebu_format_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol, struct snd_ctl_elem_value *ucontrol,
u16 (*func)(const struct hpi_hsubsys *, u32, u16)) u16 (*func)(u32, u16))
{ {
u32 h_control = kcontrol->private_value; u32 h_control = kcontrol->private_value;
...@@ -1671,7 +1690,7 @@ static int snd_asihpi_aesebu_format_put(struct snd_kcontrol *kcontrol, ...@@ -1671,7 +1690,7 @@ static int snd_asihpi_aesebu_format_put(struct snd_kcontrol *kcontrol,
if (ucontrol->value.enumerated.item[0] == 2) if (ucontrol->value.enumerated.item[0] == 2)
source = HPI_AESEBU_FORMAT_AESEBU; source = HPI_AESEBU_FORMAT_AESEBU;
if (func(ss, h_control, source) != 0) if (func(h_control, source) != 0)
return -EINVAL; return -EINVAL;
return 1; return 1;
...@@ -1680,13 +1699,13 @@ static int snd_asihpi_aesebu_format_put(struct snd_kcontrol *kcontrol, ...@@ -1680,13 +1699,13 @@ static int snd_asihpi_aesebu_format_put(struct snd_kcontrol *kcontrol,
static int snd_asihpi_aesebu_rx_format_get(struct snd_kcontrol *kcontrol, static int snd_asihpi_aesebu_rx_format_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol) { struct snd_ctl_elem_value *ucontrol) {
return snd_asihpi_aesebu_format_get(kcontrol, ucontrol, return snd_asihpi_aesebu_format_get(kcontrol, ucontrol,
HPI_AESEBU__receiver_get_format); hpi_aesebu_receiver_get_format);
} }
static int snd_asihpi_aesebu_rx_format_put(struct snd_kcontrol *kcontrol, static int snd_asihpi_aesebu_rx_format_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol) { struct snd_ctl_elem_value *ucontrol) {
return snd_asihpi_aesebu_format_put(kcontrol, ucontrol, return snd_asihpi_aesebu_format_put(kcontrol, ucontrol,
HPI_AESEBU__receiver_set_format); hpi_aesebu_receiver_set_format);
} }
static int snd_asihpi_aesebu_rxstatus_info(struct snd_kcontrol *kcontrol, 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,8 +1727,8 @@ static int snd_asihpi_aesebu_rxstatus_get(struct snd_kcontrol *kcontrol,
u32 h_control = kcontrol->private_value; u32 h_control = kcontrol->private_value;
u16 status; u16 status;
hpi_handle_error(HPI_AESEBU__receiver_get_error_status( hpi_handle_error(hpi_aesebu_receiver_get_error_status(
ss, h_control, &status)); h_control, &status));
ucontrol->value.integer.value[0] = status; ucontrol->value.integer.value[0] = status;
return 0; return 0;
} }
...@@ -1742,13 +1761,13 @@ static int __devinit snd_asihpi_aesebu_rx_add(struct snd_card_asihpi *asihpi, ...@@ -1742,13 +1761,13 @@ static int __devinit snd_asihpi_aesebu_rx_add(struct snd_card_asihpi *asihpi,
static int snd_asihpi_aesebu_tx_format_get(struct snd_kcontrol *kcontrol, static int snd_asihpi_aesebu_tx_format_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol) { struct snd_ctl_elem_value *ucontrol) {
return snd_asihpi_aesebu_format_get(kcontrol, ucontrol, return snd_asihpi_aesebu_format_get(kcontrol, ucontrol,
HPI_AESEBU__transmitter_get_format); hpi_aesebu_transmitter_get_format);
} }
static int snd_asihpi_aesebu_tx_format_put(struct snd_kcontrol *kcontrol, static int snd_asihpi_aesebu_tx_format_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol) { struct snd_ctl_elem_value *ucontrol) {
return snd_asihpi_aesebu_format_put(kcontrol, ucontrol, return snd_asihpi_aesebu_format_put(kcontrol, ucontrol,
HPI_AESEBU__transmitter_set_format); hpi_aesebu_transmitter_set_format);
} }
...@@ -1782,7 +1801,7 @@ static int snd_asihpi_tuner_gain_info(struct snd_kcontrol *kcontrol, ...@@ -1782,7 +1801,7 @@ static int snd_asihpi_tuner_gain_info(struct snd_kcontrol *kcontrol,
u16 gain_range[3]; u16 gain_range[3];
for (idx = 0; idx < 3; idx++) { for (idx = 0; idx < 3; idx++) {
err = hpi_tuner_query_gain(ss, h_control, err = hpi_tuner_query_gain(h_control,
idx, &gain_range[idx]); idx, &gain_range[idx]);
if (err != 0) if (err != 0)
return err; return err;
...@@ -1805,7 +1824,7 @@ static int snd_asihpi_tuner_gain_get(struct snd_kcontrol *kcontrol, ...@@ -1805,7 +1824,7 @@ static int snd_asihpi_tuner_gain_get(struct snd_kcontrol *kcontrol,
u32 h_control = kcontrol->private_value; u32 h_control = kcontrol->private_value;
short gain; short gain;
hpi_handle_error(hpi_tuner_get_gain(ss, h_control, &gain)); hpi_handle_error(hpi_tuner_get_gain(h_control, &gain));
ucontrol->value.integer.value[0] = gain / HPI_UNITS_PER_dB; ucontrol->value.integer.value[0] = gain / HPI_UNITS_PER_dB;
return 0; return 0;
...@@ -1821,7 +1840,7 @@ static int snd_asihpi_tuner_gain_put(struct snd_kcontrol *kcontrol, ...@@ -1821,7 +1840,7 @@ static int snd_asihpi_tuner_gain_put(struct snd_kcontrol *kcontrol,
short gain; short gain;
gain = (ucontrol->value.integer.value[0]) * HPI_UNITS_PER_dB; gain = (ucontrol->value.integer.value[0]) * HPI_UNITS_PER_dB;
hpi_handle_error(hpi_tuner_set_gain(ss, h_control, gain)); hpi_handle_error(hpi_tuner_set_gain(h_control, gain));
return 1; return 1;
} }
...@@ -1835,7 +1854,7 @@ static int asihpi_tuner_band_query(struct snd_kcontrol *kcontrol, ...@@ -1835,7 +1854,7 @@ static int asihpi_tuner_band_query(struct snd_kcontrol *kcontrol,
u32 i; u32 i;
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
err = hpi_tuner_query_band(ss, err = hpi_tuner_query_band(
h_control, i, &band_list[i]); h_control, i, &band_list[i]);
if (err != 0) if (err != 0)
break; break;
...@@ -1891,7 +1910,7 @@ static int snd_asihpi_tuner_band_get(struct snd_kcontrol *kcontrol, ...@@ -1891,7 +1910,7 @@ static int snd_asihpi_tuner_band_get(struct snd_kcontrol *kcontrol,
num_bands = asihpi_tuner_band_query(kcontrol, tuner_bands, num_bands = asihpi_tuner_band_query(kcontrol, tuner_bands,
HPI_TUNER_BAND_LAST); HPI_TUNER_BAND_LAST);
hpi_handle_error(hpi_tuner_get_band(ss, h_control, &band)); hpi_handle_error(hpi_tuner_get_band(h_control, &band));
ucontrol->value.enumerated.item[0] = -1; ucontrol->value.enumerated.item[0] = -1;
for (idx = 0; idx < HPI_TUNER_BAND_LAST; idx++) 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,7 +1937,7 @@ static int snd_asihpi_tuner_band_put(struct snd_kcontrol *kcontrol,
HPI_TUNER_BAND_LAST); HPI_TUNER_BAND_LAST);
band = tuner_bands[ucontrol->value.enumerated.item[0]]; band = tuner_bands[ucontrol->value.enumerated.item[0]];
hpi_handle_error(hpi_tuner_set_band(ss, h_control, band)); hpi_handle_error(hpi_tuner_set_band(h_control, band));
return 1; return 1;
} }
...@@ -1943,7 +1962,7 @@ static int snd_asihpi_tuner_freq_info(struct snd_kcontrol *kcontrol, ...@@ -1943,7 +1962,7 @@ static int snd_asihpi_tuner_freq_info(struct snd_kcontrol *kcontrol,
for (band_iter = 0; band_iter < num_bands; band_iter++) { for (band_iter = 0; band_iter < num_bands; band_iter++) {
for (idx = 0; idx < 3; idx++) { for (idx = 0; idx < 3; idx++) {
err = hpi_tuner_query_frequency(ss, h_control, err = hpi_tuner_query_frequency(h_control,
idx, tuner_bands[band_iter], idx, tuner_bands[band_iter],
&temp_freq_range[idx]); &temp_freq_range[idx]);
if (err != 0) if (err != 0)
...@@ -1976,7 +1995,7 @@ static int snd_asihpi_tuner_freq_get(struct snd_kcontrol *kcontrol, ...@@ -1976,7 +1995,7 @@ static int snd_asihpi_tuner_freq_get(struct snd_kcontrol *kcontrol,
u32 h_control = kcontrol->private_value; u32 h_control = kcontrol->private_value;
u32 freq; u32 freq;
hpi_handle_error(hpi_tuner_get_frequency(ss, h_control, &freq)); hpi_handle_error(hpi_tuner_get_frequency(h_control, &freq));
ucontrol->value.integer.value[0] = freq; ucontrol->value.integer.value[0] = freq;
return 0; return 0;
...@@ -1989,7 +2008,7 @@ static int snd_asihpi_tuner_freq_put(struct snd_kcontrol *kcontrol, ...@@ -1989,7 +2008,7 @@ static int snd_asihpi_tuner_freq_put(struct snd_kcontrol *kcontrol,
u32 freq; u32 freq;
freq = ucontrol->value.integer.value[0]; freq = ucontrol->value.integer.value[0];
hpi_handle_error(hpi_tuner_set_frequency(ss, h_control, freq)); hpi_handle_error(hpi_tuner_set_frequency(h_control, freq));
return 1; return 1;
} }
...@@ -2004,7 +2023,7 @@ static int __devinit snd_asihpi_tuner_add(struct snd_card_asihpi *asihpi, ...@@ -2004,7 +2023,7 @@ static int __devinit snd_asihpi_tuner_add(struct snd_card_asihpi *asihpi,
snd_control.private_value = hpi_ctl->h_control; snd_control.private_value = hpi_ctl->h_control;
snd_control.access = SNDRV_CTL_ELEM_ACCESS_READWRITE; snd_control.access = SNDRV_CTL_ELEM_ACCESS_READWRITE;
if (!hpi_tuner_get_gain(ss, hpi_ctl->h_control, NULL)) { if (!hpi_tuner_get_gain(hpi_ctl->h_control, NULL)) {
asihpi_ctl_init(&snd_control, hpi_ctl, "Gain"); asihpi_ctl_init(&snd_control, hpi_ctl, "Gain");
snd_control.info = snd_asihpi_tuner_gain_info; snd_control.info = snd_asihpi_tuner_gain_info;
snd_control.get = snd_asihpi_tuner_gain_get; snd_control.get = snd_asihpi_tuner_gain_get;
...@@ -2073,7 +2092,7 @@ static int snd_asihpi_meter_get(struct snd_kcontrol *kcontrol, ...@@ -2073,7 +2092,7 @@ static int snd_asihpi_meter_get(struct snd_kcontrol *kcontrol,
short an_gain_mB[HPI_MAX_CHANNELS], i; short an_gain_mB[HPI_MAX_CHANNELS], i;
u16 err; u16 err;
err = hpi_meter_get_peak(ss, h_control, an_gain_mB); err = hpi_meter_get_peak(h_control, an_gain_mB);
for (i = 0; i < HPI_MAX_CHANNELS; i++) { for (i = 0; i < HPI_MAX_CHANNELS; i++) {
if (err) { if (err) {
...@@ -2118,7 +2137,7 @@ static int snd_card_asihpi_mux_count_sources(struct snd_kcontrol *snd_control) ...@@ -2118,7 +2137,7 @@ static int snd_card_asihpi_mux_count_sources(struct snd_kcontrol *snd_control)
struct hpi_control hpi_ctl; struct hpi_control hpi_ctl;
int s, err; int s, err;
for (s = 0; s < 32; s++) { for (s = 0; s < 32; s++) {
err = hpi_multiplexer_query_source(ss, h_control, s, err = hpi_multiplexer_query_source(h_control, s,
&hpi_ctl. &hpi_ctl.
src_node_type, src_node_type,
&hpi_ctl. &hpi_ctl.
...@@ -2146,7 +2165,7 @@ static int snd_asihpi_mux_info(struct snd_kcontrol *kcontrol, ...@@ -2146,7 +2165,7 @@ static int snd_asihpi_mux_info(struct snd_kcontrol *kcontrol,
uinfo->value.enumerated.items - 1; uinfo->value.enumerated.items - 1;
err = err =
hpi_multiplexer_query_source(ss, h_control, hpi_multiplexer_query_source(h_control,
uinfo->value.enumerated.item, uinfo->value.enumerated.item,
&src_node_type, &src_node_index); &src_node_type, &src_node_index);
...@@ -2164,11 +2183,11 @@ static int snd_asihpi_mux_get(struct snd_kcontrol *kcontrol, ...@@ -2164,11 +2183,11 @@ static int snd_asihpi_mux_get(struct snd_kcontrol *kcontrol,
u16 src_node_type, src_node_index; u16 src_node_type, src_node_index;
int s; int s;
hpi_handle_error(hpi_multiplexer_get_source(ss, h_control, hpi_handle_error(hpi_multiplexer_get_source(h_control,
&source_type, &source_index)); &source_type, &source_index));
/* Should cache this search result! */ /* Should cache this search result! */
for (s = 0; s < 256; s++) { for (s = 0; s < 256; s++) {
if (hpi_multiplexer_query_source(ss, h_control, s, if (hpi_multiplexer_query_source(h_control, s,
&src_node_type, &src_node_index)) &src_node_type, &src_node_index))
break; break;
...@@ -2195,12 +2214,12 @@ static int snd_asihpi_mux_put(struct snd_kcontrol *kcontrol, ...@@ -2195,12 +2214,12 @@ static int snd_asihpi_mux_put(struct snd_kcontrol *kcontrol,
change = 1; change = 1;
e = hpi_multiplexer_query_source(ss, h_control, e = hpi_multiplexer_query_source(h_control,
ucontrol->value.enumerated.item[0], ucontrol->value.enumerated.item[0],
&source_type, &source_index); &source_type, &source_index);
if (!e) if (!e)
hpi_handle_error( hpi_handle_error(
hpi_multiplexer_set_source(ss, h_control, hpi_multiplexer_set_source(h_control,
source_type, source_index)); source_type, source_index));
return change; return change;
} }
...@@ -2246,7 +2265,7 @@ static int snd_asihpi_cmode_info(struct snd_kcontrol *kcontrol, ...@@ -2246,7 +2265,7 @@ static int snd_asihpi_cmode_info(struct snd_kcontrol *kcontrol,
*/ */
for (i = 0; i < HPI_CHANNEL_MODE_LAST; i++) for (i = 0; i < HPI_CHANNEL_MODE_LAST; i++)
if (!hpi_channel_mode_query_mode( if (!hpi_channel_mode_query_mode(
ss, h_control, i, &mode)) { h_control, i, &mode)) {
mode_map[valid_modes] = mode; mode_map[valid_modes] = mode;
valid_modes++; valid_modes++;
} }
...@@ -2270,7 +2289,7 @@ static int snd_asihpi_cmode_get(struct snd_kcontrol *kcontrol, ...@@ -2270,7 +2289,7 @@ static int snd_asihpi_cmode_get(struct snd_kcontrol *kcontrol,
u32 h_control = kcontrol->private_value; u32 h_control = kcontrol->private_value;
u16 mode; u16 mode;
if (hpi_channel_mode_get(ss, h_control, &mode)) if (hpi_channel_mode_get(h_control, &mode))
mode = 1; mode = 1;
ucontrol->value.enumerated.item[0] = mode - 1; ucontrol->value.enumerated.item[0] = mode - 1;
...@@ -2286,7 +2305,7 @@ static int snd_asihpi_cmode_put(struct snd_kcontrol *kcontrol, ...@@ -2286,7 +2305,7 @@ static int snd_asihpi_cmode_put(struct snd_kcontrol *kcontrol,
change = 1; change = 1;
hpi_handle_error(hpi_channel_mode_set(ss, h_control, hpi_handle_error(hpi_channel_mode_set(h_control,
ucontrol->value.enumerated.item[0] + 1)); ucontrol->value.enumerated.item[0] + 1));
return change; return change;
} }
...@@ -2310,12 +2329,12 @@ static int __devinit snd_asihpi_cmode_add(struct snd_card_asihpi *asihpi, ...@@ -2310,12 +2329,12 @@ static int __devinit snd_asihpi_cmode_add(struct snd_card_asihpi *asihpi,
/*------------------------------------------------------------ /*------------------------------------------------------------
Sampleclock source controls Sampleclock source controls
------------------------------------------------------------*/ ------------------------------------------------------------*/
static char *sampleclock_sources[MAX_CLOCKSOURCES] = static char *sampleclock_sources[MAX_CLOCKSOURCES] = {
{ "N/A", "Local PLL", "Digital Sync", "Word External", "Word Header", "N/A", "Local PLL", "Digital Sync", "Word External", "Word Header",
"SMPTE", "Digital1", "Auto", "Network", "Invalid", "SMPTE", "Digital1", "Auto", "Network", "Invalid",
"Prev Module", "Prev Module",
"Digital2", "Digital3", "Digital4", "Digital5", "Digital2", "Digital3", "Digital4", "Digital5",
"Digital6", "Digital7", "Digital8"}; "Digital6", "Digital7", "Digital8"};
static int snd_asihpi_clksrc_info(struct snd_kcontrol *kcontrol, static int snd_asihpi_clksrc_info(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo) struct snd_ctl_elem_info *uinfo)
...@@ -2347,11 +2366,11 @@ static int snd_asihpi_clksrc_get(struct snd_kcontrol *kcontrol, ...@@ -2347,11 +2366,11 @@ static int snd_asihpi_clksrc_get(struct snd_kcontrol *kcontrol,
int i; int i;
ucontrol->value.enumerated.item[0] = 0; ucontrol->value.enumerated.item[0] = 0;
if (hpi_sample_clock_get_source(ss, h_control, &source)) if (hpi_sample_clock_get_source(h_control, &source))
source = 0; source = 0;
if (source == HPI_SAMPLECLOCK_SOURCE_AESEBU_INPUT) if (source == HPI_SAMPLECLOCK_SOURCE_AESEBU_INPUT)
if (hpi_sample_clock_get_source_index(ss, h_control, &srcindex)) if (hpi_sample_clock_get_source_index(h_control, &srcindex))
srcindex = 0; srcindex = 0;
for (i = 0; i < clkcache->count; i++) for (i = 0; i < clkcache->count; i++)
...@@ -2378,11 +2397,11 @@ static int snd_asihpi_clksrc_put(struct snd_kcontrol *kcontrol, ...@@ -2378,11 +2397,11 @@ static int snd_asihpi_clksrc_put(struct snd_kcontrol *kcontrol,
if (item >= clkcache->count) if (item >= clkcache->count)
item = clkcache->count-1; item = clkcache->count-1;
hpi_handle_error(hpi_sample_clock_set_source(ss, hpi_handle_error(hpi_sample_clock_set_source(
h_control, clkcache->s[item].source)); h_control, clkcache->s[item].source));
if (clkcache->s[item].source == HPI_SAMPLECLOCK_SOURCE_AESEBU_INPUT) if (clkcache->s[item].source == HPI_SAMPLECLOCK_SOURCE_AESEBU_INPUT)
hpi_handle_error(hpi_sample_clock_set_source_index(ss, hpi_handle_error(hpi_sample_clock_set_source_index(
h_control, clkcache->s[item].index)); h_control, clkcache->s[item].index));
return change; return change;
} }
...@@ -2410,7 +2429,7 @@ static int snd_asihpi_clklocal_get(struct snd_kcontrol *kcontrol, ...@@ -2410,7 +2429,7 @@ static int snd_asihpi_clklocal_get(struct snd_kcontrol *kcontrol,
u32 rate; u32 rate;
u16 e; u16 e;
e = hpi_sample_clock_get_local_rate(ss, h_control, &rate); e = hpi_sample_clock_get_local_rate(h_control, &rate);
if (!e) if (!e)
ucontrol->value.integer.value[0] = rate; ucontrol->value.integer.value[0] = rate;
else else
...@@ -2428,7 +2447,7 @@ static int snd_asihpi_clklocal_put(struct snd_kcontrol *kcontrol, ...@@ -2428,7 +2447,7 @@ static int snd_asihpi_clklocal_put(struct snd_kcontrol *kcontrol,
asihpi->mixer_clkrate[addr][1] != right; asihpi->mixer_clkrate[addr][1] != right;
*/ */
change = 1; change = 1;
hpi_handle_error(hpi_sample_clock_set_local_rate(ss, h_control, hpi_handle_error(hpi_sample_clock_set_local_rate(h_control,
ucontrol->value.integer.value[0])); ucontrol->value.integer.value[0]));
return change; return change;
} }
...@@ -2452,7 +2471,7 @@ static int snd_asihpi_clkrate_get(struct snd_kcontrol *kcontrol, ...@@ -2452,7 +2471,7 @@ static int snd_asihpi_clkrate_get(struct snd_kcontrol *kcontrol,
u32 rate; u32 rate;
u16 e; u16 e;
e = hpi_sample_clock_get_sample_rate(ss, h_control, &rate); e = hpi_sample_clock_get_sample_rate(h_control, &rate);
if (!e) if (!e)
ucontrol->value.integer.value[0] = rate; ucontrol->value.integer.value[0] = rate;
else else
...@@ -2477,7 +2496,7 @@ static int __devinit snd_asihpi_sampleclock_add(struct snd_card_asihpi *asihpi, ...@@ -2477,7 +2496,7 @@ static int __devinit snd_asihpi_sampleclock_add(struct snd_card_asihpi *asihpi,
clkcache->has_local = 0; clkcache->has_local = 0;
for (i = 0; i <= HPI_SAMPLECLOCK_SOURCE_LAST; i++) { for (i = 0; i <= HPI_SAMPLECLOCK_SOURCE_LAST; i++) {
if (hpi_sample_clock_query_source(ss, hSC, if (hpi_sample_clock_query_source(hSC,
i, &source)) i, &source))
break; break;
clkcache->s[i].source = source; clkcache->s[i].source = source;
...@@ -2491,7 +2510,7 @@ static int __devinit snd_asihpi_sampleclock_add(struct snd_card_asihpi *asihpi, ...@@ -2491,7 +2510,7 @@ static int __devinit snd_asihpi_sampleclock_add(struct snd_card_asihpi *asihpi,
if (has_aes_in) if (has_aes_in)
/* already will have picked up index 0 above */ /* already will have picked up index 0 above */
for (j = 1; j < 8; j++) { for (j = 1; j < 8; j++) {
if (hpi_sample_clock_query_source_index(ss, hSC, if (hpi_sample_clock_query_source_index(hSC,
j, HPI_SAMPLECLOCK_SOURCE_AESEBU_INPUT, j, HPI_SAMPLECLOCK_SOURCE_AESEBU_INPUT,
&source)) &source))
break; break;
...@@ -2550,7 +2569,7 @@ static int __devinit snd_card_asihpi_mixer_new(struct snd_card_asihpi *asihpi) ...@@ -2550,7 +2569,7 @@ static int __devinit snd_card_asihpi_mixer_new(struct snd_card_asihpi *asihpi)
strcpy(card->mixername, "Asihpi Mixer"); strcpy(card->mixername, "Asihpi Mixer");
err = err =
hpi_mixer_open(ss, asihpi->adapter_index, hpi_mixer_open(asihpi->adapter_index,
&asihpi->h_mixer); &asihpi->h_mixer);
hpi_handle_error(err); hpi_handle_error(err);
if (err) if (err)
...@@ -2561,7 +2580,7 @@ static int __devinit snd_card_asihpi_mixer_new(struct snd_card_asihpi *asihpi) ...@@ -2561,7 +2580,7 @@ static int __devinit snd_card_asihpi_mixer_new(struct snd_card_asihpi *asihpi)
for (idx = 0; idx < 2000; idx++) { for (idx = 0; idx < 2000; idx++) {
err = hpi_mixer_get_control_by_index( err = hpi_mixer_get_control_by_index(
ss, asihpi->h_mixer, asihpi->h_mixer,
idx, idx,
&hpi_ctl.src_node_type, &hpi_ctl.src_node_type,
&hpi_ctl.src_node_index, &hpi_ctl.src_node_index,
...@@ -2688,14 +2707,14 @@ snd_asihpi_proc_read(struct snd_info_entry *entry, ...@@ -2688,14 +2707,14 @@ snd_asihpi_proc_read(struct snd_info_entry *entry,
version & 0x7, version & 0x7,
((version >> 13) * 100) + ((version >> 7) & 0x3f)); ((version >> 13) * 100) + ((version >> 7) & 0x3f));
err = hpi_mixer_get_control(ss, asihpi->h_mixer, err = hpi_mixer_get_control(asihpi->h_mixer,
HPI_SOURCENODE_CLOCK_SOURCE, 0, 0, 0, HPI_SOURCENODE_CLOCK_SOURCE, 0, 0, 0,
HPI_CONTROL_SAMPLECLOCK, &h_control); HPI_CONTROL_SAMPLECLOCK, &h_control);
if (!err) { if (!err) {
err = hpi_sample_clock_get_sample_rate(ss, err = hpi_sample_clock_get_sample_rate(
h_control, &rate); h_control, &rate);
err += hpi_sample_clock_get_source(ss, h_control, &source); err += hpi_sample_clock_get_source(h_control, &source);
if (!err) if (!err)
snd_iprintf(buffer, "sample_clock=%d_hz, source %s\n", 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,7 +2844,7 @@ static int __devinit snd_asihpi_probe(struct pci_dev *pci_dev,
asihpi->card = card; asihpi->card = card;
asihpi->pci = hpi_card->pci; asihpi->pci = hpi_card->pci;
asihpi->adapter_index = hpi_card->index; asihpi->adapter_index = hpi_card->index;
hpi_handle_error(hpi_adapter_get_info(ss, hpi_handle_error(hpi_adapter_get_info(
asihpi->adapter_index, asihpi->adapter_index,
&asihpi->num_outstreams, &asihpi->num_outstreams,
&asihpi->num_instreams, &asihpi->num_instreams,
...@@ -2847,33 +2866,33 @@ static int __devinit snd_asihpi_probe(struct pci_dev *pci_dev, ...@@ -2847,33 +2866,33 @@ static int __devinit snd_asihpi_probe(struct pci_dev *pci_dev,
if (pcm_substreams < asihpi->num_instreams) if (pcm_substreams < asihpi->num_instreams)
pcm_substreams = asihpi->num_instreams; pcm_substreams = asihpi->num_instreams;
err = hpi_adapter_get_property(ss, asihpi->adapter_index, err = hpi_adapter_get_property(asihpi->adapter_index,
HPI_ADAPTER_PROPERTY_CAPS1, HPI_ADAPTER_PROPERTY_CAPS1,
NULL, &asihpi->support_grouping); NULL, &asihpi->support_grouping);
if (err) if (err)
asihpi->support_grouping = 0; asihpi->support_grouping = 0;
err = hpi_adapter_get_property(ss, asihpi->adapter_index, err = hpi_adapter_get_property(asihpi->adapter_index,
HPI_ADAPTER_PROPERTY_CAPS2, HPI_ADAPTER_PROPERTY_CAPS2,
&asihpi->support_mrx, NULL); &asihpi->support_mrx, NULL);
if (err) if (err)
asihpi->support_mrx = 0; asihpi->support_mrx = 0;
err = hpi_adapter_get_property(ss, asihpi->adapter_index, err = hpi_adapter_get_property(asihpi->adapter_index,
HPI_ADAPTER_PROPERTY_INTERVAL, HPI_ADAPTER_PROPERTY_INTERVAL,
NULL, &asihpi->update_interval_frames); NULL, &asihpi->update_interval_frames);
if (err) if (err)
asihpi->update_interval_frames = 512; asihpi->update_interval_frames = 512;
hpi_handle_error(hpi_instream_open(ss, asihpi->adapter_index, hpi_handle_error(hpi_instream_open(asihpi->adapter_index,
0, &h_stream)); 0, &h_stream));
err = hpi_instream_host_buffer_free(ss, h_stream); err = hpi_instream_host_buffer_free(h_stream);
asihpi->support_mmap = (!err); asihpi->support_mmap = (!err);
hpi_handle_error(hpi_instream_close(ss, h_stream)); hpi_handle_error(hpi_instream_close(h_stream));
err = hpi_adapter_get_property(ss, asihpi->adapter_index, err = hpi_adapter_get_property(asihpi->adapter_index,
HPI_ADAPTER_PROPERTY_CURCHANNELS, HPI_ADAPTER_PROPERTY_CURCHANNELS,
&asihpi->in_max_chans, &asihpi->out_max_chans); &asihpi->in_max_chans, &asihpi->out_max_chans);
if (err) { if (err) {
...@@ -2899,13 +2918,13 @@ static int __devinit snd_asihpi_probe(struct pci_dev *pci_dev, ...@@ -2899,13 +2918,13 @@ static int __devinit snd_asihpi_probe(struct pci_dev *pci_dev,
goto __nodev; goto __nodev;
} }
err = hpi_mixer_get_control(ss, asihpi->h_mixer, err = hpi_mixer_get_control(asihpi->h_mixer,
HPI_SOURCENODE_CLOCK_SOURCE, 0, 0, 0, HPI_SOURCENODE_CLOCK_SOURCE, 0, 0, 0,
HPI_CONTROL_SAMPLECLOCK, &h_control); HPI_CONTROL_SAMPLECLOCK, &h_control);
if (!err) if (!err)
err = hpi_sample_clock_set_local_rate( err = hpi_sample_clock_set_local_rate(
ss, h_control, adapter_fs); h_control, adapter_fs);
snd_asihpi_proc_init(asihpi); snd_asihpi_proc_init(asihpi);
......
...@@ -24,17 +24,10 @@ ...@@ -24,17 +24,10 @@
The HPI is a low-level hardware abstraction layer to all The HPI is a low-level hardware abstraction layer to all
AudioScience digital audio adapters AudioScience digital audio adapters
*/
/*
You must define one operating system that the HPI is to be compiled under
HPI_OS_WIN32_USER 32bit Windows
HPI_OS_DSP_C6000 DSP TI C6000 (automatically set)
HPI_OS_WDM Windows WDM kernel driver
HPI_OS_LINUX Linux userspace
HPI_OS_LINUX_KERNEL Linux kernel (automatically set)
(C) Copyright AudioScience Inc. 1998-2010 (C) Copyright AudioScience Inc. 1998-2010
******************************************************************************/ */
#ifndef _HPI_H_ #ifndef _HPI_H_
#define _HPI_H_ #define _HPI_H_
/* HPI Version /* HPI Version
...@@ -50,8 +43,8 @@ i.e 3.05.02 is a development version ...@@ -50,8 +43,8 @@ i.e 3.05.02 is a development version
#define HPI_VER_RELEASE(v) ((int)(v & 0xFF)) #define HPI_VER_RELEASE(v) ((int)(v & 0xFF))
/* Use single digits for versions less that 10 to avoid octal. */ /* Use single digits for versions less that 10 to avoid octal. */
#define HPI_VER HPI_VERSION_CONSTRUCTOR(4L, 5, 14) #define HPI_VER HPI_VERSION_CONSTRUCTOR(4L, 5, 17)
#define HPI_VER_STRING "4.05.14" #define HPI_VER_STRING "4.05.17"
/* Library version as documented in hpi-api-versions.txt */ /* Library version as documented in hpi-api-versions.txt */
#define HPI_LIB_VER HPI_VERSION_CONSTRUCTOR(9, 0, 0) #define HPI_LIB_VER HPI_VERSION_CONSTRUCTOR(9, 0, 0)
...@@ -59,11 +52,9 @@ i.e 3.05.02 is a development version ...@@ -59,11 +52,9 @@ i.e 3.05.02 is a development version
#include <linux/types.h> #include <linux/types.h>
#define HPI_EXCLUDE_DEPRECATED #define HPI_EXCLUDE_DEPRECATED
/******************************************************************************/
/******************************************************************************/ /******************************************************************************/
/******** HPI API DEFINITIONS *****/ /******** HPI API DEFINITIONS *****/
/******************************************************************************/ /******************************************************************************/
/******************************************************************************/
/*******************************************/ /*******************************************/
/** Audio format types /** Audio format types
...@@ -175,7 +166,6 @@ The range is +1.0 to -1.0, which corresponds to digital fullscale. ...@@ -175,7 +166,6 @@ The range is +1.0 to -1.0, which corresponds to digital fullscale.
HPI_FORMAT_UNDEFINED = 0xffff HPI_FORMAT_UNDEFINED = 0xffff
}; };
/******************************************* in/out Stream states */
/*******************************************/ /*******************************************/
/** Stream States /** Stream States
\ingroup stream \ingroup stream
...@@ -195,7 +185,7 @@ enum HPI_STREAM_STATES { ...@@ -195,7 +185,7 @@ enum HPI_STREAM_STATES {
cards to be ready. */ cards to be ready. */
HPI_STATE_WAIT = 6 HPI_STATE_WAIT = 6
}; };
/******************************************* mixer source node types */ /*******************************************/
/** Source node types /** Source node types
\ingroup mixer \ingroup mixer
*/ */
...@@ -225,7 +215,7 @@ enum HPI_SOURCENODES { ...@@ -225,7 +215,7 @@ enum HPI_SOURCENODES {
/* AX6 max sourcenode types = 15 */ /* AX6 max sourcenode types = 15 */
}; };
/******************************************* mixer dest node types */ /*******************************************/
/** Destination node types /** Destination node types
\ingroup mixer \ingroup mixer
*/ */
...@@ -263,7 +253,7 @@ enum HPI_CONTROLS { ...@@ -263,7 +253,7 @@ enum HPI_CONTROLS {
HPI_CONTROL_MUTE = 4, /*mute control - not used at present. */ HPI_CONTROL_MUTE = 4, /*mute control - not used at present. */
HPI_CONTROL_MULTIPLEXER = 5, /**< multiplexer control. */ HPI_CONTROL_MULTIPLEXER = 5, /**< multiplexer control. */
HPI_CONTROL_AESEBU_TRANSMITTER = 6, /**< AES/EBU transmitter control. */ HPI_CONTROL_AESEBU_TRANSMITTER = 6, /**< AES/EBU transmitter control */
HPI_CONTROL_AESEBUTX = 6, /* HPI_CONTROL_AESEBU_TRANSMITTER */ HPI_CONTROL_AESEBUTX = 6, /* HPI_CONTROL_AESEBU_TRANSMITTER */
HPI_CONTROL_AESEBU_RECEIVER = 7, /**< AES/EBU receiver control. */ HPI_CONTROL_AESEBU_RECEIVER = 7, /**< AES/EBU receiver control. */
...@@ -297,10 +287,7 @@ enum HPI_CONTROLS { ...@@ -297,10 +287,7 @@ enum HPI_CONTROLS {
/* WARNING types 256 or greater impact bit packing in all AX6 DSP code */ /* WARNING types 256 or greater impact bit packing in all AX6 DSP code */
}; };
/* Shorthand names that match attribute names */ /*******************************************/
/******************************************* ADAPTER ATTRIBUTES ****/
/** Adapter properties /** Adapter properties
These are used in HPI_AdapterSetProperty() and HPI_AdapterGetProperty() These are used in HPI_AdapterSetProperty() and HPI_AdapterGetProperty()
\ingroup adapter \ingroup adapter
...@@ -331,9 +318,9 @@ by the driver and is not passed on to the DSP at all. ...@@ -331,9 +318,9 @@ by the driver and is not passed on to the DSP at all.
Indicates the state of the adapter's SSX2 setting. This setting is stored in Indicates the state of the adapter's SSX2 setting. This setting is stored in
non-volatile memory on the adapter. A typical call sequence would be to use non-volatile memory on the adapter. A typical call sequence would be to use
HPI_ADAPTER_PROPERTY_SSX2_SETTING to set SSX2 on the adapter and then to reload HPI_ADAPTER_PROPERTY_SSX2_SETTING to set SSX2 on the adapter and then to reload
the driver. The driver would query HPI_ADAPTER_PROPERTY_SSX2_SETTING during startup the driver. The driver would query HPI_ADAPTER_PROPERTY_SSX2_SETTING during
and if SSX2 is set, it would then call HPI_ADAPTER_PROPERTY_ENABLE_SSX2 to enable startup and if SSX2 is set, it would then call HPI_ADAPTER_PROPERTY_ENABLE_SSX2
SSX2 stream mapping within the kernel level of the driver. to enable SSX2 stream mapping within the kernel level of the driver.
*/ */
HPI_ADAPTER_PROPERTY_SSX2_SETTING = 4, HPI_ADAPTER_PROPERTY_SSX2_SETTING = 4,
...@@ -455,7 +442,7 @@ enum HPI_ADAPTER_MODE_CMDS { ...@@ -455,7 +442,7 @@ enum HPI_ADAPTER_MODE_CMDS {
}; };
/** Adapter Modes /** Adapter Modes
These are used by HPI_AdapterSetModeEx() These are used by HPI_AdapterSetModeEx()
\warning - more than 16 possible modes breaks \warning - more than 16 possible modes breaks
a bitmask in the Windows WAVE DLL a bitmask in the Windows WAVE DLL
...@@ -630,10 +617,13 @@ enum HPI_MIXER_STORE_COMMAND { ...@@ -630,10 +617,13 @@ enum HPI_MIXER_STORE_COMMAND {
HPI_MIXER_STORE_SAVE_SINGLE = 6 HPI_MIXER_STORE_SAVE_SINGLE = 6
}; };
/************************************* CONTROL ATTRIBUTE VALUES ****/ /****************************/
/* CONTROL ATTRIBUTE VALUES */
/****************************/
/** Used by mixer plugin enable functions /** Used by mixer plugin enable functions
E.g. HPI_ParametricEQ_SetState() E.g. HPI_ParametricEq_SetState()
\ingroup mixer \ingroup mixer
*/ */
enum HPI_SWITCH_STATES { enum HPI_SWITCH_STATES {
...@@ -642,6 +632,7 @@ enum HPI_SWITCH_STATES { ...@@ -642,6 +632,7 @@ enum HPI_SWITCH_STATES {
}; };
/* Volume control special gain values */ /* Volume control special gain values */
/** volumes units are 100ths of a dB /** volumes units are 100ths of a dB
\ingroup volume \ingroup volume
*/ */
...@@ -668,7 +659,7 @@ enum HPI_VOLUME_AUTOFADES { ...@@ -668,7 +659,7 @@ enum HPI_VOLUME_AUTOFADES {
/** The physical encoding format of the AESEBU I/O. /** The physical encoding format of the AESEBU I/O.
Used in HPI_AESEBU_Transmitter_SetFormat(), HPI_AESEBU_Receiver_SetFormat() Used in HPI_Aesebu_Transmitter_SetFormat(), HPI_Aesebu_Receiver_SetFormat()
along with related Get and Query functions along with related Get and Query functions
\ingroup aestx \ingroup aestx
*/ */
...@@ -681,7 +672,7 @@ enum HPI_AESEBU_FORMATS { ...@@ -681,7 +672,7 @@ enum HPI_AESEBU_FORMATS {
/** AES/EBU error status bits /** AES/EBU error status bits
Returned by HPI_AESEBU_Receiver_GetErrorStatus() Returned by HPI_Aesebu_Receiver_GetErrorStatus()
\ingroup aesrx \ingroup aesrx
*/ */
enum HPI_AESEBU_ERRORS { enum HPI_AESEBU_ERRORS {
...@@ -832,7 +823,7 @@ enum HPI_SAMPLECLOCK_SOURCES { ...@@ -832,7 +823,7 @@ enum HPI_SAMPLECLOCK_SOURCES {
HPI_SAMPLECLOCK_SOURCE_LAST = 10 HPI_SAMPLECLOCK_SOURCE_LAST = 10
}; };
/** Equalizer filter types. Used by HPI_ParametricEQ_SetBand() /** Equalizer filter types. Used by HPI_ParametricEq_SetBand()
\ingroup parmeq \ingroup parmeq
*/ */
enum HPI_FILTER_TYPE { enum HPI_FILTER_TYPE {
...@@ -875,7 +866,7 @@ enum HPI_ERROR_CODES { ...@@ -875,7 +866,7 @@ enum HPI_ERROR_CODES {
HPI_ERROR_INVALID_OBJ = 101, HPI_ERROR_INVALID_OBJ = 101,
/** Function does not exist. */ /** Function does not exist. */
HPI_ERROR_INVALID_FUNC = 102, HPI_ERROR_INVALID_FUNC = 102,
/** The specified object (adapter/Stream) does not exist. */ /** The specified object does not exist. */
HPI_ERROR_INVALID_OBJ_INDEX = 103, HPI_ERROR_INVALID_OBJ_INDEX = 103,
/** Trying to access an object that has not been opened yet. */ /** Trying to access an object that has not been opened yet. */
HPI_ERROR_OBJ_NOT_OPEN = 104, HPI_ERROR_OBJ_NOT_OPEN = 104,
...@@ -883,8 +874,8 @@ enum HPI_ERROR_CODES { ...@@ -883,8 +874,8 @@ enum HPI_ERROR_CODES {
HPI_ERROR_OBJ_ALREADY_OPEN = 105, HPI_ERROR_OBJ_ALREADY_OPEN = 105,
/** PCI, ISA resource not valid. */ /** PCI, ISA resource not valid. */
HPI_ERROR_INVALID_RESOURCE = 106, HPI_ERROR_INVALID_RESOURCE = 106,
/** GetInfo call from SubSysFindAdapters failed. */ /* GetInfo call from SubSysFindAdapters failed. */
HPI_ERROR_SUBSYSFINDADAPTERS_GETINFO = 107, /*HPI_ERROR_SUBSYSFINDADAPTERS_GETINFO= 107, */
/** Default response was never updated with actual error code. */ /** Default response was never updated with actual error code. */
HPI_ERROR_INVALID_RESPONSE = 108, HPI_ERROR_INVALID_RESPONSE = 108,
/** wSize field of response was not updated, /** wSize field of response was not updated,
...@@ -892,40 +883,47 @@ enum HPI_ERROR_CODES { ...@@ -892,40 +883,47 @@ enum HPI_ERROR_CODES {
HPI_ERROR_PROCESSING_MESSAGE = 109, HPI_ERROR_PROCESSING_MESSAGE = 109,
/** The network did not respond in a timely manner. */ /** The network did not respond in a timely manner. */
HPI_ERROR_NETWORK_TIMEOUT = 110, HPI_ERROR_NETWORK_TIMEOUT = 110,
/** An HPI handle is invalid (uninitialised?). */ /* An HPI handle is invalid (uninitialised?). */
HPI_ERROR_INVALID_HANDLE = 111, HPI_ERROR_INVALID_HANDLE = 111,
/** A function or attribute has not been implemented yet. */ /** A function or attribute has not been implemented yet. */
HPI_ERROR_UNIMPLEMENTED = 112, HPI_ERROR_UNIMPLEMENTED = 112,
/** There are too many clients attempting to access a network resource. */ /** There are too many clients attempting
to access a network resource. */
HPI_ERROR_NETWORK_TOO_MANY_CLIENTS = 113, HPI_ERROR_NETWORK_TOO_MANY_CLIENTS = 113,
/** Response buffer passed to HPI_Message was smaller than returned response */ /** Response buffer passed to HPI_Message
was smaller than returned response.
wSpecificError field of hpi response contains the required size.
*/
HPI_ERROR_RESPONSE_BUFFER_TOO_SMALL = 114, HPI_ERROR_RESPONSE_BUFFER_TOO_SMALL = 114,
/** The returned response did not match the sent message */ /** The returned response did not match the sent message */
HPI_ERROR_RESPONSE_MISMATCH = 115, HPI_ERROR_RESPONSE_MISMATCH = 115,
/** A control setting that should have been cached was not. */ /** A control setting that should have been cached was not. */
HPI_ERROR_CONTROL_CACHING = 116, HPI_ERROR_CONTROL_CACHING = 116,
/** A message buffer in the path to the adapter was smaller
than the message size.
wSpecificError field of hpi response contains the actual size.
*/
HPI_ERROR_MESSAGE_BUFFER_TOO_SMALL = 117,
/** Too many adapters.*/ /* Too many adapters. */
HPI_ERROR_TOO_MANY_ADAPTERS = 200, /* HPI_ERROR_TOO_MANY_ADAPTERS= 200, */
/** Bad adpater. */ /** Bad adpater. */
HPI_ERROR_BAD_ADAPTER = 201, HPI_ERROR_BAD_ADAPTER = 201,
/** Adapter number out of range or not set properly. */ /** Adapter number out of range or not set properly. */
HPI_ERROR_BAD_ADAPTER_NUMBER = 202, HPI_ERROR_BAD_ADAPTER_NUMBER = 202,
/** 2 adapters with the same adapter number. */ /** 2 adapters with the same adapter number. */
HPI_DUPLICATE_ADAPTER_NUMBER = 203, HPI_DUPLICATE_ADAPTER_NUMBER = 203,
/** DSP code failed to bootload. */ /** DSP code failed to bootload. (unused?) */
HPI_ERROR_DSP_BOOTLOAD = 204, HPI_ERROR_DSP_BOOTLOAD = 204,
/** Adapter failed DSP code self test. */ /** Adapter failed DSP code self test. (unused?) */
HPI_ERROR_DSP_SELFTEST = 205, HPI_ERROR_DSP_SELFTEST = 205,
/** Couldn't find or open the DSP code file. */ /** Couldn't find or open the DSP code file. */
HPI_ERROR_DSP_FILE_NOT_FOUND = 206, HPI_ERROR_DSP_FILE_NOT_FOUND = 206,
/** Internal DSP hardware error. */ /** Internal DSP hardware error. */
HPI_ERROR_DSP_HARDWARE = 207, HPI_ERROR_DSP_HARDWARE = 207,
/** Could not allocate memory in DOS. */
HPI_ERROR_DOS_MEMORY_ALLOC = 208,
/** Could not allocate memory */ /** Could not allocate memory */
HPI_ERROR_MEMORY_ALLOC = 208, HPI_ERROR_MEMORY_ALLOC = 208,
/** Failed to correctly load/config PLD .*/ /** Failed to correctly load/config PLD. (unused?) */
HPI_ERROR_PLD_LOAD = 209, HPI_ERROR_PLD_LOAD = 209,
/** Unexpected end of file, block length too big etc. */ /** Unexpected end of file, block length too big etc. */
HPI_ERROR_DSP_FILE_FORMAT = 210, HPI_ERROR_DSP_FILE_FORMAT = 210,
...@@ -934,8 +932,8 @@ enum HPI_ERROR_CODES { ...@@ -934,8 +932,8 @@ enum HPI_ERROR_CODES {
HPI_ERROR_DSP_FILE_ACCESS_DENIED = 211, HPI_ERROR_DSP_FILE_ACCESS_DENIED = 211,
/** First DSP code section header not found in DSP file. */ /** First DSP code section header not found in DSP file. */
HPI_ERROR_DSP_FILE_NO_HEADER = 212, HPI_ERROR_DSP_FILE_NO_HEADER = 212,
/** File read operation on DSP code file failed. */ /* File read operation on DSP code file failed. */
HPI_ERROR_DSP_FILE_READ_ERROR = 213, /*HPI_ERROR_DSP_FILE_READ_ERROR= 213, */
/** DSP code for adapter family not found. */ /** DSP code for adapter family not found. */
HPI_ERROR_DSP_SECTION_NOT_FOUND = 214, HPI_ERROR_DSP_SECTION_NOT_FOUND = 214,
/** Other OS specific error opening DSP file. */ /** Other OS specific error opening DSP file. */
...@@ -945,8 +943,8 @@ enum HPI_ERROR_CODES { ...@@ -945,8 +943,8 @@ enum HPI_ERROR_CODES {
/** DSP code section header had size == 0. */ /** DSP code section header had size == 0. */
HPI_ERROR_DSP_FILE_NULL_HEADER = 217, HPI_ERROR_DSP_FILE_NULL_HEADER = 217,
/** Base number for flash errors. */ /* Base number for flash errors. */
HPI_ERROR_FLASH = 220, /* HPI_ERROR_FLASH = 220, */
/** Flash has bad checksum */ /** Flash has bad checksum */
HPI_ERROR_BAD_CHECKSUM = 221, HPI_ERROR_BAD_CHECKSUM = 221,
...@@ -960,8 +958,8 @@ enum HPI_ERROR_CODES { ...@@ -960,8 +958,8 @@ enum HPI_ERROR_CODES {
/** Reserved for OEMs. */ /** Reserved for OEMs. */
HPI_ERROR_RESERVED_1 = 290, HPI_ERROR_RESERVED_1 = 290,
/** Stream does not exist. */ /* Stream does not exist. */
HPI_ERROR_INVALID_STREAM = 300, /*HPI_ERROR_INVALID_STREAM= 300, // use HPI_ERROR_INVALID_OBJ_INDEX */
/** Invalid compression format. */ /** Invalid compression format. */
HPI_ERROR_INVALID_FORMAT = 301, HPI_ERROR_INVALID_FORMAT = 301,
/** Invalid format samplerate */ /** Invalid format samplerate */
...@@ -972,21 +970,21 @@ enum HPI_ERROR_CODES { ...@@ -972,21 +970,21 @@ enum HPI_ERROR_CODES {
HPI_ERROR_INVALID_BITRATE = 304, HPI_ERROR_INVALID_BITRATE = 304,
/** Invalid datasize used for stream read/write. */ /** Invalid datasize used for stream read/write. */
HPI_ERROR_INVALID_DATASIZE = 305, HPI_ERROR_INVALID_DATASIZE = 305,
/** Stream buffer is full during stream write. */ /* Stream buffer is full during stream write. */
HPI_ERROR_BUFFER_FULL = 306, /*HPI_ERROR_BUFFER_FULL = 306, // USE HPI_ERROR_INVALID_DATASIZE */
/** Stream buffer is empty during stream read. */ /* Stream buffer is empty during stream read. */
HPI_ERROR_BUFFER_EMPTY = 307, /*HPI_ERROR_BUFFER_EMPTY = 307, // USE HPI_ERROR_INVALID_DATASIZE */
/** Invalid datasize used for stream read/write. */ /** Null data pointer used for stream read/write. */
HPI_ERROR_INVALID_DATA_TRANSFER = 308, HPI_ERROR_INVALID_DATA_POINTER = 308,
/** Packet ordering error for stream read/write. */ /** Packet ordering error for stream read/write. */
HPI_ERROR_INVALID_PACKET_ORDER = 309, HPI_ERROR_INVALID_PACKET_ORDER = 309,
/** Object can't do requested operation in its current /** Object can't do requested operation in its current
state, eg set format, change rec mux state while recording.*/ state, eg set format, change rec mux state while recording.*/
HPI_ERROR_INVALID_OPERATION = 310, HPI_ERROR_INVALID_OPERATION = 310,
/** Where an SRG is shared amongst streams, an incompatible samplerate is one /** Where a SRG is shared amongst streams, an incompatible samplerate
that is different to any currently playing or recording stream. */ is one that is different to any currently active stream. */
HPI_ERROR_INCOMPATIBLE_SAMPLERATE = 311, HPI_ERROR_INCOMPATIBLE_SAMPLERATE = 311,
/** Adapter mode is illegal.*/ /** Adapter mode is illegal.*/
HPI_ERROR_BAD_ADAPTER_MODE = 312, HPI_ERROR_BAD_ADAPTER_MODE = 312,
...@@ -1068,7 +1066,7 @@ enum HPI_ERROR_CODES { ...@@ -1068,7 +1066,7 @@ enum HPI_ERROR_CODES {
/**\}*/ /**\}*/
/* ////////////////////////////////////////////////////////////////////// */ /**************/
/* STRUCTURES */ /* STRUCTURES */
#ifndef DISABLE_PRAGMA_PACK1 #ifndef DISABLE_PRAGMA_PACK1
#pragma pack(push, 1) #pragma pack(push, 1)
...@@ -1116,724 +1114,573 @@ struct hpi_async_event { ...@@ -1116,724 +1114,573 @@ struct hpi_async_event {
/* skip host side function declarations for /* skip host side function declarations for
DSP compile and documentation extraction */ DSP compile and documentation extraction */
struct hpi_hsubsys {
int not_really_used;
};
#ifndef DISABLE_PRAGMA_PACK1 #ifndef DISABLE_PRAGMA_PACK1
#pragma pack(pop) #pragma pack(pop)
#endif #endif
/*////////////////////////////////////////////////////////////////////////// */ /*****************/
/* HPI FUNCTIONS */ /* HPI FUNCTIONS */
/*****************/
/*/////////////////////////// */ /* Stream */
/* DATA and FORMAT and STREAM */
u16 hpi_stream_estimate_buffer_size(struct hpi_format *pF, u16 hpi_stream_estimate_buffer_size(struct hpi_format *pF,
u32 host_polling_rate_in_milli_seconds, u32 *recommended_buffer_size); u32 host_polling_rate_in_milli_seconds, u32 *recommended_buffer_size);
/*/////////// */ /*************/
/* SUB SYSTEM */ /* SubSystem */
struct hpi_hsubsys *hpi_subsys_create(void); /*************/
void hpi_subsys_free(const struct hpi_hsubsys *ph_subsys); u16 hpi_subsys_get_version_ex(u32 *pversion_ex);
u16 hpi_subsys_get_version_ex(const struct hpi_hsubsys *ph_subsys, u16 hpi_subsys_get_num_adapters(int *pn_num_adapters);
u32 *pversion_ex);
u16 hpi_subsys_get_num_adapters(const struct hpi_hsubsys *ph_subsys, u16 hpi_subsys_get_adapter(int iterator, u32 *padapter_index,
int *pn_num_adapters); u16 *pw_adapter_type);
u16 hpi_subsys_get_adapter(const struct hpi_hsubsys *ph_subsys, int iterator, /***********/
u32 *padapter_index, u16 *pw_adapter_type); /* Adapter */
/***********/
/*///////// */ u16 hpi_adapter_open(u16 adapter_index);
/* ADAPTER */
u16 hpi_adapter_open(const struct hpi_hsubsys *ph_subsys, u16 adapter_index); u16 hpi_adapter_close(u16 adapter_index);
u16 hpi_adapter_close(const struct hpi_hsubsys *ph_subsys, u16 adapter_index); u16 hpi_adapter_get_info(u16 adapter_index, u16 *pw_num_outstreams,
u16 *pw_num_instreams, u16 *pw_version, u32 *pserial_number,
u16 *pw_adapter_type);
u16 hpi_adapter_get_info(const struct hpi_hsubsys *ph_subsys, u16 hpi_adapter_get_module_by_index(u16 adapter_index, u16 module_index,
u16 adapter_index, u16 *pw_num_outstreams, u16 *pw_num_instreams, u16 *pw_num_outputs, u16 *pw_num_inputs, u16 *pw_version,
u16 *pw_version, u32 *pserial_number, u16 *pw_adapter_type); u32 *pserial_number, u16 *pw_module_type, u32 *ph_module);
u16 hpi_adapter_get_module_by_index(const struct hpi_hsubsys *ph_subsys, u16 hpi_adapter_set_mode(u16 adapter_index, u32 adapter_mode);
u16 adapter_index, u16 module_index, u16 *pw_num_outputs,
u16 *pw_num_inputs, u16 *pw_version, u32 *pserial_number,
u16 *pw_module_type, u32 *ph_module);
u16 hpi_adapter_set_mode(const struct hpi_hsubsys *ph_subsys, u16 hpi_adapter_set_mode_ex(u16 adapter_index, u32 adapter_mode,
u16 adapter_index, u32 adapter_mode); u16 query_or_set);
u16 hpi_adapter_set_mode_ex(const struct hpi_hsubsys *ph_subsys, u16 hpi_adapter_get_mode(u16 adapter_index, u32 *padapter_mode);
u16 adapter_index, u32 adapter_mode, u16 query_or_set);
u16 hpi_adapter_get_mode(const struct hpi_hsubsys *ph_subsys, u16 hpi_adapter_get_assert2(u16 adapter_index, u16 *p_assert_count,
u16 adapter_index, u32 *padapter_mode); char *psz_assert, u32 *p_param1, u32 *p_param2,
u32 *p_dsp_string_addr, u16 *p_processor_id);
u16 hpi_adapter_get_assert2(const struct hpi_hsubsys *ph_subsys, u16 hpi_adapter_test_assert(u16 adapter_index, u16 assert_id);
u16 adapter_index, u16 *p_assert_count, char *psz_assert,
u32 *p_param1, u32 *p_param2, u32 *p_dsp_string_addr,
u16 *p_processor_id);
u16 hpi_adapter_test_assert(const struct hpi_hsubsys *ph_subsys, u16 hpi_adapter_enable_capability(u16 adapter_index, u16 capability, u32 key);
u16 adapter_index, u16 assert_id);
u16 hpi_adapter_enable_capability(const struct hpi_hsubsys *ph_subsys, u16 hpi_adapter_self_test(u16 adapter_index);
u16 adapter_index, u16 capability, u32 key);
u16 hpi_adapter_self_test(const struct hpi_hsubsys *ph_subsys, u16 hpi_adapter_debug_read(u16 adapter_index, u32 dsp_address, char *p_bytes,
u16 adapter_index); int *count_bytes);
u16 hpi_adapter_debug_read(const struct hpi_hsubsys *ph_subsys, u16 hpi_adapter_set_property(u16 adapter_index, u16 property, u16 paramter1,
u16 adapter_index, u32 dsp_address, char *p_bytes, int *count_bytes); u16 paramter2);
u16 hpi_adapter_set_property(const struct hpi_hsubsys *ph_subsys, u16 hpi_adapter_get_property(u16 adapter_index, u16 property,
u16 adapter_index, u16 property, u16 paramter1, u16 paramter2); u16 *pw_paramter1, u16 *pw_paramter2);
u16 hpi_adapter_get_property(const struct hpi_hsubsys *ph_subsys, u16 hpi_adapter_enumerate_property(u16 adapter_index, u16 index,
u16 adapter_index, u16 property, u16 *pw_paramter1, u16 what_to_enumerate, u16 property_index, u32 *psetting);
u16 *pw_paramter2); /*************/
/* OutStream */
/*************/
u16 hpi_outstream_open(u16 adapter_index, u16 outstream_index,
u32 *ph_outstream);
u16 hpi_adapter_enumerate_property(const struct hpi_hsubsys *ph_subsys, u16 hpi_outstream_close(u32 h_outstream);
u16 adapter_index, u16 index, u16 what_to_enumerate,
u16 property_index, u32 *psetting);
/**************/
/* OUT STREAM */
/**************/
u16 hpi_outstream_open(const struct hpi_hsubsys *ph_subsys, u16 adapter_index,
u16 outstream_index, u32 *ph_outstream);
u16 hpi_outstream_close(const struct hpi_hsubsys *ph_subsys, u32 h_outstream); u16 hpi_outstream_get_info_ex(u32 h_outstream, u16 *pw_state,
u32 *pbuffer_size, u32 *pdata_to_play, u32 *psamples_played,
u32 *pauxiliary_data_to_play);
u16 hpi_outstream_get_info_ex(const struct hpi_hsubsys *ph_subsys, u16 hpi_outstream_write_buf(u32 h_outstream, const u8 *pb_write_buf,
u32 h_outstream, u16 *pw_state, u32 *pbuffer_size, u32 *pdata_to_play, u32 bytes_to_write, const struct hpi_format *p_format);
u32 *psamples_played, u32 *pauxiliary_data_to_play);
u16 hpi_outstream_write_buf(const struct hpi_hsubsys *ph_subsys, u16 hpi_outstream_start(u32 h_outstream);
u32 h_outstream, const u8 *pb_write_buf, u32 bytes_to_write,
const struct hpi_format *p_format);
u16 hpi_outstream_start(const struct hpi_hsubsys *ph_subsys, u32 h_outstream);
u16 hpi_outstream_wait_start(const struct hpi_hsubsys *ph_subsys, u16 hpi_outstream_wait_start(u32 h_outstream);
u32 h_outstream);
u16 hpi_outstream_stop(const struct hpi_hsubsys *ph_subsys, u32 h_outstream); u16 hpi_outstream_stop(u32 h_outstream);
u16 hpi_outstream_sinegen(const struct hpi_hsubsys *ph_subsys, u16 hpi_outstream_sinegen(u32 h_outstream);
u32 h_outstream);
u16 hpi_outstream_reset(const struct hpi_hsubsys *ph_subsys, u32 h_outstream); u16 hpi_outstream_reset(u32 h_outstream);
u16 hpi_outstream_query_format(const struct hpi_hsubsys *ph_subsys, u16 hpi_outstream_query_format(u32 h_outstream, struct hpi_format *p_format);
u32 h_outstream, struct hpi_format *p_format);
u16 hpi_outstream_set_format(const struct hpi_hsubsys *ph_subsys, u16 hpi_outstream_set_format(u32 h_outstream, struct hpi_format *p_format);
u32 h_outstream, struct hpi_format *p_format);
u16 hpi_outstream_set_punch_in_out(const struct hpi_hsubsys *ph_subsys, u16 hpi_outstream_set_punch_in_out(u32 h_outstream, u32 punch_in_sample,
u32 h_outstream, u32 punch_in_sample, u32 punch_out_sample); u32 punch_out_sample);
u16 hpi_outstream_set_velocity(const struct hpi_hsubsys *ph_subsys, u16 hpi_outstream_set_velocity(u32 h_outstream, short velocity);
u32 h_outstream, short velocity);
u16 hpi_outstream_ancillary_reset(const struct hpi_hsubsys *ph_subsys, u16 hpi_outstream_ancillary_reset(u32 h_outstream, u16 mode);
u32 h_outstream, u16 mode);
u16 hpi_outstream_ancillary_get_info(const struct hpi_hsubsys *ph_subsys, u16 hpi_outstream_ancillary_get_info(u32 h_outstream, u32 *pframes_available);
u32 h_outstream, u32 *pframes_available);
u16 hpi_outstream_ancillary_read(const struct hpi_hsubsys *ph_subsys, u16 hpi_outstream_ancillary_read(u32 h_outstream,
u32 h_outstream, struct hpi_anc_frame *p_anc_frame_buffer, struct hpi_anc_frame *p_anc_frame_buffer,
u32 anc_frame_buffer_size_in_bytes, u32 anc_frame_buffer_size_in_bytes,
u32 number_of_ancillary_frames_to_read); u32 number_of_ancillary_frames_to_read);
u16 hpi_outstream_set_time_scale(const struct hpi_hsubsys *ph_subsys, u16 hpi_outstream_set_time_scale(u32 h_outstream, u32 time_scaleX10000);
u32 h_outstream, u32 time_scaleX10000);
u16 hpi_outstream_host_buffer_allocate(const struct hpi_hsubsys *ph_subsys, u16 hpi_outstream_host_buffer_allocate(u32 h_outstream, u32 size_in_bytes);
u32 h_outstream, u32 size_in_bytes);
u16 hpi_outstream_host_buffer_free(const struct hpi_hsubsys *ph_subsys, u16 hpi_outstream_host_buffer_free(u32 h_outstream);
u32 h_outstream);
u16 hpi_outstream_group_add(const struct hpi_hsubsys *ph_subsys, u16 hpi_outstream_group_add(u32 h_outstream, u32 h_stream);
u32 h_outstream, u32 h_stream);
u16 hpi_outstream_group_get_map(const struct hpi_hsubsys *ph_subsys, u16 hpi_outstream_group_get_map(u32 h_outstream, u32 *poutstream_map,
u32 h_outstream, u32 *poutstream_map, u32 *pinstream_map); u32 *pinstream_map);
u16 hpi_outstream_group_reset(const struct hpi_hsubsys *ph_subsys, u16 hpi_outstream_group_reset(u32 h_outstream);
u32 h_outstream);
/*////////// */ /************/
/* IN_STREAM */ /* InStream */
u16 hpi_instream_open(const struct hpi_hsubsys *ph_subsys, u16 adapter_index, /************/
u16 instream_index, u32 *ph_instream); u16 hpi_instream_open(u16 adapter_index, u16 instream_index,
u32 *ph_instream);
u16 hpi_instream_close(const struct hpi_hsubsys *ph_subsys, u32 h_instream); u16 hpi_instream_close(u32 h_instream);
u16 hpi_instream_query_format(const struct hpi_hsubsys *ph_subsys, u16 hpi_instream_query_format(u32 h_instream,
u32 h_instream, const struct hpi_format *p_format); const struct hpi_format *p_format);
u16 hpi_instream_set_format(const struct hpi_hsubsys *ph_subsys, u16 hpi_instream_set_format(u32 h_instream,
u32 h_instream, const struct hpi_format *p_format); const struct hpi_format *p_format);
u16 hpi_instream_read_buf(const struct hpi_hsubsys *ph_subsys, u32 h_instream, u16 hpi_instream_read_buf(u32 h_instream, u8 *pb_read_buf, u32 bytes_to_read);
u8 *pb_read_buf, u32 bytes_to_read);
u16 hpi_instream_start(const struct hpi_hsubsys *ph_subsys, u32 h_instream); u16 hpi_instream_start(u32 h_instream);
u16 hpi_instream_wait_start(const struct hpi_hsubsys *ph_subsys, u16 hpi_instream_wait_start(u32 h_instream);
u32 h_instream);
u16 hpi_instream_stop(const struct hpi_hsubsys *ph_subsys, u32 h_instream); u16 hpi_instream_stop(u32 h_instream);
u16 hpi_instream_reset(const struct hpi_hsubsys *ph_subsys, u32 h_instream); u16 hpi_instream_reset(u32 h_instream);
u16 hpi_instream_get_info_ex(const struct hpi_hsubsys *ph_subsys, u16 hpi_instream_get_info_ex(u32 h_instream, u16 *pw_state, u32 *pbuffer_size,
u32 h_instream, u16 *pw_state, u32 *pbuffer_size, u32 *pdata_recorded, u32 *pdata_recorded, u32 *psamples_recorded,
u32 *psamples_recorded, u32 *pauxiliary_data_recorded); u32 *pauxiliary_data_recorded);
u16 hpi_instream_ancillary_reset(const struct hpi_hsubsys *ph_subsys, u16 hpi_instream_ancillary_reset(u32 h_instream, u16 bytes_per_frame,
u32 h_instream, u16 bytes_per_frame, u16 mode, u16 alignment, u16 mode, u16 alignment, u16 idle_bit);
u16 idle_bit);
u16 hpi_instream_ancillary_get_info(const struct hpi_hsubsys *ph_subsys, u16 hpi_instream_ancillary_get_info(u32 h_instream, u32 *pframe_space);
u32 h_instream, u32 *pframe_space);
u16 hpi_instream_ancillary_write(const struct hpi_hsubsys *ph_subsys, u16 hpi_instream_ancillary_write(u32 h_instream,
u32 h_instream, const struct hpi_anc_frame *p_anc_frame_buffer, const struct hpi_anc_frame *p_anc_frame_buffer,
u32 anc_frame_buffer_size_in_bytes, u32 anc_frame_buffer_size_in_bytes,
u32 number_of_ancillary_frames_to_write); u32 number_of_ancillary_frames_to_write);
u16 hpi_instream_host_buffer_allocate(const struct hpi_hsubsys *ph_subsys, u16 hpi_instream_host_buffer_allocate(u32 h_instream, u32 size_in_bytes);
u32 h_instream, u32 size_in_bytes);
u16 hpi_instream_host_buffer_free(const struct hpi_hsubsys *ph_subsys, u16 hpi_instream_host_buffer_free(u32 h_instream);
u32 h_instream);
u16 hpi_instream_group_add(const struct hpi_hsubsys *ph_subsys, u16 hpi_instream_group_add(u32 h_instream, u32 h_stream);
u32 h_instream, u32 h_stream);
u16 hpi_instream_group_get_map(const struct hpi_hsubsys *ph_subsys, u16 hpi_instream_group_get_map(u32 h_instream, u32 *poutstream_map,
u32 h_instream, u32 *poutstream_map, u32 *pinstream_map); u32 *pinstream_map);
u16 hpi_instream_group_reset(const struct hpi_hsubsys *ph_subsys, u16 hpi_instream_group_reset(u32 h_instream);
u32 h_instream);
/*********/ /*********/
/* MIXER */ /* Mixer */
/*********/ /*********/
u16 hpi_mixer_open(const struct hpi_hsubsys *ph_subsys, u16 adapter_index, u16 hpi_mixer_open(u16 adapter_index, u32 *ph_mixer);
u32 *ph_mixer);
u16 hpi_mixer_close(u32 h_mixer);
u16 hpi_mixer_close(const struct hpi_hsubsys *ph_subsys, u32 h_mixer);
u16 hpi_mixer_get_control(u32 h_mixer, u16 src_node_type,
u16 hpi_mixer_get_control(const struct hpi_hsubsys *ph_subsys, u32 h_mixer, u16 src_node_type_index, u16 dst_node_type, u16 dst_node_type_index,
u16 src_node_type, u16 src_node_type_index, u16 dst_node_type, u16 control_type, u32 *ph_control);
u16 dst_node_type_index, u16 control_type, u32 *ph_control);
u16 hpi_mixer_get_control_by_index(u32 h_mixer, u16 control_index,
u16 hpi_mixer_get_control_by_index(const struct hpi_hsubsys *ph_subsys, u16 *pw_src_node_type, u16 *pw_src_node_index, u16 *pw_dst_node_type,
u32 h_mixer, u16 control_index, u16 *pw_src_node_type, u16 *pw_dst_node_index, u16 *pw_control_type, u32 *ph_control);
u16 *pw_src_node_index, u16 *pw_dst_node_type, u16 *pw_dst_node_index,
u16 *pw_control_type, u32 *ph_control); u16 hpi_mixer_store(u32 h_mixer, enum HPI_MIXER_STORE_COMMAND command,
u16 index);
u16 hpi_mixer_store(const struct hpi_hsubsys *ph_subsys, u32 h_mixer, /************/
enum HPI_MIXER_STORE_COMMAND command, u16 index); /* Controls */
/*************************/ /************/
/* mixer CONTROLS */ /******************/
/*************************/ /* Volume control */
/*************************/ /******************/
/* volume control */ u16 hpi_volume_set_gain(u32 h_control, short an_gain0_01dB[HPI_MAX_CHANNELS]
/*************************/
u16 hpi_volume_set_gain(const struct hpi_hsubsys *ph_subsys, u32 h_control,
short an_gain0_01dB[HPI_MAX_CHANNELS]
); );
u16 hpi_volume_get_gain(const struct hpi_hsubsys *ph_subsys, u32 h_control, u16 hpi_volume_get_gain(u32 h_control,
short an_gain0_01dB_out[HPI_MAX_CHANNELS] short an_gain0_01dB_out[HPI_MAX_CHANNELS]
); );
#define hpi_volume_get_range hpi_volume_query_range #define hpi_volume_get_range hpi_volume_query_range
u16 hpi_volume_query_range(const struct hpi_hsubsys *ph_subsys, u32 h_control, u16 hpi_volume_query_range(u32 h_control, short *min_gain_01dB,
short *min_gain_01dB, short *max_gain_01dB, short *step_gain_01dB); short *max_gain_01dB, short *step_gain_01dB);
u16 hpi_volume_query_channels(const struct hpi_hsubsys *ph_subsys, u16 hpi_volume_query_channels(const u32 h_volume, u32 *p_channels);
const u32 h_volume, u32 *p_channels);
u16 hpi_volume_auto_fade(const struct hpi_hsubsys *ph_subsys, u32 h_control, u16 hpi_volume_auto_fade(u32 h_control,
short an_stop_gain0_01dB[HPI_MAX_CHANNELS], u32 duration_ms); short an_stop_gain0_01dB[HPI_MAX_CHANNELS], u32 duration_ms);
u16 hpi_volume_auto_fade_profile(const struct hpi_hsubsys *ph_subsys, u16 hpi_volume_auto_fade_profile(u32 h_control,
u32 h_control, short an_stop_gain0_01dB[HPI_MAX_CHANNELS], short an_stop_gain0_01dB[HPI_MAX_CHANNELS], u32 duration_ms,
u32 duration_ms, u16 profile); u16 profile);
/*************************/ /*****************/
/* level control */ /* Level control */
/*************************/ /*****************/
u16 hpi_level_query_range(const struct hpi_hsubsys *ph_subsys, u32 h_control, u16 hpi_level_query_range(u32 h_control, short *min_gain_01dB,
short *min_gain_01dB, short *max_gain_01dB, short *step_gain_01dB); short *max_gain_01dB, short *step_gain_01dB);
u16 hpi_level_set_gain(const struct hpi_hsubsys *ph_subsys, u32 h_control, u16 hpi_level_set_gain(u32 h_control, short an_gain0_01dB[HPI_MAX_CHANNELS]
short an_gain0_01dB[HPI_MAX_CHANNELS]
); );
u16 hpi_level_get_gain(const struct hpi_hsubsys *ph_subsys, u32 h_control, u16 hpi_level_get_gain(u32 h_control,
short an_gain0_01dB_out[HPI_MAX_CHANNELS] short an_gain0_01dB_out[HPI_MAX_CHANNELS]
); );
/*************************/ /*****************/
/* meter control */ /* Meter control */
/*************************/ /*****************/
u16 hpi_meter_query_channels(const struct hpi_hsubsys *ph_subsys, u16 hpi_meter_query_channels(const u32 h_meter, u32 *p_channels);
const u32 h_meter, u32 *p_channels);
u16 hpi_meter_get_peak(const struct hpi_hsubsys *ph_subsys, u32 h_control, u16 hpi_meter_get_peak(u32 h_control,
short an_peak0_01dB_out[HPI_MAX_CHANNELS] short an_peak0_01dB_out[HPI_MAX_CHANNELS]
); );
u16 hpi_meter_get_rms(const struct hpi_hsubsys *ph_subsys, u32 h_control, u16 hpi_meter_get_rms(u32 h_control, short an_peak0_01dB_out[HPI_MAX_CHANNELS]
short an_peak0_01dB_out[HPI_MAX_CHANNELS]
); );
u16 hpi_meter_set_peak_ballistics(const struct hpi_hsubsys *ph_subsys, u16 hpi_meter_set_peak_ballistics(u32 h_control, u16 attack, u16 decay);
u32 h_control, u16 attack, u16 decay);
u16 hpi_meter_set_rms_ballistics(const struct hpi_hsubsys *ph_subsys, u16 hpi_meter_set_rms_ballistics(u32 h_control, u16 attack, u16 decay);
u32 h_control, u16 attack, u16 decay);
u16 hpi_meter_get_peak_ballistics(const struct hpi_hsubsys *ph_subsys, u16 hpi_meter_get_peak_ballistics(u32 h_control, u16 *attack, u16 *decay);
u32 h_control, u16 *attack, u16 *decay);
u16 hpi_meter_get_rms_ballistics(const struct hpi_hsubsys *ph_subsys, u16 hpi_meter_get_rms_ballistics(u32 h_control, u16 *attack, u16 *decay);
u32 h_control, u16 *attack, u16 *decay);
/*************************/ /************************/
/* channel mode control */ /* ChannelMode control */
/*************************/ /************************/
u16 hpi_channel_mode_query_mode(const struct hpi_hsubsys *ph_subsys, u16 hpi_channel_mode_query_mode(const u32 h_mode, const u32 index,
const u32 h_mode, const u32 index, u16 *pw_mode); u16 *pw_mode);
u16 hpi_channel_mode_set(const struct hpi_hsubsys *ph_subsys, u32 h_control, u16 hpi_channel_mode_set(u32 h_control, u16 mode);
u16 mode);
u16 hpi_channel_mode_get(const struct hpi_hsubsys *ph_subsys, u32 h_control, u16 hpi_channel_mode_get(u32 h_control, u16 *mode);
u16 *mode);
/*************************/ /*****************/
/* Tuner control */ /* Tuner control */
/*************************/ /*****************/
u16 hpi_tuner_query_band(const struct hpi_hsubsys *ph_subsys, u16 hpi_tuner_query_band(const u32 h_tuner, const u32 index, u16 *pw_band);
const u32 h_tuner, const u32 index, u16 *pw_band);
u16 hpi_tuner_set_band(const struct hpi_hsubsys *ph_subsys, u32 h_control, u16 hpi_tuner_set_band(u32 h_control, u16 band);
u16 band);
u16 hpi_tuner_get_band(const struct hpi_hsubsys *ph_subsys, u32 h_control, u16 hpi_tuner_get_band(u32 h_control, u16 *pw_band);
u16 *pw_band);
u16 hpi_tuner_query_frequency(const struct hpi_hsubsys *ph_subsys, u16 hpi_tuner_query_frequency(const u32 h_tuner, const u32 index,
const u32 h_tuner, const u32 index, const u16 band, u32 *pfreq); const u16 band, u32 *pfreq);
u16 hpi_tuner_set_frequency(const struct hpi_hsubsys *ph_subsys, u16 hpi_tuner_set_frequency(u32 h_control, u32 freq_ink_hz);
u32 h_control, u32 freq_ink_hz);
u16 hpi_tuner_get_frequency(const struct hpi_hsubsys *ph_subsys, u16 hpi_tuner_get_frequency(u32 h_control, u32 *pw_freq_ink_hz);
u32 h_control, u32 *pw_freq_ink_hz);
u16 hpi_tuner_getRF_level(const struct hpi_hsubsys *ph_subsys, u32 h_control, u16 hpi_tuner_get_rf_level(u32 h_control, short *pw_level);
short *pw_level);
u16 hpi_tuner_get_rawRF_level(const struct hpi_hsubsys *ph_subsys, u16 hpi_tuner_get_raw_rf_level(u32 h_control, short *pw_level);
u32 h_control, short *pw_level);
u16 hpi_tuner_query_gain(const struct hpi_hsubsys *ph_subsys, u16 hpi_tuner_query_gain(const u32 h_tuner, const u32 index, u16 *pw_gain);
const u32 h_tuner, const u32 index, u16 *pw_gain);
u16 hpi_tuner_set_gain(const struct hpi_hsubsys *ph_subsys, u32 h_control, u16 hpi_tuner_set_gain(u32 h_control, short gain);
short gain);
u16 hpi_tuner_get_gain(const struct hpi_hsubsys *ph_subsys, u32 h_control, u16 hpi_tuner_get_gain(u32 h_control, short *pn_gain);
short *pn_gain);
u16 hpi_tuner_get_status(const struct hpi_hsubsys *ph_subsys, u32 h_control, u16 hpi_tuner_get_status(u32 h_control, u16 *pw_status_mask, u16 *pw_status);
u16 *pw_status_mask, u16 *pw_status);
u16 hpi_tuner_set_mode(const struct hpi_hsubsys *ph_subsys, u32 h_control, u16 hpi_tuner_set_mode(u32 h_control, u32 mode, u32 value);
u32 mode, u32 value);
u16 hpi_tuner_get_mode(const struct hpi_hsubsys *ph_subsys, u32 h_control, u16 hpi_tuner_get_mode(u32 h_control, u32 mode, u32 *pn_value);
u32 mode, u32 *pn_value);
u16 hpi_tuner_getRDS(const struct hpi_hsubsys *ph_subsys, u32 h_control, u16 hpi_tuner_get_rds(u32 h_control, char *p_rds_data);
char *p_rds_data);
u16 hpi_tuner_query_deemphasis(const struct hpi_hsubsys *ph_subsys, u16 hpi_tuner_query_deemphasis(const u32 h_tuner, const u32 index,
const u32 h_tuner, const u32 index, const u16 band, u32 *pdeemphasis); const u16 band, u32 *pdeemphasis);
u16 hpi_tuner_set_deemphasis(const struct hpi_hsubsys *ph_subsys, u16 hpi_tuner_set_deemphasis(u32 h_control, u32 deemphasis);
u32 h_control, u32 deemphasis); u16 hpi_tuner_get_deemphasis(u32 h_control, u32 *pdeemphasis);
u16 hpi_tuner_get_deemphasis(const struct hpi_hsubsys *ph_subsys,
u32 h_control, u32 *pdeemphasis);
u16 hpi_tuner_query_program(const struct hpi_hsubsys *ph_subsys, u16 hpi_tuner_query_program(const u32 h_tuner, u32 *pbitmap_program);
const u32 h_tuner, u32 *pbitmap_program);
u16 hpi_tuner_set_program(const struct hpi_hsubsys *ph_subsys, u32 h_control, u16 hpi_tuner_set_program(u32 h_control, u32 program);
u32 program);
u16 hpi_tuner_get_program(const struct hpi_hsubsys *ph_subsys, u32 h_control, u16 hpi_tuner_get_program(u32 h_control, u32 *pprogram);
u32 *pprogram);
u16 hpi_tuner_get_hd_radio_dsp_version(const struct hpi_hsubsys *ph_subsys, u16 hpi_tuner_get_hd_radio_dsp_version(u32 h_control, char *psz_dsp_version,
u32 h_control, char *psz_dsp_version, const u32 string_size); const u32 string_size);
u16 hpi_tuner_get_hd_radio_sdk_version(const struct hpi_hsubsys *ph_subsys, u16 hpi_tuner_get_hd_radio_sdk_version(u32 h_control, char *psz_sdk_version,
u32 h_control, char *psz_sdk_version, const u32 string_size); const u32 string_size);
u16 hpi_tuner_get_hd_radio_signal_quality(const struct hpi_hsubsys *ph_subsys, u16 hpi_tuner_get_hd_radio_signal_quality(u32 h_control, u32 *pquality);
u32 h_control, u32 *pquality);
u16 hpi_tuner_get_hd_radio_signal_blend(const struct hpi_hsubsys *ph_subsys, u16 hpi_tuner_get_hd_radio_signal_blend(u32 h_control, u32 *pblend);
u32 h_control, u32 *pblend);
u16 hpi_tuner_set_hd_radio_signal_blend(const struct hpi_hsubsys *ph_subsys, u16 hpi_tuner_set_hd_radio_signal_blend(u32 h_control, const u32 blend);
u32 h_control, const u32 blend);
/****************************/ /***************/
/* PADs control */ /* PAD control */
/****************************/ /***************/
u16 HPI_PAD__get_channel_name(const struct hpi_hsubsys *ph_subsys, u16 hpi_pad_get_channel_name(u32 h_control, char *psz_string,
u32 h_control, char *psz_string, const u32 string_length); const u32 string_length);
u16 HPI_PAD__get_artist(const struct hpi_hsubsys *ph_subsys, u32 h_control, u16 hpi_pad_get_artist(u32 h_control, char *psz_string,
char *psz_string, const u32 string_length); const u32 string_length);
u16 HPI_PAD__get_title(const struct hpi_hsubsys *ph_subsys, u32 h_control, u16 hpi_pad_get_title(u32 h_control, char *psz_string,
char *psz_string, const u32 string_length); const u32 string_length);
u16 HPI_PAD__get_comment(const struct hpi_hsubsys *ph_subsys, u32 h_control, u16 hpi_pad_get_comment(u32 h_control, char *psz_string,
char *psz_string, const u32 string_length); const u32 string_length);
u16 HPI_PAD__get_program_type(const struct hpi_hsubsys *ph_subsys, u16 hpi_pad_get_program_type(u32 h_control, u32 *ppTY);
u32 h_control, u32 *ppTY);
u16 HPI_PAD__get_rdsPI(const struct hpi_hsubsys *ph_subsys, u32 h_control, u16 hpi_pad_get_rdsPI(u32 h_control, u32 *ppI);
u32 *ppI);
u16 HPI_PAD__get_program_type_string(const struct hpi_hsubsys *ph_subsys, u16 hpi_pad_get_program_type_string(u32 h_control, const u32 data_type,
u32 h_control, const u32 data_type, const u32 pTY, char *psz_string, const u32 pTY, char *psz_string, const u32 string_length);
const u32 string_length);
/****************************/ /****************************/
/* AES/EBU Receiver control */ /* AES/EBU Receiver control */
/****************************/ /****************************/
u16 HPI_AESEBU__receiver_query_format(const struct hpi_hsubsys *ph_subsys, u16 hpi_aesebu_receiver_query_format(const u32 h_aes_rx, const u32 index,
const u32 h_aes_rx, const u32 index, u16 *pw_format); u16 *pw_format);
u16 HPI_AESEBU__receiver_set_format(const struct hpi_hsubsys *ph_subsys, u16 hpi_aesebu_receiver_set_format(u32 h_control, u16 source);
u32 h_control, u16 source);
u16 HPI_AESEBU__receiver_get_format(const struct hpi_hsubsys *ph_subsys, u16 hpi_aesebu_receiver_get_format(u32 h_control, u16 *pw_source);
u32 h_control, u16 *pw_source);
u16 HPI_AESEBU__receiver_get_sample_rate(const struct hpi_hsubsys *ph_subsys, u16 hpi_aesebu_receiver_get_sample_rate(u32 h_control, u32 *psample_rate);
u32 h_control, u32 *psample_rate);
u16 HPI_AESEBU__receiver_get_user_data(const struct hpi_hsubsys *ph_subsys, u16 hpi_aesebu_receiver_get_user_data(u32 h_control, u16 index, u16 *pw_data);
u32 h_control, u16 index, u16 *pw_data);
u16 HPI_AESEBU__receiver_get_channel_status(const struct hpi_hsubsys u16 hpi_aesebu_receiver_get_channel_status(u32 h_control, u16 index,
*ph_subsys, u32 h_control, u16 index, u16 *pw_data); u16 *pw_data);
u16 HPI_AESEBU__receiver_get_error_status(const struct hpi_hsubsys *ph_subsys, u16 hpi_aesebu_receiver_get_error_status(u32 h_control, u16 *pw_error_data);
u32 h_control, u16 *pw_error_data);
/*******************************/ /*******************************/
/* AES/EBU Transmitter control */ /* AES/EBU Transmitter control */
/*******************************/ /*******************************/
u16 HPI_AESEBU__transmitter_set_sample_rate(const struct hpi_hsubsys u16 hpi_aesebu_transmitter_set_sample_rate(u32 h_control, u32 sample_rate);
*ph_subsys, u32 h_control, u32 sample_rate);
u16 HPI_AESEBU__transmitter_set_user_data(const struct hpi_hsubsys *ph_subsys, u16 hpi_aesebu_transmitter_set_user_data(u32 h_control, u16 index, u16 data);
u32 h_control, u16 index, u16 data);
u16 HPI_AESEBU__transmitter_set_channel_status(const struct hpi_hsubsys u16 hpi_aesebu_transmitter_set_channel_status(u32 h_control, u16 index,
*ph_subsys, u32 h_control, u16 index, u16 data); u16 data);
u16 HPI_AESEBU__transmitter_get_channel_status(const struct hpi_hsubsys u16 hpi_aesebu_transmitter_get_channel_status(u32 h_control, u16 index,
*ph_subsys, u32 h_control, u16 index, u16 *pw_data); u16 *pw_data);
u16 HPI_AESEBU__transmitter_query_format(const struct hpi_hsubsys *ph_subsys, u16 hpi_aesebu_transmitter_query_format(const u32 h_aes_tx, const u32 index,
const u32 h_aes_tx, const u32 index, u16 *pw_format); u16 *pw_format);
u16 HPI_AESEBU__transmitter_set_format(const struct hpi_hsubsys *ph_subsys, u16 hpi_aesebu_transmitter_set_format(u32 h_control, u16 output_format);
u32 h_control, u16 output_format);
u16 HPI_AESEBU__transmitter_get_format(const struct hpi_hsubsys *ph_subsys, u16 hpi_aesebu_transmitter_get_format(u32 h_control, u16 *pw_output_format);
u32 h_control, u16 *pw_output_format);
/***********************/ /***********************/
/* multiplexer control */ /* Multiplexer control */
/***********************/ /***********************/
u16 hpi_multiplexer_set_source(const struct hpi_hsubsys *ph_subsys, u16 hpi_multiplexer_set_source(u32 h_control, u16 source_node_type,
u32 h_control, u16 source_node_type, u16 source_node_index); u16 source_node_index);
u16 hpi_multiplexer_get_source(const struct hpi_hsubsys *ph_subsys, u16 hpi_multiplexer_get_source(u32 h_control, u16 *source_node_type,
u32 h_control, u16 *source_node_type, u16 *source_node_index);
u16 hpi_multiplexer_query_source(const struct hpi_hsubsys *ph_subsys,
u32 h_control, u16 index, u16 *source_node_type,
u16 *source_node_index); u16 *source_node_index);
u16 hpi_multiplexer_query_source(u32 h_control, u16 index,
u16 *source_node_type, u16 *source_node_index);
/***************/ /***************/
/* VOX control */ /* Vox control */
/***************/ /***************/
u16 hpi_vox_set_threshold(const struct hpi_hsubsys *ph_subsys, u32 h_control, u16 hpi_vox_set_threshold(u32 h_control, short an_gain0_01dB);
short an_gain0_01dB);
u16 hpi_vox_get_threshold(const struct hpi_hsubsys *ph_subsys, u32 h_control, u16 hpi_vox_get_threshold(u32 h_control, short *an_gain0_01dB);
short *an_gain0_01dB);
/*********************/ /*********************/
/* Bitstream control */ /* Bitstream control */
/*********************/ /*********************/
u16 hpi_bitstream_set_clock_edge(const struct hpi_hsubsys *ph_subsys, u16 hpi_bitstream_set_clock_edge(u32 h_control, u16 edge_type);
u32 h_control, u16 edge_type);
u16 hpi_bitstream_set_data_polarity(const struct hpi_hsubsys *ph_subsys, u16 hpi_bitstream_set_data_polarity(u32 h_control, u16 polarity);
u32 h_control, u16 polarity);
u16 hpi_bitstream_get_activity(const struct hpi_hsubsys *ph_subsys, u16 hpi_bitstream_get_activity(u32 h_control, u16 *pw_clk_activity,
u32 h_control, u16 *pw_clk_activity, u16 *pw_data_activity); u16 *pw_data_activity);
/***********************/ /***********************/
/* SampleClock control */ /* SampleClock control */
/***********************/ /***********************/
u16 hpi_sample_clock_query_source(const struct hpi_hsubsys *ph_subsys, u16 hpi_sample_clock_query_source(const u32 h_clock, const u32 index,
const u32 h_clock, const u32 index, u16 *pw_source); u16 *pw_source);
u16 hpi_sample_clock_set_source(const struct hpi_hsubsys *ph_subsys, u16 hpi_sample_clock_set_source(u32 h_control, u16 source);
u32 h_control, u16 source);
u16 hpi_sample_clock_get_source(const struct hpi_hsubsys *ph_subsys, u16 hpi_sample_clock_get_source(u32 h_control, u16 *pw_source);
u32 h_control, u16 *pw_source);
u16 hpi_sample_clock_query_source_index(const struct hpi_hsubsys *ph_subsys, u16 hpi_sample_clock_query_source_index(const u32 h_clock, const u32 index,
const u32 h_clock, const u32 index, const u32 source, const u32 source, u16 *pw_source_index);
u16 *pw_source_index);
u16 hpi_sample_clock_set_source_index(const struct hpi_hsubsys *ph_subsys, u16 hpi_sample_clock_set_source_index(u32 h_control, u16 source_index);
u32 h_control, u16 source_index);
u16 hpi_sample_clock_get_source_index(const struct hpi_hsubsys *ph_subsys, u16 hpi_sample_clock_get_source_index(u32 h_control, u16 *pw_source_index);
u32 h_control, u16 *pw_source_index);
u16 hpi_sample_clock_get_sample_rate(const struct hpi_hsubsys *ph_subsys, u16 hpi_sample_clock_get_sample_rate(u32 h_control, u32 *psample_rate);
u32 h_control, u32 *psample_rate);
u16 hpi_sample_clock_query_local_rate(const struct hpi_hsubsys *ph_subsys, u16 hpi_sample_clock_query_local_rate(const u32 h_clock, const u32 index,
const u32 h_clock, const u32 index, u32 *psource); u32 *psource);
u16 hpi_sample_clock_set_local_rate(const struct hpi_hsubsys *ph_subsys, u16 hpi_sample_clock_set_local_rate(u32 h_control, u32 sample_rate);
u32 h_control, u32 sample_rate);
u16 hpi_sample_clock_get_local_rate(const struct hpi_hsubsys *ph_subsys, u16 hpi_sample_clock_get_local_rate(u32 h_control, u32 *psample_rate);
u32 h_control, u32 *psample_rate);
u16 hpi_sample_clock_set_auto(const struct hpi_hsubsys *ph_subsys, u16 hpi_sample_clock_set_auto(u32 h_control, u32 enable);
u32 h_control, u32 enable);
u16 hpi_sample_clock_get_auto(const struct hpi_hsubsys *ph_subsys, u16 hpi_sample_clock_get_auto(u32 h_control, u32 *penable);
u32 h_control, u32 *penable);
u16 hpi_sample_clock_set_local_rate_lock(const struct hpi_hsubsys *ph_subsys, u16 hpi_sample_clock_set_local_rate_lock(u32 h_control, u32 lock);
u32 h_control, u32 lock);
u16 hpi_sample_clock_get_local_rate_lock(const struct hpi_hsubsys *ph_subsys, u16 hpi_sample_clock_get_local_rate_lock(u32 h_control, u32 *plock);
u32 h_control, u32 *plock);
/***********************/ /***********************/
/* Microphone control */ /* Microphone control */
/***********************/ /***********************/
u16 hpi_microphone_set_phantom_power(const struct hpi_hsubsys *ph_subsys, u16 hpi_microphone_set_phantom_power(u32 h_control, u16 on_off);
u32 h_control, u16 on_off);
u16 hpi_microphone_get_phantom_power(const struct hpi_hsubsys *ph_subsys, u16 hpi_microphone_get_phantom_power(u32 h_control, u16 *pw_on_off);
u32 h_control, u16 *pw_on_off);
/******************************* /********************************/
Parametric Equalizer control /* Parametric Equalizer control */
*******************************/ /********************************/
u16 hpi_parametricEQ__get_info(const struct hpi_hsubsys *ph_subsys, u16 hpi_parametric_eq_get_info(u32 h_control, u16 *pw_number_of_bands,
u32 h_control, u16 *pw_number_of_bands, u16 *pw_enabled); u16 *pw_enabled);
u16 hpi_parametricEQ__set_state(const struct hpi_hsubsys *ph_subsys, u16 hpi_parametric_eq_set_state(u32 h_control, u16 on_off);
u32 h_control, u16 on_off);
u16 hpi_parametricEQ__set_band(const struct hpi_hsubsys *ph_subsys, u16 hpi_parametric_eq_set_band(u32 h_control, u16 index, u16 type,
u32 h_control, u16 index, u16 type, u32 frequency_hz, short q100, u32 frequency_hz, short q100, short gain0_01dB);
short gain0_01dB);
u16 hpi_parametricEQ__get_band(const struct hpi_hsubsys *ph_subsys, u16 hpi_parametric_eq_get_band(u32 h_control, u16 index, u16 *pn_type,
u32 h_control, u16 index, u16 *pn_type, u32 *pfrequency_hz, u32 *pfrequency_hz, short *pnQ100, short *pn_gain0_01dB);
short *pnQ100, short *pn_gain0_01dB);
u16 hpi_parametricEQ__get_coeffs(const struct hpi_hsubsys *ph_subsys, u16 hpi_parametric_eq_get_coeffs(u32 h_control, u16 index, short coeffs[5]
u32 h_control, u16 index, short coeffs[5]
); );
/******************************* /*******************************/
Compressor Expander control /* Compressor Expander control */
*******************************/ /*******************************/
u16 hpi_compander_set_enable(const struct hpi_hsubsys *ph_subsys, u16 hpi_compander_set_enable(u32 h_control, u32 on);
u32 h_control, u32 on);
u16 hpi_compander_get_enable(const struct hpi_hsubsys *ph_subsys, u16 hpi_compander_get_enable(u32 h_control, u32 *pon);
u32 h_control, u32 *pon);
u16 hpi_compander_set_makeup_gain(const struct hpi_hsubsys *ph_subsys, u16 hpi_compander_set_makeup_gain(u32 h_control, short makeup_gain0_01dB);
u32 h_control, short makeup_gain0_01dB);
u16 hpi_compander_get_makeup_gain(const struct hpi_hsubsys *ph_subsys, u16 hpi_compander_get_makeup_gain(u32 h_control, short *pn_makeup_gain0_01dB);
u32 h_control, short *pn_makeup_gain0_01dB);
u16 hpi_compander_set_attack_time_constant(const struct hpi_hsubsys u16 hpi_compander_set_attack_time_constant(u32 h_control, u32 index,
*ph_subsys, u32 h_control, u32 index, u32 attack); u32 attack);
u16 hpi_compander_get_attack_time_constant(const struct hpi_hsubsys u16 hpi_compander_get_attack_time_constant(u32 h_control, u32 index,
*ph_subsys, u32 h_control, u32 index, u32 *pw_attack); u32 *pw_attack);
u16 hpi_compander_set_decay_time_constant(const struct hpi_hsubsys *ph_subsys, u16 hpi_compander_set_decay_time_constant(u32 h_control, u32 index,
u32 h_control, u32 index, u32 decay); u32 decay);
u16 hpi_compander_get_decay_time_constant(const struct hpi_hsubsys *ph_subsys, u16 hpi_compander_get_decay_time_constant(u32 h_control, u32 index,
u32 h_control, u32 index, u32 *pw_decay); u32 *pw_decay);
u16 hpi_compander_set_threshold(const struct hpi_hsubsys *ph_subsys, u16 hpi_compander_set_threshold(u32 h_control, u32 index,
u32 h_control, u32 index, short threshold0_01dB); short threshold0_01dB);
u16 hpi_compander_get_threshold(const struct hpi_hsubsys *ph_subsys, u16 hpi_compander_get_threshold(u32 h_control, u32 index,
u32 h_control, u32 index, short *pn_threshold0_01dB); short *pn_threshold0_01dB);
u16 hpi_compander_set_ratio(const struct hpi_hsubsys *ph_subsys, u16 hpi_compander_set_ratio(u32 h_control, u32 index, u32 ratio100);
u32 h_control, u32 index, u32 ratio100);
u16 hpi_compander_get_ratio(const struct hpi_hsubsys *ph_subsys, u16 hpi_compander_get_ratio(u32 h_control, u32 index, u32 *pw_ratio100);
u32 h_control, u32 index, u32 *pw_ratio100);
/******************************* /********************/
Cobranet HMI control /* Cobranet control */
*******************************/ /********************/
u16 hpi_cobranet_hmi_write(const struct hpi_hsubsys *ph_subsys, u32 h_control, u16 hpi_cobranet_hmi_write(u32 h_control, u32 hmi_address, u32 byte_count,
u32 hmi_address, u32 byte_count, u8 *pb_data); u8 *pb_data);
u16 hpi_cobranet_hmi_read(const struct hpi_hsubsys *ph_subsys, u32 h_control, u16 hpi_cobranet_hmi_read(u32 h_control, u32 hmi_address, u32 max_byte_count,
u32 hmi_address, u32 max_byte_count, u32 *pbyte_count, u8 *pb_data); u32 *pbyte_count, u8 *pb_data);
u16 hpi_cobranet_hmi_get_status(const struct hpi_hsubsys *ph_subsys, u16 hpi_cobranet_hmi_get_status(u32 h_control, u32 *pstatus,
u32 h_control, u32 *pstatus, u32 *preadable_size, u32 *preadable_size, u32 *pwriteable_size);
u32 *pwriteable_size);
/*Read the current IP address u16 hpi_cobranet_get_ip_address(u32 h_control, u32 *pdw_ip_address);
*/
u16 hpi_cobranet_getI_paddress(const struct hpi_hsubsys *ph_subsys,
u32 h_control, u32 *pi_paddress);
/* Write the current IP address u16 hpi_cobranet_set_ip_address(u32 h_control, u32 dw_ip_address);
*/
u16 hpi_cobranet_setI_paddress(const struct hpi_hsubsys *ph_subsys,
u32 h_control, u32 i_paddress);
/* Read the static IP address u16 hpi_cobranet_get_static_ip_address(u32 h_control, u32 *pdw_ip_address);
*/
u16 hpi_cobranet_get_staticI_paddress(const struct hpi_hsubsys *ph_subsys,
u32 h_control, u32 *pi_paddress);
/* Write the static IP address u16 hpi_cobranet_set_static_ip_address(u32 h_control, u32 dw_ip_address);
*/
u16 hpi_cobranet_set_staticI_paddress(const struct hpi_hsubsys *ph_subsys,
u32 h_control, u32 i_paddress);
/* Read the MAC address u16 hpi_cobranet_get_macaddress(u32 h_control, u32 *pmAC_MS_bs,
*/ u32 *pmAC_LS_bs);
u16 hpi_cobranet_getMA_caddress(const struct hpi_hsubsys *ph_subsys,
u32 h_control, u32 *pmAC_MS_bs, u32 *pmAC_LS_bs);
/******************************* /*************************/
Tone Detector control /* Tone Detector control */
*******************************/ /*************************/
u16 hpi_tone_detector_get_state(const struct hpi_hsubsys *ph_subsys, u32 hC, u16 hpi_tone_detector_get_state(u32 hC, u32 *state);
u32 *state);
u16 hpi_tone_detector_set_enable(const struct hpi_hsubsys *ph_subsys, u32 hC, u16 hpi_tone_detector_set_enable(u32 hC, u32 enable);
u32 enable);
u16 hpi_tone_detector_get_enable(const struct hpi_hsubsys *ph_subsys, u32 hC, u16 hpi_tone_detector_get_enable(u32 hC, u32 *enable);
u32 *enable);
u16 hpi_tone_detector_set_event_enable(const struct hpi_hsubsys *ph_subsys, u16 hpi_tone_detector_set_event_enable(u32 hC, u32 event_enable);
u32 hC, u32 event_enable);
u16 hpi_tone_detector_get_event_enable(const struct hpi_hsubsys *ph_subsys, u16 hpi_tone_detector_get_event_enable(u32 hC, u32 *event_enable);
u32 hC, u32 *event_enable);
u16 hpi_tone_detector_set_threshold(const struct hpi_hsubsys *ph_subsys, u16 hpi_tone_detector_set_threshold(u32 hC, int threshold);
u32 hC, int threshold);
u16 hpi_tone_detector_get_threshold(const struct hpi_hsubsys *ph_subsys, u16 hpi_tone_detector_get_threshold(u32 hC, int *threshold);
u32 hC, int *threshold);
u16 hpi_tone_detector_get_frequency(const struct hpi_hsubsys *ph_subsys, u16 hpi_tone_detector_get_frequency(u32 hC, u32 index, u32 *frequency);
u32 hC, u32 index, u32 *frequency);
/******************************* /****************************/
Silence Detector control /* Silence Detector control */
*******************************/ /****************************/
u16 hpi_silence_detector_get_state(const struct hpi_hsubsys *ph_subsys, u16 hpi_silence_detector_get_state(u32 hC, u32 *state);
u32 hC, u32 *state);
u16 hpi_silence_detector_set_enable(const struct hpi_hsubsys *ph_subsys, u16 hpi_silence_detector_set_enable(u32 hC, u32 enable);
u32 hC, u32 enable);
u16 hpi_silence_detector_get_enable(const struct hpi_hsubsys *ph_subsys, u16 hpi_silence_detector_get_enable(u32 hC, u32 *enable);
u32 hC, u32 *enable);
u16 hpi_silence_detector_set_event_enable(const struct hpi_hsubsys *ph_subsys, u16 hpi_silence_detector_set_event_enable(u32 hC, u32 event_enable);
u32 hC, u32 event_enable);
u16 hpi_silence_detector_get_event_enable(const struct hpi_hsubsys *ph_subsys, u16 hpi_silence_detector_get_event_enable(u32 hC, u32 *event_enable);
u32 hC, u32 *event_enable);
u16 hpi_silence_detector_set_delay(const struct hpi_hsubsys *ph_subsys, u16 hpi_silence_detector_set_delay(u32 hC, u32 delay);
u32 hC, u32 delay);
u16 hpi_silence_detector_get_delay(const struct hpi_hsubsys *ph_subsys, u16 hpi_silence_detector_get_delay(u32 hC, u32 *delay);
u32 hC, u32 *delay);
u16 hpi_silence_detector_set_threshold(const struct hpi_hsubsys *ph_subsys, u16 hpi_silence_detector_set_threshold(u32 hC, int threshold);
u32 hC, int threshold);
u16 hpi_silence_detector_get_threshold(const struct hpi_hsubsys *ph_subsys, u16 hpi_silence_detector_get_threshold(u32 hC, int *threshold);
u32 hC, int *threshold); /*********************/
/*//////////////////// */ /* Utility functions */
/* UTILITY functions */ /*********************/
u16 hpi_format_create(struct hpi_format *p_format, u16 channels, u16 format, u16 hpi_format_create(struct hpi_format *p_format, u16 channels, u16 format,
u32 sample_rate, u32 bit_rate, u32 attributes); u32 sample_rate, u32 bit_rate, u32 attributes);
/* Until it's verified, this function is for Windows OSs only */ #endif /*_HPI_H_ */
#endif /*_H_HPI_ */
/*
///////////////////////////////////////////////////////////////////////////////
// See CVS for history. Last complete set in rev 1.146
////////////////////////////////////////////////////////////////////////////////
*/
...@@ -104,6 +104,16 @@ enum HPI_BUSES { ...@@ -104,6 +104,16 @@ enum HPI_BUSES {
HPI_BUS_NET = 4 HPI_BUS_NET = 4
}; };
enum HPI_SUBSYS_OPTIONS {
/* 0, 256 are invalid, 1..255 reserved for global options */
HPI_SUBSYS_OPT_NET_ENABLE = 257,
HPI_SUBSYS_OPT_NET_BROADCAST = 258,
HPI_SUBSYS_OPT_NET_UNICAST = 259,
HPI_SUBSYS_OPT_NET_ADDR = 260,
HPI_SUBSYS_OPT_NET_MASK = 261,
HPI_SUBSYS_OPT_NET_ADAPTER_ADDRESS_ADD = 262
};
/******************************************* CONTROL ATTRIBUTES ****/ /******************************************* CONTROL ATTRIBUTES ****/
/* (in order of control type ID */ /* (in order of control type ID */
...@@ -365,7 +375,8 @@ enum HPI_OBJECT_TYPES { ...@@ -365,7 +375,8 @@ enum HPI_OBJECT_TYPES {
}; };
#define HPI_OBJ_FUNCTION_SPACING 0x100 #define HPI_OBJ_FUNCTION_SPACING 0x100
#define HPI_FUNC_ID(obj, index) (HPI_OBJ_##obj * HPI_OBJ_FUNCTION_SPACING + index) #define HPI_FUNC_ID(obj, index) \
(HPI_OBJ_##obj * HPI_OBJ_FUNCTION_SPACING + index)
#define HPI_EXTRACT_INDEX(fn) (fn & 0xff) #define HPI_EXTRACT_INDEX(fn) (fn & 0xff)
...@@ -1171,7 +1182,7 @@ struct hpi_response { ...@@ -1171,7 +1182,7 @@ struct hpi_response {
sizeof(struct hpi_response_header) + sizeof(struct hpi_async_res) \ sizeof(struct hpi_response_header) + sizeof(struct hpi_async_res) \
} }
/*********************** version 1 message/response *****************************/ /*********************** version 1 message/response **************************/
#define HPINET_ETHERNET_DATA_SIZE (1500) #define HPINET_ETHERNET_DATA_SIZE (1500)
#define HPINET_IP_HDR_SIZE (20) #define HPINET_IP_HDR_SIZE (20)
#define HPINET_IP_DATA_SIZE (HPINET_ETHERNET_DATA_SIZE - HPINET_IP_HDR_SIZE) #define HPINET_IP_DATA_SIZE (HPINET_ETHERNET_DATA_SIZE - HPINET_IP_HDR_SIZE)
...@@ -1484,8 +1495,7 @@ struct hpi_control_cache_pad { ...@@ -1484,8 +1495,7 @@ struct hpi_control_cache_pad {
u32 traffic_anouncement; u32 traffic_anouncement;
}; };
/*/////////////////////////////////////////////////////////////////////////// */ /* 2^N sized FIFO buffer (internal to HPI<->DSP interaction) */
/* declarations for 2^N sized FIFO buffer (internal to HPI<->DSP interaction) */
struct hpi_fifo_buffer { struct hpi_fifo_buffer {
u32 size; u32 size;
u32 dSP_index; u32 dSP_index;
...@@ -1510,25 +1520,22 @@ u32 hpi_indexes_to_handle(const char c_object, const u16 adapter_index, ...@@ -1510,25 +1520,22 @@ u32 hpi_indexes_to_handle(const char c_object, const u16 adapter_index,
/*////////////////////////////////////////////////////////////////////////// */ /*////////////////////////////////////////////////////////////////////////// */
/* main HPI entry point */ /* main HPI entry point */
hpi_handler_func hpi_send_recv; void hpi_send_recv(struct hpi_message *phm, struct hpi_response *phr);
/* UDP message */ /* UDP message */
void hpi_send_recvUDP(struct hpi_message *phm, struct hpi_response *phr, void hpi_send_recvUDP(struct hpi_message *phm, struct hpi_response *phr,
const unsigned int timeout); const unsigned int timeout);
/* used in PnP OS/driver */ /* used in PnP OS/driver */
u16 hpi_subsys_create_adapter(const struct hpi_hsubsys *ph_subsys, u16 hpi_subsys_create_adapter(const struct hpi_resource *p_resource,
const struct hpi_resource *p_resource, u16 *pw_adapter_index); u16 *pw_adapter_index);
u16 hpi_subsys_delete_adapter(const struct hpi_hsubsys *ph_subsys, u16 hpi_subsys_delete_adapter(u16 adapter_index);
u16 adapter_index);
u16 hpi_outstream_host_buffer_get_info(const struct hpi_hsubsys *ph_subsys, u16 hpi_outstream_host_buffer_get_info(u32 h_outstream, u8 **pp_buffer,
u32 h_outstream, u8 **pp_buffer,
struct hpi_hostbuffer_status **pp_status); struct hpi_hostbuffer_status **pp_status);
u16 hpi_instream_host_buffer_get_info(const struct hpi_hsubsys *ph_subsys, u16 hpi_instream_host_buffer_get_info(u32 h_instream, u8 **pp_buffer,
u32 h_instream, u8 **pp_buffer,
struct hpi_hostbuffer_status **pp_status); struct hpi_hostbuffer_status **pp_status);
u16 hpi_adapter_restart(u16 adapter_index); u16 hpi_adapter_restart(u16 adapter_index);
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -392,7 +392,7 @@ int __devinit asihpi_adapter_probe(struct pci_dev *pci_dev, ...@@ -392,7 +392,7 @@ int __devinit asihpi_adapter_probe(struct pci_dev *pci_dev,
adapter.type = hr.u.s.aw_adapter_list[adapter.index]; adapter.type = hr.u.s.aw_adapter_list[adapter.index];
hm.adapter_index = adapter.index; hm.adapter_index = adapter.index;
err = hpi_adapter_open(NULL, adapter.index); err = hpi_adapter_open(adapter.index);
if (err) if (err)
goto err; goto err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment