Home | History | Annotate | Line # | Download | only in ic
oplreg.h revision 1.2
      1  1.2  augustss /*	$NetBSD: oplreg.h,v 1.2 1998/08/26 13:08:10 augustss Exp $	*/
      2  1.1  augustss 
      3  1.1  augustss /*
      4  1.1  augustss  * Copyright (c) 1997 The NetBSD Foundation, Inc.
      5  1.1  augustss  * All rights reserved.
      6  1.1  augustss  *
      7  1.1  augustss  * Author: Lennart Augustsson
      8  1.1  augustss  *
      9  1.1  augustss  * Redistribution and use in source and binary forms, with or without
     10  1.1  augustss  * modification, are permitted provided that the following conditions
     11  1.1  augustss  * are met:
     12  1.1  augustss  * 1. Redistributions of source code must retain the above copyright
     13  1.1  augustss  *    notice, this list of conditions and the following disclaimer.
     14  1.1  augustss  * 2. Redistributions in binary form must reproduce the above copyright
     15  1.1  augustss  *    notice, this list of conditions and the following disclaimer in the
     16  1.1  augustss  *    documentation and/or other materials provided with the distribution.
     17  1.1  augustss  * 3. All advertising materials mentioning features or use of this software
     18  1.1  augustss  *    must display the following acknowledgement:
     19  1.1  augustss  *        This product includes software developed by the NetBSD
     20  1.1  augustss  *        Foundation, Inc. and its contributors.
     21  1.1  augustss  * 4. Neither the name of The NetBSD Foundation nor the names of its
     22  1.1  augustss  *    contributors may be used to endorse or promote products derived
     23  1.1  augustss  *    from this software without specific prior written permission.
     24  1.1  augustss  *
     25  1.1  augustss  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     26  1.1  augustss  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     27  1.1  augustss  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     28  1.1  augustss  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     29  1.1  augustss  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     30  1.1  augustss  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     31  1.1  augustss  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     32  1.1  augustss  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     33  1.1  augustss  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     34  1.1  augustss  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     35  1.1  augustss  * POSSIBILITY OF SUCH DAMAGE.
     36  1.1  augustss  */
     37  1.1  augustss 
     38  1.1  augustss /* Offsets from base address */
     39  1.2  augustss #define OPL_L				0
     40  1.2  augustss #define OPL_R				2
     41  1.1  augustss 
     42  1.2  augustss /* Offsets from base+[OPL_L|OPL_R] */
     43  1.1  augustss #define OPL_STATUS			0
     44  1.1  augustss #define   OPL_STATUS_IRQ		0x80
     45  1.1  augustss #define   OPL_STATUS_FT1		0x40
     46  1.1  augustss #define   OPL_STATUS_FT2		0x20
     47  1.1  augustss #define   OPL_STATUS_MASK		0xE0
     48  1.1  augustss #define OPL_ADDR			0
     49  1.1  augustss #define OPL_DATA			1
     50  1.1  augustss 
     51  1.1  augustss #define OPL_TEST			0x01
     52  1.1  augustss #define   OPL_ENABLE_WAVE_SELECT	0x20
     53  1.1  augustss 
     54  1.1  augustss #define OPL_TIMER1			0x02
     55  1.1  augustss #define OPL_TIMER2			0x03
     56  1.1  augustss 
     57  1.2  augustss #define OPL_TIMER_CONTROL		0x04	/* Left */
     58  1.1  augustss #define   OPL_TIMER1_START		0x01
     59  1.1  augustss #define   OPL_TIMER2_START		0x02
     60  1.1  augustss #define   OPL_TIMER2_MASK		0x20
     61  1.1  augustss #define   OPL_TIMER1_MASK		0x40
     62  1.1  augustss #define   OPL_IRQ_RESET			0x80
     63  1.1  augustss 
     64  1.2  augustss #define OPL_CONNECTION_SELECT		0x04	/* Right */
     65  1.1  augustss #define   OPL_NOCONNECTION		0x00
     66  1.2  augustss #define   OPL_R_4OP_0			0x01
     67  1.2  augustss #define   OPL_R_4OP_1			0x02
     68  1.2  augustss #define   OPL_R_4OP_2			0x04
     69  1.2  augustss #define   OPL_L_4OP_0			0x08
     70  1.2  augustss #define   OPL_L_4OP_1			0x10
     71  1.2  augustss #define   OPL_L_4OP_2			0x20
     72  1.1  augustss 
     73  1.2  augustss #define OPL_MODE			0x05	/* Right */
     74  1.1  augustss #define   OPL3_ENABLE			0x01
     75  1.1  augustss #define   OPL4_ENABLE			0x02
     76  1.1  augustss 
     77  1.2  augustss #define OPL_KBD_SPLIT			0x08	/* Left */
     78  1.1  augustss #define   OPL_KEYBOARD_SPLIT		0x40
     79  1.1  augustss #define   OPL_COMPOSITE_SINE_WAVE_MODE	0x80
     80  1.1  augustss 
     81  1.2  augustss #define OPL_PERCUSSION			0xbd	/* Left */
     82  1.1  augustss #define   OPL_NOPERCUSSION		0x00
     83  1.1  augustss #define   OPL_HIHAT			0x01
     84  1.1  augustss #define   OPL_CYMBAL			0x02
     85  1.1  augustss #define   OPL_TOMTOM			0x04
     86  1.1  augustss #define   OPL_SNAREDRUM			0x08
     87  1.1  augustss #define   OPL_BASSDRUM			0x10
     88  1.1  augustss #define	  OPL_PERCUSSION_ENABLE		0x20
     89  1.1  augustss #define   OPL_VIBRATO_DEPTH		0x40
     90  1.1  augustss #define   OPL_TREMOLO_DEPTH		0x80
     91  1.1  augustss 
     92  1.1  augustss /*
     93  1.2  augustss  * Offsets to the register banks for operators.
     94  1.1  augustss  */
     95  1.2  augustss /* AM/VIB/EG/KSR/Multiple (0x20 to 0x35) */
     96  1.1  augustss #define OPL_AM_VIB			0x20
     97  1.1  augustss #define   OPL_KSR			0x10
     98  1.1  augustss #define   OPL_SUSTAIN			0x20
     99  1.1  augustss #define   OPL_VIBRATO			0x40
    100  1.1  augustss #define   OPL_TREMOLO			0x80
    101  1.1  augustss #define   OPL_MULTIPLE_MASK		0x0f
    102  1.1  augustss 
    103  1.2  augustss /* KSL/Total level (0x40 to 0x55) */
    104  1.1  augustss #define OPL_KSL_LEVEL			0x40
    105  1.1  augustss #define   OPL_KSL_MASK			0xc0	/* Envelope scaling bits */
    106  1.1  augustss #define   OPL_TOTAL_LEVEL_MASK		0x3f	/* Strength (volume) of OP */
    107  1.1  augustss 
    108  1.2  augustss /* Attack / Decay rate (0x60 to 0x75) */
    109  1.1  augustss #define OPL_ATTACK_DECAY		0x60
    110  1.1  augustss #define   OPL_ATTACK_MASK		0xf0
    111  1.1  augustss #define   DECAY_MASK			0x0f
    112  1.1  augustss 
    113  1.2  augustss /* Sustain level / Release rate (0x80 to 0x95) */
    114  1.1  augustss #define OPL_SUSTAIN_RELEASE		0x80
    115  1.1  augustss #define   OPL_SUSTAIN_MASK		0xf0
    116  1.1  augustss #define   OPL_RELEASE_MASK		0x0f
    117  1.1  augustss 
    118  1.2  augustss /* Wave select (0xE0 to 0xF5) */
    119  1.1  augustss #define OPL_WAVE_SELECT			0xe0
    120  1.1  augustss 
    121  1.1  augustss #define OPL_MAXREG			0xf5
    122  1.1  augustss 
    123  1.1  augustss /*
    124  1.2  augustss  * Offsets to the register banks for voices.
    125  1.1  augustss  */
    126  1.2  augustss /* F-Number low bits (0xA0 to 0xA8). */
    127  1.1  augustss #define OPL_FNUM_LOW			0xa0
    128  1.1  augustss 
    129  1.2  augustss /* F-number high bits / Key on / Block (octave) (0xB0 to 0xB8) */
    130  1.1  augustss #define OPL_KEYON_BLOCK			0xb0
    131  1.1  augustss #define	  OPL_KEYON_BIT			0x20
    132  1.1  augustss #define	  OPL_BLOCKNUM_MASK		0x1c
    133  1.1  augustss #define   OPL_FNUM_HIGH_MASK		0x03
    134  1.1  augustss 
    135  1.2  augustss /* Feedback / Connection (0xc0 to 0xc8) */
    136  1.1  augustss #define OPL_FEEDBACK_CONNECTION		0xc0
    137  1.2  augustss #define   OPL_FEEDBACK_MASK		0x0e
    138  1.1  augustss #define   OPL_CONNECTION_BIT		0x01
    139  1.1  augustss #define   OPL_STEREO_BITS		0x30	/* OPL-3 only */
    140  1.1  augustss #define     OPL_VOICE_TO_LEFT		0x10
    141  1.1  augustss #define     OPL_VOICE_TO_RIGHT		0x20
    142  1.1  augustss 
    143  1.1  augustss #define OPL2_NVOICE 9
    144  1.1  augustss #define OPL3_NVOICE 18
    145