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 <linux/time.h>
25 #include <linux/wait.h>
26 #include <linux/slab.h>
27 #include <linux/sched.h>
28 #include <sound/core.h>
29 #include <sound/seq_oss.h>
30 #include <sound/rawmidi.h>
31 #include <sound/seq_kernel.h>
32 #include <sound/info.h>
34 /* enable debug print */
35 #define SNDRV_SEQ_OSS_DEBUG
37 /* max. applications */
38 #define SNDRV_SEQ_OSS_MAX_CLIENTS 16
39 #define SNDRV_SEQ_OSS_MAX_SYNTH_DEVS 16
40 #define SNDRV_SEQ_OSS_MAX_MIDI_DEVS 32
43 #define SNDRV_SEQ_OSS_MAJOR_VERSION 0
44 #define SNDRV_SEQ_OSS_MINOR_VERSION 1
45 #define SNDRV_SEQ_OSS_TINY_VERSION 8
46 #define SNDRV_SEQ_OSS_VERSION_STR "0.1.8"
48 /* device and proc interface name */
49 #define SNDRV_SEQ_OSS_DEVNAME "seq_oss"
50 #define SNDRV_SEQ_OSS_PROCNAME "oss"
57 typedef unsigned int reltime_t
;
58 typedef unsigned int abstime_t
;
62 * synthesizer channel information
64 struct seq_oss_chinfo
{
69 * synthesizer information
71 struct seq_oss_synthinfo
{
72 struct snd_seq_oss_arg arg
;
73 struct seq_oss_chinfo
*ch
;
74 struct seq_oss_synth_sysex
*sysex
;
83 * sequencer client information
86 struct seq_oss_devinfo
{
88 int index
; /* application index */
89 int cseq
; /* sequencer client number */
90 int port
; /* sequencer port number */
91 int queue
; /* sequencer queue number */
93 struct snd_seq_addr addr
; /* address of this device */
95 int seq_mode
; /* sequencer mode */
96 int file_mode
; /* file access */
98 /* midi device table */
101 /* synth device table */
103 struct seq_oss_synthinfo synths
[SNDRV_SEQ_OSS_MAX_SYNTH_DEVS
];
107 struct seq_oss_writeq
*writeq
;
109 /* midi input queue */
110 struct seq_oss_readq
*readq
;
113 struct seq_oss_timer
*timer
;
118 * function prototypes
121 /* create/delete OSS sequencer client */
122 int snd_seq_oss_create_client(void);
123 int snd_seq_oss_delete_client(void);
125 /* device file interface */
126 int snd_seq_oss_open(struct file
*file
, int level
);
127 void snd_seq_oss_release(struct seq_oss_devinfo
*dp
);
128 int snd_seq_oss_ioctl(struct seq_oss_devinfo
*dp
, unsigned int cmd
, unsigned long arg
);
129 int snd_seq_oss_read(struct seq_oss_devinfo
*dev
, char __user
*buf
, int count
);
130 int snd_seq_oss_write(struct seq_oss_devinfo
*dp
, const char __user
*buf
, int count
, struct file
*opt
);
131 unsigned int snd_seq_oss_poll(struct seq_oss_devinfo
*dp
, struct file
*file
, poll_table
* wait
);
133 void snd_seq_oss_reset(struct seq_oss_devinfo
*dp
);
134 void snd_seq_oss_drain_write(struct seq_oss_devinfo
*dp
);
137 void snd_seq_oss_process_queue(struct seq_oss_devinfo
*dp
, abstime_t time
);
141 void snd_seq_oss_system_info_read(struct snd_info_buffer
*buf
);
142 void snd_seq_oss_midi_info_read(struct snd_info_buffer
*buf
);
143 void snd_seq_oss_synth_info_read(struct snd_info_buffer
*buf
);
144 void snd_seq_oss_readq_info_read(struct seq_oss_readq
*q
, struct snd_info_buffer
*buf
);
146 /* file mode macros */
147 #define is_read_mode(mode) ((mode) & SNDRV_SEQ_OSS_FILE_READ)
148 #define is_write_mode(mode) ((mode) & SNDRV_SEQ_OSS_FILE_WRITE)
149 #define is_nonblock_mode(mode) ((mode) & SNDRV_SEQ_OSS_FILE_NONBLOCK)
153 snd_seq_oss_dispatch(struct seq_oss_devinfo
*dp
, struct snd_seq_event
*ev
, int atomic
, int hop
)
155 return snd_seq_kernel_client_dispatch(dp
->cseq
, ev
, atomic
, hop
);
160 snd_seq_oss_control(struct seq_oss_devinfo
*dp
, unsigned int type
, void *arg
)
162 return snd_seq_kernel_client_ctl(dp
->cseq
, type
, arg
);
165 /* fill the addresses in header */
167 snd_seq_oss_fill_addr(struct seq_oss_devinfo
*dp
, struct snd_seq_event
*ev
,
168 int dest_client
, int dest_port
)
170 ev
->queue
= dp
->queue
;
171 ev
->source
= dp
->addr
;
172 ev
->dest
.client
= dest_client
;
173 ev
->dest
.port
= dest_port
;
177 /* misc. functions for proc interface */
178 char *enabled_str(int bool);
182 #ifdef SNDRV_SEQ_OSS_DEBUG
183 extern int seq_oss_debug
;
184 #define debug_printk(x) do { if (seq_oss_debug > 0) snd_printk x; } while (0)
186 #define debug_printk(x) /**/
189 #endif /* __SEQ_OSS_DEVICE_H */