VirtualBox

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

最後變更 在這個檔案從33360是 33327,由 vboxsync 提交於 14 年 前

Audio/HDA: sound on Mac guest & some clean up.

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 7.4 KB
 
1/* $Id: DevCodec.h 33327 2010-10-22 02:36:38Z 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.alldomusa.eu.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 u32F05_param;
91 uint32_t u32F06_param;
92 uint32_t u32F09_param;
93 uint32_t u32F0d_param;
94
95 uint32_t u32A_param;
96 AMPLIFIER B_params;
97} SPDIFOUTNODE, *PSPDIFOUTNODE;
98
99typedef struct SPDIFINNODE
100{
101 CODECCOMMONNODE node;
102 uint32_t u32F05_param;
103 uint32_t u32F06_param;
104 uint32_t u32F09_param;
105 uint32_t u32F0d_param;
106
107 uint32_t u32A_param;
108 AMPLIFIER B_params;
109} SPDIFINNODE, *PSPDIFINNODE;
110
111typedef struct AFGCODECNODE
112{
113 CODECCOMMONNODE node;
114 uint32_t u32F05_param;
115 uint32_t u32F08_param;
116 uint32_t u32F20_param;
117 uint32_t u32F17_param;
118} AFGCODECNODE, *PAFGCODECNODE;
119
120typedef struct PORTNODE
121{
122 CODECCOMMONNODE node;
123 uint32_t u32F07_param;
124 uint32_t u32F08_param;
125 uint32_t u32F09_param;
126 uint32_t u32F01_param;
127 uint32_t u32F1c_param;
128 AMPLIFIER B_params;
129} PORTNODE, *PPORTNODE;
130
131typedef struct DIGOUTNODE
132{
133 CODECCOMMONNODE node;
134 uint32_t u32F01_param;
135 uint32_t u32F08_param;
136 uint32_t u32F07_param;
137 uint32_t u32F09_param;
138 uint32_t u32F1c_param;
139} DIGOUTNODE, *PDIGOUTNODE;
140
141typedef struct DIGINNODE
142{
143 CODECCOMMONNODE node;
144 uint32_t u32F05_param;
145 uint32_t u32F07_param;
146 uint32_t u32F08_param;
147 uint32_t u32F09_param;
148 uint32_t u32F0c_param;
149 uint32_t u32F1c_param;
150 uint32_t u32F1e_param;
151} DIGINNODE, *PDIGINNODE;
152
153typedef struct ADCMUXNODE
154{
155 CODECCOMMONNODE node;
156 uint32_t u32F01_param;
157
158 uint32_t u32A_param;
159 AMPLIFIER B_params;
160} ADCMUXNODE, *PADCMUXNODE;
161
162typedef struct PCBEEPNODE
163{
164 CODECCOMMONNODE node;
165 uint32_t u32F07_param;
166 uint32_t u32F0a_param;
167
168 uint32_t u32A_param;
169 AMPLIFIER B_params;
170 uint32_t u32F1c_param;
171} PCBEEPNODE, *PPCBEEPNODE;
172
173typedef struct CDNODE
174{
175 CODECCOMMONNODE node;
176 uint32_t u32F07_param;
177 uint32_t u32F1c_param;
178} CDNODE, *PCDNODE;
179
180typedef struct VOLUMEKNOBNODE
181{
182 CODECCOMMONNODE node;
183 uint32_t u32F08_param;
184 uint32_t u32F0f_param;
185} VOLUMEKNOBNODE, *PVOLUMEKNOBNODE;
186
187typedef struct ADCVOLNODE
188{
189 CODECCOMMONNODE node;
190 uint32_t u32F0c_param;
191 uint32_t u32F01_param;
192 uint32_t u32A_params;
193 AMPLIFIER B_params;
194} ADCVOLNODE, *PADCVOLNODE;
195
196typedef struct RESNODE
197{
198 CODECCOMMONNODE node;
199 uint32_t u32F05_param;
200 uint32_t u32F06_param;
201 uint32_t u32F07_param;
202 uint32_t u32F1c_param;
203} RESNODE, *PRESNODE;
204
205typedef union CODECNODE
206{
207 CODECCOMMONNODE node;
208 ROOTCODECNODE root;
209 AFGCODECNODE afg;
210 DACNODE dac;
211 ADCNODE adc;
212 SPDIFOUTNODE spdifout;
213 SPDIFINNODE spdifin;
214 PORTNODE port;
215 DIGOUTNODE digout;
216 DIGINNODE digin;
217 ADCMUXNODE adcmux;
218 PCBEEPNODE pcbeep;
219 CDNODE cdnode;
220 VOLUMEKNOBNODE volumeKnob;
221 ADCVOLNODE adcvol;
222 RESNODE reserved;
223} CODECNODE, *PCODECNODE;
224
225typedef enum
226{
227 PI_INDEX = 0, /* PCM in */
228 PO_INDEX, /* PCM out */
229 MC_INDEX, /* Mic in */
230 LAST_INDEX
231} ENMSOUNDSOURCE;
232
233typedef enum
234{
235 STAC9220_CODEC,
236 ALC885_CODEC
237} ENMCODEC;
238typedef struct CODECState
239{
240 uint16_t id;
241 uint16_t u16VendorId;
242 uint16_t u16DeviceId;
243 CODECVERB *pVerbs;
244 int cVerbs;
245 PCODECNODE pNodes;
246 QEMUSoundCard card;
247 /** PCM in */
248 SWVoiceIn *voice_pi;
249 /** PCM out */
250 SWVoiceOut *voice_po;
251 /** Mic in */
252 SWVoiceIn *voice_mc;
253 ENMCODEC enmCodec;
254 void *pHDAState;
255 bool fInReset;
256 const uint8_t cTotalNodes;
257 const uint8_t *au8Ports;
258 const uint8_t *au8Dacs;
259 const uint8_t *au8AdcVols;
260 const uint8_t *au8Adcs;
261 const uint8_t *au8AdcMuxs;
262 const uint8_t *au8Pcbeeps;
263 const uint8_t *au8SpdifIns;
264 const uint8_t *au8SpdifOuts;
265 const uint8_t *au8DigInPins;
266 const uint8_t *au8DigOutPins;
267 const uint8_t *au8Cds;
268 const uint8_t *au8VolKnobs;
269 const uint8_t *au8Reserveds;
270 const uint8_t u8AdcVolsLineIn;
271 const uint8_t u8DacLineOut;
272 DECLR3CALLBACKMEMBER(int, pfnProcess, (struct CODECState *));
273 DECLR3CALLBACKMEMBER(int, pfnLookup, (struct CODECState *pState, uint32_t verb, PPFNCODECVERBPROCESSOR));
274 DECLR3CALLBACKMEMBER(int, pfnReset, (struct CODECState *pState));
275 DECLR3CALLBACKMEMBER(void, pfnTransfer, (struct CODECState *pState, ENMSOUNDSOURCE, int avail));
276 DECLR3CALLBACKMEMBER(int, pfnCodecNodeReset, (struct CODECState *pState, uint8_t, PCODECNODE));
277
278} CODECState;
279
280
281int codecConstruct(CODECState *pCodecState, ENMCODEC enmCodec);
282int codecDestruct(CODECState *pCodecState);
283int codecSaveState(CODECState *pCodecState, PSSMHANDLE pSSMHandle);
284int codecLoadState(CODECState *pCodecState, PSSMHANDLE pSSMHandle);
285
286#endif
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette