VirtualBox

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


Ignore:
Timestamp:
Feb 20, 2013 1:10:28 PM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
83871
Message:

DevIchHda.cpp: Make Dijkstra happy.

File:
1 edited

Legend:

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

    r44760 r44761  
    12721272    bool fReset   = RT_BOOL(u32Value & HDA_REG_FIELD_FLAG_MASK(SDCTL, SRST));
    12731273    bool fInReset = RT_BOOL(HDA_REG_IND(pThis, iReg) & HDA_REG_FIELD_FLAG_MASK(SDCTL, SRST));
    1274     int rc = VINF_SUCCESS;
     1274
    12751275    if (fInReset)
    12761276    {
    1277         /* Assert!!! Guest is resetting HDA's stream, we're expecting guest will mark stream as exit
     1277        /*
     1278         * Assert!!! Guest is resetting HDA's stream, we're expecting guest will mark stream as exit
    12781279         * from reset
    12791280         */
    12801281        Assert((!fReset));
    12811282        Log(("hda: guest initiated exit of stream reset.\n"));
    1282         goto l_done;
    12831283    }
    12841284    else if (fReset)
     
    13031303            default:
    13041304                Log(("hda: changing SRST bit on non-attached stream\n"));
    1305                 goto l_done;
     1305                return hdaRegWriteU24(pThis, iReg, u32Value);
    13061306        }
    13071307        Log(("hda: guest initiated enter to stream reset.\n"));
    13081308        hdaInitTransferDescriptor(pThis, pBdle, u8Strm, &StreamDesc);
    13091309        hdaStreamReset(pThis, pBdle, &StreamDesc, u8Strm);
    1310         goto l_done;
    1311     }
    1312 
    1313     /* we enter here to change DMA states only */
    1314     if (   (fInRun && !fRun)
    1315         || (fRun && !fInRun))
    1316     {
    1317         Assert((!fReset && !fInReset));
    1318         switch (iReg)
     1310    }
     1311    else
     1312    {
     1313        /* we enter here to change DMA states only */
     1314        if (   (fInRun && !fRun)
     1315            || (fRun && !fInRun))
    13191316        {
    1320             case ICH6_HDA_REG_SD0CTL:
    1321                 AUD_set_active_in(pThis->Codec.SwVoiceIn, fRun);
    1322                 break;
    1323             case ICH6_HDA_REG_SD4CTL:
    1324                 AUD_set_active_out(pThis->Codec.SwVoiceOut, fRun);
    1325                 break;
    1326             default:
    1327                 Log(("hda: changing RUN bit on non-attached stream\n"));
    1328                 goto l_done;
     1317            Assert((!fReset && !fInReset));
     1318            switch (iReg)
     1319            {
     1320                case ICH6_HDA_REG_SD0CTL:
     1321                    AUD_set_active_in(pThis->Codec.SwVoiceIn, fRun);
     1322                    break;
     1323                case ICH6_HDA_REG_SD4CTL:
     1324                    AUD_set_active_out(pThis->Codec.SwVoiceOut, fRun);
     1325                    break;
     1326                default:
     1327                    Log(("hda: changing RUN bit on non-attached stream\n"));
     1328                    break;
     1329            }
    13291330        }
    13301331    }
    13311332
    1332 l_done:
    1333     rc = hdaRegWriteU24(pThis, iReg, u32Value);
    1334     if (RT_FAILURE(rc))
    1335         AssertRCReturn(rc, VINF_SUCCESS);
    1336     return rc;
     1333    return hdaRegWriteU24(pThis, iReg, u32Value);
    13371334}
    13381335
     
    18401837    cb2Copy = hdaCalculateTransferBufferLength(pBdle, pStreamDesc, *pu32Avail, u32CblLimit);
    18411838    if (!cb2Copy)
    1842     {
    18431839        /* if we enter here we can't report "unreported bits" */
    18441840        *fStop = true;
    1845         goto l_done;
    1846     }
    1847 
    1848 
    1849     /*
    1850      * read from backend input line to the last unreported position or at the begining.
    1851      */
    1852     cbBackendCopy = AUD_read(pThis->Codec.SwVoiceIn, pBdle->au8HdaBuffer, cb2Copy);
    1853     /*
    1854      * write the HDA DMA buffer
    1855      */
    1856     PDMDevHlpPhysWrite(pThis->pDevIns, pBdle->u64BdleCviAddr + pBdle->u32BdleCviPos, pBdle->au8HdaBuffer, cbBackendCopy);
    1857 
    1858     /* Don't see any reason why cb2Copy would differ from cbBackendCopy */
    1859     Assert((cbBackendCopy == cb2Copy && (*pu32Avail) >= cb2Copy)); /* sanity */
    1860 
    1861     if (pBdle->cbUnderFifoW + cbBackendCopy > hdaFifoWToSz(pThis, 0))
    1862         hdaBackendReadTransferReported(pBdle, cb2Copy, cbBackendCopy, &cbTransferred, pu32Avail);
    18631841    else
    18641842    {
    1865         hdaBackendTransferUnreported(pThis, pBdle, pStreamDesc, cbBackendCopy, pu32Avail);
    1866         *fStop = true;
    1867     }
    1868 l_done:
     1843        /*
     1844         * read from backend input line to the last unreported position or at the begining.
     1845         */
     1846        cbBackendCopy = AUD_read(pThis->Codec.SwVoiceIn, pBdle->au8HdaBuffer, cb2Copy);
     1847        /*
     1848         * write the HDA DMA buffer
     1849         */
     1850        PDMDevHlpPhysWrite(pThis->pDevIns, pBdle->u64BdleCviAddr + pBdle->u32BdleCviPos, pBdle->au8HdaBuffer, cbBackendCopy);
     1851
     1852        /* Don't see any reason why cb2Copy would differ from cbBackendCopy */
     1853        Assert((cbBackendCopy == cb2Copy && (*pu32Avail) >= cb2Copy)); /* sanity */
     1854
     1855        if (pBdle->cbUnderFifoW + cbBackendCopy > hdaFifoWToSz(pThis, 0))
     1856            hdaBackendReadTransferReported(pBdle, cb2Copy, cbBackendCopy, &cbTransferred, pu32Avail);
     1857        else
     1858        {
     1859            hdaBackendTransferUnreported(pThis, pBdle, pStreamDesc, cbBackendCopy, pu32Avail);
     1860            *fStop = true;
     1861        }
     1862    }
     1863
    18691864    Assert((cbTransferred <= (SDFIFOS(pThis, 0) + 1)));
    18701865    Log(("hda:ra: CVI(pos:%d, len:%d) cbTransferred: %d\n", pBdle->u32BdleCviPos, pBdle->u32BdleCviLen, cbTransferred));
     
    18881883     */
    18891884    if (!cb2Copy)
    1890     {
    18911885        *fStop = true;
    1892         goto l_done;
    1893     }
    1894 
    1895     PDMDevHlpPhysRead(pThis->pDevIns, pBdle->u64BdleCviAddr + pBdle->u32BdleCviPos, pBdle->au8HdaBuffer + pBdle->cbUnderFifoW, cb2Copy);
    1896     /*
    1897      * Write to audio backend. we should ensure that we have enough bytes to copy to the backend.
    1898      */
    1899     if (cb2Copy + pBdle->cbUnderFifoW >= hdaFifoWToSz(pThis, pStreamDesc))
    1900     {
     1886    else
     1887    {
     1888        PDMDevHlpPhysRead(pThis->pDevIns, pBdle->u64BdleCviAddr + pBdle->u32BdleCviPos, pBdle->au8HdaBuffer + pBdle->cbUnderFifoW, cb2Copy);
    19011889        /*
    1902          * Feed the newly fetched samples, including unreported ones, to the backend.
     1890         * Write to audio backend. we should ensure that we have enough bytes to copy to the backend.
    19031891         */
    1904         cbBackendCopy = AUD_write (pThis->Codec.SwVoiceOut, pBdle->au8HdaBuffer, cb2Copy + pBdle->cbUnderFifoW);
    1905         hdaBackendWriteTransferReported(pBdle, cb2Copy, cbBackendCopy, &cbTransferred, pu32Avail);
    1906     }
    1907     else
    1908     {
    1909         /* Not enough bytes to be processed and reported, we'll try our luck next time around */
    1910         hdaBackendTransferUnreported(pThis, pBdle, pStreamDesc, cb2Copy, NULL);
    1911         *fStop = true;
    1912     }
    1913 
    1914 l_done:
     1892        if (cb2Copy + pBdle->cbUnderFifoW >= hdaFifoWToSz(pThis, pStreamDesc))
     1893        {
     1894            /*
     1895             * Feed the newly fetched samples, including unreported ones, to the backend.
     1896             */
     1897            cbBackendCopy = AUD_write (pThis->Codec.SwVoiceOut, pBdle->au8HdaBuffer, cb2Copy + pBdle->cbUnderFifoW);
     1898            hdaBackendWriteTransferReported(pBdle, cb2Copy, cbBackendCopy, &cbTransferred, pu32Avail);
     1899        }
     1900        else
     1901        {
     1902            /* Not enough bytes to be processed and reported, we'll try our luck next time around */
     1903            hdaBackendTransferUnreported(pThis, pBdle, pStreamDesc, cb2Copy, NULL);
     1904            *fStop = true;
     1905        }
     1906    }
     1907
    19151908    Assert(cbTransferred <= SDFIFOS(pThis, 4) + 1);
    19161909    Log(("hda:wa: CVI(pos:%d, len:%d, cbTransferred:%d)\n", pBdle->u32BdleCviPos, pBdle->u32BdleCviLen, cbTransferred));
Note: See TracChangeset for help on using the changeset viewer.

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