cs4215reg.h revision 1.5 1 1.5 macallan /* $NetBSD: cs4215reg.h,v 1.5 2017/12/21 21:56:29 macallan Exp $ */
2 1.1 macallan
3 1.1 macallan /*
4 1.3 macallan * Copyright (c) 2001 Jared D. McNeill <jmcneill (at) NetBSD.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 *
16 1.1 macallan * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17 1.1 macallan * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 1.1 macallan * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 1.1 macallan * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20 1.1 macallan * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 1.1 macallan * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 1.1 macallan * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 1.1 macallan * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 1.1 macallan * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 1.1 macallan * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 1.1 macallan * SUCH DAMAGE.
27 1.1 macallan *
28 1.1 macallan */
29 1.1 macallan
30 1.1 macallan /* time slot 1: status register */
31 1.1 macallan #define CS4215_CLB (1<<2) /* control latch bit */
32 1.1 macallan #define CS4215_MLB (1<<4) /* 1: mic: 20 dB gain disabled */
33 1.5 macallan #define CS4215_ONE (1<<5) /* always one */
34 1.1 macallan
35 1.1 macallan /* time slot 2: data format register */
36 1.1 macallan #define CS4215_DFR_LINEAR16 0
37 1.1 macallan #define CS4215_DFR_ULAW 1
38 1.1 macallan #define CS4215_DFR_ALAW 2
39 1.1 macallan #define CS4215_DFR_LINEAR8 3
40 1.1 macallan #define CS4215_DFR_STEREO (1<<2)
41 1.1 macallan const struct {
42 1.1 macallan unsigned short freq;
43 1.1 macallan unsigned char xtal;
44 1.1 macallan unsigned char csval;
45 1.1 macallan } CS4215_FREQ[] = {
46 1.1 macallan { 8000, (1<<4), (0<<3) },
47 1.1 macallan { 16000, (1<<4), (1<<3) },
48 1.1 macallan { 27429, (1<<4), (2<<3) }, /* actually 24428.57 */
49 1.1 macallan { 32000, (1<<4), (3<<3) },
50 1.1 macallan /* NA (4<<3) */
51 1.1 macallan /* NA (5<<3) */
52 1.1 macallan { 48000, (1<<4), (6<<3) },
53 1.1 macallan { 9600, (1<<4), (7<<3) },
54 1.1 macallan { 5513, (2<<4), (0<<3) }, /* actually 5512.5 */
55 1.1 macallan { 11025, (2<<4), (1<<3) },
56 1.1 macallan { 18900, (2<<4), (2<<3) },
57 1.1 macallan { 22050, (2<<4), (3<<3) },
58 1.1 macallan { 37800, (2<<4), (4<<3) },
59 1.1 macallan { 44100, (2<<4), (5<<3) },
60 1.1 macallan { 33075, (2<<4), (6<<3) },
61 1.1 macallan { 6615, (2<<4), (7<<3) },
62 1.1 macallan { 0, 0, 0 }
63 1.1 macallan };
64 1.1 macallan
65 1.1 macallan /* time slot 3: serial port control register */
66 1.1 macallan #define CS4215_XCLK (1<<1) /* 0: enable serial output */
67 1.1 macallan #define CS4215_BSEL_128 (1<<2) /* bitrate: 128 bits per frame */
68 1.1 macallan
69 1.1 macallan /* time slot 5: output setting */
70 1.3 macallan #define CS4215_LO(v) (v) /* left output attenuation 0x3f: -94.5 dB */
71 1.1 macallan #define CS4215_LE (1<<6) /* line out enable */
72 1.1 macallan #define CS4215_HE (1<<7) /* headphone enable */
73 1.1 macallan
74 1.1 macallan /* time slot 6: output setting */
75 1.3 macallan #define CS4215_RO(v) (v) /* right output attenuation 0x3f: -94.5 dB */
76 1.1 macallan #define CS4215_SE (1<<6) /* speaker enable */
77 1.1 macallan #define CS4215_ADI (1<<7) /* a/d data invalid: busy in calibration */
78 1.1 macallan
79 1.1 macallan /* time slot 7: input setting */
80 1.3 macallan #define CS4215_LG(v) (v) /* left gain setting 0xf: 22.5 dB */
81 1.1 macallan #define CS4215_IS (1<<4) /* input select: 1 = mic, 0 = line */
82 1.1 macallan #define CS4215_PIO0 (1<<6) /* parallel I/O 0 */
83 1.1 macallan #define CS4215_PIO1 (1<<7) /* parallel I/O 1 */
84 1.1 macallan
85 1.1 macallan /* time slot 8: input setting */
86 1.3 macallan #define CS4215_RG(v) (v) /* right gain setting 0xf: 22.5 dB */
87 1.3 macallan #define CS4215_MA(v) ((v)<<4) /* monitor path attenuation 0xf: mute */
88 1.1 macallan
89