1 /* 2 * linux/kernel/chr_drv/sound/dev_table.c 3 * 4 * Device call tables. 5 * 6 * Copyright by Hannu Savolainen 1993 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions are 10 * met: 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 2. 12 * Redistributions in binary form must reproduce the above copyright notice, 13 * this list of conditions and the following disclaimer in the documentation 14 * and/or other materials provided with the distribution. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR 20 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 22 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 23 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 * 28 */ 29
30 #define_DEV_TABLE_C_ 31 #include "sound_config.h"
32
33 #ifdefCONFIGURE_SOUNDCARD 34
35 long 36 sndtable_init (longmem_start)
/* */ 37 { 38 inti, n = sizeof (supported_drivers) / sizeof (structcard_info);
39
40 for (i = 0; i < (n - 1); i++)
41 if (supported_drivers[i].probe (&supported_drivers[i].config))
42 { 43 #ifndefSHORT_BANNERS 44 printk ("snd%d",
45 supported_drivers[i].card_type);
46 #endif 47
48 mem_start = supported_drivers[i].attach (mem_start, &supported_drivers[i].config);
49 #ifndefSHORT_BANNERS 50 printk (" at 0x%3x irq %d drq %d\n",
51 supported_drivers[i].config.io_base,
52 supported_drivers[i].config.irq,
53 supported_drivers[i].config.dma);
54 #endif 55 } 56 returnmem_start;
57 } 58
59 int 60 sndtable_probe (intunit, structaddress_info *hw_config)
/* */ 61 { 62 inti, n = sizeof (supported_drivers) / sizeof (structcard_info);
63
64 if (!unit)
65 returnTRUE;
66
67 for (i = 0; i < (n - 1); i++)
68 if (supported_drivers[i].card_type == unit)
69 returnsupported_drivers[i].probe (hw_config);
70
71 returnFALSE;
72 } 73
74 int 75 sndtable_init_card (intunit, structaddress_info *hw_config)
/* */ 76 { 77 inti, n = sizeof (supported_drivers) / sizeof (structcard_info);
78
79 if (!unit)
80 { 81 if (sndtable_init (0) != 0)
82 panic ("snd: Invalid memory allocation\n");
83 returnTRUE;
84 } 85
86 for (i = 0; i < (n - 1); i++)
87 if (supported_drivers[i].card_type == unit)
88 { 89 if (supported_drivers[i].attach (0, hw_config) != 0)
90 panic ("snd#: Invalid memory allocation\n");
91 returnTRUE;
92 } 93
94 returnFALSE;
95 } 96
97 int 98 sndtable_get_cardcount (void)
/* */ 99 { 100 returnnum_dspdevs + num_mixers + num_synths + num_midis;
101 } 102
103 #endif