1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * OSS compatible sequencer driver
4 * read fifo queue
5 *
6 * Copyright (C) 1998,99 Takashi Iwai <tiwai@suse.de>
7 */
8
9#ifndef __SEQ_OSS_READQ_H
10#define __SEQ_OSS_READQ_H
11
12#include "seq_oss_device.h"
13
14
15/*
16 * definition of read queue
17 */
18struct seq_oss_readq {
19	union evrec *q;
20	int qlen;
21	int maxlen;
22	int head, tail;
23	unsigned long pre_event_timeout;
24	unsigned long input_time;
25	wait_queue_head_t midi_sleep;
26	spinlock_t lock;
27};
28
29struct seq_oss_readq *snd_seq_oss_readq_new(struct seq_oss_devinfo *dp, int maxlen);
30void snd_seq_oss_readq_delete(struct seq_oss_readq *q);
31void snd_seq_oss_readq_clear(struct seq_oss_readq *readq);
32unsigned int snd_seq_oss_readq_poll(struct seq_oss_readq *readq, struct file *file, poll_table *wait);
33int snd_seq_oss_readq_puts(struct seq_oss_readq *readq, int dev, unsigned char *data, int len);
34int snd_seq_oss_readq_sysex(struct seq_oss_readq *q, int dev,
35			    struct snd_seq_event *ev);
36int snd_seq_oss_readq_put_event(struct seq_oss_readq *readq, union evrec *ev);
37int snd_seq_oss_readq_put_timestamp(struct seq_oss_readq *readq, unsigned long curt, int seq_mode);
38int snd_seq_oss_readq_pick(struct seq_oss_readq *q, union evrec *rec);
39void snd_seq_oss_readq_wait(struct seq_oss_readq *q);
40void snd_seq_oss_readq_free(struct seq_oss_readq *q);
41
42#define snd_seq_oss_readq_lock(q, flags) spin_lock_irqsave(&(q)->lock, flags)
43#define snd_seq_oss_readq_unlock(q, flags) spin_unlock_irqrestore(&(q)->lock, flags)
44
45#endif
46