Changeset 60941 in vbox for trunk/src/VBox/Devices/Audio/DevIchHdaCodec.cpp
- Timestamp:
- May 12, 2016 1:12:20 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DevIchHdaCodec.cpp
r60925 r60941 550 550 typedef struct CODECCOMMONNODE 551 551 { 552 /** Node id - 7 bit format*/553 uint8_t id;554 /** The node name. */552 /** The node's ID. */ 553 uint8_t uID; 554 /** The node's name. */ 555 555 char const *pszName; 556 /** The SDn ID this node is assigned to. 557 * 0 means not assigned, 1 is SDn0. */ 558 uint8_t uSD; 559 /** The SDn's channel to use. 560 * Only valid if a valid SDn ID is set. */ 561 uint8_t uChannel; 556 562 /* PRM 5.3.6 */ 557 563 uint32_t au32F00_param[CODECNODE_F00_PARAM_LENGTH]; … … 839 845 static SSMFIELD const g_aCodecNodeFields[] = 840 846 { 841 SSMFIELD_ENTRY( CODECSAVEDSTATENODE, Core. id),847 SSMFIELD_ENTRY( CODECSAVEDSTATENODE, Core.uID), 842 848 SSMFIELD_ENTRY_PAD_HC_AUTO(3, 3), 843 849 SSMFIELD_ENTRY( CODECSAVEDSTATENODE, Core.au32F00_param), … … 850 856 static SSMFIELD const g_aCodecNodeFieldsV1[] = 851 857 { 852 SSMFIELD_ENTRY( CODECSAVEDSTATENODE, Core. id),858 SSMFIELD_ENTRY( CODECSAVEDSTATENODE, Core.uID), 853 859 SSMFIELD_ENTRY_PAD_HC_AUTO(3, 7), 854 860 SSMFIELD_ENTRY_OLD_HCPTR(Core.name), … … 890 896 891 897 /* Set common parameters across all nodes. */ 892 pNode->node.id = uNID; 898 pNode->node.uID = uNID; 899 pNode->node.uSD = 0; 893 900 894 901 switch (uNID) … … 2051 2058 && pThis->pfnCodecNodeReset) 2052 2059 { 2053 uint8_t i;2054 2060 LogFunc(("Entering reset ...\n")); 2055 2061 2056 //pThis->fInReset = true;2057 2058 for ( i = 0; i < pThis->cTotalNodes; ++i)2062 pThis->fInReset = true; 2063 2064 for (uint8_t i = 0; i < pThis->cTotalNodes; ++i) 2059 2065 pThis->pfnCodecNodeReset(pThis, i, &pThis->paNodes[i]); 2060 2066 2061 //pThis->fInReset = false;2067 pThis->fInReset = false; 2062 2068 2063 2069 LogFunc(("Exited reset\n")); … … 2274 2280 *pResp = 0; 2275 2281 2282 bool fIsOut; 2283 2276 2284 if (hdaCodecIsDacNode(pThis, CODEC_NID(cmd))) 2277 2285 *pResp = pThis->paNodes[CODEC_NID(cmd)].dac.u32F06_param; … … 2287 2295 LogRel2(("HDA: Warning: Unhandled get stream ID command for NID0x%02x: 0x%x\n", CODEC_NID(cmd), cmd)); 2288 2296 2289 /*LogFlowFunc(("[NID0x%02x] Stream ID is 0x%x\n",2290 CODEC_NID(cmd), CODEC_F00_06_GET_STREAM_ID( *pResp)));*/2297 LogFlowFunc(("[NID0x%02x] Stream ID=%RU8, channel=%RU8\n", 2298 CODEC_NID(cmd), CODEC_F00_06_GET_STREAM_ID(cmd), CODEC_F00_06_GET_CHANNEL_ID(cmd))); 2291 2299 2292 2300 return VINF_SUCCESS; … … 2298 2306 *pResp = 0; 2299 2307 2308 PDMAUDIODIR enmDir; 2309 2300 2310 uint32_t *pu32Addr = NULL; 2301 2311 if (hdaCodecIsDacNode(pThis, CODEC_NID(cmd))) 2312 { 2302 2313 pu32Addr = &pThis->paNodes[CODEC_NID(cmd)].dac.u32F06_param; 2314 enmDir = PDMAUDIODIR_OUT; 2315 } 2303 2316 else if (hdaCodecIsAdcNode(pThis, CODEC_NID(cmd))) 2317 { 2304 2318 pu32Addr = &pThis->paNodes[CODEC_NID(cmd)].adc.u32F06_param; 2319 enmDir = PDMAUDIODIR_IN; 2320 } 2305 2321 else if (hdaCodecIsSpdifOutNode(pThis, CODEC_NID(cmd))) 2322 { 2306 2323 pu32Addr = &pThis->paNodes[CODEC_NID(cmd)].spdifout.u32F06_param; 2324 enmDir = PDMAUDIODIR_OUT; 2325 } 2307 2326 else if (hdaCodecIsSpdifInNode(pThis, CODEC_NID(cmd))) 2327 { 2308 2328 pu32Addr = &pThis->paNodes[CODEC_NID(cmd)].spdifin.u32F06_param; 2309 else if (hdaCodecIsReservedNode(pThis, CODEC_NID(cmd)))2310 pu32Addr = &pThis->paNodes[CODEC_NID(cmd)].reserved.u32F06_param;2329 enmDir = PDMAUDIODIR_IN; 2330 } 2311 2331 else 2332 { 2333 enmDir = PDMAUDIODIR_UNKNOWN; 2312 2334 LogRel2(("HDA: Warning: Unhandled set stream ID command for NID0x%02x: 0x%x\n", CODEC_NID(cmd), cmd)); 2313 2314 /* LogFlowFunc(("[NID0x%02x] Setting new stream ID to 0x%x\n", 2315 CODEC_NID(cmd), CODEC_F00_06_GET_STREAM_ID(cmd)));*/ 2335 } 2336 2337 /* Do we (re-)assign our input/output SDn (SDI/SDO) IDs? */ 2338 if (enmDir != PDMAUDIODIR_UNKNOWN) 2339 { 2340 uint8_t uSD = CODEC_F00_06_GET_STREAM_ID(cmd); 2341 uint8_t uChannel = CODEC_F00_06_GET_CHANNEL_ID(cmd); 2342 2343 LogFlowFunc(("[NID0x%02x] Setting to stream ID=%RU8, channel=%RU8, enmDir=%RU32\n", 2344 CODEC_NID(cmd), uSD, uChannel, enmDir)); 2345 2346 pThis->paNodes[CODEC_NID(cmd)].node.uSD = uSD; 2347 pThis->paNodes[CODEC_NID(cmd)].node.uChannel = uChannel; 2348 2349 if (enmDir == PDMAUDIODIR_OUT) 2350 { 2351 /** @todo Check if non-interleaved streams need a different channel / SDn? */ 2352 2353 /* Propagate to the controller. */ 2354 pThis->pfnMixerSetStream(pThis->pHDAState, PDMAUDIOMIXERCTL_FRONT, uSD, uChannel); 2355 #ifdef VBOX_WITH_HDA_51_SURROUND 2356 pThis->pfnMixerSetStream(pThis->pHDAState, PDMAUDIOMIXERCTL_CENTER_LFE, uSD, uChannel); 2357 pThis->pfnMixerSetStream(pThis->pHDAState, PDMAUDIOMIXERCTL_REAR, uSD, uChannel); 2358 #endif 2359 } 2360 else if (enmDir == PDMAUDIODIR_IN) 2361 { 2362 pThis->pfnMixerSetStream(pThis->pHDAState, PDMAUDIOMIXERCTL_LINE_IN, uSD, uChannel); 2363 #ifdef VBOX_WITH_HDA_MIC_IN 2364 pThis->pfnMixerSetStream(pThis->pHDAState, PDMAUDIOMIXERCTL_MIC_IN, uSD, uChannel); 2365 #endif 2366 } 2367 } 2316 2368 2317 2369 if (pu32Addr) … … 2756 2808 static void codecDbgPrintNode(PCODECDBGINFO pInfo, PCODECNODE pNode, bool fRecursive) 2757 2809 { 2758 codecDbgPrintf(pInfo, "Node 0x%02x (%02RU8): ", pNode->node. id, pNode->node.id);2759 2760 if (pNode->node. id== STAC9220_NID_ROOT)2810 codecDbgPrintf(pInfo, "Node 0x%02x (%02RU8): ", pNode->node.uID, pNode->node.uID); 2811 2812 if (pNode->node.uID == STAC9220_NID_ROOT) 2761 2813 { 2762 2814 CODECDBG_PRINT("ROOT\n"); 2763 2815 } 2764 else if (pNode->node. id== STAC9220_NID_AFG)2816 else if (pNode->node.uID == STAC9220_NID_AFG) 2765 2817 { 2766 2818 CODECDBG_PRINT("AFG\n"); … … 2770 2822 CODECDBG_UNINDENT 2771 2823 } 2772 else if (hdaCodecIsPortNode(pInfo->pThis, pNode->node. id))2824 else if (hdaCodecIsPortNode(pInfo->pThis, pNode->node.uID)) 2773 2825 { 2774 2826 CODECDBG_PRINT("PORT\n"); 2775 2827 } 2776 else if (hdaCodecIsDacNode(pInfo->pThis, pNode->node. id))2828 else if (hdaCodecIsDacNode(pInfo->pThis, pNode->node.uID)) 2777 2829 { 2778 2830 CODECDBG_PRINT("DAC\n"); … … 2784 2836 CODECDBG_UNINDENT 2785 2837 } 2786 else if (hdaCodecIsAdcVolNode(pInfo->pThis, pNode->node. id))2838 else if (hdaCodecIsAdcVolNode(pInfo->pThis, pNode->node.uID)) 2787 2839 { 2788 2840 CODECDBG_PRINT("ADC VOLUME\n"); … … 2793 2845 CODECDBG_UNINDENT 2794 2846 } 2795 else if (hdaCodecIsAdcNode(pInfo->pThis, pNode->node. id))2847 else if (hdaCodecIsAdcNode(pInfo->pThis, pNode->node.uID)) 2796 2848 { 2797 2849 CODECDBG_PRINT("ADC\n"); … … 2803 2855 CODECDBG_UNINDENT 2804 2856 } 2805 else if (hdaCodecIsAdcMuxNode(pInfo->pThis, pNode->node. id))2857 else if (hdaCodecIsAdcMuxNode(pInfo->pThis, pNode->node.uID)) 2806 2858 { 2807 2859 CODECDBG_PRINT("ADC MUX\n"); … … 2812 2864 CODECDBG_UNINDENT 2813 2865 } 2814 else if (hdaCodecIsPcbeepNode(pInfo->pThis, pNode->node. id))2866 else if (hdaCodecIsPcbeepNode(pInfo->pThis, pNode->node.uID)) 2815 2867 { 2816 2868 CODECDBG_PRINT("PC BEEP\n"); 2817 2869 } 2818 else if (hdaCodecIsSpdifOutNode(pInfo->pThis, pNode->node. id))2870 else if (hdaCodecIsSpdifOutNode(pInfo->pThis, pNode->node.uID)) 2819 2871 { 2820 2872 CODECDBG_PRINT("SPDIF OUT\n"); 2821 2873 } 2822 else if (hdaCodecIsSpdifInNode(pInfo->pThis, pNode->node. id))2874 else if (hdaCodecIsSpdifInNode(pInfo->pThis, pNode->node.uID)) 2823 2875 { 2824 2876 CODECDBG_PRINT("SPDIF IN\n"); 2825 2877 } 2826 else if (hdaCodecIsDigInPinNode(pInfo->pThis, pNode->node. id))2878 else if (hdaCodecIsDigInPinNode(pInfo->pThis, pNode->node.uID)) 2827 2879 { 2828 2880 CODECDBG_PRINT("DIGITAL IN PIN\n"); 2829 2881 } 2830 else if (hdaCodecIsDigOutPinNode(pInfo->pThis, pNode->node. id))2882 else if (hdaCodecIsDigOutPinNode(pInfo->pThis, pNode->node.uID)) 2831 2883 { 2832 2884 CODECDBG_PRINT("DIGITAL OUT PIN\n"); 2833 2885 } 2834 else if (hdaCodecIsCdNode(pInfo->pThis, pNode->node. id))2886 else if (hdaCodecIsCdNode(pInfo->pThis, pNode->node.uID)) 2835 2887 { 2836 2888 CODECDBG_PRINT("CD\n"); 2837 2889 } 2838 else if (hdaCodecIsVolKnobNode(pInfo->pThis, pNode->node. id))2890 else if (hdaCodecIsVolKnobNode(pInfo->pThis, pNode->node.uID)) 2839 2891 { 2840 2892 CODECDBG_PRINT("VOLUME KNOB\n"); 2841 2893 } 2842 else if (hdaCodecIsReservedNode(pInfo->pThis, pNode->node. id))2894 else if (hdaCodecIsReservedNode(pInfo->pThis, pNode->node.uID)) 2843 2895 { 2844 2896 CODECDBG_PRINT("RESERVED\n"); 2845 2897 } 2846 2898 else 2847 CODECDBG_PRINT("UNKNOWN TYPE 0x%x\n", pNode->node. id);2899 CODECDBG_PRINT("UNKNOWN TYPE 0x%x\n", pNode->node.uID); 2848 2900 2849 2901 if (fRecursive) … … 2853 2905 { \ 2854 2906 const uint8_t uID = RT_BYTE##_aEntry(_aNode->node.au32F02_param[0x0]); \ 2855 if (pNode->node. id== uID) \2907 if (pNode->node.uID == uID) \ 2856 2908 codecDbgPrintNode(pInfo, _aNode, false /* fRecursive */); \ 2857 2909 } … … 2861 2913 { 2862 2914 const PCODECNODE pSubNode = &pInfo->pThis->paNodes[i]; 2863 if (pSubNode->node. id == pNode->node.id)2915 if (pSubNode->node.uID == pNode->node.uID) 2864 2916 continue; 2865 2917 … … 3052 3104 for (unsigned idxNode = 0; idxNode < pThis->cTotalNodes; ++idxNode) 3053 3105 { 3054 uint8_t idOld = pThis->paNodes[idxNode].SavedState.Core. id;3106 uint8_t idOld = pThis->paNodes[idxNode].SavedState.Core.uID; 3055 3107 int rc = SSMR3GetStructEx(pSSM, &pThis->paNodes[idxNode].SavedState, 3056 3108 sizeof(pThis->paNodes[idxNode].SavedState), … … 3058 3110 if (RT_FAILURE(rc)) 3059 3111 return rc; 3060 AssertLogRelMsgReturn(idOld == pThis->paNodes[idxNode].SavedState.Core. id,3061 ("loaded %#x, expected %#x\n", pThis->paNodes[idxNode].SavedState.Core. id, idOld),3112 AssertLogRelMsgReturn(idOld == pThis->paNodes[idxNode].SavedState.Core.uID, 3113 ("loaded %#x, expected %#x\n", pThis->paNodes[idxNode].SavedState.Core.uID, idOld), 3062 3114 VERR_SSM_DATA_UNIT_FORMAT_CHANGED); 3063 3115 }
Note:
See TracChangeset
for help on using the changeset viewer.