root/drivers/sound/dev_table.c

/* [previous][next][first][last][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. sndtable_init
  2. sndtable_probe
  3. sndtable_init_card
  4. sndtable_get_cardcount

   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 #ifdef CONFIGURE_SOUNDCARD
  34 
  35 long
  36 sndtable_init (long mem_start)
     /* [previous][next][first][last][top][bottom][index][help] */
  37 {
  38   int             i, n = sizeof (supported_drivers) / sizeof (struct card_info);
  39 
  40   for (i = 0; i < (n - 1); i++)
  41     if (supported_drivers[i].probe (&supported_drivers[i].config))
  42       {
  43 #ifndef SHORT_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 #ifndef SHORT_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   return mem_start;
  57 }
  58 
  59 int
  60 sndtable_probe (int unit, struct address_info *hw_config)
     /* [previous][next][first][last][top][bottom][index][help] */
  61 {
  62   int             i, n = sizeof (supported_drivers) / sizeof (struct card_info);
  63 
  64   if (!unit)
  65     return TRUE;
  66 
  67   for (i = 0; i < (n - 1); i++)
  68     if (supported_drivers[i].card_type == unit)
  69       return supported_drivers[i].probe (hw_config);
  70 
  71   return FALSE;
  72 }
  73 
  74 int
  75 sndtable_init_card (int unit, struct address_info *hw_config)
     /* [previous][next][first][last][top][bottom][index][help] */
  76 {
  77   int             i, n = sizeof (supported_drivers) / sizeof (struct card_info);
  78 
  79   if (!unit)
  80     {
  81       if (sndtable_init (0) != 0)
  82         panic ("snd: Invalid memory allocation\n");
  83       return TRUE;
  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         return TRUE;
  92       }
  93 
  94   return FALSE;
  95 }
  96 
  97 int
  98 sndtable_get_cardcount (void)
     /* [previous][next][first][last][top][bottom][index][help] */
  99 {
 100   return num_dspdevs + num_mixers + num_synths + num_midis;
 101 }
 102 
 103 #endif

/* [previous][next][first][last][top][bottom][index][help] */