aboutsummaryrefslogtreecommitdiffstats
path: root/sound/isa/sb/emu8000_pcm.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2005-11-17 08:34:36 -0500
committerJaroslav Kysela <perex@suse.cz>2006-01-03 06:18:25 -0500
commit029d64b0cfa30abc10f722e2f67d282abe09c9da (patch)
treed9a1e72e9792b33e57db2695f6c1a1a4843df0bf /sound/isa/sb/emu8000_pcm.c
parentd3a7e476740dc23588ea65fa0df1aacdf8e70003 (diff)
[ALSA] Remove xxx_t typedefs: ISA SB8/SB16/SBAWE
Remove xxx_t typedefs from the ISA SB8/SB16/SBAWE drivers. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/isa/sb/emu8000_pcm.c')
-rw-r--r--sound/isa/sb/emu8000_pcm.c104
1 files changed, 51 insertions, 53 deletions
diff --git a/sound/isa/sb/emu8000_pcm.c b/sound/isa/sb/emu8000_pcm.c
index b323beeeda15..91dc3d83e2cf 100644
--- a/sound/isa/sb/emu8000_pcm.c
+++ b/sound/isa/sb/emu8000_pcm.c
@@ -46,14 +46,12 @@
46 */ 46 */
47 47
48 48
49typedef struct snd_emu8k_pcm emu8k_pcm_t;
50
51struct snd_emu8k_pcm { 49struct snd_emu8k_pcm {
52 emu8000_t *emu; 50 struct snd_emu8000 *emu;
53 snd_pcm_substream_t *substream; 51 struct snd_pcm_substream *substream;
54 52
55 unsigned int allocated_bytes; 53 unsigned int allocated_bytes;
56 snd_util_memblk_t *block; 54 struct snd_util_memblk *block;
57 unsigned int offset; 55 unsigned int offset;
58 unsigned int buf_size; 56 unsigned int buf_size;
59 unsigned int period_size; 57 unsigned int period_size;
@@ -77,7 +75,7 @@ struct snd_emu8k_pcm {
77 * open up channels for the simultaneous data transfer and playback 75 * open up channels for the simultaneous data transfer and playback
78 */ 76 */
79static int 77static int
80emu8k_open_dram_for_pcm(emu8000_t *emu, int channels) 78emu8k_open_dram_for_pcm(struct snd_emu8000 *emu, int channels)
81{ 79{
82 int i; 80 int i;
83 81
@@ -113,7 +111,7 @@ emu8k_open_dram_for_pcm(emu8000_t *emu, int channels)
113/* 111/*
114 */ 112 */
115static void 113static void
116snd_emu8000_write_wait(emu8000_t *emu, int can_schedule) 114snd_emu8000_write_wait(struct snd_emu8000 *emu, int can_schedule)
117{ 115{
118 while ((EMU8000_SMALW_READ(emu) & 0x80000000) != 0) { 116 while ((EMU8000_SMALW_READ(emu) & 0x80000000) != 0) {
119 if (can_schedule) { 117 if (can_schedule) {
@@ -128,7 +126,7 @@ snd_emu8000_write_wait(emu8000_t *emu, int can_schedule)
128 * close all channels 126 * close all channels
129 */ 127 */
130static void 128static void
131emu8k_close_dram(emu8000_t *emu) 129emu8k_close_dram(struct snd_emu8000 *emu)
132{ 130{
133 int i; 131 int i;
134 132
@@ -156,7 +154,7 @@ static int calc_rate_offset(int hz)
156/* 154/*
157 */ 155 */
158 156
159static snd_pcm_hardware_t emu8k_pcm_hw = { 157static struct snd_pcm_hardware emu8k_pcm_hw = {
160#ifdef USE_NONINTERLEAVE 158#ifdef USE_NONINTERLEAVE
161 .info = SNDRV_PCM_INFO_NONINTERLEAVED, 159 .info = SNDRV_PCM_INFO_NONINTERLEAVED,
162#else 160#else
@@ -180,7 +178,7 @@ static snd_pcm_hardware_t emu8k_pcm_hw = {
180/* 178/*
181 * get the current position at the given channel from CCCA register 179 * get the current position at the given channel from CCCA register
182 */ 180 */
183static inline int emu8k_get_curpos(emu8k_pcm_t *rec, int ch) 181static inline int emu8k_get_curpos(struct snd_emu8k_pcm *rec, int ch)
184{ 182{
185 int val = EMU8000_CCCA_READ(rec->emu, ch) & 0xfffffff; 183 int val = EMU8000_CCCA_READ(rec->emu, ch) & 0xfffffff;
186 val -= rec->loop_start[ch] - 1; 184 val -= rec->loop_start[ch] - 1;
@@ -194,7 +192,7 @@ static inline int emu8k_get_curpos(emu8k_pcm_t *rec, int ch)
194 */ 192 */
195static void emu8k_pcm_timer_func(unsigned long data) 193static void emu8k_pcm_timer_func(unsigned long data)
196{ 194{
197 emu8k_pcm_t *rec = (emu8k_pcm_t *)data; 195 struct snd_emu8k_pcm *rec = (struct snd_emu8k_pcm *)data;
198 int ptr, delta; 196 int ptr, delta;
199 197
200 spin_lock(&rec->timer_lock); 198 spin_lock(&rec->timer_lock);
@@ -226,11 +224,11 @@ static void emu8k_pcm_timer_func(unsigned long data)
226 * open pcm 224 * open pcm
227 * creating an instance here 225 * creating an instance here
228 */ 226 */
229static int emu8k_pcm_open(snd_pcm_substream_t *subs) 227static int emu8k_pcm_open(struct snd_pcm_substream *subs)
230{ 228{
231 emu8000_t *emu = snd_pcm_substream_chip(subs); 229 struct snd_emu8000 *emu = snd_pcm_substream_chip(subs);
232 emu8k_pcm_t *rec; 230 struct snd_emu8k_pcm *rec;
233 snd_pcm_runtime_t *runtime = subs->runtime; 231 struct snd_pcm_runtime *runtime = subs->runtime;
234 232
235 rec = kzalloc(sizeof(*rec), GFP_KERNEL); 233 rec = kzalloc(sizeof(*rec), GFP_KERNEL);
236 if (! rec) 234 if (! rec)
@@ -256,9 +254,9 @@ static int emu8k_pcm_open(snd_pcm_substream_t *subs)
256 return 0; 254 return 0;
257} 255}
258 256
259static int emu8k_pcm_close(snd_pcm_substream_t *subs) 257static int emu8k_pcm_close(struct snd_pcm_substream *subs)
260{ 258{
261 emu8k_pcm_t *rec = subs->runtime->private_data; 259 struct snd_emu8k_pcm *rec = subs->runtime->private_data;
262 kfree(rec); 260 kfree(rec);
263 subs->runtime->private_data = NULL; 261 subs->runtime->private_data = NULL;
264 return 0; 262 return 0;
@@ -281,9 +279,9 @@ static int calc_pitch_target(int pitch)
281/* 279/*
282 * set up the voice 280 * set up the voice
283 */ 281 */
284static void setup_voice(emu8k_pcm_t *rec, int ch) 282static void setup_voice(struct snd_emu8k_pcm *rec, int ch)
285{ 283{
286 emu8000_t *hw = rec->emu; 284 struct snd_emu8000 *hw = rec->emu;
287 unsigned int temp; 285 unsigned int temp;
288 286
289 /* channel to be silent and idle */ 287 /* channel to be silent and idle */
@@ -334,10 +332,10 @@ static void setup_voice(emu8k_pcm_t *rec, int ch)
334/* 332/*
335 * trigger the voice 333 * trigger the voice
336 */ 334 */
337static void start_voice(emu8k_pcm_t *rec, int ch) 335static void start_voice(struct snd_emu8k_pcm *rec, int ch)
338{ 336{
339 unsigned long flags; 337 unsigned long flags;
340 emu8000_t *hw = rec->emu; 338 struct snd_emu8000 *hw = rec->emu;
341 unsigned int temp, aux; 339 unsigned int temp, aux;
342 int pt = calc_pitch_target(rec->pitch); 340 int pt = calc_pitch_target(rec->pitch);
343 341
@@ -370,10 +368,10 @@ static void start_voice(emu8k_pcm_t *rec, int ch)
370/* 368/*
371 * stop the voice immediately 369 * stop the voice immediately
372 */ 370 */
373static void stop_voice(emu8k_pcm_t *rec, int ch) 371static void stop_voice(struct snd_emu8k_pcm *rec, int ch)
374{ 372{
375 unsigned long flags; 373 unsigned long flags;
376 emu8000_t *hw = rec->emu; 374 struct snd_emu8000 *hw = rec->emu;
377 375
378 EMU8000_DCYSUSV_WRITE(hw, ch, 0x807F); 376 EMU8000_DCYSUSV_WRITE(hw, ch, 0x807F);
379 377
@@ -386,9 +384,9 @@ static void stop_voice(emu8k_pcm_t *rec, int ch)
386 spin_unlock_irqrestore(&rec->timer_lock, flags); 384 spin_unlock_irqrestore(&rec->timer_lock, flags);
387} 385}
388 386
389static int emu8k_pcm_trigger(snd_pcm_substream_t *subs, int cmd) 387static int emu8k_pcm_trigger(struct snd_pcm_substream *subs, int cmd)
390{ 388{
391 emu8k_pcm_t *rec = subs->runtime->private_data; 389 struct snd_emu8k_pcm *rec = subs->runtime->private_data;
392 int ch; 390 int ch;
393 391
394 switch (cmd) { 392 switch (cmd) {
@@ -428,7 +426,7 @@ do { \
428 426
429#ifdef USE_NONINTERLEAVE 427#ifdef USE_NONINTERLEAVE
430/* copy one channel block */ 428/* copy one channel block */
431static int emu8k_transfer_block(emu8000_t *emu, int offset, unsigned short *buf, int count) 429static int emu8k_transfer_block(struct snd_emu8000 *emu, int offset, unsigned short *buf, int count)
432{ 430{
433 EMU8000_SMALW_WRITE(emu, offset); 431 EMU8000_SMALW_WRITE(emu, offset);
434 while (count > 0) { 432 while (count > 0) {
@@ -442,14 +440,14 @@ static int emu8k_transfer_block(emu8000_t *emu, int offset, unsigned short *buf,
442 return 0; 440 return 0;
443} 441}
444 442
445static int emu8k_pcm_copy(snd_pcm_substream_t *subs, 443static int emu8k_pcm_copy(struct snd_pcm_substream *subs,
446 int voice, 444 int voice,
447 snd_pcm_uframes_t pos, 445 snd_pcm_uframes_t pos,
448 void *src, 446 void *src,
449 snd_pcm_uframes_t count) 447 snd_pcm_uframes_t count)
450{ 448{
451 emu8k_pcm_t *rec = subs->runtime->private_data; 449 struct snd_emu8k_pcm *rec = subs->runtime->private_data;
452 emu8000_t *emu = rec->emu; 450 struct snd_emu8000 *emu = rec->emu;
453 451
454 snd_emu8000_write_wait(emu, 1); 452 snd_emu8000_write_wait(emu, 1);
455 if (voice == -1) { 453 if (voice == -1) {
@@ -469,7 +467,7 @@ static int emu8k_pcm_copy(snd_pcm_substream_t *subs,
469} 467}
470 468
471/* make a channel block silence */ 469/* make a channel block silence */
472static int emu8k_silence_block(emu8000_t *emu, int offset, int count) 470static int emu8k_silence_block(struct snd_emu8000 *emu, int offset, int count)
473{ 471{
474 EMU8000_SMALW_WRITE(emu, offset); 472 EMU8000_SMALW_WRITE(emu, offset);
475 while (count > 0) { 473 while (count > 0) {
@@ -480,13 +478,13 @@ static int emu8k_silence_block(emu8000_t *emu, int offset, int count)
480 return 0; 478 return 0;
481} 479}
482 480
483static int emu8k_pcm_silence(snd_pcm_substream_t *subs, 481static int emu8k_pcm_silence(struct snd_pcm_substream *subs,
484 int voice, 482 int voice,
485 snd_pcm_uframes_t pos, 483 snd_pcm_uframes_t pos,
486 snd_pcm_uframes_t count) 484 snd_pcm_uframes_t count)
487{ 485{
488 emu8k_pcm_t *rec = subs->runtime->private_data; 486 struct snd_emu8k_pcm *rec = subs->runtime->private_data;
489 emu8000_t *emu = rec->emu; 487 struct snd_emu8000 *emu = rec->emu;
490 488
491 snd_emu8000_write_wait(emu, 1); 489 snd_emu8000_write_wait(emu, 1);
492 if (voice == -1 && rec->voices == 1) 490 if (voice == -1 && rec->voices == 1)
@@ -508,14 +506,14 @@ static int emu8k_pcm_silence(snd_pcm_substream_t *subs,
508 * copy the interleaved data can be done easily by using 506 * copy the interleaved data can be done easily by using
509 * DMA "left" and "right" channels on emu8k engine. 507 * DMA "left" and "right" channels on emu8k engine.
510 */ 508 */
511static int emu8k_pcm_copy(snd_pcm_substream_t *subs, 509static int emu8k_pcm_copy(struct snd_pcm_substream *subs,
512 int voice, 510 int voice,
513 snd_pcm_uframes_t pos, 511 snd_pcm_uframes_t pos,
514 void __user *src, 512 void __user *src,
515 snd_pcm_uframes_t count) 513 snd_pcm_uframes_t count)
516{ 514{
517 emu8k_pcm_t *rec = subs->runtime->private_data; 515 struct snd_emu8k_pcm *rec = subs->runtime->private_data;
518 emu8000_t *emu = rec->emu; 516 struct snd_emu8000 *emu = rec->emu;
519 unsigned short __user *buf = src; 517 unsigned short __user *buf = src;
520 518
521 snd_emu8000_write_wait(emu, 1); 519 snd_emu8000_write_wait(emu, 1);
@@ -539,13 +537,13 @@ static int emu8k_pcm_copy(snd_pcm_substream_t *subs,
539 return 0; 537 return 0;
540} 538}
541 539
542static int emu8k_pcm_silence(snd_pcm_substream_t *subs, 540static int emu8k_pcm_silence(struct snd_pcm_substream *subs,
543 int voice, 541 int voice,
544 snd_pcm_uframes_t pos, 542 snd_pcm_uframes_t pos,
545 snd_pcm_uframes_t count) 543 snd_pcm_uframes_t count)
546{ 544{
547 emu8k_pcm_t *rec = subs->runtime->private_data; 545 struct snd_emu8k_pcm *rec = subs->runtime->private_data;
548 emu8000_t *emu = rec->emu; 546 struct snd_emu8000 *emu = rec->emu;
549 547
550 snd_emu8000_write_wait(emu, 1); 548 snd_emu8000_write_wait(emu, 1);
551 EMU8000_SMALW_WRITE(emu, rec->loop_start[0] + pos); 549 EMU8000_SMALW_WRITE(emu, rec->loop_start[0] + pos);
@@ -567,10 +565,10 @@ static int emu8k_pcm_silence(snd_pcm_substream_t *subs,
567/* 565/*
568 * allocate a memory block 566 * allocate a memory block
569 */ 567 */
570static int emu8k_pcm_hw_params(snd_pcm_substream_t *subs, 568static int emu8k_pcm_hw_params(struct snd_pcm_substream *subs,
571 snd_pcm_hw_params_t *hw_params) 569 struct snd_pcm_hw_params *hw_params)
572{ 570{
573 emu8k_pcm_t *rec = subs->runtime->private_data; 571 struct snd_emu8k_pcm *rec = subs->runtime->private_data;
574 572
575 if (rec->block) { 573 if (rec->block) {
576 /* reallocation - release the old block */ 574 /* reallocation - release the old block */
@@ -592,9 +590,9 @@ static int emu8k_pcm_hw_params(snd_pcm_substream_t *subs,
592/* 590/*
593 * free the memory block 591 * free the memory block
594 */ 592 */
595static int emu8k_pcm_hw_free(snd_pcm_substream_t *subs) 593static int emu8k_pcm_hw_free(struct snd_pcm_substream *subs)
596{ 594{
597 emu8k_pcm_t *rec = subs->runtime->private_data; 595 struct snd_emu8k_pcm *rec = subs->runtime->private_data;
598 596
599 if (rec->block) { 597 if (rec->block) {
600 int ch; 598 int ch;
@@ -610,9 +608,9 @@ static int emu8k_pcm_hw_free(snd_pcm_substream_t *subs)
610 608
611/* 609/*
612 */ 610 */
613static int emu8k_pcm_prepare(snd_pcm_substream_t *subs) 611static int emu8k_pcm_prepare(struct snd_pcm_substream *subs)
614{ 612{
615 emu8k_pcm_t *rec = subs->runtime->private_data; 613 struct snd_emu8k_pcm *rec = subs->runtime->private_data;
616 614
617 rec->pitch = 0xe000 + calc_rate_offset(subs->runtime->rate); 615 rec->pitch = 0xe000 + calc_rate_offset(subs->runtime->rate);
618 rec->last_ptr = 0; 616 rec->last_ptr = 0;
@@ -656,16 +654,16 @@ static int emu8k_pcm_prepare(snd_pcm_substream_t *subs)
656 return 0; 654 return 0;
657} 655}
658 656
659static snd_pcm_uframes_t emu8k_pcm_pointer(snd_pcm_substream_t *subs) 657static snd_pcm_uframes_t emu8k_pcm_pointer(struct snd_pcm_substream *subs)
660{ 658{
661 emu8k_pcm_t *rec = subs->runtime->private_data; 659 struct snd_emu8k_pcm *rec = subs->runtime->private_data;
662 if (rec->running) 660 if (rec->running)
663 return emu8k_get_curpos(rec, 0); 661 return emu8k_get_curpos(rec, 0);
664 return 0; 662 return 0;
665} 663}
666 664
667 665
668static snd_pcm_ops_t emu8k_pcm_ops = { 666static struct snd_pcm_ops emu8k_pcm_ops = {
669 .open = emu8k_pcm_open, 667 .open = emu8k_pcm_open,
670 .close = emu8k_pcm_close, 668 .close = emu8k_pcm_close,
671 .ioctl = snd_pcm_lib_ioctl, 669 .ioctl = snd_pcm_lib_ioctl,
@@ -679,15 +677,15 @@ static snd_pcm_ops_t emu8k_pcm_ops = {
679}; 677};
680 678
681 679
682static void snd_emu8000_pcm_free(snd_pcm_t *pcm) 680static void snd_emu8000_pcm_free(struct snd_pcm *pcm)
683{ 681{
684 emu8000_t *emu = pcm->private_data; 682 struct snd_emu8000 *emu = pcm->private_data;
685 emu->pcm = NULL; 683 emu->pcm = NULL;
686} 684}
687 685
688int snd_emu8000_pcm_new(snd_card_t *card, emu8000_t *emu, int index) 686int snd_emu8000_pcm_new(struct snd_card *card, struct snd_emu8000 *emu, int index)
689{ 687{
690 snd_pcm_t *pcm; 688 struct snd_pcm *pcm;
691 int err; 689 int err;
692 690
693 if ((err = snd_pcm_new(card, "Emu8000 PCM", index, 1, 0, &pcm)) < 0) 691 if ((err = snd_pcm_new(card, "Emu8000 PCM", index, 1, 0, &pcm)) < 0)