~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/sound/initval.h

Version: ~ [ linux-6.0-rc6 ] ~ [ linux-5.19.10 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.69 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.144 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.214 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.259 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.294 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.329 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.302 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 #ifndef __SOUND_INITVAL_H
  2 #define __SOUND_INITVAL_H
  3 
  4 /*
  5  *  Init values for soundcard modules
  6  *  Copyright (c) by Jaroslav Kysela <perex@suse.cz>
  7  *
  8  *   This program is free software; you can redistribute it and/or modify
  9  *   it under the terms of the GNU General Public License as published by
 10  *   the Free Software Foundation; either version 2 of the License, or
 11  *   (at your option) any later version.
 12  *
 13  *   This program is distributed in the hope that it will be useful,
 14  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 15  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 16  *   GNU General Public License for more details.
 17  *
 18  *   You should have received a copy of the GNU General Public License
 19  *   along with this program; if not, write to the Free Software
 20  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 21  *
 22  */
 23 
 24 #ifndef MODULE_GENERIC_STRING
 25 #ifdef MODULE
 26 #define MODULE_GENERIC_STRING(name, string) \
 27 static const char __module_generic_string_##name [] \
 28   __attribute__ ((unused, __section__(".modstring"))) = #name "=" string;
 29 #else
 30 #define MODULE_GENERIC_STRING(name, string)
 31 #endif
 32 #endif
 33 
 34 #define MODULE_CLASSES(val) MODULE_GENERIC_STRING(info_classes, val)
 35 #define MODULE_DEVICES(val) MODULE_GENERIC_STRING(info_devices, val)
 36 #define MODULE_PARM_SYNTAX(id, val) MODULE_GENERIC_STRING(info_parm_##id, val)
 37 
 38 #define SNDRV_AUTO_PORT         0xffff
 39 #define SNDRV_AUTO_IRQ          0xffff
 40 #define SNDRV_AUTO_DMA          0xffff
 41 #define SNDRV_AUTO_DMA_SIZE     (0x7fffffff)
 42 
 43 #define SNDRV_DEFAULT_IDX1      (-1)
 44 #define SNDRV_DEFAULT_STR1      NULL
 45 #define SNDRV_DEFAULT_ENABLE1   1
 46 #define SNDRV_DEFAULT_PORT1     SNDRV_AUTO_PORT
 47 #define SNDRV_DEFAULT_IRQ1      SNDRV_AUTO_IRQ
 48 #define SNDRV_DEFAULT_DMA1      SNDRV_AUTO_DMA
 49 #define SNDRV_DEFAULT_DMA_SIZE1 SNDRV_AUTO_DMA_SIZE
 50 #define SNDRV_DEFAULT_PTR1      SNDRV_DEFAULT_STR1
 51 
 52 #define SNDRV_DEFAULT_IDX       { [0 ... (SNDRV_CARDS-1)] = -1 }
 53 #define SNDRV_DEFAULT_STR       { [0 ... (SNDRV_CARDS-1)] = NULL }
 54 #define SNDRV_DEFAULT_ENABLE    { 1, [1 ... (SNDRV_CARDS-1)] = 0 }
 55 #define SNDRV_DEFAULT_ENABLE_PNP { [0 ... (SNDRV_CARDS-1)] = 1 }
 56 #ifdef CONFIG_PNP
 57 #define SNDRV_DEFAULT_ENABLE_ISAPNP SNDRV_DEFAULT_ENABLE_PNP
 58 #else
 59 #define SNDRV_DEFAULT_ENABLE_ISAPNP SNDRV_DEFAULT_ENABLE
 60 #endif
 61 #define SNDRV_DEFAULT_PORT      { SNDRV_AUTO_PORT, [1 ... (SNDRV_CARDS-1)] = -1 }
 62 #define SNDRV_DEFAULT_IRQ       { [0 ... (SNDRV_CARDS-1)] = SNDRV_AUTO_IRQ }
 63 #define SNDRV_DEFAULT_DMA       { [0 ... (SNDRV_CARDS-1)] = SNDRV_AUTO_DMA }
 64 #define SNDRV_DEFAULT_DMA_SIZE  { [0 ... (SNDRV_CARDS-1)] = SNDRV_AUTO_DMA_SIZE }
 65 #define SNDRV_DEFAULT_PTR       SNDRV_DEFAULT_STR
 66 
 67 #define SNDRV_BOOLEAN_TRUE_DESC "allows:{{0,Disabled},{1,Enabled}},default:1,dialog:check"
 68 #define SNDRV_BOOLEAN_FALSE_DESC "allows:{{0,Disabled},{1,Enabled}},default:0,dialog:check"
 69 
 70 #define SNDRV_ENABLED           "enable:(enable)"
 71 
 72 #define SNDRV_INDEX_DESC        SNDRV_ENABLED ",allows:{{0,7}},unique,skill:required,dialog:list"
 73 #define SNDRV_ID_DESC           SNDRV_ENABLED ",unique"
 74 #define SNDRV_ENABLE_DESC       SNDRV_BOOLEAN_FALSE_DESC
 75 #define SNDRV_ISAPNP_DESC       SNDRV_ENABLED "," SNDRV_BOOLEAN_TRUE_DESC
 76 #define SNDRV_DMA8_DESC         SNDRV_ENABLED ",allows:{{0,1},{3}},dialog:list"
 77 #define SNDRV_DMA16_DESC        SNDRV_ENABLED ",allows:{{5,7}},dialog:list"
 78 #define SNDRV_DMA_DESC          SNDRV_ENABLED ",allows:{{0,1},{3},{5,7}},dialog:list"
 79 #define SNDRV_IRQ_DESC          SNDRV_ENABLED ",allows:{{5},{7},{9},{10,12},{14,15}},dialog:list"
 80 #define SNDRV_DMA_SIZE_DESC     SNDRV_ENABLED ",allows:{{4,128}},default:64,skill:advanced"
 81 #define SNDRV_DMA8_SIZE_DESC    SNDRV_ENABLED ",allows:{{4, 64}},default:64,skill:advanced"
 82 #define SNDRV_DMA16_SIZE_DESC   SNDRV_ENABLED ",allows:{{4,128}},default:64,skill:advanced"
 83 #define SNDRV_PORT12_DESC       SNDRV_ENABLED ",allows:{{0,0x3fff}},base:16"
 84 #define SNDRV_PORT_DESC         SNDRV_ENABLED ",allows:{{0,0xffff}},base:16"
 85 
 86 #ifdef SNDRV_LEGACY_AUTO_PROBE
 87 static int snd_legacy_auto_probe(unsigned long *ports, int (*probe)(unsigned long port))
 88 {
 89         int result = 0; /* number of detected cards */
 90 
 91         while ((signed long)*ports != -1) {
 92                 if (probe(*ports) >= 0)
 93                         result++;
 94                 ports++;
 95         }
 96         return result;
 97 }
 98 #endif
 99 
100 #ifdef SNDRV_LEGACY_FIND_FREE_IRQ
101 #include <linux/interrupt.h>
102 
103 static irqreturn_t snd_legacy_empty_irq_handler(int irq, void *dev_id, struct pt_regs *regs)
104 {
105         return IRQ_HANDLED;
106 }
107 
108 static int snd_legacy_find_free_irq(int *irq_table)
109 {
110         while (*irq_table != -1) {
111                 if (!request_irq(*irq_table, snd_legacy_empty_irq_handler,
112                                  SA_INTERRUPT, "ALSA Test IRQ", (void *) irq_table)) {
113                         free_irq(*irq_table, (void *) irq_table);
114                         return *irq_table;
115                 }
116                 irq_table++;
117         }
118         return -1;
119 }
120 #endif
121 
122 #ifdef SNDRV_LEGACY_FIND_FREE_DMA
123 static int snd_legacy_find_free_dma(int *dma_table)
124 {
125         while (*dma_table != -1) {
126                 if (!request_dma(*dma_table, "ALSA Test DMA")) {
127                         free_dma(*dma_table);
128                         return *dma_table;
129                 }
130                 dma_table++;
131         }
132         return -1;
133 }
134 #endif
135 
136 #if defined(SNDRV_GET_ID) && !defined(MODULE)
137 #include <linux/ctype.h>
138 #include <linux/init.h>
139 static int __init get_id(char **str, char **dst)
140 {
141         char *s, *d;
142 
143         if (!(*str) || !(**str))
144                 return 0;
145         for (s = *str; isalpha(*s) || isdigit(*s) || *s == '_'; s++);
146         if (s != *str) {
147                 *dst = (char *)kmalloc((s - *str) + 1, GFP_KERNEL);
148                 s = *str; d = *dst;
149                 while (isalpha(*s) || isdigit(*s) || *s == '_') {
150                         if (d != NULL)
151                                 *d++ = *s;
152                         s++;
153                 }
154                 if (d != NULL)
155                         *d = '\0';
156         }
157         *str = s;
158         if (*s == ',') {
159                 (*str)++;
160                 return 2;
161         }
162         return 1;
163 }
164 #endif
165 
166 #endif /* __SOUND_INITVAL_H */
167 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp