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