]> git.ipfire.org Git - thirdparty/linux.git/blame - sound/core/seq/seq_fifo.h
treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156
[thirdparty/linux.git] / sound / core / seq / seq_fifo.h
CommitLineData
1a59d1b8 1/* SPDX-License-Identifier: GPL-2.0-or-later */
1da177e4
LT
2/*
3 * ALSA sequencer FIFO
4 * Copyright (c) 1998 by Frank van de Pol <fvdpol@coil.demon.nl>
1da177e4
LT
5 */
6#ifndef __SND_SEQ_FIFO_H
7#define __SND_SEQ_FIFO_H
8
9#include "seq_memory.h"
10#include "seq_lock.h"
11
12
13/* === FIFO === */
14
c7e0b5bf
TI
15struct snd_seq_fifo {
16 struct snd_seq_pool *pool; /* FIFO pool */
17 struct snd_seq_event_cell *head; /* pointer to head of fifo */
18 struct snd_seq_event_cell *tail; /* pointer to tail of fifo */
1da177e4
LT
19 int cells;
20 spinlock_t lock;
21 snd_use_lock_t use_lock;
22 wait_queue_head_t input_sleep;
23 atomic_t overflow;
24
c7e0b5bf 25};
1da177e4
LT
26
27/* create new fifo (constructor) */
c7e0b5bf 28struct snd_seq_fifo *snd_seq_fifo_new(int poolsize);
1da177e4
LT
29
30/* delete fifo (destructor) */
c7e0b5bf 31void snd_seq_fifo_delete(struct snd_seq_fifo **f);
1da177e4
LT
32
33
34/* enqueue event to fifo */
c7e0b5bf 35int snd_seq_fifo_event_in(struct snd_seq_fifo *f, struct snd_seq_event *event);
1da177e4
LT
36
37/* lock fifo from release */
38#define snd_seq_fifo_lock(fifo) snd_use_lock_use(&(fifo)->use_lock)
39#define snd_seq_fifo_unlock(fifo) snd_use_lock_free(&(fifo)->use_lock)
40
41/* get a cell from fifo - fifo should be locked */
c7e0b5bf 42int snd_seq_fifo_cell_out(struct snd_seq_fifo *f, struct snd_seq_event_cell **cellp, int nonblock);
1da177e4
LT
43
44/* free dequeued cell - fifo should be locked */
c7e0b5bf 45void snd_seq_fifo_cell_putback(struct snd_seq_fifo *f, struct snd_seq_event_cell *cell);
1da177e4
LT
46
47/* clean up queue */
c7e0b5bf 48void snd_seq_fifo_clear(struct snd_seq_fifo *f);
1da177e4
LT
49
50/* polling */
c7e0b5bf 51int snd_seq_fifo_poll_wait(struct snd_seq_fifo *f, struct file *file, poll_table *wait);
1da177e4
LT
52
53/* resize pool in fifo */
c7e0b5bf 54int snd_seq_fifo_resize(struct snd_seq_fifo *f, int poolsize);
1da177e4
LT
55
56
57#endif