Home | History | Annotate | Line # | Download | only in ic
cs4215reg.h revision 1.1
      1  1.1  macallan /*	$NetBSD: cs4215reg.h,v 1.1 2005/07/16 18:58:49 macallan Exp $	*/
      2  1.1  macallan 
      3  1.1  macallan /*
      4  1.1  macallan  * Copyright (c) 2001 Jared D. McNeill <jmcneill (at) invisible.yi.org>
      5  1.1  macallan  * All rights reserved.
      6  1.1  macallan  *
      7  1.1  macallan  * Redistribution and use in source and binary forms, with or without
      8  1.1  macallan  * modification, are permitted provided that the following conditions
      9  1.1  macallan  * are met:
     10  1.1  macallan  * 1. Redistributions of source code must retain the above copyright
     11  1.1  macallan  *    notice, this list of conditions and the following disclaimer.
     12  1.1  macallan  * 2. Redistributions in binary form must reproduce the above copyright
     13  1.1  macallan  *    notice, this list of conditions and the following disclaimer in the
     14  1.1  macallan  *    documentation and/or other materials provided with the distribution.
     15  1.1  macallan  * 3. All advertising materials mentioning features or use of this software
     16  1.1  macallan  *    must display the following acknowledgement:
     17  1.1  macallan  *	This product includes software developed by Jared D. McNeill.
     18  1.1  macallan  * 4. Neither the name of the author nor the names of any contributors may
     19  1.1  macallan  *    be used to endorse or promote products derived from this software
     20  1.1  macallan  *    without specific prior written permission.
     21  1.1  macallan  *
     22  1.1  macallan  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     23  1.1  macallan  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     24  1.1  macallan  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     25  1.1  macallan  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     26  1.1  macallan  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     27  1.1  macallan  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     28  1.1  macallan  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     29  1.1  macallan  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     30  1.1  macallan  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     31  1.1  macallan  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     32  1.1  macallan  * SUCH DAMAGE.
     33  1.1  macallan  *
     34  1.1  macallan  */
     35  1.1  macallan 
     36  1.1  macallan /* time slot 1: status register */
     37  1.1  macallan #define	CS4215_CLB	(1<<2)	/* control latch bit */
     38  1.1  macallan #define	CS4215_MLB	(1<<4)	/* 1: mic: 20 dB gain disabled */
     39  1.1  macallan #define	CS4215_RSRVD_1	(1<<5)
     40  1.1  macallan 
     41  1.1  macallan /* time slot 2: data format register */
     42  1.1  macallan #define	CS4215_DFR_LINEAR16	0
     43  1.1  macallan #define	CS4215_DFR_ULAW		1
     44  1.1  macallan #define	CS4215_DFR_ALAW		2
     45  1.1  macallan #define	CS4215_DFR_LINEAR8	3
     46  1.1  macallan #define	CS4215_DFR_STEREO	(1<<2)
     47  1.1  macallan const struct {
     48  1.1  macallan 	unsigned short	freq;
     49  1.1  macallan 	unsigned char	xtal;
     50  1.1  macallan 	unsigned char	csval;
     51  1.1  macallan } CS4215_FREQ[] = {
     52  1.1  macallan 	{ 8000, 	(1<<4), (0<<3) },
     53  1.1  macallan 	{ 16000, 	(1<<4), (1<<3) },
     54  1.1  macallan 	{ 27429, 	(1<<4), (2<<3) },	/* actually 24428.57 */
     55  1.1  macallan 	{ 32000, 	(1<<4), (3<<3) },
     56  1.1  macallan 		/* NA		(4<<3) */
     57  1.1  macallan 		/* NA		(5<<3) */
     58  1.1  macallan 	{ 48000, 	(1<<4), (6<<3) },
     59  1.1  macallan 	{ 9600, 	(1<<4), (7<<3) },
     60  1.1  macallan 	{ 5513, 	(2<<4), (0<<3) },	/* actually 5512.5 */
     61  1.1  macallan 	{ 11025, 	(2<<4), (1<<3) },
     62  1.1  macallan 	{ 18900, 	(2<<4), (2<<3) },
     63  1.1  macallan 	{ 22050, 	(2<<4), (3<<3) },
     64  1.1  macallan 	{ 37800, 	(2<<4), (4<<3) },
     65  1.1  macallan 	{ 44100, 	(2<<4), (5<<3) },
     66  1.1  macallan 	{ 33075, 	(2<<4), (6<<3) },
     67  1.1  macallan 	{ 6615, 	(2<<4), (7<<3) },
     68  1.1  macallan 	{ 0, 		0, 	0 }
     69  1.1  macallan };
     70  1.1  macallan 
     71  1.1  macallan /* time slot 3: serial port control register */
     72  1.1  macallan #define	CS4215_XCLK	(1<<1)		/* 0: enable serial output */
     73  1.1  macallan #define	CS4215_BSEL_128	(1<<2)		/* bitrate: 128 bits per frame */
     74  1.1  macallan 
     75  1.1  macallan /* time slot 5: output setting */
     76  1.1  macallan #define	CS4215_LO(v)	v	/* left output attenuation 0x3f: -94.5 dB */
     77  1.1  macallan #define	CS4215_LE	(1<<6)	/* line out enable */
     78  1.1  macallan #define	CS4215_HE	(1<<7)	/* headphone enable */
     79  1.1  macallan 
     80  1.1  macallan /* time slot 6: output setting */
     81  1.1  macallan #define CS4215_RO(v)	v	/* right output attenuation 0x3f: -94.5 dB */
     82  1.1  macallan #define	CS4215_SE	(1<<6)	/* speaker enable */
     83  1.1  macallan #define CS4215_ADI	(1<<7)	/* a/d data invalid: busy in calibration */
     84  1.1  macallan 
     85  1.1  macallan /* time slot 7: input setting */
     86  1.1  macallan #define	CS4215_LG(v)	v	/* left gain setting 0xf: 22.5 dB */
     87  1.1  macallan #define	CS4215_IS	(1<<4)	/* input select: 1 = mic, 0 = line */
     88  1.1  macallan #define	CS4215_PIO0	(1<<6)	/* parallel I/O 0 */
     89  1.1  macallan #define	CS4215_PIO1	(1<<7)	/* parallel I/O 1 */
     90  1.1  macallan 
     91  1.1  macallan /* time slot 8: input setting */
     92  1.1  macallan #define	CS4215_RG(v)	v	/* right gain setting 0xf: 22.5 dB */
     93  1.1  macallan #define	CS4215_MA(v)	(v<<4)	/* monitor path attenuation 0xf: mute */
     94  1.1  macallan 
     95