VirtualBox

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

Last change on this file since 54988 was 53831, checked in by vboxsync, 10 years ago

PDM/Audio: Build fix; forgot some files.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.8 KB
Line 
1/* $Id: DevIchHdaCodec.h 53831 2015-01-15 16:15:21Z vboxsync $ */
2/** @file
3 * DevIchHdaCodec - VBox ICH Intel HD Audio Codec.
4 */
5
6/*
7 * Copyright (C) 2006-2014 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_CODEC_H
19#define DEV_CODEC_H
20
21/** The ICH HDA (Intel) controller. */
22typedef struct HDASTATE *PHDASTATE;
23/** The ICH HDA (Intel) codec state. */
24typedef struct HDACODEC HDACODEC, *PHDACODEC;
25/** The HDA host driver backend. */
26typedef struct HDADRIVER 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
41
42#ifndef VBOX_WITH_HDA_CODEC_EMU
43typedef struct CODECVERB
44{
45 uint32_t verb;
46 /* operation bitness mask */
47 uint32_t mask;
48 PFNHDACODECVERBPROCESSOR pfn;
49} CODECVERB;
50#endif
51
52#ifndef VBOX_WITH_HDA_CODEC_EMU
53# define TYPE union
54#else
55# define TYPE struct
56typedef struct CODECEMU CODECEMU;
57typedef CODECEMU *PCODECEMU;
58#endif
59TYPE CODECNODE;
60typedef TYPE CODECNODE CODECNODE;
61typedef TYPE CODECNODE *PCODECNODE;
62
63typedef enum
64{
65 PI_INDEX = 0, /* PCM in */
66 PO_INDEX, /* PCM out */
67 MC_INDEX, /* Mic in */
68 LAST_INDEX
69} ENMSOUNDSOURCE;
70
71typedef struct HDACODEC
72{
73 uint16_t id;
74 uint16_t u16VendorId;
75 uint16_t u16DeviceId;
76 uint8_t u8BSKU;
77 uint8_t u8AssemblyId;
78 /* List of assigned HDA drivers to this codec.
79 * A driver only can be assigned to one codec
80 * at a time. */
81 RTLISTANCHOR lstDrv;
82
83#ifndef VBOX_WITH_HDA_CODEC_EMU
84 CODECVERB const *paVerbs;
85 int cVerbs;
86#else
87 PCODECEMU pCodecBackend;
88#endif
89 PCODECNODE paNodes;
90 /** Pointer to HDA state (controller) this
91 * codec is assigned to. */
92 PHDASTATE pHDAState;
93 bool fInReset;
94#ifndef VBOX_WITH_HDA_CODEC_EMU
95 const uint8_t cTotalNodes;
96 const uint8_t *au8Ports;
97 const uint8_t *au8Dacs;
98 const uint8_t *au8AdcVols;
99 const uint8_t *au8Adcs;
100 const uint8_t *au8AdcMuxs;
101 const uint8_t *au8Pcbeeps;
102 const uint8_t *au8SpdifIns;
103 const uint8_t *au8SpdifOuts;
104 const uint8_t *au8DigInPins;
105 const uint8_t *au8DigOutPins;
106 const uint8_t *au8Cds;
107 const uint8_t *au8VolKnobs;
108 const uint8_t *au8Reserveds;
109 const uint8_t u8AdcVolsLineIn;
110 const uint8_t u8DacLineOut;
111#endif
112#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
113 /* Callbacks to the HDA controller, mostly used for multiplexing to the various host backends. */
114 DECLR3CALLBACKMEMBER(void, pfnCloseIn, (PHDASTATE pThis, PDMAUDIORECSOURCE enmRecSource));
115 DECLR3CALLBACKMEMBER(void, pfnCloseOut, (PHDASTATE pThis));
116 DECLR3CALLBACKMEMBER(int, pfnOpenIn, (PHDASTATE pThis, const char *pszName, PDMAUDIORECSOURCE enmRecSource, PPDMAUDIOSTREAMCFG pCfg));
117 DECLR3CALLBACKMEMBER(int, pfnOpenOut, (PHDASTATE pThis, const char *pszName, PPDMAUDIOSTREAMCFG pCfg));
118 DECLR3CALLBACKMEMBER(int, pfnSetVolume, (PHDASTATE pThis, bool fMute, uint8_t uVolLeft, uint8_t uVolRight));
119#else
120 QEMUSoundCard card;
121 /** PCM in */
122 SWVoiceIn *SwVoiceIn;
123 /** PCM out */
124 SWVoiceOut *SwVoiceOut;
125 /* Callbacks for host driver backends. */
126 DECLR3CALLBACKMEMBER(int, pfnTransfer, (PHDACODEC pCodec, ENMSOUNDSOURCE enmSource, uint32_t cbAvail));
127#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
128 /* Callbacks by codec implementation. */
129 DECLR3CALLBACKMEMBER(int, pfnLookup, (PHDACODEC pThis, uint32_t verb, PPFNHDACODECVERBPROCESSOR));
130 DECLR3CALLBACKMEMBER(int, pfnReset, (PHDACODEC pThis));
131 DECLR3CALLBACKMEMBER(int, pfnCodecNodeReset, (PHDACODEC pThis, uint8_t, PCODECNODE));
132 /* Callbacks by codec implementation to answer debugger requests. */
133 DECLR3CALLBACKMEMBER(void, pfnCodecDbgListNodes, (PHDACODEC pThis, PCDBGFINFOHLP pHlp, const char *pszArgs));
134 DECLR3CALLBACKMEMBER(void, pfnCodecDbgSelector, (PHDACODEC pThis, PCDBGFINFOHLP pHlp, const char *pszArgs));
135} CODECState;
136
137int hdaCodecConstruct(PPDMDEVINS pDevIns, PHDACODEC pThis, uint16_t uLUN, PCFGMNODE pCfg);
138int hdaCodecDestruct(PHDACODEC pThis);
139int hdaCodecSaveState(PHDACODEC pThis, PSSMHANDLE pSSM);
140int hdaCodecLoadState(PHDACODEC pThis, PSSMHANDLE pSSM, uint32_t uVersion);
141#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
142int hdaCodecOpenStream(PHDACODEC pThis, PDMAUDIORECSOURCE enmRecSource, PDMAUDIOSTREAMCFG *pAudioSettings);
143#else
144int hdaCodecOpenVoice(PHDACODEC pThis, ENMSOUNDSOURCE enmSoundSource, audsettings_t *pAudioSettings);
145#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
146
147#define HDA_SSM_VERSION 4
148#define HDA_SSM_VERSION_1 1
149#define HDA_SSM_VERSION_2 2
150#define HDA_SSM_VERSION_3 3
151
152# ifdef VBOX_WITH_HDA_CODEC_EMU
153/* */
154struct CODECEMU
155{
156 DECLR3CALLBACKMEMBER(int, pfnCodecEmuConstruct,(PHDACODEC pThis));
157 DECLR3CALLBACKMEMBER(int, pfnCodecEmuDestruct,(PHDACODEC pThis));
158 DECLR3CALLBACKMEMBER(int, pfnCodecEmuReset,(PHDACODEC pThis, bool fInit));
159};
160# endif
161#endif
162
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