VirtualBox

Changeset 82421 in vbox for trunk/src/VBox/Devices/Audio


Ignore:
Timestamp:
Dec 5, 2019 2:08:43 PM (5 years ago)
Author:
vboxsync
Message:

DevHDA: Keep the 'hdcnodes' debug info item working in release builds too. bugref:9218

Location:
trunk/src/VBox/Devices/Audio
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Audio/DevHDA.cpp

    r82417 r82421  
    42314231
    42324232/**
    4233  * @callback_method_impl{FNDBGFHANDLERDEV}
     4233 * @callback_method_impl{FNDBGFHANDLERDEV, hdastream}
    42344234 */
    42354235static DECLCALLBACK(void) hdaR3DbgInfoStream(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
     
    42454245
    42464246/**
    4247  * @callback_method_impl{FNDBGFHANDLERDEV}
     4247 * @callback_method_impl{FNDBGFHANDLERDEV, hdabdle}
    42484248 */
    42494249static DECLCALLBACK(void) hdaR3DbgInfoBDLE(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
     
    42594259
    42604260/**
    4261  * @callback_method_impl{FNDBGFHANDLERDEV}
     4261 * @callback_method_impl{FNDBGFHANDLERDEV, hdcnodes}
    42624262 */
    42634263static DECLCALLBACK(void) hdaR3DbgInfoCodecNodes(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
     
    42724272
    42734273/**
    4274  * @callback_method_impl{FNDBGFHANDLERDEV}
     4274 * @callback_method_impl{FNDBGFHANDLERDEV, hdcselector}
    42754275 */
    42764276static DECLCALLBACK(void) hdaR3DbgInfoCodecSelector(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
     
    42854285
    42864286/**
    4287  * @callback_method_impl{FNDBGFHANDLERDEV}
     4287 * @callback_method_impl{FNDBGFHANDLERDEV, hdamixer}
    42884288 */
    42894289static DECLCALLBACK(void) hdaR3DbgInfoMixer(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
  • trunk/src/VBox/Devices/Audio/DevHDA.h

    r82417 r82421  
    6868
    6969/** @todo Make STAM values out of this? */
    70 typedef struct HDASTATEDBGINFO
     70typedef struct HDASTATEDEBUG
    7171{
    7272#ifdef DEBUG
     
    9898     *  Defaults to VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH. */
    9999    char                    szOutPath[RTPATH_MAX + 1];
    100 } HDASTATEDBGINFO, *PHDASTATEDBGINFO;
     100} HDASTATEDEBUG;
    101101
    102102/**
     
    192192    /** Padding for alignment. */
    193193    uint8_t                 au8Padding3[3];
    194     HDASTATEDBGINFO         Dbg;
     194    /** Debug stuff. */
     195    HDASTATEDEBUG           Dbg;
    195196
    196197    /** PCI Region \#0: 16KB of MMIO stuff. */
  • trunk/src/VBox/Devices/Audio/HDACodec.cpp

    r82417 r82421  
    27682768};
    27692769
    2770 #ifdef DEBUG
    2771 typedef struct CODECDBGINFO
     2770
     2771/**
     2772 * CODEC debug info item printing state.
     2773 */
     2774typedef struct CODECDEBUG
    27722775{
    27732776    /** DBGF info helpers. */
     
    27772780    /** Pointer to codec state. */
    27782781    PHDACODEC pThis;
    2779 
    2780 } CODECDBGINFO, *PCODECDBGINFO;
    2781 
    2782 #define CODECDBG_INDENT   pInfo->uLevel++;
    2783 #define CODECDBG_UNINDENT if (pInfo->uLevel) pInfo->uLevel--;
    2784 
    2785 #define CODECDBG_PRINT(...)  pInfo->pHlp->pfnPrintf(pInfo->pHlp, __VA_ARGS__)
    2786 #define CODECDBG_PRINTI(...) codecDbgPrintf(pInfo, __VA_ARGS__)
    2787 
    2788 static void codecDbgPrintfIndentV(PCODECDBGINFO pInfo, uint16_t uIndent, const char *pszFormat, va_list va)
    2789 {
    2790     char *pszValueFormat;
    2791     if (RTStrAPrintfV(&pszValueFormat, pszFormat, va))
    2792     {
    2793         pInfo->pHlp->pfnPrintf(pInfo->pHlp, "%*s%s", uIndent, "", pszValueFormat);
    2794         RTStrFree(pszValueFormat);
    2795     }
    2796 }
    2797 
    2798 static void codecDbgPrintf(PCODECDBGINFO pInfo, const char *pszFormat, ...)
     2782} CODECDEBUG;
     2783/** Pointer to the debug info item printing state for the codec. */
     2784typedef CODECDEBUG *PCODECDEBUG;
     2785
     2786#define CODECDBG_INDENT         pInfo->uLevel++;
     2787#define CODECDBG_UNINDENT       if (pInfo->uLevel) pInfo->uLevel--;
     2788
     2789#define CODECDBG_PRINT(...)     pInfo->pHlp->pfnPrintf(pInfo->pHlp, __VA_ARGS__)
     2790#define CODECDBG_PRINTI(...)    codecDbgPrintf(pInfo, __VA_ARGS__)
     2791
     2792/** Wrapper around DBGFINFOHLP::pfnPrintf that adds identation. */
     2793static void codecDbgPrintf(PCODECDEBUG pInfo, const char *pszFormat, ...)
    27992794{
    28002795    va_list va;
    28012796    va_start(va, pszFormat);
    2802     codecDbgPrintfIndentV(pInfo, pInfo->uLevel * 4, pszFormat, va);
     2797    pInfo->pHlp->pfnPrintf(pInfo->pHlp, "%*s%N", pInfo->uLevel * 4, "", pszFormat, &va);
    28032798    va_end(va);
    28042799}
    28052800
    2806 /* Power state */
    2807 static void codecDbgPrintNodeRegF05(PCODECDBGINFO pInfo, uint32_t u32Reg)
     2801/** Power state */
     2802static void codecDbgPrintNodeRegF05(PCODECDEBUG pInfo, uint32_t u32Reg)
    28082803{
    28092804    codecDbgPrintf(pInfo, "Power (F05): fReset=%RTbool, fStopOk=%RTbool, Set=%RU8, Act=%RU8\n",
     
    28112806}
    28122807
    2813 static void codecDbgPrintNodeRegA(PCODECDBGINFO pInfo, uint32_t u32Reg)
     2808static void codecDbgPrintNodeRegA(PCODECDEBUG pInfo, uint32_t u32Reg)
    28142809{
    28152810    codecDbgPrintf(pInfo, "RegA: %x\n", u32Reg);
    28162811}
    28172812
    2818 static void codecDbgPrintNodeRegF00(PCODECDBGINFO pInfo, uint32_t *paReg00)
     2813static void codecDbgPrintNodeRegF00(PCODECDEBUG pInfo, uint32_t *paReg00)
    28192814{
    28202815    codecDbgPrintf(pInfo, "Parameters (F00):\n");
     
    28412836}
    28422837
    2843 static void codecDbgPrintNodeAmp(PCODECDBGINFO pInfo, uint32_t *paReg, uint8_t uIdx, uint8_t uDir)
    2844 {
    2845 #define CODECDBG_AMP(reg, chan) \
    2846     codecDbgPrintf(pInfo, "Amp %RU8 %s %s: In=%RTbool, Out=%RTbool, Left=%RTbool, Right=%RTbool, Idx=%RU8, fMute=%RTbool, uGain=%RU8\n", \
    2847                    uIdx, chan, uDir == AMPLIFIER_IN ? "In" : "Out", \
    2848                    RT_BOOL(CODEC_SET_AMP_IS_IN_DIRECTION(reg)), RT_BOOL(CODEC_SET_AMP_IS_OUT_DIRECTION(reg)), \
    2849                    RT_BOOL(CODEC_SET_AMP_IS_LEFT_SIDE(reg)), RT_BOOL(CODEC_SET_AMP_IS_RIGHT_SIDE(reg)), \
    2850                    CODEC_SET_AMP_INDEX(reg), RT_BOOL(CODEC_SET_AMP_MUTE(reg)), CODEC_SET_AMP_GAIN(reg));
     2838static void codecDbgPrintNodeAmp(PCODECDEBUG pInfo, uint32_t *paReg, uint8_t uIdx, uint8_t uDir)
     2839{
     2840# define CODECDBG_AMP(reg, chan) \
     2841        codecDbgPrintf(pInfo, "Amp %RU8 %s %s: In=%RTbool, Out=%RTbool, Left=%RTbool, Right=%RTbool, Idx=%RU8, fMute=%RTbool, uGain=%RU8\n", \
     2842                       uIdx, chan, uDir == AMPLIFIER_IN ? "In" : "Out", \
     2843                       RT_BOOL(CODEC_SET_AMP_IS_IN_DIRECTION(reg)), RT_BOOL(CODEC_SET_AMP_IS_OUT_DIRECTION(reg)), \
     2844                       RT_BOOL(CODEC_SET_AMP_IS_LEFT_SIDE(reg)), RT_BOOL(CODEC_SET_AMP_IS_RIGHT_SIDE(reg)), \
     2845                       CODEC_SET_AMP_INDEX(reg), RT_BOOL(CODEC_SET_AMP_MUTE(reg)), CODEC_SET_AMP_GAIN(reg))
    28512846
    28522847    uint32_t regAmp = AMPLIFIER_REGISTER(paReg, uDir, AMPLIFIER_LEFT, uIdx);
     
    28552850    CODECDBG_AMP(regAmp, "Right");
    28562851
    2857 #undef CODECDBG_AMP
    2858 }
    2859 
    2860 #if 0 /* unused */
    2861 static void codecDbgPrintNodeConnections(PCODECDBGINFO pInfo, PCODECNODE pNode)
     2852# undef CODECDBG_AMP
     2853}
     2854
     2855# if 0 /* unused */
     2856static void codecDbgPrintNodeConnections(PCODECDEBUG pInfo, PCODECNODE pNode)
    28622857{
    28632858    if (pNode->node.au32F00_param[0xE] == 0) /* Directly connected to HDA link. */
     
    28672862    }
    28682863}
    2869 #endif
    2870 
    2871 static void codecDbgPrintNode(PCODECDBGINFO pInfo, PCODECNODE pNode, bool fRecursive)
     2864# endif
     2865
     2866static void codecDbgPrintNode(PCODECDEBUG pInfo, PCODECNODE pNode, bool fRecursive)
    28722867{
    28732868    codecDbgPrintf(pInfo, "Node 0x%02x (%02RU8): ", pNode->node.uID, pNode->node.uID);
     
    29282923    }
    29292924    else if (hdaCodecIsPcbeepNode(pInfo->pThis, pNode->node.uID))
    2930     {
    29312925        CODECDBG_PRINT("PC BEEP\n");
    2932     }
    29332926    else if (hdaCodecIsSpdifOutNode(pInfo->pThis, pNode->node.uID))
    2934     {
    29352927        CODECDBG_PRINT("SPDIF OUT\n");
    2936     }
    29372928    else if (hdaCodecIsSpdifInNode(pInfo->pThis, pNode->node.uID))
    2938     {
    29392929        CODECDBG_PRINT("SPDIF IN\n");
    2940     }
    29412930    else if (hdaCodecIsDigInPinNode(pInfo->pThis, pNode->node.uID))
    2942     {
    29432931        CODECDBG_PRINT("DIGITAL IN PIN\n");
    2944     }
    29452932    else if (hdaCodecIsDigOutPinNode(pInfo->pThis, pNode->node.uID))
    2946     {
    29472933        CODECDBG_PRINT("DIGITAL OUT PIN\n");
    2948     }
    29492934    else if (hdaCodecIsCdNode(pInfo->pThis, pNode->node.uID))
    2950     {
    29512935        CODECDBG_PRINT("CD\n");
    2952     }
    29532936    else if (hdaCodecIsVolKnobNode(pInfo->pThis, pNode->node.uID))
    2954     {
    29552937        CODECDBG_PRINT("VOLUME KNOB\n");
    2956     }
    29572938    else if (hdaCodecIsReservedNode(pInfo->pThis, pNode->node.uID))
    2958     {
    29592939        CODECDBG_PRINT("RESERVED\n");
    2960     }
    29612940    else
    29622941        CODECDBG_PRINT("UNKNOWN TYPE 0x%x\n", pNode->node.uID);
     
    29642943    if (fRecursive)
    29652944    {
    2966 #define CODECDBG_PRINT_CONLIST_ENTRY(_aNode, _aEntry)                              \
    2967         if (cCnt >= _aEntry)                                                      \
    2968         {                                                                          \
    2969             const uint8_t uID = RT_BYTE##_aEntry(_aNode->node.au32F02_param[0x0]); \
    2970             if (pNode->node.uID == uID)                                            \
    2971                 codecDbgPrintNode(pInfo, _aNode, false /* fRecursive */);          \
    2972         }
     2945# define CODECDBG_PRINT_CONLIST_ENTRY(_aNode, _aEntry) \
     2946            if (cCnt >= _aEntry) \
     2947            { \
     2948                const uint8_t uID = RT_BYTE##_aEntry(_aNode->node.au32F02_param[0x0]); \
     2949                if (pNode->node.uID == uID) \
     2950                    codecDbgPrintNode(pInfo, _aNode, false /* fRecursive */); \
     2951            }
    29732952
    29742953        /* Slow recursion, but this is debug stuff anyway. */
     
    29912970        }
    29922971
    2993 #undef CODECDBG_PRINT_CONLIST_ENTRY
     2972# undef CODECDBG_PRINT_CONLIST_ENTRY
    29942973   }
    29952974}
     
    30002979    pHlp->pfnPrintf(pHlp, "HDA LINK / INPUTS\n");
    30012980
    3002     CODECDBGINFO dbgInfo;
     2981    CODECDEBUG dbgInfo;
    30032982    dbgInfo.pHlp   = pHlp;
    30042983    dbgInfo.pThis  = pThis;
    30052984    dbgInfo.uLevel = 0;
    30062985
    3007     PCODECDBGINFO pInfo = &dbgInfo;
     2986    PCODECDEBUG pInfo = &dbgInfo;
    30082987
    30092988    CODECDBG_INDENT
     
    30192998}
    30202999
     3000#ifdef DEBUG
     3001
    30213002static DECLCALLBACK(void) codecDbgSelector(PHDACODEC pThis, PCDBGFINFOHLP pHlp, const char *pszArgs)
    30223003{
    30233004    RT_NOREF(pThis, pHlp, pszArgs);
    30243005}
    3025 #endif
     3006
     3007#endif /* DEBUG */
    30263008
    30273009static DECLCALLBACK(int) codecLookup(PHDACODEC pThis, uint32_t cmd, uint64_t *puResp)
     
    32513233#ifdef DEBUG
    32523234    pThis->pfnDbgSelector  = codecDbgSelector;
     3235#endif
    32533236    pThis->pfnDbgListNodes = codecDbgListNodes;
    3254 #endif
    32553237    pThis->pfnLookup       = codecLookup;
    32563238
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette