VirtualBox

source: vbox/trunk/src/VBox/Devices/Audio/DevIchHdaCodec.h@ 60404

Last change on this file since 60404 was 60353, checked in by vboxsync, 8 years ago

Audio: Added HDA support for newer Linux guests; more work on surround support (disabled by default).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.8 KB
Line 
1/* $Id: DevIchHdaCodec.h 60353 2016-04-06 11:54:39Z vboxsync $ */
2/** @file
3 * DevIchHdaCodec - VBox ICH Intel HD Audio Codec.
4 */
5
6/*
7 * Copyright (C) 2006-2016 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
18#ifndef DEV_HDA_CODEC_H
19#define DEV_HDA_CODEC_H
20
21/** The ICH HDA (Intel) controller. */
22typedef struct HDASTATE *PHDASTATE;
23/** The ICH HDA (Intel) codec state. */
24typedef struct HDACODEC *PHDACODEC;
25/** The HDA host driver backend. */
26typedef struct HDADRIVER *PHDADRIVER;
27typedef struct PDMIAUDIOCONNECTOR *PPDMIAUDIOCONNECTOR;
28typedef struct PDMAUDIOGSTSTRMOUT *PPDMAUDIOGSTSTRMOUT;
29typedef struct PDMAUDIOGSTSTRMIN *PPDMAUDIOGSTSTRMIN;
30
31/**
32 * Verb processor method.
33 */
34typedef DECLCALLBACK(int) FNHDACODECVERBPROCESSOR(PHDACODEC pThis, uint32_t cmd, uint64_t *pResp);
35typedef FNHDACODECVERBPROCESSOR *PFNHDACODECVERBPROCESSOR;
36typedef FNHDACODECVERBPROCESSOR **PPFNHDACODECVERBPROCESSOR;
37
38/* PRM 5.3.1 */
39#define CODEC_RESPONSE_UNSOLICITED RT_BIT_64(34)
40
41typedef struct CODECVERB
42{
43 uint32_t verb;
44 /** operation bitness mask */
45 uint32_t mask;
46 PFNHDACODECVERBPROCESSOR pfn;
47} CODECVERB;
48
49union CODECNODE;
50typedef union CODECNODE CODECNODE, *PCODECNODE;
51
52/**
53 * Structure for keeping a HDA codec state.
54 */
55typedef struct HDACODEC
56{
57 uint16_t id;
58 uint16_t u16VendorId;
59 uint16_t u16DeviceId;
60 uint8_t u8BSKU;
61 uint8_t u8AssemblyId;
62 /** List of assigned HDA drivers to this codec.
63 * A driver only can be assigned to one codec at a time. */
64 RTLISTANCHOR lstDrv;
65
66 CODECVERB const *paVerbs;
67 int cVerbs;
68
69 PCODECNODE paNodes;
70 /** Pointer to HDA state (controller) this
71 * codec is assigned to. */
72 PHDASTATE pHDAState;
73 bool fInReset;
74
75 const uint8_t cTotalNodes;
76 const uint8_t *au8Ports;
77 const uint8_t *au8Dacs;
78 const uint8_t *au8AdcVols;
79 const uint8_t *au8Adcs;
80 const uint8_t *au8AdcMuxs;
81 const uint8_t *au8Pcbeeps;
82 const uint8_t *au8SpdifIns;
83 const uint8_t *au8SpdifOuts;
84 const uint8_t *au8DigInPins;
85 const uint8_t *au8DigOutPins;
86 const uint8_t *au8Cds;
87 const uint8_t *au8VolKnobs;
88 const uint8_t *au8Reserveds;
89 const uint8_t u8AdcVolsLineIn;
90 const uint8_t u8DacLineOut;
91
92 /** Callbacks to the HDA controller, mostly used for multiplexing to the various host backends. */
93 DECLR3CALLBACKMEMBER(int, pfnMixerAddStream, (PHDASTATE pThis, PDMAUDIOMIXERCTL enmMixerCtl, PPDMAUDIOSTREAMCFG pCfg));
94 DECLR3CALLBACKMEMBER(int, pfnMixerRemoveStream, (PHDASTATE pThis, PDMAUDIOMIXERCTL enmMixerCtl));
95 DECLR3CALLBACKMEMBER(int, pfnMixerSetVolume, (PHDASTATE pThis, PDMAUDIOMIXERCTL enmMixerCtl, PPDMAUDIOVOLUME pVol));
96 /** Callbacks by codec implementation. */
97 DECLR3CALLBACKMEMBER(int, pfnLookup, (PHDACODEC pThis, uint32_t verb, PPFNHDACODECVERBPROCESSOR));
98 DECLR3CALLBACKMEMBER(int, pfnReset, (PHDACODEC pThis));
99 DECLR3CALLBACKMEMBER(int, pfnCodecNodeReset, (PHDACODEC pThis, uint8_t, PCODECNODE));
100 /** These callbacks are set by codec implementation to answer debugger requests. */
101 DECLR3CALLBACKMEMBER(void, pfnDbgListNodes, (PHDACODEC pThis, PCDBGFINFOHLP pHlp, const char *pszArgs));
102 DECLR3CALLBACKMEMBER(void, pfnDbgSelector, (PHDACODEC pThis, PCDBGFINFOHLP pHlp, const char *pszArgs));
103} HDACODEC;
104
105int hdaCodecConstruct(PPDMDEVINS pDevIns, PHDACODEC pThis, uint16_t uLUN, PCFGMNODE pCfg);
106int hdaCodecDestruct(PHDACODEC pThis);
107int hdaCodecSaveState(PHDACODEC pThis, PSSMHANDLE pSSM);
108int hdaCodecLoadState(PHDACODEC pThis, PSSMHANDLE pSSM, uint32_t uVersion);
109int hdaCodecAddStream(PHDACODEC pThis, PDMAUDIOMIXERCTL enmMixerCtl, PPDMAUDIOSTREAMCFG pCfg);
110int hdaCodecRemoveStream(PHDACODEC pThis, PDMAUDIOMIXERCTL enmMixerCtl);
111
112#define HDA_SSM_VERSION 6
113/** Introduced dynamic number of streams + stream identifiers for serialization.
114 * Bug: Did not save the BDLE states correctly.
115 * Those will be skipped on load then. */
116#define HDA_SSM_VERSION_5 5
117/** Since this version the number of MMIO registers can be flexible. */
118#define HDA_SSM_VERSION_4 4
119#define HDA_SSM_VERSION_3 3
120#define HDA_SSM_VERSION_2 2
121#define HDA_SSM_VERSION_1 1
122
123#endif /* DEV_HDA_CODEC_H */
124
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use