2
* This software module makes it possible to use Open Ssund System for Linux
3
* (the _professional_ version) as a low level driver source for ALSA.
5
* Copyright (C) 2004-2006 Hannu Savolainen (hannu@voimakentta.net).
7
* This library is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU Lesser General Public
9
* License as published by the Free Software Foundation; either
10
* version 2.1 of the License.
12
* This library is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
* Lesser General Public License for more details.
21
* !!!!!!!!!!!!!!!!!!!! Important !!!!!!!!!!!!!!!!!!
23
* If this file doesn't compile, you must not try to resolve the problem
24
* without perfect understanding of internals of Linux kernel, ALSA and
27
* Instead you need to check that you are using the version of this file
28
* that matches the versions of ALSA, OSS and Linux you are currently using.
32
#include "../include/sys/soundcard.h"
34
#include <linux/version.h>
36
#define _LOOSE_KERNEL_NAMES
38
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,18)
39
#include <linux/config.h>
41
#include <linux/autoconf.h>
44
#if !defined(__SMP__) && defined(CONFIG_SMP)
47
#include <linux/module.h>
51
extern int oss_get_cardinfo (int cardnum, oss_card_info * ci); /* from oss_config.h */
53
#include <linux/param.h>
54
#include <linux/types.h>
55
#include <linux/errno.h>
56
#include <linux/signal.h>
57
#include <linux/fcntl.h>
58
#include <linux/sched.h>
59
#include <linux/timer.h>
60
#include <linux/tty.h>
62
#include <linux/ctype.h>
63
#include <linux/delay.h>
64
#include <linux/vmalloc.h>
65
#include <asm/processor.h>
67
#include <linux/pci.h>
68
#include <linux/apm_bios.h>
69
#include <asm/segment.h>
70
#include <asm/uaccess.h>
71
#include <linux/poll.h>
73
#include <asm/system.h>
75
#include <linux/wait.h>
76
#include <linux/slab.h>
77
#include <linux/string.h>
78
#include <linux/ioport.h>
79
//#include <asm/mach-default/irq_vectors.h>
80
#include <linux/interrupt.h>
85
/* Caution! This definition must match Linux/osscore.c */
89
#define audio_devs dummy_audio_devs
91
#include "../include/internals/oss_exports.h"
92
#include "../build/wrap.h"
93
#include "../include/internals/ossddk.h"
95
typedef struct oss_wait_queue oss_wait_queue_t; /* This must match oss_config.h */
97
#include "../include/internals/ossddk.h"
99
//#include <sound/driver.h>
100
#include <sound/core.h>
101
#include <sound/control.h>
102
#include <sound/pcm.h>
104
#include "../build/osscore_symbols.inc"
107
#include <sound/initval.h>
109
typedef caddr_t ioctl_arg;
110
typedef char snd_rw_buf;
112
typedef int sound_os_info;
114
#define WR_BUF_CONST const
116
#include "../include/internals/audio_core.h"
117
#include "../include/internals/mixer_core.h"
119
typedef struct _snd_cuckoo cuckoo_t, chip_t;
126
#define MAX_OSSPCM 24 // Max # of PCM devices/card instance
129
// Older ALSA versions used to define these...
130
typedef struct snd_card snd_card_t;
131
typedef struct snd_pcm snd_pcm_t;
132
typedef struct snd_rawmidi snd_rawmidi_t;
133
typedef struct snd_rawmidi_substream snd_rawmidi_substream_t;
134
typedef struct snd_rawmidi_ops snd_rawmidi_ops_t;
135
typedef struct snd_kcontrol snd_kcontrol_t;
136
typedef struct snd_kcontrol_new snd_kcontrol_new_t;
137
typedef struct snd_ctl_elem_info snd_ctl_elem_info_t;
138
typedef struct snd_ctl_elem_value snd_ctl_elem_value_t;
139
typedef struct snd_pcm_substream snd_pcm_substream_t;
140
typedef struct snd_pcm_hardware snd_pcm_hardware_t;
141
typedef struct snd_pcm_runtime snd_pcm_runtime_t;
142
typedef struct snd_pcm_hw_params snd_pcm_hw_params_t;
143
typedef struct snd_pcm_ops snd_pcm_ops_t;
144
typedef struct snd_device snd_device_t;
145
typedef struct snd_device_ops snd_device_ops_t;
151
snd_pcm_t *pcm[MAX_OSSPCM];
152
adev_p play_adev[MAX_OSSPCM], capture_adev[MAX_OSSPCM];
154
int nplay, ncapture, npcm;
157
#define cuckoo_t_magic 0xaabbccdd
158
#define chip__tmagic cuckoo_t_magic
160
//#define OPEN_READ PCM_ENABLE_INPUT
161
//#define OPEN_WRITE PCM_ENABLE_OUTPUT
163
extern int install_mixer_instances (cuckoo_t * chip, int cardno);
164
extern int install_midiport_instances (cuckoo_t * chip, int cardno);
165
extern int install_pcm_instances (cuckoo_t * chip, int cardno);
167
// Disable locking for now
168
#define udi_spin_lock_irqsave(a, b) *(b)=0
169
#define udi_spin_unlock_irqrestore(a, b)
171
#define strlcpy(a, b) {strncpy(a, b, sizeof(a)-1);a[sizeof(a)-1]=0;}