brintos

brintos / linux-shallow public Read only

0
0
Text · 3.9 KiB · 98dd20b Raw
165 lines · c
1/* SPDX-License-Identifier: GPL-2.0-or-later */2/*3 * OSS compatible sequencer driver4 *5 * Copyright (C) 1998,99 Takashi Iwai <tiwai@suse.de>6 */7 8#ifndef __SEQ_OSS_DEVICE_H9#define __SEQ_OSS_DEVICE_H10 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"21 22/* max. applications */23#define SNDRV_SEQ_OSS_MAX_CLIENTS	1624#define SNDRV_SEQ_OSS_MAX_SYNTH_DEVS	1625#define SNDRV_SEQ_OSS_MAX_MIDI_DEVS	3226 27/* version */28#define SNDRV_SEQ_OSS_MAJOR_VERSION	029#define SNDRV_SEQ_OSS_MINOR_VERSION	130#define SNDRV_SEQ_OSS_TINY_VERSION	831#define SNDRV_SEQ_OSS_VERSION_STR	"0.1.8"32 33/* device and proc interface name */34#define SNDRV_SEQ_OSS_PROCNAME		"oss"35 36 37/*38 * type definitions39 */40 41typedef unsigned int reltime_t;42typedef unsigned int abstime_t;43 44 45/*46 * synthesizer channel information47 */48struct seq_oss_chinfo {49	int note, vel;50};51 52/*53 * synthesizer information54 */55struct 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;63};64 65 66/*67 * sequencer client information68 */69 70struct seq_oss_devinfo {71 72	int index;	/* application index */73	int cseq;	/* sequencer client number */74	int port;	/* sequencer port number */75	int queue;	/* sequencer queue number */76 77	struct snd_seq_addr addr;	/* address of this device */78 79	int seq_mode;	/* sequencer mode */80	int file_mode;	/* file access */81 82	/* midi device table */83	int max_mididev;84 85	/* synth device table */86	int max_synthdev;87	struct seq_oss_synthinfo synths[SNDRV_SEQ_OSS_MAX_SYNTH_DEVS];88	int synth_opened;89 90	/* output queue */91	struct seq_oss_writeq *writeq;92 93	/* midi input queue */94	struct seq_oss_readq *readq;95 96	/* timer */97	struct seq_oss_timer *timer;98};99 100 101/*102 * function prototypes103 */104 105/* create/delete OSS sequencer client */106int snd_seq_oss_create_client(void);107int snd_seq_oss_delete_client(void);108 109/* device file interface */110int snd_seq_oss_open(struct file *file, int level);111void snd_seq_oss_release(struct seq_oss_devinfo *dp);112int snd_seq_oss_ioctl(struct seq_oss_devinfo *dp, unsigned int cmd, unsigned long arg);113int snd_seq_oss_read(struct seq_oss_devinfo *dev, char __user *buf, int count);114int 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);116 117void snd_seq_oss_reset(struct seq_oss_devinfo *dp);118 119/* proc interface */120void snd_seq_oss_system_info_read(struct snd_info_buffer *buf);121void snd_seq_oss_midi_info_read(struct snd_info_buffer *buf);122void snd_seq_oss_synth_info_read(struct snd_info_buffer *buf);123void snd_seq_oss_readq_info_read(struct seq_oss_readq *q, struct snd_info_buffer *buf);124 125/* file mode macros */126#define is_read_mode(mode)	((mode) & SNDRV_SEQ_OSS_FILE_READ)127#define is_write_mode(mode)	((mode) & SNDRV_SEQ_OSS_FILE_WRITE)128#define is_nonblock_mode(mode)	((mode) & SNDRV_SEQ_OSS_FILE_NONBLOCK)129 130/* dispatch event */131static inline int132snd_seq_oss_dispatch(struct seq_oss_devinfo *dp, struct snd_seq_event *ev, int atomic, int hop)133{134	return snd_seq_kernel_client_dispatch(dp->cseq, ev, atomic, hop);135}136 137/* ioctl for writeq */138static inline int139snd_seq_oss_control(struct seq_oss_devinfo *dp, unsigned int type, void *arg)140{141	int err;142 143	snd_seq_client_ioctl_lock(dp->cseq);144	err = snd_seq_kernel_client_ctl(dp->cseq, type, arg);145	snd_seq_client_ioctl_unlock(dp->cseq);146	return err;147}148 149/* fill the addresses in header */150static inline void151snd_seq_oss_fill_addr(struct seq_oss_devinfo *dp, struct snd_seq_event *ev,152		     int dest_client, int dest_port)153{154	ev->queue = dp->queue;155	ev->source = dp->addr;156	ev->dest.client = dest_client;157	ev->dest.port = dest_port;158}159 160 161/* misc. functions for proc interface */162char *enabled_str(bool b);163 164#endif /* __SEQ_OSS_DEVICE_H */165