0001
0002 #ifndef __SOUND_INITVAL_H
0003 #define __SOUND_INITVAL_H
0004
0005
0006
0007
0008
0009
0010 #define SNDRV_AUTO_PORT 1
0011 #define SNDRV_AUTO_IRQ 0xffff
0012 #define SNDRV_AUTO_DMA 0xffff
0013 #define SNDRV_AUTO_DMA_SIZE (0x7fffffff)
0014
0015 #define SNDRV_DEFAULT_IDX1 (-1)
0016 #define SNDRV_DEFAULT_STR1 NULL
0017 #define SNDRV_DEFAULT_ENABLE1 1
0018 #define SNDRV_DEFAULT_PORT1 SNDRV_AUTO_PORT
0019 #define SNDRV_DEFAULT_IRQ1 SNDRV_AUTO_IRQ
0020 #define SNDRV_DEFAULT_DMA1 SNDRV_AUTO_DMA
0021 #define SNDRV_DEFAULT_DMA_SIZE1 SNDRV_AUTO_DMA_SIZE
0022 #define SNDRV_DEFAULT_PTR1 SNDRV_DEFAULT_STR1
0023
0024 #define SNDRV_DEFAULT_IDX { [0 ... (SNDRV_CARDS-1)] = -1 }
0025 #define SNDRV_DEFAULT_STR { [0 ... (SNDRV_CARDS-1)] = NULL }
0026 #define SNDRV_DEFAULT_ENABLE { 1, [1 ... (SNDRV_CARDS-1)] = 0 }
0027 #define SNDRV_DEFAULT_ENABLE_PNP { [0 ... (SNDRV_CARDS-1)] = 1 }
0028 #ifdef CONFIG_PNP
0029 #define SNDRV_DEFAULT_ENABLE_ISAPNP SNDRV_DEFAULT_ENABLE_PNP
0030 #else
0031 #define SNDRV_DEFAULT_ENABLE_ISAPNP SNDRV_DEFAULT_ENABLE
0032 #endif
0033 #define SNDRV_DEFAULT_PORT { [0 ... (SNDRV_CARDS-1)] = SNDRV_AUTO_PORT }
0034 #define SNDRV_DEFAULT_IRQ { [0 ... (SNDRV_CARDS-1)] = SNDRV_AUTO_IRQ }
0035 #define SNDRV_DEFAULT_DMA { [0 ... (SNDRV_CARDS-1)] = SNDRV_AUTO_DMA }
0036 #define SNDRV_DEFAULT_DMA_SIZE { [0 ... (SNDRV_CARDS-1)] = SNDRV_AUTO_DMA_SIZE }
0037 #define SNDRV_DEFAULT_PTR SNDRV_DEFAULT_STR
0038
0039 #ifdef SNDRV_LEGACY_FIND_FREE_IOPORT
0040 static long snd_legacy_find_free_ioport(const long *port_table, long size)
0041 {
0042 while (*port_table != -1) {
0043 if (request_region(*port_table, size, "ALSA test")) {
0044 release_region(*port_table, size);
0045 return *port_table;
0046 }
0047 port_table++;
0048 }
0049 return -1;
0050 }
0051 #endif
0052
0053 #ifdef SNDRV_LEGACY_FIND_FREE_IRQ
0054 #include <linux/interrupt.h>
0055
0056 static irqreturn_t snd_legacy_empty_irq_handler(int irq, void *dev_id)
0057 {
0058 return IRQ_HANDLED;
0059 }
0060
0061 static int snd_legacy_find_free_irq(const int *irq_table)
0062 {
0063 while (*irq_table != -1) {
0064 if (!request_irq(*irq_table, snd_legacy_empty_irq_handler,
0065 IRQF_PROBE_SHARED, "ALSA Test IRQ",
0066 (void *) irq_table)) {
0067 free_irq(*irq_table, (void *) irq_table);
0068 return *irq_table;
0069 }
0070 irq_table++;
0071 }
0072 return -1;
0073 }
0074 #endif
0075
0076 #ifdef SNDRV_LEGACY_FIND_FREE_DMA
0077 static int snd_legacy_find_free_dma(const int *dma_table)
0078 {
0079 while (*dma_table != -1) {
0080 if (!request_dma(*dma_table, "ALSA Test DMA")) {
0081 free_dma(*dma_table);
0082 return *dma_table;
0083 }
0084 dma_table++;
0085 }
0086 return -1;
0087 }
0088 #endif
0089
0090 #endif