Annotation of sys/dev/sequencervar.h, Revision 1.1
1.1 ! nbrk 1: /* $OpenBSD: sequencervar.h,v 1.3 2002/03/14 01:26:52 millert Exp $ */
! 2: /* $NetBSD: sequencervar.h,v 1.5 1998/11/25 22:17:07 augustss Exp $ */
! 3:
! 4: /*
! 5: * Copyright (c) 1998 The NetBSD Foundation, Inc.
! 6: * All rights reserved.
! 7: *
! 8: * This code is derived from software contributed to The NetBSD Foundation
! 9: * by Lennart Augustsson (augustss@netbsd.org).
! 10: *
! 11: * Redistribution and use in source and binary forms, with or without
! 12: * modification, are permitted provided that the following conditions
! 13: * are met:
! 14: * 1. Redistributions of source code must retain the above copyright
! 15: * notice, this list of conditions and the following disclaimer.
! 16: * 2. Redistributions in binary form must reproduce the above copyright
! 17: * notice, this list of conditions and the following disclaimer in the
! 18: * documentation and/or other materials provided with the distribution.
! 19: * 3. All advertising materials mentioning features or use of this software
! 20: * must display the following acknowledgement:
! 21: * This product includes software developed by the NetBSD
! 22: * Foundation, Inc. and its contributors.
! 23: * 4. Neither the name of The NetBSD Foundation nor the names of its
! 24: * contributors may be used to endorse or promote products derived
! 25: * from this software without specific prior written permission.
! 26: *
! 27: * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
! 28: * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! 29: * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
! 30: * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
! 31: * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! 32: * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! 33: * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! 34: * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! 35: * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! 36: * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! 37: * POSSIBILITY OF SUCH DAMAGE.
! 38: */
! 39:
! 40: struct midi_softc;
! 41:
! 42: struct syn_timer {
! 43: struct timeval start, stop;
! 44: int tempo, timebase;
! 45: u_long last;
! 46: u_long tick;
! 47: int running;
! 48: };
! 49:
! 50: #define SEQ_MAXQ 256
! 51: struct sequencer_queue {
! 52: seq_event_rec buf[SEQ_MAXQ];
! 53: u_int in; /* input index in buf */
! 54: u_int out; /* output index in buf */
! 55: u_int count; /* filled slots in buf */
! 56: };
! 57: #define SEQ_QINIT(q) ((q)->in = (q)->out = (q)->count = 0)
! 58: #define SEQ_QEMPTY(q) ((q)->count == 0)
! 59: #define SEQ_QFULL(q) ((q)->count >= SEQ_MAXQ)
! 60: #define SEQ_QPUT(q, e) ((q)->buf[(q)->in++] = (e), (q)->in %= SEQ_MAXQ, (q)->count++)
! 61: #define SEQ_QGET(q, e) ((e) = (q)->buf[(q)->out++], (q)->out %= SEQ_MAXQ, (q)->count--)
! 62: #define SEQ_QLEN(q) ((q)->count)
! 63:
! 64: struct sequencer_softc;
! 65:
! 66: #define MAXCHAN 16
! 67: struct midi_dev {
! 68: char *name;
! 69: int subtype;
! 70: int capabilities;
! 71: int nr_voices;
! 72: int instr_bank_size;
! 73: int unit;
! 74: u_char last_cmd;
! 75: struct sequencer_softc *seq;
! 76: struct midi_softc *msc;
! 77: };
! 78:
! 79: struct sequencer_softc {
! 80: struct device dev;
! 81: struct device *sc_dev; /* Hardware device struct */
! 82: int isopen; /* Open indicator */
! 83: int flags; /* Open flags */
! 84: int mode;
! 85: #define SEQ_OLD 0
! 86: #define SEQ_NEW 1
! 87: int rchan, wchan;
! 88: int pbus;
! 89: struct selinfo wsel; /* write selector */
! 90: struct selinfo rsel; /* read selector */
! 91: struct proc *async; /* process who wants audio SIGIO */
! 92: struct timeout timo; /* timeout handle */
! 93:
! 94: char doingsysex; /* doing a SEQ_SYSEX */
! 95:
! 96: int nmidi; /* number of MIDI devices */
! 97: struct midi_dev **devs;
! 98: struct syn_timer timer;
! 99:
! 100: struct sequencer_queue outq; /* output event queue */
! 101: u_int lowat; /* output queue low water mark */
! 102: char timeout; /* timeout has been set */
! 103:
! 104: struct sequencer_queue inq; /* input event queue */
! 105: u_long input_stamp;
! 106: };
! 107:
! 108: void seq_event_intr(void *, seq_event_rec *);
! 109:
! 110: #define SEQUENCERUNIT(d) ((d) & 0x7f)
! 111: #define SEQ_IS_OLD(d) ((d) & 0x80)
! 112:
CVSweb