[PATCH] Avoid console spam with ext3 aborted journal.
[linux-2.6/verdex.git] / sound / core / seq / oss / seq_oss_device.h
blobda23c4db8dd5f9e01fb3ada1e4a147314e629fae
1 /*
2 * OSS compatible sequencer driver
4 * Copyright (C) 1998,99 Takashi Iwai <tiwai@suse.de>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #ifndef __SEQ_OSS_DEVICE_H
22 #define __SEQ_OSS_DEVICE_H
24 #include <sound/driver.h>
25 #include <linux/time.h>
26 #include <linux/wait.h>
27 #include <linux/slab.h>
28 #include <linux/sched.h>
29 #include <sound/core.h>
30 #include <sound/seq_oss.h>
31 #include <sound/rawmidi.h>
32 #include <sound/seq_kernel.h>
33 #include <sound/info.h>
35 /* enable debug print */
36 #define SNDRV_SEQ_OSS_DEBUG
38 /* max. applications */
39 #define SNDRV_SEQ_OSS_MAX_CLIENTS 16
40 #define SNDRV_SEQ_OSS_MAX_SYNTH_DEVS 16
41 #define SNDRV_SEQ_OSS_MAX_MIDI_DEVS 32
43 /* version */
44 #define SNDRV_SEQ_OSS_MAJOR_VERSION 0
45 #define SNDRV_SEQ_OSS_MINOR_VERSION 1
46 #define SNDRV_SEQ_OSS_TINY_VERSION 8
47 #define SNDRV_SEQ_OSS_VERSION_STR "0.1.8"
49 /* device and proc interface name */
50 #define SNDRV_SEQ_OSS_DEVNAME "seq_oss"
51 #define SNDRV_SEQ_OSS_PROCNAME "oss"
55 * type definitions
58 typedef struct seq_oss_devinfo_t seq_oss_devinfo_t;
59 typedef struct seq_oss_writeq_t seq_oss_writeq_t;
60 typedef struct seq_oss_readq_t seq_oss_readq_t;
61 typedef struct seq_oss_timer_t seq_oss_timer_t;
62 typedef struct seq_oss_synthinfo_t seq_oss_synthinfo_t;
63 typedef struct seq_oss_synth_sysex_t seq_oss_synth_sysex_t;
64 typedef struct seq_oss_chinfo_t seq_oss_chinfo_t;
65 typedef unsigned int reltime_t;
66 typedef unsigned int abstime_t;
67 typedef union evrec_t evrec_t;
71 * synthesizer channel information
73 struct seq_oss_chinfo_t {
74 int note, vel;
78 * synthesizer information
80 struct seq_oss_synthinfo_t {
81 snd_seq_oss_arg_t arg;
82 seq_oss_chinfo_t *ch;
83 seq_oss_synth_sysex_t *sysex;
84 int nr_voices;
85 int opened;
86 int is_midi;
87 int midi_mapped;
92 * sequencer client information
95 struct seq_oss_devinfo_t {
97 int index; /* application index */
98 int cseq; /* sequencer client number */
99 int port; /* sequencer port number */
100 int queue; /* sequencer queue number */
102 snd_seq_addr_t addr; /* address of this device */
104 int seq_mode; /* sequencer mode */
105 int file_mode; /* file access */
107 /* midi device table */
108 int max_mididev;
110 /* synth device table */
111 int max_synthdev;
112 seq_oss_synthinfo_t synths[SNDRV_SEQ_OSS_MAX_SYNTH_DEVS];
113 int synth_opened;
115 /* output queue */
116 seq_oss_writeq_t *writeq;
118 /* midi input queue */
119 seq_oss_readq_t *readq;
121 /* timer */
122 seq_oss_timer_t *timer;
127 * function prototypes
130 /* create/delete OSS sequencer client */
131 int snd_seq_oss_create_client(void);
132 int snd_seq_oss_delete_client(void);
134 /* device file interface */
135 int snd_seq_oss_open(struct file *file, int level);
136 void snd_seq_oss_release(seq_oss_devinfo_t *dp);
137 int snd_seq_oss_ioctl(seq_oss_devinfo_t *dp, unsigned int cmd, unsigned long arg);
138 int snd_seq_oss_read(seq_oss_devinfo_t *dev, char __user *buf, int count);
139 int snd_seq_oss_write(seq_oss_devinfo_t *dp, const char __user *buf, int count, struct file *opt);
140 unsigned int snd_seq_oss_poll(seq_oss_devinfo_t *dp, struct file *file, poll_table * wait);
142 void snd_seq_oss_reset(seq_oss_devinfo_t *dp);
143 void snd_seq_oss_drain_write(seq_oss_devinfo_t *dp);
145 /* */
146 void snd_seq_oss_process_queue(seq_oss_devinfo_t *dp, abstime_t time);
149 /* proc interface */
150 void snd_seq_oss_system_info_read(snd_info_buffer_t *buf);
151 void snd_seq_oss_midi_info_read(snd_info_buffer_t *buf);
152 void snd_seq_oss_synth_info_read(snd_info_buffer_t *buf);
153 void snd_seq_oss_readq_info_read(seq_oss_readq_t *q, snd_info_buffer_t *buf);
155 /* file mode macros */
156 #define is_read_mode(mode) ((mode) & SNDRV_SEQ_OSS_FILE_READ)
157 #define is_write_mode(mode) ((mode) & SNDRV_SEQ_OSS_FILE_WRITE)
158 #define is_nonblock_mode(mode) ((mode) & SNDRV_SEQ_OSS_FILE_NONBLOCK)
160 /* dispatch event */
161 inline static int
162 snd_seq_oss_dispatch(seq_oss_devinfo_t *dp, snd_seq_event_t *ev, int atomic, int hop)
164 return snd_seq_kernel_client_dispatch(dp->cseq, ev, atomic, hop);
167 /* ioctl */
168 inline static int
169 snd_seq_oss_control(seq_oss_devinfo_t *dp, unsigned int type, void *arg)
171 return snd_seq_kernel_client_ctl(dp->cseq, type, arg);
174 /* fill the addresses in header */
175 inline static void
176 snd_seq_oss_fill_addr(seq_oss_devinfo_t *dp, snd_seq_event_t *ev,
177 int dest_client, int dest_port)
179 ev->queue = dp->queue;
180 ev->source = dp->addr;
181 ev->dest.client = dest_client;
182 ev->dest.port = dest_port;
186 /* misc. functions for proc interface */
187 char *enabled_str(int bool);
190 /* for debug */
191 #ifdef SNDRV_SEQ_OSS_DEBUG
192 extern int seq_oss_debug;
193 #define debug_printk(x) do { if (seq_oss_debug > 0) snd_printk x; } while (0)
194 #else
195 #define debug_printk(x) /**/
196 #endif
198 #endif /* __SEQ_OSS_DEVICE_H */