Changeset 212 for GPL/branches/alsa-resync1/alsa-kernel/drivers/mtpav.c
- Timestamp:
- Jul 14, 2007, 7:13:46 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GPL/branches/alsa-resync1/alsa-kernel/drivers/mtpav.c
r207 r212 2 2 * MOTU Midi Timepiece ALSA Main routines 3 3 * Copyright by Michael T. Mayers (c) Jan 09, 2000 4 * mail: tweakoz@pacbell.net4 * mail: michael@tweakoz.com 5 5 * Thanks to John Galbraith 6 6 * … … 45 45 * - Recoded & debugged 46 46 * - Added timer interrupt for midi outputs 47 * - snd_hwports is between 1 and 8, which specifies the number of hardware ports.47 * - hwports is between 1 and 8, which specifies the number of hardware ports. 48 48 * The three global ports, computer, adat and broadcast ports, are created 49 49 * always after h/w and remote ports. … … 55 55 #include <linux/init.h> 56 56 #include <linux/slab.h> 57 #include <linux/ioport.h> 57 58 #include <sound/core.h> 58 59 #define SNDRV_GET_ID … … 75 76 #define MTPAV_MAX_PORTS 8 76 77 77 static int snd_index = SNDRV_DEFAULT_IDX1;78 static char * snd_id = SNDRV_DEFAULT_STR1;79 static long snd_port = MTPAV_IOBASE; /* 0x378, 0x278 */80 static int snd_irq = MTPAV_IRQ; /* 7, 5 */81 static int snd_hwports = MTPAV_MAX_PORTS; /* use hardware ports 1-8 */82 83 MODULE_PARM( snd_index, "i");84 MODULE_PARM_DESC( snd_index, "Index value for MotuMTPAV MIDI.");85 MODULE_PARM_SYNTAX( snd_index, SNDRV_INDEX_DESC);86 MODULE_PARM( snd_id, "s");87 MODULE_PARM_DESC( snd_id, "ID string for MotuMTPAV MIDI.");88 MODULE_PARM_SYNTAX( snd_id, SNDRV_ID_DESC);89 MODULE_PARM( snd_port, "l");90 MODULE_PARM_DESC( snd_port, "Parallel port # for MotuMTPAV MIDI.");91 MODULE_PARM_SYNTAX( snd_port, SNDRV_ENABLED ",allows:{{0x378},{0x278}},dialog:list");92 MODULE_PARM( snd_irq, "i");93 MODULE_PARM_DESC( snd_irq, "Parallel IRQ # for MotuMTPAV MIDI.");94 MODULE_PARM_SYNTAX( snd_irq, SNDRV_ENABLED ",allows:{{7},{5}},dialog:list");95 MODULE_PARM( snd_hwports, "i");96 MODULE_PARM_DESC( snd_hwports, "Hardware ports # for MotuMTPAV MIDI.");97 MODULE_PARM_SYNTAX( snd_hwports, SNDRV_ENABLED ",allows:{{1,8}},dialog:list");78 static int index = SNDRV_DEFAULT_IDX1; 79 static char *id = SNDRV_DEFAULT_STR1; 80 static long port = MTPAV_IOBASE; /* 0x378, 0x278 */ 81 static int irq = MTPAV_IRQ; /* 7, 5 */ 82 static int hwports = MTPAV_MAX_PORTS; /* use hardware ports 1-8 */ 83 84 MODULE_PARM(index, "i"); 85 MODULE_PARM_DESC(index, "Index value for MotuMTPAV MIDI."); 86 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC); 87 MODULE_PARM(id, "s"); 88 MODULE_PARM_DESC(id, "ID string for MotuMTPAV MIDI."); 89 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC); 90 MODULE_PARM(port, "l"); 91 MODULE_PARM_DESC(port, "Parallel port # for MotuMTPAV MIDI."); 92 MODULE_PARM_SYNTAX(port, SNDRV_ENABLED ",allows:{{0x378},{0x278}},dialog:list"); 93 MODULE_PARM(irq, "i"); 94 MODULE_PARM_DESC(irq, "Parallel IRQ # for MotuMTPAV MIDI."); 95 MODULE_PARM_SYNTAX(irq, SNDRV_ENABLED ",allows:{{7},{5}},dialog:list"); 96 MODULE_PARM(hwports, "i"); 97 MODULE_PARM_DESC(hwports, "Hardware ports # for MotuMTPAV MIDI."); 98 MODULE_PARM_SYNTAX(hwports, SNDRV_ENABLED ",allows:{{1,8}},dialog:list"); 98 99 99 100 /* … … 421 422 } 422 423 424 /* spinlock held! */ 423 425 static void snd_mtpav_add_output_timer(mtpav_t *chip) 424 426 { 425 unsigned long flags;426 427 spin_lock_irqsave(&chip->spinlock, flags);428 427 chip->timer.function = snd_mtpav_output_timer; 429 428 chip->timer.data = (unsigned long) mtp_card; 430 429 chip->timer.expires = 1 + jiffies; 431 430 add_timer(&chip->timer); 432 spin_unlock_irqrestore(&chip->spinlock, flags); 433 } 434 431 } 432 433 /* spinlock held! */ 435 434 static void snd_mtpav_remove_output_timer(mtpav_t *chip) 436 435 { 437 unsigned long flags;438 439 spin_lock_irqsave(&chip->spinlock, flags);440 436 del_timer(&chip->timer); 441 spin_unlock_irqrestore(&chip->spinlock, flags);442 437 } 443 438 … … 510 505 511 506 port = &mcrd->ports[mcrd->inmidiport]; 512 if (port->mode & MTPAV_MODE_INPUT_TRIGGERED) 507 if (port->mode & MTPAV_MODE_INPUT_TRIGGERED) { 508 spin_unlock(&mcrd->spinlock); 513 509 snd_rawmidi_receive(port->input, &inbyte, 1); 510 spin_lock(&mcrd->spinlock); 511 } 514 512 } 515 513 … … 589 587 static int snd_mtpav_get_ISA(mtpav_t * mcard) 590 588 { 591 if ((mcard->res_port = request_region( snd_port, 3, "MotuMTPAV MIDI")) == NULL) {592 snd_printk("MTVAP port 0x%lx is busy\n", snd_port);589 if ((mcard->res_port = request_region(port, 3, "MotuMTPAV MIDI")) == NULL) { 590 snd_printk("MTVAP port 0x%lx is busy\n", port); 593 591 return -EBUSY; 594 592 } 595 mcard->port = snd_port;596 if (request_irq( snd_irq, snd_mtpav_irqh, SA_INTERRUPT, "MOTU MTPAV", (void *)mcard)) {597 snd_printk("MTVAP IRQ %d busy\n", snd_irq);593 mcard->port = port; 594 if (request_irq(irq, snd_mtpav_irqh, SA_INTERRUPT, "MOTU MTPAV", (void *)mcard)) { 595 snd_printk("MTVAP IRQ %d busy\n", irq); 598 596 return -EBUSY; 599 597 } 600 mcard->irq = snd_irq;598 mcard->irq = irq; 601 599 return 0; 602 600 } … … 606 604 */ 607 605 608 #ifdef TARGET_OS2609 606 static snd_rawmidi_ops_t snd_mtpav_output = { 610 snd_mtpav_output_open, 611 snd_mtpav_output_close, 612 snd_mtpav_output_trigger, 613 0 607 .open = snd_mtpav_output_open, 608 .close = snd_mtpav_output_close, 609 .trigger = snd_mtpav_output_trigger, 614 610 }; 615 611 616 612 static snd_rawmidi_ops_t snd_mtpav_input = { 617 snd_mtpav_input_open, 618 snd_mtpav_input_close, 619 snd_mtpav_input_trigger, 620 0 613 .open = snd_mtpav_input_open, 614 .close = snd_mtpav_input_close, 615 .trigger = snd_mtpav_input_trigger, 621 616 }; 622 #else 623 static snd_rawmidi_ops_t snd_mtpav_output = { 624 open: snd_mtpav_output_open, 625 close: snd_mtpav_output_close, 626 trigger: snd_mtpav_output_trigger, 627 }; 628 629 static snd_rawmidi_ops_t snd_mtpav_input = { 630 open: snd_mtpav_input_open, 631 close: snd_mtpav_input_close, 632 trigger: snd_mtpav_input_trigger, 633 }; 634 #endif 617 635 618 636 619 /* … … 661 644 //printk("entering snd_mtpav_get_RAWMIDI\n"); 662 645 663 if ( snd_hwports < 1)646 if (hwports < 1) 664 647 mcard->num_ports = 1; 665 else if ( snd_hwports > 8)648 else if (hwports > 8) 666 649 mcard->num_ports = 8; 667 650 else 668 mcard->num_ports = snd_hwports;651 mcard->num_ports = hwports; 669 652 670 653 if ((rval = snd_rawmidi_new(mcard->card, "MotuMIDI", 0, … … 746 729 return -ENOMEM; 747 730 748 mtp_card->card = snd_card_new( snd_index, snd_id, THIS_MODULE, 0);731 mtp_card->card = snd_card_new(index, id, THIS_MODULE, 0); 749 732 if (mtp_card->card == NULL) { 750 733 free_mtpav(mtp_card); … … 776 759 snd_mtpav_portscan(mtp_card); 777 760 778 printk(KERN_INFO "Motu MidiTimePiece on parallel port irq: %d ioport: 0x%lx\n", snd_irq, snd_port);761 printk(KERN_INFO "Motu MidiTimePiece on parallel port irq: %d ioport: 0x%lx\n", irq, port); 779 762 780 763 return 0; … … 806 789 #ifndef MODULE 807 790 808 /* format is: snd-mtpav=snd_enable, snd_index,snd_id,809 snd_port,snd_irq,snd_hwports */791 /* format is: snd-mtpav=snd_enable,index,id, 792 port,irq,hwports */ 810 793 811 794 static int __init alsa_card_mtpav_setup(char *str) … … 814 797 815 798 (void)(get_option(&str,&enable) == 2 && 816 get_option(&str,& snd_index) == 2 &&817 get_id(&str,& snd_id) == 2 &&818 get_option(&str,(int *)& snd_port) == 2 &&819 get_option(&str,& snd_irq) == 2 &&820 get_option(&str,& snd_hwports) == 2);799 get_option(&str,&index) == 2 && 800 get_id(&str,&id) == 2 && 801 get_option(&str,(int *)&port) == 2 && 802 get_option(&str,&irq) == 2 && 803 get_option(&str,&hwports) == 2); 821 804 return 1; 822 805 }
Note:
See TracChangeset
for help on using the changeset viewer.