Home | History | Annotate | Line # | Download | only in ic
ad1848reg.h revision 1.1
      1 /*	$NetBSD: ad1848reg.h,v 1.1 1995/07/07 02:11:45 brezak Exp $	*/
      2 
      3 /*
      4  * Copyright (c) 1994 John Brezak
      5  * Copyright (c) 1991-1993 Regents of the University of California.
      6  * All rights reserved.
      7  *
      8  * Redistribution and use in source and binary forms, with or without
      9  * modification, are permitted provided that the following conditions
     10  * are met:
     11  * 1. Redistributions of source code must retain the above copyright
     12  *    notice, this list of conditions and the following disclaimer.
     13  * 2. Redistributions in binary form must reproduce the above copyright
     14  *    notice, this list of conditions and the following disclaimer in the
     15  *    documentation and/or other materials provided with the distribution.
     16  * 3. All advertising materials mentioning features or use of this software
     17  *    must display the following acknowledgement:
     18  *	This product includes software developed by the Computer Systems
     19  *	Engineering Group at Lawrence Berkeley Laboratory.
     20  * 4. Neither the name of the University nor of the Laboratory may be used
     21  *    to endorse or promote products derived from this software without
     22  *    specific prior written permission.
     23  *
     24  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     25  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     26  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     27  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     28  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     29  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     30  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     31  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     33  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     34  * SUCH DAMAGE.
     35  *
     36  */
     37 /*
     38  * Copyright (c) 1993 Analog Devices Inc. All rights reserved
     39  */
     40 
     41 /* parent driver is primarily responsible for checking this */
     42 #define AD1848_BASE_VALID(base)	(((base) & 0x003) == 0)
     43 
     44 /* AD1848 direct registers */
     45 #define AD1848_IADDR		0x04
     46 #define AD1848_IDATA		0x05
     47 #define AD1848_STATUS		0x06
     48 #define AD1848_PIO		0x07
     49 
     50 /* Gain constants  */
     51 #define GAIN_0			0x00
     52 #define GAIN_1_5		0x01
     53 #define GAIN_3			0x02
     54 #define GAIN_4_5		0x03
     55 #define GAIN_6			0x04
     56 #define GAIN_7_5		0x05
     57 #define GAIN_9			0x06
     58 #define GAIN_10_5		0x07
     59 #define GAIN_12			0x08
     60 #define GAIN_13_5		0x09
     61 #define GAIN_15			0x0a
     62 #define GAIN_16_5		0x0b
     63 #define GAIN_18			0x0c
     64 #define GAIN_19_5		0x0d
     65 #define GAIN_21			0x0e
     66 #define GAIN_22_5		0x0f
     67 
     68 /* Attenuation constants  */
     69 
     70 #define ATTEN_0			0x00
     71 #define ATTEN_1_5		0x01
     72 #define ATTEN_3			0x02
     73 #define ATTEN_4_5		0x03
     74 #define ATTEN_6			0x04
     75 #define ATTEN_7_5		0x05
     76 #define ATTEN_9			0x06
     77 #define ATTEN_10_5		0x07
     78 #define ATTEN_12		0x08
     79 #define ATTEN_13_5		0x09
     80 #define ATTEN_15		0x0a
     81 #define ATTEN_16_5		0x0b
     82 #define ATTEN_18		0x0c
     83 #define ATTEN_19_5		0x0d
     84 #define ATTEN_21		0x0e
     85 #define ATTEN_22_5		0x0f
     86 
     87 /* AD1848 Sound Port bit defines */
     88 #define SP_IN_INIT		0x80
     89 #define MODE_CHANGE_ENABLE	0x40
     90 #define MODE_CHANGE_MASK	0xbf
     91 #define TRANSFER_DISABLE	0x20
     92 #define TRANSFER_DISABLE_MASK	0xdf
     93 #define ADDRESS_MASK		0xe0
     94 
     95 /* Status bits */
     96 #define INTERRUPT_STATUS	0x01
     97 #define PLAYBACK_READY		0x02
     98 #define PLAYBACK_LEFT		0x04
     99 /* pbright is not left */
    100 #define PLAYBACK_UPPER		0x08
    101 /* bplower is not upper */
    102 
    103 #define SAMPLE_ERROR		0x10
    104 #define CAPTURE_READY		0x20
    105 #define CAPTURE_LEFT		0x40
    106 /* cpright is not left */
    107 #define CAPTURE_UPPER		0x08
    108 /* cplower is not upper */
    109 
    110 /* Input & Output regs bits */
    111 #define LINE_INPUT		0x00
    112 #define AUX_INPUT		0x40
    113 #define MIC_INPUT		0x80
    114 #define MIXED_DAC_INPUT		0xC0
    115 #define INPUT_GAIN_MASK		0xf0
    116 #define INPUT_MIC_GAIN_ENABLE	0x20
    117 #define INPUT_MIC_GAIN_MASK	0xdf
    118 #define INPUT_SOURCE_MASK	0x3f
    119 #define AUX_INPUT_ATTEN_BITS	0x1f
    120 #define AUX_INPUT_ATTEN_MASK	0xe0
    121 #define AUX_INPUT_MUTE		0x80
    122 #define AUX_INPUT_MUTE_MASK	0x7f
    123 #define OUTPUT_MUTE		0x80
    124 #define OUTPUT_MUTE_MASK	0x7f
    125 #define OUTPUT_ATTEN_BITS	0x3f
    126 #define OUTPUT_ATTEN_MASK	0xc0
    127 
    128 /* Clock and Data format reg bits (some also Capture Data format) */
    129 #define CLOCK_SELECT_MASK	0xfe
    130 #define CLOCK_XTAL2		0x01
    131 #define CLOCK_XTAL1		0x00
    132 #define CLOCK_FREQ_MASK		0xf1
    133 #define STEREO_MONO_MASK	0xef
    134 #define FMT_STEREO		0x10
    135 #define FMT_MONO		0x00
    136 #define FORMAT_MASK		0x1f
    137 #define FMT_PCM8		0x00	/* 8-bit unsigned */
    138 #define FMT_ULAW		0x20	/* 8-bit mu-law */
    139 #define FMT_TWOS_COMP		0x40	/* 16-bit signed */
    140 #define FMT_ALAW		0x60	/* 8-bit alaw */
    141 #define FMT_TWOS_COMP_BE	0xC0	/* 16-bit signed, big endian */
    142 
    143 /* Interface Configuration reg bits */
    144 #define PLAYBACK_ENABLE		0x01
    145 #define PLAYBACK_ENABLE_MASK	0xfe
    146 #define CAPTURE_ENABLE		0x02
    147 #define CAPTURE_ENABLE_MASK	0xfd
    148 #define SINGLE_DMA		0x04
    149 #define SINGLE_DMA_MASK		0xfb
    150 #define DUAL_DMA		0x00
    151 #define AUTO_CAL_ENABLE		0x08
    152 #define AUTO_CAL_DISABLE_MASK	0xf7
    153 #define PLAYBACK_PIO_ENABLE	0x40
    154 #define PLAYBACK_DMA_MASK	0xbf
    155 #define CAPTURE_PIO_ENABLE	0x80
    156 #define CAPTURE_DMA_MASK	0x7f
    157 
    158 /* Pin control bits */
    159 #define INTERRUPT_ENABLE	0x02
    160 #define INTERRUPT_MASK		0xfd
    161 #define XCTL0_ENABLE		0x40
    162 #define XCTL1_ENABLE		0x80
    163 
    164 /* Test and init reg bits */
    165 #define OVERRANGE_LEFT_MASK	0xfc
    166 #define OVERRANGE_RIGHT_MASK	0xf3
    167 #define DATA_REQUEST_STATUS	0x10
    168 #define AUTO_CAL_IN_PROG	0x20
    169 #define PLAYBACK_UNDERRUN	0x40
    170 #define CAPTURE_OVERRUN		0x80
    171 
    172 /* Miscellaneous Control reg bits */
    173 #define ID_MASK			0x70
    174 #define MODE2			0x40
    175 
    176 /* Digital Mix Control reg bits */
    177 #define DIGITAL_MIX1_MUTE_MASK	0xfe
    178 #define DIGITAL_MIX1_ENABLE	0x01
    179 #define MIX_ATTEN_MASK		0xfc
    180 
    181 /* AD1848 Sound Port reg defines */
    182 #define SP_LEFT_INPUT_CONTROL	0x00
    183 #define SP_RIGHT_INPUT_CONTROL	0x01
    184 #define SP_LEFT_AUX1_CONTROL	0x02
    185 #define SP_RIGHT_AUX1_CONTROL	0x03
    186 #define SP_LEFT_AUX2_CONTROL	0x04
    187 #define SP_RIGHT_AUX2_CONTROL	0x05
    188 #define SP_LEFT_OUTPUT_CONTROL	0x06
    189 #define SP_RIGHT_OUTPUT_CONTROL 0x07
    190 #define SP_CLOCK_DATA_FORMAT	0x08
    191 #define SP_INTERFACE_CONFIG	0x09
    192 #define SP_PIN_CONTROL		0x0A
    193 #define SP_TEST_AND_INIT	0x0B
    194 #define SP_MISC_INFO		0x0C
    195 #define SP_DIGITAL_MIX		0x0D
    196 #define SP_UPPER_BASE_COUNT	0x0E
    197 #define SP_LOWER_BASE_COUNT	0x0F
    198 
    199