VirtualBox

source: vbox/trunk/src/VBox/Devices/Audio/HDACodec.h@ 80596

Last change on this file since 80596 was 76565, checked in by vboxsync, 6 years ago

Devices: Use VBOX_INCLUDED_SRC_ as header guard prefix with scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.8 KB
Line 
1/* $Id: HDACodec.h 76565 2019-01-01 04:23:20Z vboxsync $ */
2/** @file
3 * HDACodec - VBox HD Audio Codec.
4 */
5
6/*
7 * Copyright (C) 2006-2019 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 VBOX_INCLUDED_SRC_Audio_HDACodec_h
19#define VBOX_INCLUDED_SRC_Audio_HDACodec_h
20#ifndef RT_WITHOUT_PRAGMA_ONCE
21# pragma once
22#endif
23
24#include <iprt/list.h>
25
26#include "AudioMixer.h"
27
28/** The ICH HDA (Intel) controller. */
29typedef struct HDASTATE *PHDASTATE;
30/** The ICH HDA (Intel) codec state. */
31typedef struct HDACODEC *PHDACODEC;
32/** The HDA host driver backend. */
33typedef struct HDADRIVER *PHDADRIVER;
34typedef struct PDMIAUDIOCONNECTOR *PPDMIAUDIOCONNECTOR;
35typedef struct PDMAUDIOGSTSTRMOUT *PPDMAUDIOGSTSTRMOUT;
36typedef struct PDMAUDIOGSTSTRMIN *PPDMAUDIOGSTSTRMIN;
37
38/**
39 * Verb processor method.
40 */
41typedef DECLCALLBACK(int) FNHDACODECVERBPROCESSOR(PHDACODEC pThis, uint32_t cmd, uint64_t *pResp);
42typedef FNHDACODECVERBPROCESSOR *PFNHDACODECVERBPROCESSOR;
43typedef FNHDACODECVERBPROCESSOR **PPFNHDACODECVERBPROCESSOR;
44
45/* PRM 5.3.1 */
46#define CODEC_RESPONSE_UNSOLICITED RT_BIT_64(34)
47
48typedef struct CODECVERB
49{
50 /** Verb. */
51 uint32_t verb;
52 /** Verb mask. */
53 uint32_t mask;
54 /** Function pointer for implementation callback. */
55 PFNHDACODECVERBPROCESSOR pfn;
56 /** Friendly name, for debugging. */
57 const char *pszName;
58} CODECVERB;
59
60union CODECNODE;
61typedef union CODECNODE CODECNODE, *PCODECNODE;
62
63/**
64 * Structure for keeping a HDA codec state.
65 */
66typedef struct HDACODEC
67{
68 uint16_t id;
69 uint16_t u16VendorId;
70 uint16_t u16DeviceId;
71 uint8_t u8BSKU;
72 uint8_t u8AssemblyId;
73 /** List of assigned HDA drivers to this codec.
74 * A driver only can be assigned to one codec at a time. */
75 RTLISTANCHOR lstDrv;
76
77 CODECVERB const *paVerbs;
78 size_t cVerbs;
79
80 PCODECNODE paNodes;
81 /** Pointer to HDA state (controller) this
82 * codec is assigned to. */
83 PHDASTATE pHDAState;
84 bool fInReset;
85
86 const uint8_t cTotalNodes;
87 const uint8_t *au8Ports;
88 const uint8_t *au8Dacs;
89 const uint8_t *au8AdcVols;
90 const uint8_t *au8Adcs;
91 const uint8_t *au8AdcMuxs;
92 const uint8_t *au8Pcbeeps;
93 const uint8_t *au8SpdifIns;
94 const uint8_t *au8SpdifOuts;
95 const uint8_t *au8DigInPins;
96 const uint8_t *au8DigOutPins;
97 const uint8_t *au8Cds;
98 const uint8_t *au8VolKnobs;
99 const uint8_t *au8Reserveds;
100 const uint8_t u8AdcVolsLineIn;
101 const uint8_t u8DacLineOut;
102
103 /** Public codec functions. */
104 DECLR3CALLBACKMEMBER(int, pfnLookup, (PHDACODEC pThis, uint32_t uVerb, uint64_t *puResp));
105 DECLR3CALLBACKMEMBER(void, pfnReset, (PHDACODEC pThis));
106 DECLR3CALLBACKMEMBER(int, pfnNodeReset, (PHDACODEC pThis, uint8_t, PCODECNODE));
107
108 /** Callbacks to the HDA controller, mostly used for multiplexing to the various host backends. */
109 DECLR3CALLBACKMEMBER(int, pfnCbMixerAddStream, (PHDASTATE pThis, PDMAUDIOMIXERCTL enmMixerCtl, PPDMAUDIOSTREAMCFG pCfg));
110 DECLR3CALLBACKMEMBER(int, pfnCbMixerRemoveStream, (PHDASTATE pThis, PDMAUDIOMIXERCTL enmMixerCtl));
111 DECLR3CALLBACKMEMBER(int, pfnCbMixerControl, (PHDASTATE pThis, PDMAUDIOMIXERCTL enmMixerCtl, uint8_t uSD, uint8_t uChannel));
112 DECLR3CALLBACKMEMBER(int, pfnCbMixerSetVolume, (PHDASTATE pThis, PDMAUDIOMIXERCTL enmMixerCtl, PPDMAUDIOVOLUME pVol));
113
114 /** These callbacks are set by codec implementation to answer debugger requests. */
115 DECLR3CALLBACKMEMBER(void, pfnDbgListNodes, (PHDACODEC pThis, PCDBGFINFOHLP pHlp, const char *pszArgs));
116 DECLR3CALLBACKMEMBER(void, pfnDbgSelector, (PHDACODEC pThis, PCDBGFINFOHLP pHlp, const char *pszArgs));
117} HDACODEC;
118
119int hdaCodecConstruct(PPDMDEVINS pDevIns, PHDACODEC pThis, uint16_t uLUN, PCFGMNODE pCfg);
120void hdaCodecDestruct(PHDACODEC pThis);
121void hdaCodecPowerOff(PHDACODEC pThis);
122int hdaCodecSaveState(PHDACODEC pThis, PSSMHANDLE pSSM);
123int hdaCodecLoadState(PHDACODEC pThis, PSSMHANDLE pSSM, uint32_t uVersion);
124int hdaCodecAddStream(PHDACODEC pThis, PDMAUDIOMIXERCTL enmMixerCtl, PPDMAUDIOSTREAMCFG pCfg);
125int hdaCodecRemoveStream(PHDACODEC pThis, PDMAUDIOMIXERCTL enmMixerCtl);
126
127/** Added (Controller): Current wall clock value (this independent from WALCLK register value).
128 * Added (Controller): Current IRQ level.
129 * Added (Per stream): Ring buffer. This is optional and can be skipped if (not) needed.
130 * Added (Per stream): Struct g_aSSMStreamStateFields7.
131 * Added (Per stream): Struct g_aSSMStreamPeriodFields7.
132 * Added (Current BDLE per stream): Struct g_aSSMBDLEDescFields7.
133 * Added (Current BDLE per stream): Struct g_aSSMBDLEStateFields7. */
134#define HDA_SSM_VERSION 7
135/** Saves the current BDLE state. */
136#define HDA_SSM_VERSION_6 6
137/** Introduced dynamic number of streams + stream identifiers for serialization.
138 * Bug: Did not save the BDLE states correctly.
139 * Those will be skipped on load then. */
140#define HDA_SSM_VERSION_5 5
141/** Since this version the number of MMIO registers can be flexible. */
142#define HDA_SSM_VERSION_4 4
143#define HDA_SSM_VERSION_3 3
144#define HDA_SSM_VERSION_2 2
145#define HDA_SSM_VERSION_1 1
146
147#endif /* !VBOX_INCLUDED_SRC_Audio_HDACodec_h */
148
Note: See TracBrowser for help on using the repository browser.

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