diff options
Diffstat (limited to 'sound/isa/sb/emu8000_pcm.c')
-rw-r--r-- | sound/isa/sb/emu8000_pcm.c | 104 |
1 files changed, 51 insertions, 53 deletions
diff --git a/sound/isa/sb/emu8000_pcm.c b/sound/isa/sb/emu8000_pcm.c index b323beeeda1..91dc3d83e2c 100644 --- a/sound/isa/sb/emu8000_pcm.c +++ b/sound/isa/sb/emu8000_pcm.c @@ -46,14 +46,12 @@ */ -typedef struct snd_emu8k_pcm emu8k_pcm_t; - struct snd_emu8k_pcm { - emu8000_t *emu; - snd_pcm_substream_t *substream; + struct snd_emu8000 *emu; + struct snd_pcm_substream *substream; unsigned int allocated_bytes; - snd_util_memblk_t *block; + struct snd_util_memblk *block; unsigned int offset; unsigned int buf_size; unsigned int period_size; @@ -77,7 +75,7 @@ struct snd_emu8k_pcm { * open up channels for the simultaneous data transfer and playback */ static int -emu8k_open_dram_for_pcm(emu8000_t *emu, int channels) +emu8k_open_dram_for_pcm(struct snd_emu8000 *emu, int channels) { int i; @@ -113,7 +111,7 @@ emu8k_open_dram_for_pcm(emu8000_t *emu, int channels) /* */ static void -snd_emu8000_write_wait(emu8000_t *emu, int can_schedule) +snd_emu8000_write_wait(struct snd_emu8000 *emu, int can_schedule) { while ((EMU8000_SMALW_READ(emu) & 0x80000000) != 0) { if (can_schedule) { @@ -128,7 +126,7 @@ snd_emu8000_write_wait(emu8000_t *emu, int can_schedule) * close all channels */ static void -emu8k_close_dram(emu8000_t *emu) +emu8k_close_dram(struct snd_emu8000 *emu) { int i; @@ -156,7 +154,7 @@ static int calc_rate_offset(int hz) /* */ -static snd_pcm_hardware_t emu8k_pcm_hw = { +static struct snd_pcm_hardware emu8k_pcm_hw = { #ifdef USE_NONINTERLEAVE .info = SNDRV_PCM_INFO_NONINTERLEAVED, #else @@ -180,7 +178,7 @@ static snd_pcm_hardware_t emu8k_pcm_hw = { /* * get the current position at the given channel from CCCA register */ -static inline int emu8k_get_curpos(emu8k_pcm_t *rec, int ch) +static inline int emu8k_get_curpos(struct snd_emu8k_pcm *rec, int ch) { int val = EMU8000_CCCA_READ(rec->emu, ch) & 0xfffffff; val -= rec->loop_start[ch] - 1; @@ -194,7 +192,7 @@ static inline int emu8k_get_curpos(emu8k_pcm_t *rec, int ch) */ static void emu8k_pcm_timer_func(unsigned long data) { - emu8k_pcm_t *rec = (emu8k_pcm_t *)data; + struct snd_emu8k_pcm *rec = (struct snd_emu8k_pcm *)data; int ptr, delta; spin_lock(&rec->timer_lock); @@ -226,11 +224,11 @@ static void emu8k_pcm_timer_func(unsigned long data) * open pcm * creating an instance here */ -static int emu8k_pcm_open(snd_pcm_substream_t *subs) +static int emu8k_pcm_open(struct snd_pcm_substream *subs) { - emu8000_t *emu = snd_pcm_substream_chip(subs); - emu8k_pcm_t *rec; - snd_pcm_runtime_t *runtime = subs->runtime; + struct snd_emu8000 *emu = snd_pcm_substream_chip(subs); + struct snd_emu8k_pcm *rec; + struct snd_pcm_runtime *runtime = subs->runtime; rec = kzalloc(sizeof(*rec), GFP_KERNEL); if (! rec) @@ -256,9 +254,9 @@ static int emu8k_pcm_open(snd_pcm_substream_t *subs) return 0; } -static int emu8k_pcm_close(snd_pcm_substream_t *subs) +static int emu8k_pcm_close(struct snd_pcm_substream *subs) { - emu8k_pcm_t *rec = subs->runtime->private_data; + struct snd_emu8k_pcm *rec = subs->runtime->private_data; kfree(rec); subs->runtime->private_data = NULL; return 0; @@ -281,9 +279,9 @@ static int calc_pitch_target(int pitch) /* * set up the voice */ -static void setup_voice(emu8k_pcm_t *rec, int ch) +static void setup_voice(struct snd_emu8k_pcm *rec, int ch) { - emu8000_t *hw = rec->emu; + struct snd_emu8000 *hw = rec->emu; unsigned int temp; /* channel to be silent and idle */ @@ -334,10 +332,10 @@ static void setup_voice(emu8k_pcm_t *rec, int ch) /* * trigger the voice */ -static void start_voice(emu8k_pcm_t *rec, int ch) +static void start_voice(struct snd_emu8k_pcm *rec, int ch) { unsigned long flags; - emu8000_t *hw = rec->emu; + struct snd_emu8000 *hw = rec->emu; unsigned int temp, aux; int pt = calc_pitch_target(rec->pitch); @@ -370,10 +368,10 @@ static void start_voice(emu8k_pcm_t *rec, int ch) /* * stop the voice immediately */ -static void stop_voice(emu8k_pcm_t *rec, int ch) +static void stop_voice(struct snd_emu8k_pcm *rec, int ch) { unsigned long flags; - emu8000_t *hw = rec->emu; + struct snd_emu8000 *hw = rec->emu; EMU8000_DCYSUSV_WRITE(hw, ch, 0x807F); @@ -386,9 +384,9 @@ static void stop_voice(emu8k_pcm_t *rec, int ch) spin_unlock_irqrestore(&rec->timer_lock, flags); } -static int emu8k_pcm_trigger(snd_pcm_substream_t *subs, int cmd) +static int emu8k_pcm_trigger(struct snd_pcm_substream *subs, int cmd) { - emu8k_pcm_t *rec = subs->runtime->private_data; + struct snd_emu8k_pcm *rec = subs->runtime->private_data; int ch; switch (cmd) { @@ -428,7 +426,7 @@ do { \ #ifdef USE_NONINTERLEAVE /* copy one channel block */ -static int emu8k_transfer_block(emu8000_t *emu, int offset, unsigned short *buf, int count) +static int emu8k_transfer_block(struct snd_emu8000 *emu, int offset, unsigned short *buf, int count) { EMU8000_SMALW_WRITE(emu, offset); while (count > 0) { @@ -442,14 +440,14 @@ static int emu8k_transfer_block(emu8000_t *emu, int offset, unsigned short *buf, return 0; } -static int emu8k_pcm_copy(snd_pcm_substream_t *subs, +static int emu8k_pcm_copy(struct snd_pcm_substream *subs, int voice, snd_pcm_uframes_t pos, void *src, snd_pcm_uframes_t count) { - emu8k_pcm_t *rec = subs->runtime->private_data; - emu8000_t *emu = rec->emu; + struct snd_emu8k_pcm *rec = subs->runtime->private_data; + struct snd_emu8000 *emu = rec->emu; snd_emu8000_write_wait(emu, 1); if (voice == -1) { @@ -469,7 +467,7 @@ static int emu8k_pcm_copy(snd_pcm_substream_t *subs, } /* make a channel block silence */ -static int emu8k_silence_block(emu8000_t *emu, int offset, int count) +static int emu8k_silence_block(struct snd_emu8000 *emu, int offset, int count) { EMU8000_SMALW_WRITE(emu, offset); while (count > 0) { @@ -480,13 +478,13 @@ static int emu8k_silence_block(emu8000_t *emu, int offset, int count) return 0; } -static int emu8k_pcm_silence(snd_pcm_substream_t *subs, +static int emu8k_pcm_silence(struct snd_pcm_substream *subs, int voice, snd_pcm_uframes_t pos, snd_pcm_uframes_t count) { - emu8k_pcm_t *rec = subs->runtime->private_data; - emu8000_t *emu = rec->emu; + struct snd_emu8k_pcm *rec = subs->runtime->private_data; + struct snd_emu8000 *emu = rec->emu; snd_emu8000_write_wait(emu, 1); if (voice == -1 && rec->voices == 1) @@ -508,14 +506,14 @@ static int emu8k_pcm_silence(snd_pcm_substream_t *subs, * copy the interleaved data can be done easily by using * DMA "left" and "right" channels on emu8k engine. */ -static int emu8k_pcm_copy(snd_pcm_substream_t *subs, +static int emu8k_pcm_copy(struct snd_pcm_substream *subs, int voice, snd_pcm_uframes_t pos, void __user *src, snd_pcm_uframes_t count) { - emu8k_pcm_t *rec = subs->runtime->private_data; - emu8000_t *emu = rec->emu; + struct snd_emu8k_pcm *rec = subs->runtime->private_data; + struct snd_emu8000 *emu = rec->emu; unsigned short __user *buf = src; snd_emu8000_write_wait(emu, 1); @@ -539,13 +537,13 @@ static int emu8k_pcm_copy(snd_pcm_substream_t *subs, return 0; } -static int emu8k_pcm_silence(snd_pcm_substream_t *subs, +static int emu8k_pcm_silence(struct snd_pcm_substream *subs, int voice, snd_pcm_uframes_t pos, snd_pcm_uframes_t count) { - emu8k_pcm_t *rec = subs->runtime->private_data; - emu8000_t *emu = rec->emu; + struct snd_emu8k_pcm *rec = subs->runtime->private_data; + struct snd_emu8000 *emu = rec->emu; snd_emu8000_write_wait(emu, 1); EMU8000_SMALW_WRITE(emu, rec->loop_start[0] + pos); @@ -567,10 +565,10 @@ static int emu8k_pcm_silence(snd_pcm_substream_t *subs, /* * allocate a memory block */ -static int emu8k_pcm_hw_params(snd_pcm_substream_t *subs, - snd_pcm_hw_params_t *hw_params) +static int emu8k_pcm_hw_params(struct snd_pcm_substream *subs, + struct snd_pcm_hw_params *hw_params) { - emu8k_pcm_t *rec = subs->runtime->private_data; + struct snd_emu8k_pcm *rec = subs->runtime->private_data; if (rec->block) { /* reallocation - release the old block */ @@ -592,9 +590,9 @@ static int emu8k_pcm_hw_params(snd_pcm_substream_t *subs, /* * free the memory block */ -static int emu8k_pcm_hw_free(snd_pcm_substream_t *subs) +static int emu8k_pcm_hw_free(struct snd_pcm_substream *subs) { - emu8k_pcm_t *rec = subs->runtime->private_data; + struct snd_emu8k_pcm *rec = subs->runtime->private_data; if (rec->block) { int ch; @@ -610,9 +608,9 @@ static int emu8k_pcm_hw_free(snd_pcm_substream_t *subs) /* */ -static int emu8k_pcm_prepare(snd_pcm_substream_t *subs) +static int emu8k_pcm_prepare(struct snd_pcm_substream *subs) { - emu8k_pcm_t *rec = subs->runtime->private_data; + struct snd_emu8k_pcm *rec = subs->runtime->private_data; rec->pitch = 0xe000 + calc_rate_offset(subs->runtime->rate); rec->last_ptr = 0; @@ -656,16 +654,16 @@ static int emu8k_pcm_prepare(snd_pcm_substream_t *subs) return 0; } -static snd_pcm_uframes_t emu8k_pcm_pointer(snd_pcm_substream_t *subs) +static snd_pcm_uframes_t emu8k_pcm_pointer(struct snd_pcm_substream *subs) { - emu8k_pcm_t *rec = subs->runtime->private_data; + struct snd_emu8k_pcm *rec = subs->runtime->private_data; if (rec->running) return emu8k_get_curpos(rec, 0); return 0; } -static snd_pcm_ops_t emu8k_pcm_ops = { +static struct snd_pcm_ops emu8k_pcm_ops = { .open = emu8k_pcm_open, .close = emu8k_pcm_close, .ioctl = snd_pcm_lib_ioctl, @@ -679,15 +677,15 @@ static snd_pcm_ops_t emu8k_pcm_ops = { }; -static void snd_emu8000_pcm_free(snd_pcm_t *pcm) +static void snd_emu8000_pcm_free(struct snd_pcm *pcm) { - emu8000_t *emu = pcm->private_data; + struct snd_emu8000 *emu = pcm->private_data; emu->pcm = NULL; } -int snd_emu8000_pcm_new(snd_card_t *card, emu8000_t *emu, int index) +int snd_emu8000_pcm_new(struct snd_card *card, struct snd_emu8000 *emu, int index) { - snd_pcm_t *pcm; + struct snd_pcm *pcm; int err; if ((err = snd_pcm_new(card, "Emu8000 PCM", index, 1, 0, &pcm)) < 0) |