1 /* $OpenBSD: oplvar.h,v 1.4 2006/07/27 05:55:00 miod Exp $ */ 2 /* $NetBSD: oplvar.h,v 1.3 1998/11/25 22:17:06 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 #include <dev/midivar.h> 41 #include <dev/midisynvar.h> 42 43 struct opl_voice { 44 int voiceno; 45 int iooffs; 46 u_int8_t op[4]; 47 const struct opl_operators *patch; 48 u_int8_t rB0; 49 }; 50 51 struct opl_softc { 52 struct midi_softc mididev; 53 bus_space_tag_t iot; 54 bus_space_handle_t ioh; 55 int offs; 56 int model; 57 #define OPL_2 2 58 #define OPL_3 3 59 struct midisyn syn; 60 61 struct opl_voice voices[OPL3_NVOICE]; 62 int volume; 63 64 int (*spkrctl)(void *, int); 65 void *spkrarg; 66 }; 67 68 struct opl_attach_arg { 69 bus_space_tag_t iot; 70 bus_space_handle_t ioh; 71 int offs; 72 int done; 73 }; 74 75 struct opl_operators { 76 u_int8_t opl3; 77 u_int8_t ops[22]; 78 #define OO_CHARS 0 79 #define OO_KSL_LEV 2 80 #define OO_ATT_DEC 4 81 #define OO_SUS_REL 6 82 #define OO_WAV_SEL 8 83 #define OO_FB_CONN 10 84 #define OO_4OP_OFFS 11 85 }; 86 87 #define OPL_NINSTR 256 88 extern const struct opl_operators opl2_instrs[]; 89 extern const struct opl_operators opl3_instrs[]; 90 91 int opl_find(struct opl_attach_arg *); 92 void opl_attach(struct opl_softc *);