1 #ifndef __SOUND_INITVAL_H
2 #define __SOUND_INITVAL_H
5 * Init values for soundcard modules
6 * Copyright (c) by Jaroslav Kysela <perex@suse.cz>
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.
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.
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
24 #ifndef MODULE_GENERIC_STRING
26 #define MODULE_GENERIC_STRING(name, string) \
27 static const char __module_generic_string_##name [] \
28 __attribute__ ((unused, __section__(".modstring"))) = #name "=" string;
30 #define MODULE_GENERIC_STRING(name, string)
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)
38 #define SNDRV_AUTO_PORT 1
39 #define SNDRV_AUTO_IRQ 0xffff
40 #define SNDRV_AUTO_DMA 0xffff
41 #define SNDRV_AUTO_DMA_SIZE (0x7fffffff)
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
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 }
57 #define SNDRV_DEFAULT_ENABLE_ISAPNP SNDRV_DEFAULT_ENABLE_PNP
59 #define SNDRV_DEFAULT_ENABLE_ISAPNP SNDRV_DEFAULT_ENABLE
61 #define SNDRV_DEFAULT_PORT { [0 ... (SNDRV_CARDS-1)] = SNDRV_AUTO_PORT }
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
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"
70 #define SNDRV_ENABLED "enable:(enable)"
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"
86 #ifdef SNDRV_LEGACY_AUTO_PROBE
87 static int snd_legacy_auto_probe(unsigned long *ports, int (*probe)(unsigned long port))
89 int result = 0; /* number of detected cards */
91 while ((signed long)*ports != -1) {
92 if (probe(*ports) >= 0)
100 #ifdef SNDRV_LEGACY_FIND_FREE_IRQ
101 #include <linux/interrupt.h>
103 static irqreturn_t snd_legacy_empty_irq_handler(int irq, void *dev_id, struct pt_regs *regs)
108 static int snd_legacy_find_free_irq(int *irq_table)
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);
122 #ifdef SNDRV_LEGACY_FIND_FREE_DMA
123 static int snd_legacy_find_free_dma(int *dma_table)
125 while (*dma_table != -1) {
126 if (!request_dma(*dma_table, "ALSA Test DMA")) {
127 free_dma(*dma_table);
136 #if defined(SNDRV_GET_ID) && !defined(MODULE)
137 #include <linux/ctype.h>
138 #include <linux/init.h>
139 #include <linux/bootmem.h>
140 static int __init get_id(char **str, char **dst)
144 if (!(*str) || !(**str))
146 for (s = *str; isalpha(*s) || isdigit(*s) || *s == '_'; s++);
149 char *d = (char *)alloc_bootmem(len + 1);
151 memcpy(*dst = d, *str, len);
164 /* simple wrapper for long variable.
165 * the value more than 32bit won't work!
167 inline static int get_option_long(char **str, long *valp)
170 ret = get_option(str, &val);
176 #endif /* __SOUND_INITVAL_H */