source: mainline/uspace/drv/audio/hdaudio/spec/regs.h@ 99cb9bf

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 99cb9bf was a333b7f, checked in by Jiri Svoboda <jiri@…>, 11 years ago

Interrupt handling - RIRB interrupts.

  • Property mode set to 100644
File size: 7.1 KB
Line 
1/*
2 * Copyright (c) 2014 Jiri Svoboda
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 *
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * - The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29/** @addtogroup hdaudio
30 * @{
31 */
32/** @file High Definition Audio register interface
33 */
34
35#ifndef SPEC_REGS_H
36#define SPEC_REGS_H
37
38#include <sys/types.h>
39
40/** Stream Descriptor registers */
41typedef struct {
42 /** Control 1 */
43 uint8_t ctl1;
44 /** Control 2 */
45 uint8_t ctl2;
46 /** Control 3 */
47 uint8_t ctl3;
48 /** Status */
49 uint8_t sts;
50 /** Link Position in Current Buffer */
51 uint32_t lpib;
52 /** Cyclic Buffer Length */
53 uint32_t cbl;
54 /** Last Valid Index */
55 uint16_t lvi;
56 /** Reserved */
57 uint8_t reserved1[2];
58 /** FIFO Size */
59 uint16_t fifod;
60 /** Format */
61 uint16_t fmt;
62 /** Reserved */
63 uint8_t reserved2[4];
64 /** Buffer Descriptor List Pointer - Lower */
65 uint32_t bdpl;
66 /** Buffer Descriptor List Pointer - Upper */
67 uint32_t bdpu;
68} hda_sdesc_regs_t;
69
70typedef struct {
71 /** Global Capabilities */
72 uint16_t gcap;
73 /** Minor Version */
74 uint8_t vmin;
75 /** Major Version */
76 uint8_t vmaj;
77 /** Output Payload Capability */
78 uint16_t outpay;
79 /** Input Payload Capability */
80 uint16_t inpay;
81 /** Global Control */
82 uint32_t gctl;
83 /** Wake Enable */
84 uint16_t wakeen;
85 /** State Change Status */
86 uint16_t statests;
87 /** Global Status */
88 uint16_t gsts;
89 /** Reserved */
90 uint8_t reserved1[6];
91 /** Output Stream Payload Capability */
92 uint16_t outstrmpay;
93 /** Input Stream Payload Capability */
94 uint16_t instrmpay;
95 /** Reserved */
96 uint8_t reserved2[4];
97 /** Interrupt Control */
98 uint32_t intctl;
99 /** Interrupt Status */
100 uint32_t intsts;
101 /** Reserved */
102 uint8_t reserved3[8];
103 /** Wall Clock Counter */
104 uint32_t walclk;
105 /** Reserved */
106 uint8_t reserved4[4];
107 /** Stream Synchronization */
108 uint32_t ssync;
109 /** Reserved */
110 uint8_t reserved5[4];
111 /** CORB Lower Base Address */
112 uint32_t corblbase;
113 /** CORB Upper Base Address */
114 uint32_t corbubase;
115 /** CORB Write Pointer */
116 uint16_t corbwp;
117 /** CORB Read Pointer */
118 uint16_t corbrp;
119 /** CORB Control */
120 uint8_t corbctl;
121 /** CORB Status */
122 uint8_t corbsts;
123 /** CORB Size */
124 uint8_t corbsize;
125 /** Reserved */
126 uint8_t reserved6[1];
127 /** RIRB Lower Base Address */
128 uint32_t rirblbase;
129 /** RIRB Upper Base Address */
130 uint32_t rirbubase;
131 /** RIRB Write Pointer */
132 uint16_t rirbwp;
133 /** Response Interrupt Count */
134 uint16_t rintcnt;
135 /** RIRB Control */
136 uint8_t rirbctl;
137 /** RIRB Status */
138 uint8_t rirbsts;
139 /** RIRB Size */
140 uint8_t rirbsize;
141 /** Reserved */
142 uint8_t reserved7[1];
143 /** Immediate Command Output Interface */
144 uint32_t icoi;
145 /** Immediate Command Input Interface */
146 uint32_t icii;
147 /** Immediate Command Status */
148 uint16_t icis;
149 /** Reserved */
150 uint8_t reserved8[6];
151 /** DMA Position Buffer Lower Base */
152 uint32_t dplbase;
153 /** DMA Position Buffer Upper Base */
154 uint32_t dpubase;
155 /** Reserved */
156 uint8_t reserved9[8];
157 /** Stream descriptor registers */
158 hda_sdesc_regs_t sdesc[64];
159 /** Fill up to 0x2030 */
160 uint8_t reserved10[6064];
161 /** Wall Clock Counter Alias */
162 uint32_t walclka;
163 /** Stream Descriptor Link Position in Current Buffer */
164 uint32_t sdlpiba[64];
165} hda_regs_t;
166
167typedef enum {
168 /** Number of Output Streams Supported (H) */
169 gcap_oss_h = 15,
170 /** Number of Output Streams Supported (L) */
171 gcap_oss_l = 12,
172 /** Number of Input Streams Supported (H) */
173 gcap_iss_h = 11,
174 /** Number of Input Streams Supported (L) */
175 gcap_iss_l = 8,
176 /** Number of Bidirectional Streams Supported (H) */
177 gcap_bss_h = 7,
178 /** Number of Bidirectional Streams Supported (L) */
179 gcap_bss_l = 3,
180 /** Number of Serial Data Out Signals (H) */
181 gcap_nsdo_h = 2,
182 /** Number of Serial Data Out Signals (H) */
183 gcap_nsdo_l = 1,
184 /** 64 Bit Address Supported */
185 gcap_64ok = 0
186} hda_gcap_bits_t;
187
188typedef enum {
189 /** Accept Unsolicited Response Enable */
190 gctl_unsol = 8,
191 /** Flush Control */
192 gctl_fcntrl = 1,
193 /** Controller Reset */
194 gctl_crst = 0
195} hda_gctl_bits_t;
196
197typedef enum {
198 /** Global Interrupt Enable */
199 intctl_gie = 31,
200 /** Controller Interrupt Enable */
201 intctl_cie = 30,
202 /** Stream Interrupt Enable */
203 intctl_sie = 29
204} hda_intctl_bits_t;
205
206typedef enum {
207 /** CORB Read Pointer Reset */
208 corbrp_rst = 15,
209 /** CORB Read Pointer (H) */
210 corbrp_rp_h = 7,
211 /** CORB Read Pointer (L) */
212 corbrp_rp_l = 0
213} hda_corbrp_bits_t;
214
215typedef enum {
216 /** CORB Write Pointer (H) */
217 corbwp_wp_h = 7,
218 /** CORB Write Pointer (L) */
219 corbwp_wp_l = 0
220} hda_corbwp_bits_t;
221
222typedef enum {
223 /** Enable CORB DMA Engine */
224 corbctl_run = 1,
225 /** CORB Memory Error Interrupt Enable */
226 corbctl_meie = 0
227} hda_corbctl_bits_t;
228
229typedef enum {
230 /** CORB Size Capability (H) */
231 corbsize_cap_h = 7,
232 /** CORB Size Capability (L) */
233 corbsize_cap_l = 4,
234 /** CORB Size (H) */
235 corbsize_size_h = 1,
236 /** CORB Size (L) */
237 corbsize_size_l = 0
238} hda_corbsize_bits_t;
239
240typedef enum {
241 /** RIRB Write Pointer Reset */
242 rirbwp_rst = 15,
243 /** RIRB Write Pointer (H) */
244 rirbwp_wp_h = 7,
245 /** RIRB Write Pointer (L) */
246 rirbwp_wp_l = 0
247} hda_rirbwp_bits_t;
248
249typedef enum {
250 /** Response Overrun Interrupt Control */
251 rirbctl_oic = 2,
252 /** RIRB DMA Enable */
253 rirbctl_run = 1,
254 /** CORB Memory Error Interrupt Enable */
255 rirbctl_int = 0
256} hda_rirbctl_bits_t;
257
258typedef enum {
259 /** Response Overrun Interrupt Status */
260 rirbsts_ois = 2,
261 /** Response Interrupt */
262 rirbsts_intfl = 0
263} hda_rirbsts_bits_t;
264
265typedef enum {
266 /** RIRB Size Capability (H) */
267 rirbsize_cap_h = 7,
268 /** RIRB Size Capability (L) */
269 rirbsize_cap_l = 4,
270 /** RIRB Size (H) */
271 rirbsize_size_h = 1,
272 /** RIRB Size (L) */
273 rirbsize_size_l = 0
274} hda_rirbsize_bits_t;
275
276typedef struct {
277 /** Response - data received from codec */
278 uint32_t resp;
279 /** Response Extended - added by controller */
280 uint32_t respex;
281} hda_rirb_entry_t;
282
283typedef enum {
284 /** Unsolicited response */
285 respex_unsol = 4,
286 /** Codec Address (H) */
287 respex_addr_h = 3,
288 /** Codec Address (L) */
289 respex_addr_l = 0
290} hda_respex_bits_t;
291
292#endif
293
294/** @}
295 */
Note: See TracBrowser for help on using the repository browser.