1 | /* $Id: DevIchHdaCodec.h 44669 2013-02-13 15:00:00Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * DevIchHdaCodec - VBox ICH Intel HD Audio Codec.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2013 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) codec state. */
|
---|
22 | typedef struct HDACODEC HDACODEC;
|
---|
23 | /** Pointer to the Intel ICH HDA codec state. */
|
---|
24 | typedef HDACODEC *PHDACODEC;
|
---|
25 |
|
---|
26 | /**
|
---|
27 | * Verb processor method.
|
---|
28 | */
|
---|
29 | typedef DECLCALLBACK(int) FNHDACODECVERBPROCESSOR(PHDACODEC pThis, uint32_t cmd, uint64_t *pResp);
|
---|
30 | typedef FNHDACODECVERBPROCESSOR *PFNHDACODECVERBPROCESSOR;
|
---|
31 | typedef FNHDACODECVERBPROCESSOR **PPFNHDACODECVERBPROCESSOR;
|
---|
32 |
|
---|
33 | /* PRM 5.3.1 */
|
---|
34 | #define CODEC_RESPONSE_UNSOLICITED RT_BIT_64(34)
|
---|
35 |
|
---|
36 |
|
---|
37 | #ifndef VBOX_WITH_HDA_CODEC_EMU
|
---|
38 | typedef struct CODECVERB
|
---|
39 | {
|
---|
40 | uint32_t verb;
|
---|
41 | /* operation bitness mask */
|
---|
42 | uint32_t mask;
|
---|
43 | PFNHDACODECVERBPROCESSOR pfn;
|
---|
44 | } CODECVERB;
|
---|
45 | #endif
|
---|
46 |
|
---|
47 | #ifndef VBOX_WITH_HDA_CODEC_EMU
|
---|
48 | # define TYPE union
|
---|
49 | #else
|
---|
50 | # define TYPE struct
|
---|
51 | typedef struct CODECEMU CODECEMU;
|
---|
52 | typedef CODECEMU *PCODECEMU;
|
---|
53 | #endif
|
---|
54 | TYPE CODECNODE;
|
---|
55 | typedef TYPE CODECNODE CODECNODE;
|
---|
56 | typedef TYPE CODECNODE *PCODECNODE;
|
---|
57 |
|
---|
58 | typedef enum
|
---|
59 | {
|
---|
60 | PI_INDEX = 0, /* PCM in */
|
---|
61 | PO_INDEX, /* PCM out */
|
---|
62 | MC_INDEX, /* Mic in */
|
---|
63 | LAST_INDEX
|
---|
64 | } ENMSOUNDSOURCE;
|
---|
65 |
|
---|
66 |
|
---|
67 | typedef struct HDACODEC
|
---|
68 | {
|
---|
69 | uint16_t id;
|
---|
70 | uint16_t u16VendorId;
|
---|
71 | uint16_t u16DeviceId;
|
---|
72 | uint8_t u8BSKU;
|
---|
73 | uint8_t u8AssemblyId;
|
---|
74 | #ifndef VBOX_WITH_HDA_CODEC_EMU
|
---|
75 | CODECVERB const *paVerbs;
|
---|
76 | int cVerbs;
|
---|
77 | #else
|
---|
78 | PCODECEMU pCodecBackend;
|
---|
79 | #endif
|
---|
80 | PCODECNODE paNodes;
|
---|
81 | QEMUSoundCard card;
|
---|
82 | /** PCM in */
|
---|
83 | SWVoiceIn *SwVoiceIn;
|
---|
84 | /** PCM out */
|
---|
85 | SWVoiceOut *SwVoiceOut;
|
---|
86 | void *pvHDAState;
|
---|
87 | bool fInReset;
|
---|
88 | #ifndef VBOX_WITH_HDA_CODEC_EMU
|
---|
89 | const uint8_t cTotalNodes;
|
---|
90 | const uint8_t *au8Ports;
|
---|
91 | const uint8_t *au8Dacs;
|
---|
92 | const uint8_t *au8AdcVols;
|
---|
93 | const uint8_t *au8Adcs;
|
---|
94 | const uint8_t *au8AdcMuxs;
|
---|
95 | const uint8_t *au8Pcbeeps;
|
---|
96 | const uint8_t *au8SpdifIns;
|
---|
97 | const uint8_t *au8SpdifOuts;
|
---|
98 | const uint8_t *au8DigInPins;
|
---|
99 | const uint8_t *au8DigOutPins;
|
---|
100 | const uint8_t *au8Cds;
|
---|
101 | const uint8_t *au8VolKnobs;
|
---|
102 | const uint8_t *au8Reserveds;
|
---|
103 | const uint8_t u8AdcVolsLineIn;
|
---|
104 | const uint8_t u8DacLineOut;
|
---|
105 | #endif
|
---|
106 | DECLR3CALLBACKMEMBER(int, pfnProcess, (PHDACODEC pCodec));
|
---|
107 | DECLR3CALLBACKMEMBER(void, pfnTransfer, (PHDACODEC pCodec, ENMSOUNDSOURCE, int avail));
|
---|
108 | /* These callbacks are set by Codec implementation. */
|
---|
109 | DECLR3CALLBACKMEMBER(int, pfnLookup, (PHDACODEC pThis, uint32_t verb, PPFNHDACODECVERBPROCESSOR));
|
---|
110 | DECLR3CALLBACKMEMBER(int, pfnReset, (PHDACODEC pThis));
|
---|
111 | DECLR3CALLBACKMEMBER(int, pfnCodecNodeReset, (PHDACODEC pThis, uint8_t, PCODECNODE));
|
---|
112 | /* These callbacks are set by codec implementation to answer debugger requests. */
|
---|
113 | DECLR3CALLBACKMEMBER(void, pfnCodecDbgListNodes, (PHDACODEC pThis, PCDBGFINFOHLP pHlp, const char *pszArgs));
|
---|
114 | DECLR3CALLBACKMEMBER(void, pfnCodecDbgSelector, (PHDACODEC pThis, PCDBGFINFOHLP pHlp, const char *pszArgs));
|
---|
115 | } CODECState;
|
---|
116 |
|
---|
117 | int hdaCodecConstruct(PPDMDEVINS pDevIns, PHDACODEC pThis, PCFGMNODE pCfg);
|
---|
118 | int hdaCodecDestruct(PHDACODEC pThis);
|
---|
119 | int hdaCodecSaveState(PHDACODEC pThis, PSSMHANDLE pSSM);
|
---|
120 | int hdaCodecLoadState(PHDACODEC pThis, PSSMHANDLE pSSM, uint32_t uVersion);
|
---|
121 | int hdaCodecOpenVoice(PHDACODEC pThis, ENMSOUNDSOURCE enmSoundSource, audsettings_t *pAudioSettings);
|
---|
122 |
|
---|
123 | #define HDA_SSM_VERSION 4
|
---|
124 | #define HDA_SSM_VERSION_1 1
|
---|
125 | #define HDA_SSM_VERSION_2 2
|
---|
126 | #define HDA_SSM_VERSION_3 3
|
---|
127 |
|
---|
128 | # ifdef VBOX_WITH_HDA_CODEC_EMU
|
---|
129 | /* */
|
---|
130 | struct CODECEMU
|
---|
131 | {
|
---|
132 | DECLR3CALLBACKMEMBER(int, pfnCodecEmuConstruct,(PHDACODEC pThis));
|
---|
133 | DECLR3CALLBACKMEMBER(int, pfnCodecEmuDestruct,(PHDACODEC pThis));
|
---|
134 | DECLR3CALLBACKMEMBER(int, pfnCodecEmuReset,(PHDACODEC pThis, bool fInit));
|
---|
135 | };
|
---|
136 | # endif
|
---|
137 | #endif
|
---|