VirtualBox

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

Last change on this file since 68253 was 67899, checked in by vboxsync, 7 years ago

Audio/DevHDA.cpp: Modularized code more by also factoring out the HDA stream functions into an own file. No actual code changes.

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