Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /*
0003  *   ALSA sequencer FIFO
0004  *   Copyright (c) 1998 by Frank van de Pol <fvdpol@coil.demon.nl>
0005  */
0006 #ifndef __SND_SEQ_FIFO_H
0007 #define __SND_SEQ_FIFO_H
0008 
0009 #include "seq_memory.h"
0010 #include "seq_lock.h"
0011 
0012 
0013 /* === FIFO === */
0014 
0015 struct snd_seq_fifo {
0016     struct snd_seq_pool *pool;      /* FIFO pool */
0017     struct snd_seq_event_cell *head;        /* pointer to head of fifo */
0018     struct snd_seq_event_cell *tail;        /* pointer to tail of fifo */
0019     int cells;
0020     spinlock_t lock;
0021     snd_use_lock_t use_lock;
0022     wait_queue_head_t input_sleep;
0023     atomic_t overflow;
0024 
0025 };
0026 
0027 /* create new fifo (constructor) */
0028 struct snd_seq_fifo *snd_seq_fifo_new(int poolsize);
0029 
0030 /* delete fifo (destructor) */
0031 void snd_seq_fifo_delete(struct snd_seq_fifo **f);
0032 
0033 
0034 /* enqueue event to fifo */
0035 int snd_seq_fifo_event_in(struct snd_seq_fifo *f, struct snd_seq_event *event);
0036 
0037 /* lock fifo from release */
0038 #define snd_seq_fifo_lock(fifo)     snd_use_lock_use(&(fifo)->use_lock)
0039 #define snd_seq_fifo_unlock(fifo)   snd_use_lock_free(&(fifo)->use_lock)
0040 
0041 /* get a cell from fifo - fifo should be locked */
0042 int snd_seq_fifo_cell_out(struct snd_seq_fifo *f, struct snd_seq_event_cell **cellp, int nonblock);
0043 
0044 /* free dequeued cell - fifo should be locked */
0045 void snd_seq_fifo_cell_putback(struct snd_seq_fifo *f, struct snd_seq_event_cell *cell);
0046 
0047 /* clean up queue */
0048 void snd_seq_fifo_clear(struct snd_seq_fifo *f);
0049 
0050 /* polling */
0051 int snd_seq_fifo_poll_wait(struct snd_seq_fifo *f, struct file *file, poll_table *wait);
0052 
0053 /* resize pool in fifo */
0054 int snd_seq_fifo_resize(struct snd_seq_fifo *f, int poolsize);
0055 
0056 /* get the number of unused cells safely */
0057 int snd_seq_fifo_unused_cells(struct snd_seq_fifo *f);
0058 
0059 #endif