arm64: bpf: Fix branch offset in JIT
[linux/fpc-iii.git] / sound / core / seq / oss / seq_oss_device.h
blob6c2c4fb9b753786784a967efe926c09a4f603d20
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3 * OSS compatible sequencer driver
5 * Copyright (C) 1998,99 Takashi Iwai <tiwai@suse.de>
6 */
8 #ifndef __SEQ_OSS_DEVICE_H
9 #define __SEQ_OSS_DEVICE_H
11 #include <linux/time.h>
12 #include <linux/wait.h>
13 #include <linux/slab.h>
14 #include <linux/sched/signal.h>
15 #include <sound/core.h>
16 #include <sound/seq_oss.h>
17 #include <sound/rawmidi.h>
18 #include <sound/seq_kernel.h>
19 #include <sound/info.h>
20 #include "../seq_clientmgr.h"
22 /* max. applications */
23 #define SNDRV_SEQ_OSS_MAX_CLIENTS 16
24 #define SNDRV_SEQ_OSS_MAX_SYNTH_DEVS 16
25 #define SNDRV_SEQ_OSS_MAX_MIDI_DEVS 32
27 /* version */
28 #define SNDRV_SEQ_OSS_MAJOR_VERSION 0
29 #define SNDRV_SEQ_OSS_MINOR_VERSION 1
30 #define SNDRV_SEQ_OSS_TINY_VERSION 8
31 #define SNDRV_SEQ_OSS_VERSION_STR "0.1.8"
33 /* device and proc interface name */
34 #define SNDRV_SEQ_OSS_PROCNAME "oss"
38 * type definitions
41 typedef unsigned int reltime_t;
42 typedef unsigned int abstime_t;
46 * synthesizer channel information
48 struct seq_oss_chinfo {
49 int note, vel;
53 * synthesizer information
55 struct seq_oss_synthinfo {
56 struct snd_seq_oss_arg arg;
57 struct seq_oss_chinfo *ch;
58 struct seq_oss_synth_sysex *sysex;
59 int nr_voices;
60 int opened;
61 int is_midi;
62 int midi_mapped;
67 * sequencer client information
70 struct seq_oss_devinfo {
72 int index; /* application index */
73 int cseq; /* sequencer client number */
74 int port; /* sequencer port number */
75 int queue; /* sequencer queue number */
77 struct snd_seq_addr addr; /* address of this device */
79 int seq_mode; /* sequencer mode */
80 int file_mode; /* file access */
82 /* midi device table */
83 int max_mididev;
85 /* synth device table */
86 int max_synthdev;
87 struct seq_oss_synthinfo synths[SNDRV_SEQ_OSS_MAX_SYNTH_DEVS];
88 int synth_opened;
90 /* output queue */
91 struct seq_oss_writeq *writeq;
93 /* midi input queue */
94 struct seq_oss_readq *readq;
96 /* timer */
97 struct seq_oss_timer *timer;
102 * function prototypes
105 /* create/delete OSS sequencer client */
106 int snd_seq_oss_create_client(void);
107 int snd_seq_oss_delete_client(void);
109 /* device file interface */
110 int snd_seq_oss_open(struct file *file, int level);
111 void snd_seq_oss_release(struct seq_oss_devinfo *dp);
112 int snd_seq_oss_ioctl(struct seq_oss_devinfo *dp, unsigned int cmd, unsigned long arg);
113 int snd_seq_oss_read(struct seq_oss_devinfo *dev, char __user *buf, int count);
114 int snd_seq_oss_write(struct seq_oss_devinfo *dp, const char __user *buf, int count, struct file *opt);
115 __poll_t snd_seq_oss_poll(struct seq_oss_devinfo *dp, struct file *file, poll_table * wait);
117 void snd_seq_oss_reset(struct seq_oss_devinfo *dp);
119 /* */
120 void snd_seq_oss_process_queue(struct seq_oss_devinfo *dp, abstime_t time);
123 /* proc interface */
124 void snd_seq_oss_system_info_read(struct snd_info_buffer *buf);
125 void snd_seq_oss_midi_info_read(struct snd_info_buffer *buf);
126 void snd_seq_oss_synth_info_read(struct snd_info_buffer *buf);
127 void snd_seq_oss_readq_info_read(struct seq_oss_readq *q, struct snd_info_buffer *buf);
129 /* file mode macros */
130 #define is_read_mode(mode) ((mode) & SNDRV_SEQ_OSS_FILE_READ)
131 #define is_write_mode(mode) ((mode) & SNDRV_SEQ_OSS_FILE_WRITE)
132 #define is_nonblock_mode(mode) ((mode) & SNDRV_SEQ_OSS_FILE_NONBLOCK)
134 /* dispatch event */
135 static inline int
136 snd_seq_oss_dispatch(struct seq_oss_devinfo *dp, struct snd_seq_event *ev, int atomic, int hop)
138 return snd_seq_kernel_client_dispatch(dp->cseq, ev, atomic, hop);
141 /* ioctl for writeq */
142 static inline int
143 snd_seq_oss_control(struct seq_oss_devinfo *dp, unsigned int type, void *arg)
145 int err;
147 snd_seq_client_ioctl_lock(dp->cseq);
148 err = snd_seq_kernel_client_ctl(dp->cseq, type, arg);
149 snd_seq_client_ioctl_unlock(dp->cseq);
150 return err;
153 /* fill the addresses in header */
154 static inline void
155 snd_seq_oss_fill_addr(struct seq_oss_devinfo *dp, struct snd_seq_event *ev,
156 int dest_client, int dest_port)
158 ev->queue = dp->queue;
159 ev->source = dp->addr;
160 ev->dest.client = dest_client;
161 ev->dest.port = dest_port;
165 /* misc. functions for proc interface */
166 char *enabled_str(int bool);
168 #endif /* __SEQ_OSS_DEVICE_H */