xref: /OK3568_Linux_fs/kernel/include/sound/seq_oss.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0-or-later */
2*4882a593Smuzhiyun #ifndef __SOUND_SEQ_OSS_H
3*4882a593Smuzhiyun #define __SOUND_SEQ_OSS_H
4*4882a593Smuzhiyun 
5*4882a593Smuzhiyun /*
6*4882a593Smuzhiyun  * OSS compatible sequencer driver
7*4882a593Smuzhiyun  *
8*4882a593Smuzhiyun  * Copyright (C) 1998,99 Takashi Iwai
9*4882a593Smuzhiyun  */
10*4882a593Smuzhiyun 
11*4882a593Smuzhiyun #include <sound/asequencer.h>
12*4882a593Smuzhiyun #include <sound/seq_kernel.h>
13*4882a593Smuzhiyun 
14*4882a593Smuzhiyun /*
15*4882a593Smuzhiyun  * argument structure for synthesizer operations
16*4882a593Smuzhiyun  */
17*4882a593Smuzhiyun struct snd_seq_oss_arg {
18*4882a593Smuzhiyun 	/* given by OSS sequencer */
19*4882a593Smuzhiyun 	int app_index;	/* application unique index */
20*4882a593Smuzhiyun 	int file_mode;	/* file mode - see below */
21*4882a593Smuzhiyun 	int seq_mode;	/* sequencer mode - see below */
22*4882a593Smuzhiyun 
23*4882a593Smuzhiyun 	/* following must be initialized in open callback */
24*4882a593Smuzhiyun 	struct snd_seq_addr addr;	/* opened port address */
25*4882a593Smuzhiyun 	void *private_data;	/* private data for lowlevel drivers */
26*4882a593Smuzhiyun 
27*4882a593Smuzhiyun 	/* note-on event passing mode: initially given by OSS seq,
28*4882a593Smuzhiyun 	 * but configurable by drivers - see below
29*4882a593Smuzhiyun 	 */
30*4882a593Smuzhiyun 	int event_passing;
31*4882a593Smuzhiyun };
32*4882a593Smuzhiyun 
33*4882a593Smuzhiyun 
34*4882a593Smuzhiyun /*
35*4882a593Smuzhiyun  * synthesizer operation callbacks
36*4882a593Smuzhiyun  */
37*4882a593Smuzhiyun struct snd_seq_oss_callback {
38*4882a593Smuzhiyun 	struct module *owner;
39*4882a593Smuzhiyun 	int (*open)(struct snd_seq_oss_arg *p, void *closure);
40*4882a593Smuzhiyun 	int (*close)(struct snd_seq_oss_arg *p);
41*4882a593Smuzhiyun 	int (*ioctl)(struct snd_seq_oss_arg *p, unsigned int cmd, unsigned long arg);
42*4882a593Smuzhiyun 	int (*load_patch)(struct snd_seq_oss_arg *p, int format, const char __user *buf, int offs, int count);
43*4882a593Smuzhiyun 	int (*reset)(struct snd_seq_oss_arg *p);
44*4882a593Smuzhiyun 	int (*raw_event)(struct snd_seq_oss_arg *p, unsigned char *data);
45*4882a593Smuzhiyun };
46*4882a593Smuzhiyun 
47*4882a593Smuzhiyun /* flag: file_mode */
48*4882a593Smuzhiyun #define SNDRV_SEQ_OSS_FILE_ACMODE		3
49*4882a593Smuzhiyun #define SNDRV_SEQ_OSS_FILE_READ		1
50*4882a593Smuzhiyun #define SNDRV_SEQ_OSS_FILE_WRITE		2
51*4882a593Smuzhiyun #define SNDRV_SEQ_OSS_FILE_NONBLOCK	4
52*4882a593Smuzhiyun 
53*4882a593Smuzhiyun /* flag: seq_mode */
54*4882a593Smuzhiyun #define SNDRV_SEQ_OSS_MODE_SYNTH		0
55*4882a593Smuzhiyun #define SNDRV_SEQ_OSS_MODE_MUSIC		1
56*4882a593Smuzhiyun 
57*4882a593Smuzhiyun /* flag: event_passing */
58*4882a593Smuzhiyun #define SNDRV_SEQ_OSS_PROCESS_EVENTS	0	/* key == 255 is processed as velocity change */
59*4882a593Smuzhiyun #define SNDRV_SEQ_OSS_PASS_EVENTS		1	/* pass all events to callback */
60*4882a593Smuzhiyun #define SNDRV_SEQ_OSS_PROCESS_KEYPRESS	2	/* key >= 128 will be processed as key-pressure */
61*4882a593Smuzhiyun 
62*4882a593Smuzhiyun /* default control rate: fixed */
63*4882a593Smuzhiyun #define SNDRV_SEQ_OSS_CTRLRATE		100
64*4882a593Smuzhiyun 
65*4882a593Smuzhiyun /* default max queue length: configurable by module option */
66*4882a593Smuzhiyun #define SNDRV_SEQ_OSS_MAX_QLEN		1024
67*4882a593Smuzhiyun 
68*4882a593Smuzhiyun 
69*4882a593Smuzhiyun /*
70*4882a593Smuzhiyun  * data pointer to snd_seq_register_device
71*4882a593Smuzhiyun  */
72*4882a593Smuzhiyun struct snd_seq_oss_reg {
73*4882a593Smuzhiyun 	int type;
74*4882a593Smuzhiyun 	int subtype;
75*4882a593Smuzhiyun 	int nvoices;
76*4882a593Smuzhiyun 	struct snd_seq_oss_callback oper;
77*4882a593Smuzhiyun 	void *private_data;
78*4882a593Smuzhiyun };
79*4882a593Smuzhiyun 
80*4882a593Smuzhiyun /* device id */
81*4882a593Smuzhiyun #define SNDRV_SEQ_DEV_ID_OSS		"seq-oss"
82*4882a593Smuzhiyun 
83*4882a593Smuzhiyun #endif /* __SOUND_SEQ_OSS_H */
84