VirtualBox

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


Ignore:
Timestamp:
Nov 30, 2015 10:11:22 PM (9 years ago)
Author:
vboxsync
Message:

HDA: Handle the DMA buffer position bit, comments.

File:
1 edited

Legend:

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

    r58925 r58926  
    277277#define HDA_RMX_DPUBASE             31
    278278#define DPUBASE(pThis)              (HDA_REG((pThis), DPUBASE))
    279 /** DMA Position Buffer Enable (3.3.32). */
    280 #define DPBASE_ENABLED              RT_BIT(0)
     279
    281280#define DPBASE_ADDR_MASK            (~(uint64_t)0x7f)
    282281
     
    704703     *  Made out of DPLBASE + DPUBASE (3.3.32 + 3.3.33). */
    705704    uint64_t                           u64DPBase;
     705    /** DMA position buffer enable bit. */
     706    bool                               fDMAPosition;
    706707    /** Pointer to CORB buffer. */
    707708    R3PTRTYPE(uint32_t *)              pu32CorbBuf;
     
    769770} HDACALLBACKCTX, *PHDACALLBACKCTX;
    770771#endif
    771 
    772 #define ISD0FMT_TO_AUDIO_SELECTOR(pThis) \
    773     ( AUDIO_FORMAT_SELECTOR((pThis)->pCodec, In, SDFMT_BASE_RATE(pThis, 0), SDFMT_MULT(pThis, 0), SDFMT_DIV(pThis, 0)) )
    774 #define OSD0FMT_TO_AUDIO_SELECTOR(pThis) \
    775     ( AUDIO_FORMAT_SELECTOR((pThis)->pCodec, Out, SDFMT_BASE_RATE(pThis, 4), SDFMT_MULT(pThis, 4), SDFMT_DIV(pThis, 4)) )
    776 
    777772
    778773/*********************************************************************************************************************************
     
    949944    { 0x00064, 0x00004, 0x00000000, 0xFFFFFFFF, hdaRegReadU32          , hdaRegWriteUnimpl     , HDA_REG_IDX(IR)           }, /* Immediate Response */
    950945    { 0x00068, 0x00002, 0x00000002, 0x00000002, hdaRegReadIRS          , hdaRegWriteIRS        , HDA_REG_IDX(IRS)          }, /* Immediate Command Status */
    951     { 0x00070, 0x00004, 0xFFFFFFFF, 0xFFFFFF81, hdaRegReadU32          , hdaRegWriteBase       , HDA_REG_IDX(DPLBASE)      }, /* MA Position Lower Base */
     946    { 0x00070, 0x00004, 0xFFFFFFFF, 0xFFFFFF81, hdaRegReadU32          , hdaRegWriteBase       , HDA_REG_IDX(DPLBASE)      }, /* DMA Position Lower Base */
    952947    { 0x00074, 0x00004, 0xFFFFFFFF, 0xFFFFFFFF, hdaRegReadU32          , hdaRegWriteBase       , HDA_REG_IDX(DPUBASE)      }, /* DMA Position Upper Base */
    953948    /* 4 Input Stream Descriptors (ISD). */
     
    10221017    Assert(u32LPIB <= pStrmSt->u32CBL);
    10231018
    1024     LogFlowFunc(("uStrm=%RU8, LPIB=%RU32 (DMA Position: %RTbool)\n",
    1025                  pStrmSt->u8Strm, u32LPIB, RT_BOOL(pThis->u64DPBase & DPBASE_ENABLED)));
     1019    LogFlowFunc(("uStrm=%RU8, LPIB=%RU32 (DMA Position Buffer Enabled: %RTbool)\n",
     1020                 pStrmSt->u8Strm, u32LPIB, pThis->fDMAPosition));
    10261021
    10271022    /* Update LPIB in any case. */
     
    10291024
    10301025    /* Do we need to tell the current DMA position? */
    1031     if (pThis->u64DPBase & DPBASE_ENABLED)
     1026    if (pThis->fDMAPosition)
    10321027    {
    10331028        int rc2 = PDMDevHlpPCIPhysWrite(pThis->CTX_SUFF(pDevIns),
     
    11301125#endif
    11311126
     1127    /*
     1128     * Switch to the next BDLE entry and do a wrap around
     1129     * if we reached the end of the Buffer Descriptor List (BDL).
     1130     */
    11321131    pStrmSt->State.uCurBDLE++;
    11331132    if (pStrmSt->State.uCurBDLE == pStrmSt->State.cBDLE)
     
    11461145
    11471146#ifdef DEBUG
    1148     LogFlowFunc(("uOldBDLE=%RU16, uCurBDLE=%RU16 %R[bdle]\n", uOldBDLE, pStrmSt->State.uCurBDLE, pBDLE));
     1147    LogFlowFunc(("uOldBDLE=%RU16, uCurBDLE=%RU16, cBDLE=%RU32, %R[bdle]\n",
     1148                 uOldBDLE, pStrmSt->State.uCurBDLE, pStrmSt->State.cBDLE, pBDLE));
    11491149#endif
    11501150    return pBDLE;
     
    22402240            break;
    22412241        case HDA_REG_DPLBASE:
    2242             /** @todo: first bit has special meaning */
     2242        {
    22432243            pThis->u64DPBase &= UINT64_C(0xFFFFFFFF00000000);
    22442244            pThis->u64DPBase |= pThis->au32Regs[iRegMem];
     2245
     2246            /* Also make sure to handle the DMA position enable bit. */
     2247            bool fEnabled = pThis->au32Regs[iRegMem] & RT_BIT_32(0);
     2248            if (pThis->fDMAPosition != fEnabled)
     2249            {
     2250                LogRel(("HDA: %s DMA position buffer\n", fEnabled ? "Enabled" : "Disabled"));
     2251                pThis->fDMAPosition = fEnabled;
     2252
     2253                if (pThis->fDMAPosition)
     2254                {
     2255                    /* Immediately tell the position. */
     2256                    hdaStreamUpdateLPIB(pThis, &pThis->StrmStLineIn, HDA_STREAM_REG(pThis, LPIB, pThis->StrmStLineIn.u8Strm));
     2257                    hdaStreamUpdateLPIB(pThis, &pThis->StrmStMicIn,  HDA_STREAM_REG(pThis, LPIB, pThis->StrmStMicIn.u8Strm));
     2258                    hdaStreamUpdateLPIB(pThis, &pThis->StrmStOut,    HDA_STREAM_REG(pThis, LPIB, pThis->StrmStOut.u8Strm));
     2259                }
     2260            }
    22452261            break;
     2262        }
    22462263        case HDA_REG_DPUBASE:
    22472264            pThis->u64DPBase &= UINT64_C(0x00000000FFFFFFFF);
     
    22492266            break;
    22502267        default:
    2251             AssertMsgFailed(("Invalid index"));
     2268            AssertMsgFailed(("Invalid index\n"));
    22522269            break;
    22532270    }
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