18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci#ifndef __SOUND_SEQ_OSS_H
38c2ecf20Sopenharmony_ci#define __SOUND_SEQ_OSS_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci/*
68c2ecf20Sopenharmony_ci * OSS compatible sequencer driver
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci * Copyright (C) 1998,99 Takashi Iwai
98c2ecf20Sopenharmony_ci */
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#include <sound/asequencer.h>
128c2ecf20Sopenharmony_ci#include <sound/seq_kernel.h>
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci/*
158c2ecf20Sopenharmony_ci * argument structure for synthesizer operations
168c2ecf20Sopenharmony_ci */
178c2ecf20Sopenharmony_cistruct snd_seq_oss_arg {
188c2ecf20Sopenharmony_ci	/* given by OSS sequencer */
198c2ecf20Sopenharmony_ci	int app_index;	/* application unique index */
208c2ecf20Sopenharmony_ci	int file_mode;	/* file mode - see below */
218c2ecf20Sopenharmony_ci	int seq_mode;	/* sequencer mode - see below */
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci	/* following must be initialized in open callback */
248c2ecf20Sopenharmony_ci	struct snd_seq_addr addr;	/* opened port address */
258c2ecf20Sopenharmony_ci	void *private_data;	/* private data for lowlevel drivers */
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci	/* note-on event passing mode: initially given by OSS seq,
288c2ecf20Sopenharmony_ci	 * but configurable by drivers - see below
298c2ecf20Sopenharmony_ci	 */
308c2ecf20Sopenharmony_ci	int event_passing;
318c2ecf20Sopenharmony_ci};
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci/*
358c2ecf20Sopenharmony_ci * synthesizer operation callbacks
368c2ecf20Sopenharmony_ci */
378c2ecf20Sopenharmony_cistruct snd_seq_oss_callback {
388c2ecf20Sopenharmony_ci	struct module *owner;
398c2ecf20Sopenharmony_ci	int (*open)(struct snd_seq_oss_arg *p, void *closure);
408c2ecf20Sopenharmony_ci	int (*close)(struct snd_seq_oss_arg *p);
418c2ecf20Sopenharmony_ci	int (*ioctl)(struct snd_seq_oss_arg *p, unsigned int cmd, unsigned long arg);
428c2ecf20Sopenharmony_ci	int (*load_patch)(struct snd_seq_oss_arg *p, int format, const char __user *buf, int offs, int count);
438c2ecf20Sopenharmony_ci	int (*reset)(struct snd_seq_oss_arg *p);
448c2ecf20Sopenharmony_ci	int (*raw_event)(struct snd_seq_oss_arg *p, unsigned char *data);
458c2ecf20Sopenharmony_ci};
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci/* flag: file_mode */
488c2ecf20Sopenharmony_ci#define SNDRV_SEQ_OSS_FILE_ACMODE		3
498c2ecf20Sopenharmony_ci#define SNDRV_SEQ_OSS_FILE_READ		1
508c2ecf20Sopenharmony_ci#define SNDRV_SEQ_OSS_FILE_WRITE		2
518c2ecf20Sopenharmony_ci#define SNDRV_SEQ_OSS_FILE_NONBLOCK	4
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ci/* flag: seq_mode */
548c2ecf20Sopenharmony_ci#define SNDRV_SEQ_OSS_MODE_SYNTH		0
558c2ecf20Sopenharmony_ci#define SNDRV_SEQ_OSS_MODE_MUSIC		1
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ci/* flag: event_passing */
588c2ecf20Sopenharmony_ci#define SNDRV_SEQ_OSS_PROCESS_EVENTS	0	/* key == 255 is processed as velocity change */
598c2ecf20Sopenharmony_ci#define SNDRV_SEQ_OSS_PASS_EVENTS		1	/* pass all events to callback */
608c2ecf20Sopenharmony_ci#define SNDRV_SEQ_OSS_PROCESS_KEYPRESS	2	/* key >= 128 will be processed as key-pressure */
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_ci/* default control rate: fixed */
638c2ecf20Sopenharmony_ci#define SNDRV_SEQ_OSS_CTRLRATE		100
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_ci/* default max queue length: configurable by module option */
668c2ecf20Sopenharmony_ci#define SNDRV_SEQ_OSS_MAX_QLEN		1024
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_ci
698c2ecf20Sopenharmony_ci/*
708c2ecf20Sopenharmony_ci * data pointer to snd_seq_register_device
718c2ecf20Sopenharmony_ci */
728c2ecf20Sopenharmony_cistruct snd_seq_oss_reg {
738c2ecf20Sopenharmony_ci	int type;
748c2ecf20Sopenharmony_ci	int subtype;
758c2ecf20Sopenharmony_ci	int nvoices;
768c2ecf20Sopenharmony_ci	struct snd_seq_oss_callback oper;
778c2ecf20Sopenharmony_ci	void *private_data;
788c2ecf20Sopenharmony_ci};
798c2ecf20Sopenharmony_ci
808c2ecf20Sopenharmony_ci/* device id */
818c2ecf20Sopenharmony_ci#define SNDRV_SEQ_DEV_ID_OSS		"seq-oss"
828c2ecf20Sopenharmony_ci
838c2ecf20Sopenharmony_ci#endif /* __SOUND_SEQ_OSS_H */
84