1 /*
2 * Include file for midi buffer.
3 *
4 * Copyright by Seigo Tanimura 1999.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 * $FreeBSD: releng/5.1/sys/dev/sound/midi/midibuf.h 88773 2002-01-01 17:36:26Z tanimura $
28 *
29 */
30
31 /*
32 * descriptor of a midi buffer. See midibuf.c for documentation.
33 * (rp,rl) and (fp,fl) identify the READY and FREE regions of the
34 * buffer. dl contains the length used for dma transfer, dl>0 also
35 * means that the channel is busy and there is a DMA transfer in progress.
36 */
37
38 typedef struct _midi_dbuf {
39 char *buf;
40 int bufsize ;
41 volatile int rp, fp; /* pointers to the ready and free area */
42 volatile int dl; /* transfer size */
43 volatile int rl, fl; /* length of ready and free areas. */
44 int int_count;
45 int chan; /* dma channel */
46 int unit_size ; /* unit size */
47 struct selinfo sel;
48 u_long total; /* total bytes processed */
49 u_long prev_total; /* copy of the above when GETxPTR called */
50 struct cv cv_in, cv_out; /* condvars */
51 int blocksize; /* block size */
52 } midi_dbuf ;
53
54 /*
55 * These are the midi buffer methods, used in midi interface devices.
56 */
57 int midibuf_init(midi_dbuf *dbuf);
58 int midibuf_destroy(midi_dbuf *dbuf);
59 int midibuf_clear(midi_dbuf *dbuf);
60 int midibuf_seqwrite(midi_dbuf *dbuf, u_char* data, int len, int *lenw, midi_callback_t *cb, void *d, int reason, struct mtx *m);
61 int midibuf_output_intr(midi_dbuf *dbuf, u_char *data, int len, int *leno);
62 int midibuf_input_intr(midi_dbuf *dbuf, u_char *data, int len, int *leni);
63 int midibuf_seqread(midi_dbuf *dbuf, u_char* data, int len, int *lenr, midi_callback_t *cb, void *d, int reason, struct mtx *m);
64 int midibuf_seqcopy(midi_dbuf *dbuf, u_char* data, int len, int *lenc, midi_callback_t *cb, void *d, int reason, struct mtx *m);
65 int midibuf_seqdelete(midi_dbuf *dbuf, int len, int *lend, midi_callback_t *cb, void *d, int reason, struct mtx *m);
Cache object: a96f99bf07364a27b60f3c561a4a29cb
|