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 #include "seq_oss_event.h" 14 15 16 /* 17 * definition of read queue 18 */ 19 struct seq_oss_readq { 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 union evrec q[] __counted_by(maxlen); 28 }; 29 30 struct seq_oss_readq *snd_seq_oss_readq_new(struct seq_oss_devinfo *dp, int maxlen); 31 void snd_seq_oss_readq_delete(struct seq_oss_readq *q); 32 void snd_seq_oss_readq_clear(struct seq_oss_readq *readq); 33 unsigned int snd_seq_oss_readq_poll(struct seq_oss_readq *readq, struct file *file, poll_table *wait); 34 int snd_seq_oss_readq_puts(struct seq_oss_readq *readq, int dev, unsigned char *data, int len); 35 int snd_seq_oss_readq_sysex(struct seq_oss_readq *q, int dev, 36 struct snd_seq_event *ev); 37 int snd_seq_oss_readq_put_event(struct seq_oss_readq *readq, union evrec *ev); 38 int snd_seq_oss_readq_put_timestamp(struct seq_oss_readq *readq, unsigned long curt, int seq_mode); 39 int snd_seq_oss_readq_pick(struct seq_oss_readq *q, union evrec *rec); 40 void snd_seq_oss_readq_wait(struct seq_oss_readq *q); 41 void snd_seq_oss_readq_free(struct seq_oss_readq *q); 42 43 #define snd_seq_oss_readq_lock(q, flags) spin_lock_irqsave(&(q)->lock, flags) 44 #define snd_seq_oss_readq_unlock(q, flags) spin_unlock_irqrestore(&(q)->lock, flags) 45 46 #endif 47