1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21#ifndef __SEQ_OSS_DEVICE_H
22#define __SEQ_OSS_DEVICE_H
23
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>
33
34
35#define SNDRV_SEQ_OSS_DEBUG
36
37
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
41
42
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"
47
48
49#define SNDRV_SEQ_OSS_DEVNAME "seq_oss"
50#define SNDRV_SEQ_OSS_PROCNAME "oss"
51
52
53
54
55
56
57typedef unsigned int reltime_t;
58typedef unsigned int abstime_t;
59
60
61
62
63
64struct seq_oss_chinfo {
65 int note, vel;
66};
67
68
69
70
71struct seq_oss_synthinfo {
72 struct snd_seq_oss_arg arg;
73 struct seq_oss_chinfo *ch;
74 struct seq_oss_synth_sysex *sysex;
75 int nr_voices;
76 int opened;
77 int is_midi;
78 int midi_mapped;
79};
80
81
82
83
84
85
86struct seq_oss_devinfo {
87
88 int index;
89 int cseq;
90 int port;
91 int queue;
92
93 struct snd_seq_addr addr;
94
95 int seq_mode;
96 int file_mode;
97
98
99 int max_mididev;
100
101
102 int max_synthdev;
103 struct seq_oss_synthinfo synths[SNDRV_SEQ_OSS_MAX_SYNTH_DEVS];
104 int synth_opened;
105
106
107 struct seq_oss_writeq *writeq;
108
109
110 struct seq_oss_readq *readq;
111
112
113 struct seq_oss_timer *timer;
114};
115
116
117
118
119
120
121
122int snd_seq_oss_create_client(void);
123int snd_seq_oss_delete_client(void);
124
125
126int snd_seq_oss_open(struct file *file, int level);
127void snd_seq_oss_release(struct seq_oss_devinfo *dp);
128int snd_seq_oss_ioctl(struct seq_oss_devinfo *dp, unsigned int cmd, unsigned long arg);
129int snd_seq_oss_read(struct seq_oss_devinfo *dev, char __user *buf, int count);
130int snd_seq_oss_write(struct seq_oss_devinfo *dp, const char __user *buf, int count, struct file *opt);
131unsigned int snd_seq_oss_poll(struct seq_oss_devinfo *dp, struct file *file, poll_table * wait);
132
133void snd_seq_oss_reset(struct seq_oss_devinfo *dp);
134void snd_seq_oss_drain_write(struct seq_oss_devinfo *dp);
135
136
137void snd_seq_oss_process_queue(struct seq_oss_devinfo *dp, abstime_t time);
138
139
140
141void snd_seq_oss_system_info_read(struct snd_info_buffer *buf);
142void snd_seq_oss_midi_info_read(struct snd_info_buffer *buf);
143void snd_seq_oss_synth_info_read(struct snd_info_buffer *buf);
144void snd_seq_oss_readq_info_read(struct seq_oss_readq *q, struct snd_info_buffer *buf);
145
146
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)
150
151
152static inline int
153snd_seq_oss_dispatch(struct seq_oss_devinfo *dp, struct snd_seq_event *ev, int atomic, int hop)
154{
155 return snd_seq_kernel_client_dispatch(dp->cseq, ev, atomic, hop);
156}
157
158
159static inline int
160snd_seq_oss_control(struct seq_oss_devinfo *dp, unsigned int type, void *arg)
161{
162 return snd_seq_kernel_client_ctl(dp->cseq, type, arg);
163}
164
165
166static inline void
167snd_seq_oss_fill_addr(struct seq_oss_devinfo *dp, struct snd_seq_event *ev,
168 int dest_client, int dest_port)
169{
170 ev->queue = dp->queue;
171 ev->source = dp->addr;
172 ev->dest.client = dest_client;
173 ev->dest.port = dest_port;
174}
175
176
177
178char *enabled_str(int bool);
179
180
181
182#ifdef SNDRV_SEQ_OSS_DEBUG
183extern int seq_oss_debug;
184#define debug_printk(x) do { if (seq_oss_debug > 0) snd_printd x; } while (0)
185#else
186#define debug_printk(x)
187#endif
188
189#endif
190