/*1* ALSA sequencer FIFO2* Copyright (c) 1998 by Frank van de Pol <[email protected]>3*4*5* This program is free software; you can redistribute it and/or modify6* it under the terms of the GNU General Public License as published by7* the Free Software Foundation; either version 2 of the License, or8* (at your option) any later version.9*10* This program is distributed in the hope that it will be useful,11* but WITHOUT ANY WARRANTY; without even the implied warranty of12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13* GNU General Public License for more details.14*15* You should have received a copy of the GNU General Public License16* along with this program; if not, write to the Free Software17* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA18*19*/20#ifndef __SND_SEQ_FIFO_H21#define __SND_SEQ_FIFO_H2223#include "seq_memory.h"24#include "seq_lock.h"252627/* === FIFO === */2829struct snd_seq_fifo {30struct snd_seq_pool *pool; /* FIFO pool */31struct snd_seq_event_cell *head; /* pointer to head of fifo */32struct snd_seq_event_cell *tail; /* pointer to tail of fifo */33int cells;34spinlock_t lock;35snd_use_lock_t use_lock;36wait_queue_head_t input_sleep;37atomic_t overflow;3839};4041/* create new fifo (constructor) */42struct snd_seq_fifo *snd_seq_fifo_new(int poolsize);4344/* delete fifo (destructor) */45void snd_seq_fifo_delete(struct snd_seq_fifo **f);464748/* enqueue event to fifo */49int snd_seq_fifo_event_in(struct snd_seq_fifo *f, struct snd_seq_event *event);5051/* lock fifo from release */52#define snd_seq_fifo_lock(fifo) snd_use_lock_use(&(fifo)->use_lock)53#define snd_seq_fifo_unlock(fifo) snd_use_lock_free(&(fifo)->use_lock)5455/* get a cell from fifo - fifo should be locked */56int snd_seq_fifo_cell_out(struct snd_seq_fifo *f, struct snd_seq_event_cell **cellp, int nonblock);5758/* free dequeued cell - fifo should be locked */59void snd_seq_fifo_cell_putback(struct snd_seq_fifo *f, struct snd_seq_event_cell *cell);6061/* clean up queue */62void snd_seq_fifo_clear(struct snd_seq_fifo *f);6364/* polling */65int snd_seq_fifo_poll_wait(struct snd_seq_fifo *f, struct file *file, poll_table *wait);6667/* resize pool in fifo */68int snd_seq_fifo_resize(struct snd_seq_fifo *f, int poolsize);697071#endif727374