VirtualBox

source: vbox/trunk/src/VBox/Devices/Audio/DevCodec.h@ 33000

Last change on this file since 33000 was 32933, checked in by vboxsync, 14 years ago

Audio/HDA: alc885 codec is introduced(workable with Linux guest, recognized by Mac guest), not configurable (disabled).

F02 verb handling is fixed.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 7.1 KB
Line 
1/* $Id: DevCodec.h 32933 2010-10-06 08:55:41Z vboxsync $ */
2/** @file
3 * DevCodec - VBox ICH Intel HD Audio Codec.
4 */
5
6/*
7 * Copyright (C) 2006-2008 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17#ifndef DEV_CODEC_H
18#define DEV_CODEC_H
19struct CODECState;
20struct INTELHDLinkState;
21
22typedef DECLCALLBACK(int) FNCODECVERBPROCESSOR(struct CODECState *pState, uint32_t cmd, uint64_t *pResp);
23typedef FNCODECVERBPROCESSOR *PFNCODECVERBPROCESSOR;
24typedef FNCODECVERBPROCESSOR **PPFNCODECVERBPROCESSOR;
25
26/* RPM 5.3.1 */
27#define CODEC_RESPONSE_UNSOLICITED RT_BIT_64(34)
28
29typedef struct CODECVERB
30{
31 uint32_t verb;
32 /* operation bitness mask */
33 uint32_t mask;
34 PFNCODECVERBPROCESSOR pfn;
35} CODECVERB;
36
37#define CODECNODE_F0_PARAM_LENGTH 0x14
38#define CODECNODE_F02_PARAM_LENGTH 16
39typedef struct CODECCOMMONNODE
40{
41 uint8_t id; /* 7 - bit format */
42 const char *name;
43 /* RPM 5.3.6 */
44 uint32_t au32F00_param[CODECNODE_F0_PARAM_LENGTH];
45 uint32_t au32F02_param[CODECNODE_F02_PARAM_LENGTH];
46} CODECCOMMONNODE, *PCODECCOMMONNODE;
47
48typedef struct ROOTCODECNODE
49{
50 CODECCOMMONNODE node;
51}ROOTCODECNODE, *PROOTCODECNODE;
52
53#define AMPLIFIER_SIZE 60
54typedef uint32_t AMPLIFIER[AMPLIFIER_SIZE];
55#define AMPLIFIER_IN 0
56#define AMPLIFIER_OUT 1
57#define AMPLIFIER_LEFT 1
58#define AMPLIFIER_RIGHT 0
59#define AMPLIFIER_REGISTER(amp, inout, side, index) ((amp)[30*(inout) + 15*(side) + (index)])
60typedef struct DACNODE
61{
62 CODECCOMMONNODE node;
63 uint32_t u32F0d_param;
64 uint32_t u32F04_param;
65 uint32_t u32F05_param;
66 uint32_t u32F06_param;
67 uint32_t u32F0c_param;
68
69 uint32_t u32A_param;
70 AMPLIFIER B_params;
71
72} DACNODE, *PDACNODE;
73
74typedef struct ADCNODE
75{
76 CODECCOMMONNODE node;
77 uint32_t u32F03_param;
78 uint32_t u32F05_param;
79 uint32_t u32F06_param;
80 uint32_t u32F09_param;
81
82 uint32_t u32A_param;
83 uint32_t u32F01_param;
84 AMPLIFIER B_params;
85} ADCNODE, *PADCNODE;
86
87typedef struct SPDIFOUTNODE
88{
89 CODECCOMMONNODE node;
90 uint32_t u32F06_param;
91 uint32_t u32F09_param;
92 uint32_t u32F0d_param;
93
94 uint32_t u32A_param;
95 AMPLIFIER B_params;
96} SPDIFOUTNODE, *PSPDIFOUTNODE;
97
98typedef struct SPDIFINNODE
99{
100 CODECCOMMONNODE node;
101 uint32_t u32F06_param;
102 uint32_t u32F09_param;
103 uint32_t u32F0d_param;
104
105 uint32_t u32A_param;
106 AMPLIFIER B_params;
107} SPDIFINNODE, *PSPDIFINNODE;
108
109typedef struct AFGCODECNODE
110{
111 CODECCOMMONNODE node;
112 uint32_t u32F05_param;
113 uint32_t u32F08_param;
114 uint32_t u32F20_param;
115} AFGCODECNODE, *PAFGCODECNODE;
116
117typedef struct PORTNODE
118{
119 CODECCOMMONNODE node;
120 uint32_t u32F07_param;
121 uint32_t u32F08_param;
122 uint32_t u32F09_param;
123 uint32_t u32F01_param;
124 uint32_t u32F1c_param;
125 AMPLIFIER B_params;
126} PORTNODE, *PPORTNODE;
127
128typedef struct DIGOUTNODE
129{
130 CODECCOMMONNODE node;
131 uint32_t u32F01_param;
132 uint32_t u32F07_param;
133 uint32_t u32F09_param;
134 uint32_t u32F1c_param;
135} DIGOUTNODE, *PDIGOUTNODE;
136
137typedef struct DIGINNODE
138{
139 CODECCOMMONNODE node;
140 uint32_t u32F05_param;
141 uint32_t u32F07_param;
142 uint32_t u32F08_param;
143 uint32_t u32F09_param;
144 uint32_t u32F0c_param;
145 uint32_t u32F1c_param;
146 uint32_t u32F1e_param;
147} DIGINNODE, *PDIGINNODE;
148
149typedef struct ADCMUXNODE
150{
151 CODECCOMMONNODE node;
152 uint32_t u32F01_param;
153
154 uint32_t u32A_param;
155 AMPLIFIER B_params;
156} ADCMUXNODE, *PADCMUXNODE;
157
158typedef struct PCBEEPNODE
159{
160 CODECCOMMONNODE node;
161 uint32_t u32F0a_param;
162
163 uint32_t u32A_param;
164 AMPLIFIER B_params;
165} PCBEEPNODE, *PPCBEEPNODE;
166
167typedef struct CDNODE
168{
169 CODECCOMMONNODE node;
170 uint32_t u32F07_param;
171 uint32_t u32F1c_param;
172} CDNODE, *PCDNODE;
173
174typedef struct VOLUMEKNOBNODE
175{
176 CODECCOMMONNODE node;
177 uint32_t u32F08_param;
178 uint32_t u32F0f_param;
179} VOLUMEKNOBNODE, *PVOLUMEKNOBNODE;
180
181typedef struct ADCVOLNODE
182{
183 CODECCOMMONNODE node;
184 uint32_t u32F0c_param;
185 uint32_t u32A_params;
186 AMPLIFIER B_params;
187} ADCVOLNODE, *PADCVOLNODE;
188
189typedef struct RESNODE
190{
191 CODECCOMMONNODE node;
192 uint32_t u32F07_param;
193 uint32_t u32F06_param;
194 uint32_t u32F1c_param;
195} RESNODE, *PRESNODE;
196
197typedef union CODECNODE
198{
199 CODECCOMMONNODE node;
200 ROOTCODECNODE root;
201 AFGCODECNODE afg;
202 DACNODE dac;
203 ADCNODE adc;
204 SPDIFOUTNODE spdifout;
205 SPDIFINNODE spdifin;
206 PORTNODE port;
207 DIGOUTNODE digout;
208 DIGINNODE digin;
209 ADCMUXNODE adcmux;
210 PCBEEPNODE pcbeep;
211 CDNODE cdnode;
212 VOLUMEKNOBNODE volumeKnob;
213 ADCVOLNODE adcvol;
214 RESNODE reserved;
215} CODECNODE, *PCODECNODE;
216
217typedef enum
218{
219 PI_INDEX = 0, /* PCM in */
220 PO_INDEX, /* PCM out */
221 MC_INDEX, /* Mic in */
222 LAST_INDEX
223} ENMSOUNDSOURCE;
224
225typedef enum
226{
227 STAC9220_CODEC,
228 ALC885_CODEC
229} ENMCODEC;
230typedef struct CODECState
231{
232 uint16_t id;
233 CODECVERB *pVerbs;
234 int cVerbs;
235 PCODECNODE pNodes;
236 QEMUSoundCard card;
237 /** PCM in */
238 SWVoiceIn *voice_pi;
239 /** PCM out */
240 SWVoiceOut *voice_po;
241 /** Mic in */
242 SWVoiceIn *voice_mc;
243 ENMCODEC enmCodec;
244 void *pHDAState;
245 bool fInReset;
246 const uint8_t cTotalNodes;
247 const uint8_t *au8Ports;
248 const uint8_t *au8Dacs;
249 const uint8_t *au8AdcVols;
250 const uint8_t *au8Adcs;
251 const uint8_t *au8AdcMuxs;
252 const uint8_t *au8Pcbeeps;
253 const uint8_t *au8SpdifIns;
254 const uint8_t *au8SpdifOuts;
255 const uint8_t *au8DigInPins;
256 const uint8_t *au8DigOutPins;
257 const uint8_t *au8Cds;
258 const uint8_t *au8VolKnobs;
259 const uint8_t *au8Reserveds;
260 const uint8_t u8AdcVolsLineIn;
261 const uint8_t u8DacLineOut;
262 DECLR3CALLBACKMEMBER(int, pfnProcess, (struct CODECState *));
263 DECLR3CALLBACKMEMBER(int, pfnLookup, (struct CODECState *pState, uint32_t verb, PPFNCODECVERBPROCESSOR));
264 DECLR3CALLBACKMEMBER(int, pfnReset, (struct CODECState *pState));
265 DECLR3CALLBACKMEMBER(void, pfnTransfer, (struct CODECState *pState, ENMSOUNDSOURCE, int avail));
266 DECLR3CALLBACKMEMBER(int, pfnCodecNodeReset, (struct CODECState *pState, uint8_t, PCODECNODE));
267
268} CODECState;
269
270
271int codecConstruct(CODECState *pCodecState, ENMCODEC enmCodec);
272int codecDestruct(CODECState *pCodecState);
273int codecSaveState(CODECState *pCodecState, PSSMHANDLE pSSMHandle);
274int codecLoadState(CODECState *pCodecState, PSSMHANDLE pSSMHandle);
275
276#endif
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use