xref: /dragonfly/sys/dev/sound/pci/cs4281.h (revision ed5d5720)
1 /*-
2  * Copyright (c) 2000 Orion Hodson <O.Hodson@cs.ucl.ac.uk>
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHERIN CONTRACT, STRICT
22  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THEPOSSIBILITY OF
24  * SUCH DAMAGE.
25  *
26  * $FreeBSD: src/sys/dev/sound/pci/cs4281.h,v 1.4 2005/01/06 01:43:19 imp Exp $
27  * $DragonFly: src/sys/dev/sound/pci/cs4281.h,v 1.3 2007/01/04 21:47:02 corecode Exp $
28  */
29 
30 #ifndef _CS4281_H_
31 #define _CS4281_H_
32 
33 #define CS4281_PCI_ID 	0x60051013
34 
35 /* Ball Parks */
36 #define CS4281PCI_BA0_SIZE 	4096
37 #define CS4281PCI_BA1_SIZE	65536
38 
39 /* Register values */
40 #define CS4281PCI_HISR		0x000
41 #	define CS4281PCI_HISR_DMAI		0x00040000
42 #	define CS4281PCI_HISR_DMA(x)		(0x0100 << (x))
43 
44 #define CS4281PCI_HICR		0x008
45 #	define CS4281PCI_HICR_EOI		0x00000003
46 
47 #define CS4281PCI_HIMR		0x00c
48 #	define CS4281PCI_HIMR_DMAI		0x00040000
49 #	define CS4281PCI_HIMR_DMA(x)		(0x0100 << (x))
50 
51 #define CS4281PCI_IIER		0x010
52 
53 #define CS4281PCI_HDSR(x)	(0x0f0 + (x)*0x004)
54 #	define CS4281PCI_HDSR_CH1P		0x02000000
55 #	define CS4281PCI_HDSR_CH2P		0x01000000
56 #	define CS4281PCI_HDSR_HDTC		0x00020000
57 #	define CS4281PCI_HDSR_DTC		0x00010000
58 #	define CS4281PCI_HDSR_DRUN		0x00008000
59 #	define CS4281PCI_HDSR_RQ		0x00000080
60 
61 #define CS4281PCI_DCA(x)	(0x110 + (x) * 0x010)
62 #define CS4281PCI_DCC(x)	(0x114 + (x) * 0x010)
63 #define CS4281PCI_DBA(x)	(0x118 + (x) * 0x010)
64 #define CS4281PCI_DBC(x)	(0x11c + (x) * 0x010)
65 
66 #define CS4281PCI_DMR(x)	(0x150 + (x) * 0x008)
67 #	define CS4281PCI_DMR_DMA		0x20000000
68 #	define CS4281PCI_DMR_POLL		0x10000000
69 #	define CS4281PCI_DMR_TBC		0x02000000
70 #	define CS4281PCI_DMR_CBC		0x01000000
71 #	define CS4281PCI_DMR_SWAPC		0x00400000
72 #	define CS4281PCI_DMR_SIZE20		0x00100000
73 #	define CS4281PCI_DMR_USIGN		0x00080000
74 #	define CS4281PCI_DMR_BEND		0x00040000
75 #	define CS4281PCI_DMR_MONO		0x00020000
76 #	define CS4281PCI_DMR_SIZE8		0x00010000
77 #	define CS4281PCI_DMR_TYPE_DEMAND	0x00000000
78 #	define CS4281PCI_DMR_TYPE_SINGLE	0x00000040
79 #	define CS4281PCI_DMR_TYPE_BLOCK		0x00000080
80 #	define CS4281PCI_DMR_TYPE_CASCADE	0x000000c0
81 #	define CS4281PCI_DMR_DEC		0x00000020
82 #	define CS4281PCI_DMR_AUTO		0x00000010
83 #	define CS4281PCI_DMR_TR_PLAY		0x00000008
84 #	define CS4281PCI_DMR_TR_REC		0x00000004
85 
86 #define CS4281PCI_DCR(x)	(0x154 + (x) * 0x008)
87 #	define CS4281PCI_DCR_HTCIE		0x00020000
88 #	define CS4281PCI_DCR_TCIE		0x00010000
89 #	define CS4281PCI_DCR_MSK		0x00000001
90 
91 #define CS4281PCI_FCR(x)	(0x180 + (x) * 0x004)
92 #	define CS4281PCI_FCR_FEN		0x80000000
93 #	define CS4281PCI_FCR_DACZ		0x40000000
94 #	define CS4281PCI_FCR_PSH		0x20000000
95 #	define CS4281PCI_FCR_RS(x)		((x) << 24)
96 #	define CS4281PCI_FCR_LS(x)		((x) << 16)
97 #	define CS4281PCI_FCR_SZ(x)		((x) << 8)
98 #	define CS4281PCI_FCR_OF(x)		(x)
99 
100 #define CS4281PCI_FPDR(x)	(0x190 + (x) * 0x004)
101 
102 #define CS4281PCI_FCHS		0x20c
103 #define CS4281PCI_FSIC(x)	(0x210 + (x) * 0x004)
104 
105 #define CS4281PCI_PMCS		0x344
106 #	define CS4281PCI_PMCS_PS_MASK		0x00000003
107 #define CS4281PCI_PMCS_OFFSET	(CS4281PCI_PMCS - 0x300)
108 
109 #define CS4281PCI_CWPR		0x3e0
110 #	define CS4281PCI_CWPR_MAGIC		0x00004281
111 
112 #define CS4281PCI_EPPMC		0x3e4
113 #	define CS4281PCI_EPPMC_FPDN		0x00004000
114 #define CS4281PCI_GPIOR		0x3e8
115 
116 #define CS4281PCI_SPMC		0x3ec
117 #	define CS4281PCI_SPMC_RSTN		0x00000001
118 #	define CS4281PCI_SPMC_ASYN		0x00000002
119 #	define CS4281PCI_SPMC_WUP1		0x00000004
120 #	define CS4281PCI_SPMC_WUP2		0x00000008
121 #	define CS4281PCI_SPMC_ASDO		0x00000080
122 #	define CS4281PCI_SPMC_ASDI2E		0x00000100
123 #	define CS4281PCI_SPMC_EESPD		0x00000200
124 #	define CS4281PCI_SPMC_GISPEN		0x00004000
125 #	define CS4281PCI_SPMC_GIPPEN		0x00008000
126 
127 #define CS4281PCI_CFLR		0x3f0
128 #define CS4281PCI_IISR		0x3f4
129 #define CS4281PCI_TMS		0x3f8
130 #define CS4281PCI_SSVID		0x3fc
131 
132 #define CS4281PCI_CLKCR1	0x400
133 #	define CS_4281PCI_CLKCR1_DLLSS_MASK	0x0000000c
134 #	define CS_4281PCI_CLKCR1_DLLSS_AC97	0x00000004
135 #	define CS4281PCI_CLKCR1_DLLP		0x00000010
136 #	define CS4281PCI_CLKCR1_SWCE		0x00000020
137 #	define CS4281PCI_CLKCR1_DLLOS		0x00000040
138 #	define CS4281PCI_CLKCR1_CKRA		0x00010000
139 #	define CS4281PCI_CLKCR1_DLLRDY		0x01000000
140 #	define CS4281PCI_CLKCR1_CLKON		0x02000000
141 
142 #define CS4281PCI_FRR		0x410
143 
144 #define CS4281PCI_SLT12O	0x41c
145 #define CS4281PCI_SERMC		0x420
146 #	define CS4281PCI_SERMC_PTC_AC97		0x00000002
147 #	define CS4281PCI_SERMC_PTC_MASK		0x0000000e
148 #	define CS4281PCI_SERMC_ODSEN1		0x01000000
149 #	define CS4281PCI_SERMC_ODSEN2		0x02000000
150 #define CS4281PCI_SERC1		0x428
151 #define CS4281PCI_SERC2		0x42c
152 
153 #define CS4281PCI_SLT12M	0x45c
154 #define CS4281PCI_ACCTL		0x460
155 #	define CS4281PCI_ACCTL_ESYN		0x00000002
156 #	define CS4281PCI_ACCTL_VFRM		0x00000004
157 #	define CS4281PCI_ACCTL_DCV		0x00000008
158 #	define CS4281PCI_ACCTL_CRW		0x00000010
159 #	define CS4281PCI_ACCTL_TC		0x00000040
160 
161 #define CS4281PCI_ACSTS		0x464
162 #	define CS4281PCI_ACSTS_CRDY		0x00000001
163 #	define CS4281PCI_ACSTS_VSTS		0x00000002
164 
165 #define CS4281PCI_ACOSV		0x468
166 #	define CS4281PCI_ACOSV_SLV(x)		(1 << (x - 3))
167 #define CS4281PCI_ACCAD		0x46c
168 #define CS4281PCI_ACCDA		0x470
169 #define CS4281PCI_ACISV		0x474
170 #	define CS4281PCI_ACISV_ISV(x)		(1 << (x - 3))
171 #define CS4281PCI_ACSAD		0x478
172 #define CS4281PCI_ACSDA		0x47c
173 #define CS4281PCI_JSPT		0x480
174 #define CS4281PCI_JSCTL		0x484
175 
176 #define CS4281PCI_SSPM		0x740
177 #	define CS4281PCI_SSPM_MIXEN		0x00000040
178 #	define CS4281PCI_SSPM_CSRCEN		0x00000020
179 #	define CS4281PCI_SSPM_PSRCEN		0x00000010
180 #	define CS4281PCI_SSPM_JSEN		0x00000008
181 #	define CS4281PCI_SSPM_ACLEN		0x00000004
182 #	define CS4281PCI_SSPM_FMEN		0x00000002
183 
184 #define CS4281PCI_DACSR		0x744
185 #define CS4281PCI_ADCSR		0x748
186 #define CS4281PCI_SSCR		0x74c
187 
188 #define CS4281PCI_SRCSA		0x75c
189 #	define CS4281PCI_SRCSA_PLSS(x)		(x)
190 #	define CS4281PCI_SRCSA_PRSS(x)		((x) << 8)
191 #	define CS4281PCI_SRCSA_CLSS(x)		((x) << 16)
192 #	define CS4281PCI_SRCSA_CRSS(x)		((x) << 24)
193 
194 #define CS4281PCI_PPLVC		0x760
195 #define CS4281PCI_PPRVC		0x764
196 
197 /* Slot definitions (minimal) */
198 #define CS4281PCI_LPCM_PLAY_SLOT	0x00
199 #define CS4281PCI_RPCM_PLAY_SLOT	0x01
200 
201 #define CS4281PCI_LPCM_REC_SLOT		0x0a
202 #define CS4281PCI_RPCM_REC_SLOT		0x0b
203 
204 #define CS4281PCI_DISABLED_SLOT		0x1f
205 
206 #endif /* _CS4281_H_ */
207