- Timestamp:
- Jul 9, 2021 2:38:20 PM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 145633
- Location:
- trunk/src/VBox/Devices/Audio
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DevHdaCodec.cpp
r90128 r90131 53 53 54 54 55 /* STAC9220 - Nodes IDs / names. */ 55 /** @name STAC9220 - Nodes IDs / Names. 56 * @{ */ 56 57 #define STAC9220_NID_ROOT 0x0 /* Root node */ 57 58 #define STAC9220_NID_AFG 0x1 /* Audio Configuration Group */ … … 90 91 /** Number of total nodes emulated. */ 91 92 #define STAC9221_NUM_NODES 0x1C 93 /** @} */ 92 94 93 95 … … 134 136 * Global Variables * 135 137 *********************************************************************************************************************************/ 136 #ifdef IN_RING3 137 138 /* STAC9220 - Referenced through STAC9220WIDGET in the constructor below.*/138 /** @name STAC9220 Values 139 * @note Referenced through STAC9220WIDGET in the constructor below 140 * @{ */ 139 141 static uint8_t const g_abStac9220Ports[] = { STAC9220_NID_PIN_HEADPHONE0, STAC9220_NID_PIN_B, STAC9220_NID_PIN_C, STAC9220_NID_PIN_HEADPHONE1, STAC9220_NID_PIN_E, STAC9220_NID_PIN_F, 0 }; 140 142 static uint8_t const g_abStac9220Dacs[] = { STAC9220_NID_DAC0, STAC9220_NID_DAC1, STAC9220_NID_DAC2, STAC9220_NID_DAC3, 0 }; … … 149 151 static uint8_t const g_abStac9220Cds[] = { STAC9220_NID_PIN_CD, 0 }; 150 152 static uint8_t const g_abStac9220VolKnobs[] = { STAC9220_NID_VOL_KNOB, 0 }; 151 /* STAC 9221. */ 153 /** @} */ 154 155 /** @name STAC 9221 Values. 156 * @note Referenced through STAC9220WIDGET in the constructor below 157 * @{ */ 152 158 /** @todo Is STAC9220_NID_SPDIF_IN really correct for reserved nodes? */ 153 159 static uint8_t const g_abStac9220Reserveds[] = { STAC9220_NID_SPDIF_IN, STAC9221_NID_ADAT_OUT, STAC9221_NID_I2S_OUT, STAC9221_NID_PIN_I2S_OUT, 0 }; 160 /** @} */ 161 154 162 155 163 /** SSM description of CODECCOMMONNODE. */ … … 176 184 }; 177 185 178 #endif /* IN_RING3 */179 186 180 187 … … 780 787 } 781 788 782 #ifdef IN_RING3783 789 784 790 static int stac9220Construct(PHDACODEC pThis) … … 840 846 return VINF_SUCCESS; 841 847 } 842 843 #endif /* IN_RING3 */844 848 845 849 … … 887 891 HDA_CODEC_IS_NODE_OF_TYPE_FUNC(Reserved) 888 892 889 #ifdef IN_RING3890 893 891 894 /* … … 940 943 } 941 944 942 #endif /* IN_RING3 */943 945 944 946 DECLINLINE(void) hdaCodecSetRegister(uint32_t *pu32Reg, uint32_t u32Cmd, uint8_t u8Offset, uint32_t mask) … … 2079 2081 } 2080 2082 2081 #ifdef IN_RING32082 2083 2083 2084 /** … … 2222 2223 } 2223 2224 2224 #endif /* IN_RING3 */2225 2225 2226 2226 … … 2235 2235 ---------- --------------------- ------------------------------------------------------------------- */ 2236 2236 { 0x00020000, CODEC_VERB_16BIT_CMD, vrbProcSetConverterFormat , "SetConverterFormat " }, 2237 { 0x00030000, CODEC_VERB_16BIT_CMD, CTX_EXPR(vrbProcR3SetAmplifier,NULL,NULL), "SetAmplifier " },2237 { 0x00030000, CODEC_VERB_16BIT_CMD, vrbProcR3SetAmplifier , "SetAmplifier " }, 2238 2238 { 0x00070100, CODEC_VERB_8BIT_CMD , vrbProcSetConSelectCtrl , "SetConSelectCtrl " }, 2239 2239 { 0x00070300, CODEC_VERB_8BIT_CMD , vrbProcSetProcessingState , "SetProcessingState " }, 2240 2240 { 0x00070400, CODEC_VERB_8BIT_CMD , vrbProcSetSDISelect , "SetSDISelect " }, 2241 2241 { 0x00070500, CODEC_VERB_8BIT_CMD , vrbProcSetPowerState , "SetPowerState " }, 2242 { 0x00070600, CODEC_VERB_8BIT_CMD , CTX_EXPR(vrbProcR3SetStreamId,NULL,NULL), "SetStreamId " },2242 { 0x00070600, CODEC_VERB_8BIT_CMD , vrbProcR3SetStreamId , "SetStreamId " }, 2243 2243 { 0x00070700, CODEC_VERB_8BIT_CMD , vrbProcSetPinCtrl , "SetPinCtrl " }, 2244 2244 { 0x00070800, CODEC_VERB_8BIT_CMD , vrbProcSetUnsolicitedEnabled , "SetUnsolicitedEnabled " }, … … 2338 2338 * Found it! Run the callback and return. 2339 2339 */ 2340 #ifndef IN_RING32341 if (!g_aCodecVerbs[iCur].pfn)2342 {2343 Log3Func(("[NID0x%02x] (0x%x) %s: 0x%x -> VERR_INVALID_CONTEXT\n", /* -> ring-3 */2344 CODEC_NID(uCmd), g_aCodecVerbs[iCur].uVerb, g_aCodecVerbs[iCur].pszName, CODEC_VERB_PAYLOAD8(uCmd)));2345 return VERR_INVALID_CONTEXT;2346 }2347 #endif2348 2340 AssertPtrReturn(g_aCodecVerbs[iCur].pfn, VERR_INTERNAL_ERROR_5); /* Paranoia^2. */ 2349 2341 … … 2373 2365 * Debug * 2374 2366 *********************************************************************************************************************************/ 2375 #ifdef IN_RING32376 2377 2367 /** 2378 2368 * CODEC debug info item printing state. … … 2390 2380 typedef CODECDEBUG *PCODECDEBUG; 2391 2381 2392 # define CODECDBG_INDENTpInfo->uLevel++;2393 # define CODECDBG_UNINDENTif (pInfo->uLevel) pInfo->uLevel--;2394 2395 # define CODECDBG_PRINT(...)pInfo->pHlp->pfnPrintf(pInfo->pHlp, __VA_ARGS__)2396 # define CODECDBG_PRINTI(...)codecDbgPrintf(pInfo, __VA_ARGS__)2382 #define CODECDBG_INDENT pInfo->uLevel++; 2383 #define CODECDBG_UNINDENT if (pInfo->uLevel) pInfo->uLevel--; 2384 2385 #define CODECDBG_PRINT(...) pInfo->pHlp->pfnPrintf(pInfo->pHlp, __VA_ARGS__) 2386 #define CODECDBG_PRINTI(...) codecDbgPrintf(pInfo, __VA_ARGS__) 2397 2387 2398 2388 … … 2449 2439 static void codecDbgPrintNodeAmp(PCODECDEBUG pInfo, uint32_t *paReg, uint8_t uIdx, uint8_t uDir) 2450 2440 { 2451 # 2441 #define CODECDBG_AMP(reg, chan) \ 2452 2442 codecDbgPrintf(pInfo, "Amp %RU8 %s %s: In=%RTbool, Out=%RTbool, Left=%RTbool, Right=%RTbool, Idx=%RU8, fMute=%RTbool, uGain=%RU8\n", \ 2453 2443 uIdx, chan, uDir == AMPLIFIER_IN ? "In" : "Out", \ … … 2461 2451 CODECDBG_AMP(regAmp, "Right"); 2462 2452 2463 # 2464 } 2465 2466 2467 # 2453 #undef CODECDBG_AMP 2454 } 2455 2456 2457 #if 0 /* unused */ 2468 2458 static void codecDbgPrintNodeConnections(PCODECDEBUG pInfo, PCODECNODE pNode) 2469 2459 { … … 2474 2464 } 2475 2465 } 2476 # 2466 #endif 2477 2467 2478 2468 … … 2552 2542 if (fRecursive) 2553 2543 { 2554 # 2544 #define CODECDBG_PRINT_CONLIST_ENTRY(_aNode, _aEntry) \ 2555 2545 if (cCnt >= _aEntry) \ 2556 2546 { \ … … 2579 2569 } 2580 2570 2581 # 2571 #undef CODECDBG_PRINT_CONLIST_ENTRY 2582 2572 } 2583 2573 } … … 2616 2606 2617 2607 2618 # 2608 #if 0 /* unused */ 2619 2609 static DECLCALLBACK(void) stac9220DbgNodes(PHDACODEC pThis, PCDBGFINFOHLP pHlp, const char *pszArgs) 2620 2610 { … … 2632 2622 } 2633 2623 } 2634 # endif 2635 2636 #endif /* IN_RING3 */ 2637 2624 #endif 2638 2625 2639 2626 … … 2641 2628 * DevHDA API * 2642 2629 *********************************************************************************************************************************/ 2643 2644 #ifdef IN_RING32645 2630 2646 2631 int hdaR3CodecAddStream(PHDACODECR3 pThisCC, PDMAUDIOMIXERCTL enmMixerCtl, PPDMAUDIOSTREAMCFG pCfg) … … 2854 2839 AssertRCReturn(rc, rc); 2855 2840 2856 # 2857 # 2858 # 2841 #ifdef VBOX_WITH_AUDIO_HDA_MIC_IN 2842 # error "Implement mic-in support!" 2843 #endif 2859 2844 2860 2845 /* … … 2862 2847 */ 2863 2848 PDMDevHlpSTAMRegister(pDevIns, &pThis->StatLookupsR3, STAMTYPE_COUNTER, "Codec/LookupsR0", STAMUNIT_OCCURENCES, "Number of R0 codecLookup calls"); 2864 # 2849 #if 0 /* Codec is not yet kosher enough for ring-0. @bugref{9890c64} */ 2865 2850 PDMDevHlpSTAMRegister(pDevIns, &pThis->StatLookupsR0, STAMTYPE_COUNTER, "Codec/LookupsR3", STAMUNIT_OCCURENCES, "Number of R3 codecLookup calls"); 2866 # 2851 #endif 2867 2852 2868 2853 return rc; 2869 2854 } 2870 2855 2871 #else /* IN_RING0 */2872 2873 /**2874 * Constructs a codec (ring-0).2875 *2876 * @returns VBox status code.2877 * @param pDevIns Associated device instance.2878 * @param pThis Shared codec data beteen r0/r3.2879 * @param pThisCC Context-specific codec data (ring-0).2880 */2881 int hdaR0CodecConstruct(PPDMDEVINS pDevIns, PHDACODEC pThis, PHDACODECR0 pThisCC)2882 {2883 AssertPtrReturn(pDevIns, VERR_INVALID_POINTER);2884 AssertPtrReturn(pThis, VERR_INVALID_POINTER);2885 AssertPtrReturn(pThisCC, VERR_INVALID_POINTER);2886 2887 pThisCC->pfnLookup = codecLookup;2888 2889 /* Note: Everything else is done in the R3 part. */2890 2891 return VINF_SUCCESS;2892 }2893 2894 #endif /* IN_RING0 */2895 2856 2896 2857 /** … … 2909 2870 } 2910 2871 2872 2911 2873 /** 2912 2874 * Resets a codec. -
trunk/src/VBox/Devices/Audio/DevHdaCodec.h
r90128 r90131 32 32 /** The ICH HDA (Intel) common codec state. */ 33 33 typedef struct HDACODEC *PHDACODEC; 34 /** The ICH HDA (Intel) ring-0 codec state. */35 typedef struct HDACODECR0 *PHDACODECR0;36 34 /** The ICH HDA (Intel) ring-3 codec state. */ 37 35 typedef struct HDACODECR3 *PHDACODECR3; 36 #ifdef IN_RING3 /* (A leftover from attempt at running the codec in ring-0. Deemed unsafe 37 and not help with performance when it mattered.) */ 38 38 /** The ICH HDA (Intel) current context codec state. */ 39 39 typedef CTX_SUFF(PHDACODEC) PHDACODECCC; 40 #endif 40 41 41 42 /** … … 841 842 } HDACODEC; 842 843 843 /**844 * HDA codec state (ring-0).845 */846 typedef struct HDACODECR0847 {848 /** @name Public codec functions.849 * @{ */850 #if 0 /** @todo r=bird: why can I just disable these and not get compile errors? Unfinished code? No comments. Not at all amused! */851 DECLR0CALLBACKMEMBER(void, pfnReset, (PHDACODEC pThis, PHDACODECR0 pThisCC));852 DECLR0CALLBACKMEMBER(int, pfnNodeReset, (PHDACODEC pThis, uint8_t nID, PCODECNODE pNode));853 #endif854 DECLR0CALLBACKMEMBER(int, pfnLookup, (PHDACODEC pThis, PHDACODECR0 pThisCC, uint32_t uVerb, uint64_t *puResp));855 /** @} */856 } HDACODECR0;857 858 int hdaR0CodecConstruct(PPDMDEVINS pDevIns, PHDACODEC pThis, PHDACODECR0 pThisCC);859 844 860 845 /**
Note:
See TracChangeset
for help on using the changeset viewer.