VirtualBox

Changeset 55355 in vbox


Ignore:
Timestamp:
Apr 21, 2015 2:14:26 PM (10 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
99689
Message:

SB16/Audio: VBoxized.

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

Legend:

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

    r55335 r55355  
    5252#include <VBox/vmm/pdmaudioifs.h>
    5353
    54 #include "vl_vbox.h"
     54#include "VBoxDD.h"
    5555
    5656#ifdef LOG_GROUP
     
    6868#endif
    6969
    70 #ifndef VBOX
    71 #define LENOFA(a) ((int) (sizeof(a)/sizeof(a[0])))
    72 #else /* VBOX */
    7370/** Current saved state version. */
    7471#define SB16_SAVE_STATE_VERSION         2
    7572/** The version used in VirtualBox version 3.0 and earlier. This didn't include the config dump. */
    7673#define SB16_SAVE_STATE_VERSION_VBOX_30 1
    77 #endif /* VBOX */
    78 
    79 #ifndef VBOX
    80 #define IO_READ_PROTO(name)                             \
    81     uint32_t name (void *opaque, uint32_t nport)
    82 #define IO_WRITE_PROTO(name)                                    \
    83     void name (void *opaque, uint32_t nport, uint32_t val)
    84 #else  /* VBOX */
     74
    8575#define IO_READ_PROTO(name)                                             \
    8676    DECLCALLBACK(int) name (PPDMDEVINS pDevIns, void *opaque,       \
     
    9080    DECLCALLBACK(int) name (PPDMDEVINS pDevIns, void *opaque,       \
    9181                            RTIOPORT nport, uint32_t val, unsigned cb)
    92 #endif /* VBOX */
    9382
    9483static const char e3[] = "COPYRIGHT (C) CREATIVE TECHNOLOGY LTD, 1992.";
    95 
    96 #ifndef VBOX
    97 static struct
    98 {
    99     int ver_lo;
    100     int ver_hi;
    101     int irq;
    102     int dma;
    103     int hdma;
    104     int port;
    105 } conf = {5, 4, 5, 1, 5, 0x220};
    106 #endif /* !VBOX */
    10784
    10885#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
     
    391368    LogFlowFunc(("hold %d high %d dma %d\n", hold, pThis->use_hdma, dma));
    392369
    393 #ifndef VBOX
    394     if (hold)
    395     {
    396         DMA_hold_DREQ(dma);
    397         AUD_set_active_out(pThis->voice, 1);
    398     }
    399     else
    400     {
    401         DMA_release_DREQ(dma);
    402         AUD_set_active_out(pThis->voice, 0);
    403     }
    404 #else  /* VBOX */
    405370# ifdef VBOX_WITH_PDM_AUDIO_DRIVER
    406371    PSB16DRIVER pDrv;
     
    429394# endif
    430395    }
    431 #endif /* VBOX */
    432 }
    433 
    434 #ifndef VBOX
    435 static void aux_timer (void *opaque)
    436 {
    437     PSB16STATE pThis = opaque;
    438     pThis->can_write = 1;
    439     qemu_irq_raise (pThis->pic[pThis->irq]);
    440 }
    441 #else  /* VBOX */
     396}
     397
    442398static DECLCALLBACK(void) sb16TimerIRQ(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvThis)
    443399{
     
    446402    PDMDevHlpISASetIrq(pThis->pDevIns, pThis->irq, 1);
    447403}
    448 #endif /* VBOX */
    449404
    450405#define DMA8_AUTO 1
     
    873828                dsp_out_data(pThis, 0xaa);
    874829                pThis->mixer_regs[0x82] |= (cmd == 0xf2) ? 1 : 2;
    875 #ifndef VBOX
    876                 qemu_irq_raise (pThis->pic[pThis->irq]);
    877 #else
    878830                PDMDevHlpISASetIrq(pThis->pDevIns, pThis->irq, 1);
    879 #endif
    880831                break;
    881832
     
    1048999            samples = dsp_get_lohi (pThis) + 1;
    10491000            bytes = samples << pThis->fmt_stereo << ((pThis->fmt_bits == 16) ? 1 : 0);
    1050 #ifndef VBOX
    1051             ticks = (bytes * ticks_per_sec) / freq;
    1052             if (ticks < ticks_per_sec / 1024) {
    1053                 qemu_irq_raise (pThis->pic[pThis->irq]);
    1054             }
    1055             else {
    1056                 if (pThis->aux_ts) {
    1057                     qemu_mod_timer (
    1058                         pThis->aux_ts,
    1059                         qemu_get_clock (vm_clock) + ticks
    1060                         );
    1061                 }
    1062             }
    1063             LogFlowFunc(("mix silence %d %d %" PRId64 "\n", samples, bytes, ticks));
    1064 #else  /* VBOX */
    10651001            ticks = (bytes * TMTimerGetFreq(pThis->pTimerIRQ)) / freq;
    10661002            if (ticks < TMTimerGetFreq(pThis->pTimerIRQ) / 1024)
     
    10691005                TMTimerSet(pThis->pTimerIRQ, TMTimerGet(pThis->pTimerIRQ) + ticks);
    10701006            LogFlowFunc(("mix silence %d %d % %RU64\n", samples, bytes, ticks));
    1071 #endif /* VBOX */
    1072 
    10731007            break;
    10741008        }
     
    11611095static void sb16Reset(PSB16STATE pThis)
    11621096{
    1163 #ifndef VBOX
    1164     qemu_irq_lower (pThis->pic[pThis->irq]);
    1165     if (pThis->dma_auto) {
    1166         qemu_irq_raise (pThis->pic[pThis->irq]);
    1167         qemu_irq_lower (pThis->pic[pThis->irq]);
    1168     }
    1169 #else  /* VBOX */
    11701097    PDMDevHlpISASetIrq(pThis->pDevIns, pThis->irq, 0);
    11711098    if (pThis->dma_auto)
     
    11741101        PDMDevHlpISASetIrq(pThis->pDevIns, pThis->irq, 0);
    11751102    }
    1176 #endif /* VBOX */
    11771103
    11781104    pThis->mixer_regs[0x82] = 0;
     
    12121138                        {
    12131139                            pThis->highspeed = 0;
    1214 #ifndef VBOX
    1215                             qemu_irq_lower (pThis->pic[pThis->irq]);
    1216 #else
    12171140                            PDMDevHlpISASetIrq(pThis->pDevIns, pThis->irq, 0);
    1218 #endif
    12191141                            sb16Control(pThis, 0);
    12201142                        }
     
    12911213    }
    12921214
    1293 #ifdef VBOX
    12941215    return VINF_SUCCESS;
    1295 #endif
    12961216}
    12971217
     
    13021222
    13031223    iport = nport - pThis->port;
    1304 #ifdef VBOX
     1224
    13051225    /** @todo reject non-byte access?
    13061226     *  The spec does not mention a non-byte access so we should check how real hardware behaves. */
    1307 #endif
    13081227
    13091228    switch (iport)
     
    13431262                ack = 1;
    13441263                pThis->mixer_regs[0x82] &= ~1;
    1345 #ifndef VBOX
    1346                 qemu_irq_lower (pThis->pic[pThis->irq]);
    1347 #else
    13481264                PDMDevHlpISASetIrq(pThis->pDevIns, pThis->irq, 0);
    1349 #endif
    13501265            }
    13511266            break;
     
    13571272                ack = 1;
    13581273                pThis->mixer_regs[0x82] &= ~2;
    1359 #ifndef VBOX
    1360                qemu_irq_lower (pThis->pic[pThis->irq]);
    1361 #else
    13621274               PDMDevHlpISASetIrq(pThis->pDevIns, pThis->irq, 0);
    1363 #endif
    13641275            }
    13651276            break;
     
    13721283        LogFlowFunc(("read %#x -> %#x\n", nport, retval));
    13731284
    1374 #ifndef VBOX
    1375     return retval;
    1376 #else
    13771285    *pu32 = retval;
    13781286    return VINF_SUCCESS;
    1379 #endif
    13801287
    13811288 error:
    13821289    LogFlowFunc(("warning: dsp_read %#x error\n", nport));
    1383 #ifndef VBOX
    1384     return 0xff;
    1385 #else
    13861290    return VERR_IOM_IOPORT_UNUSED;
    1387 #endif
    13881291}
    13891292
     
    14571360    pThis->mixer_nreg = val;
    14581361
    1459 #ifdef VBOX
    14601362    return VINF_SUCCESS;
    1461 #endif
    14621363}
    14631364
     
    15621463        case 0x82:
    15631464            LogFlowFunc(("attempt to write into IRQ status register (val=%#x)\n", val));
    1564 #ifdef VBOX
    15651465            return VINF_SUCCESS;
    1566 #endif
    15671466
    15681467        default:
     
    15741473    pThis->mixer_regs[pThis->mixer_nreg] = val;
    15751474
    1576 #ifdef VBOX
    15771475    /* Update the master (mixer) volume. */
    15781476    if (fUpdateMaster)
     
    16041502#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
    16051503    }
    1606 #endif /* VBOX */
    1607 
    1608 #ifdef VBOX
     1504
    16091505    return VINF_SUCCESS;
    1610 #endif
    16111506}
    16121507
    16131508static IO_WRITE_PROTO(mixer_write)
    16141509{
    1615 #ifndef VBOX
    1616     mixer_write_indexb (opaque, nport, val & 0xff);
    1617     mixer_write_datab (opaque, nport, (val >> 8) & 0xff);
    1618 #else  /* VBOX */
    16191510    PSB16STATE pThis = (PSB16STATE)opaque;
    16201511    int iport = nport - pThis->port;
     
    16411532    }
    16421533    return VINF_SUCCESS;
    1643 #endif /* VBOX */
    16441534}
    16451535
     
    16581548            pThis->mixer_nreg, pThis->mixer_regs[pThis->mixer_nreg]));
    16591549#endif
    1660 #ifndef VBOX
    1661     return pThis->mixer_regs[pThis->mixer_nreg];
    1662 #else
    16631550    *pu32 = pThis->mixer_regs[pThis->mixer_nreg];
    16641551    return VINF_SUCCESS;
    1665 #endif
    16661552}
    16671553
     
    16751561    while (cbToWrite)
    16761562    {
    1677 #ifndef VBOX
    1678         size_t cbToRead;
    1679         int cbRead;
    1680 #else
    16811563        uint32_t cbWrittenMin = UINT32_MAX;
    16821564        uint32_t cbToRead;
    16831565        uint32_t cbRead;
    1684 #endif
     1566
    16851567        cbToRead = RT_MIN(dma_len - dma_pos, cbToWrite);
    16861568        if (cbToRead > sizeof(tmpbuf))
    16871569            cbToRead = sizeof(tmpbuf);
    16881570
    1689 #ifndef VBOX
    1690         cbRead = DMA_read_memory (nchan, tmpbuf, dma_pos, cbToRead);
    1691 #else
    16921571        int rc = PDMDevHlpDMAReadMemory(pThis->pDevIns, nchan, tmpbuf, dma_pos, cbToRead, &cbRead);
    16931572        AssertMsgRC(rc, ("DMAReadMemory -> %Rrc\n", rc));
    1694 #endif
    16951573
    16961574#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
     
    17271605}
    17281606
    1729 #ifndef VBOX
    1730 static int sb16DMARead(void *opaque, int nchan, int dma_pos, int dma_len)
    1731 #else
    17321607static DECLCALLBACK(uint32_t) sb16DMARead(PPDMDEVINS pDevIns, void *opaque, unsigned nchan, uint32_t dma_pos, uint32_t dma_len)
    1733 #endif
    17341608{
    17351609    PSB16STATE pThis = (PSB16STATE)opaque;
     
    18081682    {
    18091683        pThis->mixer_regs[0x82] |= (nchan & 4) ? 2 : 1;
    1810 #ifndef VBOX
    1811         qemu_irq_raise (pThis->pic[pThis->irq]);
    1812 #else
    18131684        PDMDevHlpISASetIrq(pThis->pDevIns, pThis->irq, 1);
    1814 #endif
    18151685        if (0 == pThis->dma_auto)
    18161686        {
     
    18381708    AssertPtrReturnVoid(pState);
    18391709    pState->audio_free = cbFree;
    1840 #ifdef VBOX
    18411710    /* New space available, see if we can transfer more. There is no cyclic DMA timer in VBox. */
    18421711    PDMDevHlpDMASchedule(pState->pDevIns);
    1843 #endif
    18441712}
    18451713#else
     
    19121780#endif /* !VBOX_WITH_PDM_AUDIO_DRIVER */
    19131781
    1914 static void SB_save (QEMUFile *f, void *opaque)
    1915 {
    1916 #ifndef VBOX
    1917     PSB16STATE pThis = opaque;
    1918 #else
    1919     PSB16STATE pThis = (PSB16STATE)opaque;
    1920 #endif
    1921 
    1922     qemu_put_be32 (f, pThis->irq);
    1923     qemu_put_be32 (f, pThis->dma);
    1924     qemu_put_be32 (f, pThis->hdma);
    1925     qemu_put_be32 (f, pThis->port);
    1926     qemu_put_be32 (f, pThis->ver);
    1927     qemu_put_be32 (f, pThis->in_index);
    1928     qemu_put_be32 (f, pThis->out_data_len);
    1929     qemu_put_be32 (f, pThis->fmt_stereo);
    1930     qemu_put_be32 (f, pThis->fmt_signed);
    1931     qemu_put_be32 (f, pThis->fmt_bits);
    1932     qemu_put_be32s (f, &pThis->fmt);
    1933     qemu_put_be32 (f, pThis->dma_auto);
    1934     qemu_put_be32 (f, pThis->block_size);
    1935     qemu_put_be32 (f, pThis->fifo);
    1936     qemu_put_be32 (f, pThis->freq);
    1937     qemu_put_be32 (f, pThis->time_const);
    1938     qemu_put_be32 (f, pThis->speaker);
    1939     qemu_put_be32 (f, pThis->needed_bytes);
    1940     qemu_put_be32 (f, pThis->cmd);
    1941     qemu_put_be32 (f, pThis->use_hdma);
    1942     qemu_put_be32 (f, pThis->highspeed);
    1943     qemu_put_be32 (f, pThis->can_write);
    1944     qemu_put_be32 (f, pThis->v2x6);
    1945 
    1946     qemu_put_8s (f, &pThis->csp_param);
    1947     qemu_put_8s (f, &pThis->csp_value);
    1948     qemu_put_8s (f, &pThis->csp_mode);
    1949     qemu_put_8s (f, &pThis->csp_param);
    1950     qemu_put_buffer (f, pThis->csp_regs, 256);
    1951     qemu_put_8s (f, &pThis->csp_index);
    1952     qemu_put_buffer (f, pThis->csp_reg83, 4);
    1953     qemu_put_be32 (f, pThis->csp_reg83r);
    1954     qemu_put_be32 (f, pThis->csp_reg83w);
    1955 
    1956     qemu_put_buffer (f, pThis->in2_data, sizeof (pThis->in2_data));
    1957     qemu_put_buffer (f, pThis->out_data, sizeof (pThis->out_data));
    1958     qemu_put_8s (f, &pThis->test_reg);
    1959     qemu_put_8s (f, &pThis->last_read_byte);
    1960 
    1961     qemu_put_be32 (f, pThis->nzero);
    1962     qemu_put_be32 (f, pThis->left_till_irq);
    1963     qemu_put_be32 (f, pThis->dma_running);
    1964     qemu_put_be32 (f, pThis->bytes_per_second);
    1965     qemu_put_be32 (f, pThis->align);
    1966 
    1967     qemu_put_be32 (f, pThis->mixer_nreg);
    1968     qemu_put_buffer (f, pThis->mixer_regs, 256);
    1969 }
    1970 
    1971 static int SB_load (QEMUFile *f, void *opaque, int version_id)
    1972 {
    1973 #ifndef VBOX
    1974     PSB16STATE pThis = opaque;
    1975 
    1976     if (version_id != 1) {
    1977         return -EINVAL;
    1978     }
    1979 #else
    1980     PSB16STATE pThis = (PSB16STATE)opaque;
    1981 #endif
    1982 
    1983     pThis->irq=qemu_get_be32 (f);
    1984     pThis->dma=qemu_get_be32 (f);
    1985     pThis->hdma=qemu_get_be32 (f);
    1986     pThis->port=qemu_get_be32 (f);
    1987     pThis->ver=qemu_get_be32 (f);
    1988     pThis->in_index=qemu_get_be32 (f);
    1989     pThis->out_data_len=qemu_get_be32 (f);
    1990     pThis->fmt_stereo=qemu_get_be32 (f);
    1991     pThis->fmt_signed=qemu_get_be32 (f);
    1992     pThis->fmt_bits=qemu_get_be32 (f);
    1993     qemu_get_be32s (f, (uint32_t*)&pThis->fmt);
    1994     pThis->dma_auto=qemu_get_be32 (f);
    1995     pThis->block_size=qemu_get_be32 (f);
    1996     pThis->fifo=qemu_get_be32 (f);
    1997     pThis->freq=qemu_get_be32 (f);
    1998     pThis->time_const=qemu_get_be32 (f);
    1999     pThis->speaker=qemu_get_be32 (f);
    2000     pThis->needed_bytes=qemu_get_be32 (f);
    2001     pThis->cmd=qemu_get_be32 (f);
    2002     pThis->use_hdma=qemu_get_be32 (f);
    2003     pThis->highspeed=qemu_get_be32 (f);
    2004     pThis->can_write=qemu_get_be32 (f);
    2005     pThis->v2x6=qemu_get_be32 (f);
    2006 
    2007     qemu_get_8s (f, &pThis->csp_param);
    2008     qemu_get_8s (f, &pThis->csp_value);
    2009     qemu_get_8s (f, &pThis->csp_mode);
    2010     qemu_get_8s (f, &pThis->csp_param);
    2011     qemu_get_buffer (f, pThis->csp_regs, 256);
    2012     qemu_get_8s (f, &pThis->csp_index);
    2013     qemu_get_buffer (f, pThis->csp_reg83, 4);
    2014     pThis->csp_reg83r=qemu_get_be32 (f);
    2015     pThis->csp_reg83w=qemu_get_be32 (f);
    2016 
    2017     qemu_get_buffer (f, pThis->in2_data, sizeof (pThis->in2_data));
    2018     qemu_get_buffer (f, pThis->out_data, sizeof (pThis->out_data));
    2019     qemu_get_8s (f, &pThis->test_reg);
    2020     qemu_get_8s (f, &pThis->last_read_byte);
    2021 
    2022     pThis->nzero=qemu_get_be32 (f);
    2023     pThis->left_till_irq=qemu_get_be32 (f);
    2024     pThis->dma_running=qemu_get_be32 (f);
    2025     pThis->bytes_per_second=qemu_get_be32 (f);
    2026     pThis->align=qemu_get_be32 (f);
    2027 
    2028     pThis->mixer_nreg=qemu_get_be32 (f);
    2029     qemu_get_buffer (f, pThis->mixer_regs, 256);
     1782static void sb16Save(PSSMHANDLE pSSM, PSB16STATE pThis)
     1783{
     1784    SSMR3PutS32(pSSM, pThis->irq);
     1785    SSMR3PutS32(pSSM, pThis->dma);
     1786    SSMR3PutS32(pSSM, pThis->hdma);
     1787    SSMR3PutS32(pSSM, pThis->port);
     1788    SSMR3PutS32(pSSM, pThis->ver);
     1789    SSMR3PutS32(pSSM, pThis->in_index);
     1790    SSMR3PutS32(pSSM, pThis->out_data_len);
     1791    SSMR3PutS32(pSSM, pThis->fmt_stereo);
     1792    SSMR3PutS32(pSSM, pThis->fmt_signed);
     1793    SSMR3PutS32(pSSM, pThis->fmt_bits);
     1794
     1795    SSMR3PutU32(pSSM, pThis->fmt);
     1796
     1797    SSMR3PutS32(pSSM, pThis->dma_auto);
     1798    SSMR3PutS32(pSSM, pThis->block_size);
     1799    SSMR3PutS32(pSSM, pThis->fifo);
     1800    SSMR3PutS32(pSSM, pThis->freq);
     1801    SSMR3PutS32(pSSM, pThis->time_const);
     1802    SSMR3PutS32(pSSM, pThis->speaker);
     1803    SSMR3PutS32(pSSM, pThis->needed_bytes);
     1804    SSMR3PutS32(pSSM, pThis->cmd);
     1805    SSMR3PutS32(pSSM, pThis->use_hdma);
     1806    SSMR3PutS32(pSSM, pThis->highspeed);
     1807    SSMR3PutS32(pSSM, pThis->can_write);
     1808    SSMR3PutS32(pSSM, pThis->v2x6);
     1809
     1810    SSMR3PutU8 (pSSM, pThis->csp_param);
     1811    SSMR3PutU8 (pSSM, pThis->csp_value);
     1812    SSMR3PutU8 (pSSM, pThis->csp_mode);
     1813    SSMR3PutU8 (pSSM, pThis->csp_param); /* Bug compatible! */
     1814    SSMR3PutMem(pSSM, pThis->csp_regs, 256);
     1815    SSMR3PutU8 (pSSM, pThis->csp_index);
     1816    SSMR3PutMem(pSSM, pThis->csp_reg83, 4);
     1817    SSMR3PutS32(pSSM, pThis->csp_reg83r);
     1818    SSMR3PutS32(pSSM, pThis->csp_reg83w);
     1819
     1820    SSMR3PutMem(pSSM, pThis->in2_data, sizeof (pThis->in2_data));
     1821    SSMR3PutMem(pSSM, pThis->out_data, sizeof (pThis->out_data));
     1822    SSMR3PutU8 (pSSM, pThis->test_reg);
     1823    SSMR3PutU8 (pSSM, pThis->last_read_byte);
     1824
     1825    SSMR3PutS32(pSSM, pThis->nzero);
     1826    SSMR3PutS32(pSSM, pThis->left_till_irq);
     1827    SSMR3PutS32(pSSM, pThis->dma_running);
     1828    SSMR3PutS32(pSSM, pThis->bytes_per_second);
     1829    SSMR3PutS32(pSSM, pThis->align);
     1830
     1831    SSMR3PutS32(pSSM, pThis->mixer_nreg);
     1832    SSMR3PutMem(pSSM, pThis->mixer_regs, 256);
     1833
     1834}
     1835
     1836static int sb16Load(PSSMHANDLE pSSM, PSB16STATE pThis, int version_id)
     1837{
     1838    SSMR3GetS32(pSSM, &pThis->irq);
     1839    SSMR3GetS32(pSSM, &pThis->dma);
     1840    SSMR3GetS32(pSSM, &pThis->hdma);
     1841    SSMR3GetS32(pSSM, &pThis->port);
     1842    SSMR3GetS32(pSSM, &pThis->ver);
     1843    SSMR3GetS32(pSSM, &pThis->in_index);
     1844    SSMR3GetS32(pSSM, &pThis->out_data_len);
     1845    SSMR3GetS32(pSSM, &pThis->fmt_stereo);
     1846    SSMR3GetS32(pSSM, &pThis->fmt_signed);
     1847    SSMR3GetS32(pSSM, &pThis->fmt_bits);
     1848
     1849    SSMR3GetU32(pSSM, (uint32_t *)&pThis->fmt);
     1850
     1851    SSMR3GetS32(pSSM, &pThis->dma_auto);
     1852    SSMR3GetS32(pSSM, &pThis->block_size);
     1853    SSMR3GetS32(pSSM, &pThis->fifo);
     1854    SSMR3GetS32(pSSM, &pThis->freq);
     1855    SSMR3GetS32(pSSM, &pThis->time_const);
     1856    SSMR3GetS32(pSSM, &pThis->speaker);
     1857    SSMR3GetS32(pSSM, &pThis->needed_bytes);
     1858    SSMR3GetS32(pSSM, &pThis->cmd);
     1859    SSMR3GetS32(pSSM, &pThis->use_hdma);
     1860    SSMR3GetS32(pSSM, &pThis->highspeed);
     1861    SSMR3GetS32(pSSM, &pThis->can_write);
     1862    SSMR3GetS32(pSSM, &pThis->v2x6);
     1863
     1864    SSMR3GetU8 (pSSM, &pThis->csp_param);
     1865    SSMR3GetU8 (pSSM, &pThis->csp_value);
     1866    SSMR3GetU8 (pSSM, &pThis->csp_mode);
     1867    SSMR3GetU8 (pSSM, &pThis->csp_param);   /* Bug compatible! */
     1868    SSMR3GetMem(pSSM, pThis->csp_regs, 256);
     1869    SSMR3GetU8 (pSSM, &pThis->csp_index);
     1870    SSMR3GetMem(pSSM, pThis->csp_reg83, 4);
     1871    SSMR3GetS32(pSSM, &pThis->csp_reg83r);
     1872    SSMR3GetS32(pSSM, &pThis->csp_reg83w);
     1873
     1874    SSMR3GetMem(pSSM, pThis->in2_data, sizeof (pThis->in2_data));
     1875    SSMR3GetMem(pSSM, pThis->out_data, sizeof (pThis->out_data));
     1876    SSMR3GetU8 (pSSM, &pThis->test_reg);
     1877    SSMR3GetU8 (pSSM, &pThis->last_read_byte);
     1878
     1879    SSMR3GetS32(pSSM, &pThis->nzero);
     1880    SSMR3GetS32(pSSM, &pThis->left_till_irq);
     1881    SSMR3GetS32(pSSM, &pThis->dma_running);
     1882    SSMR3GetS32(pSSM, &pThis->bytes_per_second);
     1883    SSMR3GetS32(pSSM, &pThis->align);
     1884
     1885    SSMR3GetS32(pSSM, &pThis->mixer_nreg);
     1886    SSMR3GetMem(pSSM, pThis->mixer_regs, 256);
    20301887
    20311888#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
     
    20801937    }
    20811938
    2082 #ifdef VBOX
    20831939    return VINF_SUCCESS;
    2084 #endif
    2085 }
    2086 
    2087 #ifndef VBOX
    2088 int SB16_init (AudioState *audio, qemu_irq *pic)
    2089 {
    2090     PSB16STATE pThis;
    2091     int i;
    2092     static const uint8_t dsp_write_ports[] = {0x6, 0xc};
    2093     static const uint8_t dsp_read_ports[] = {0x6, 0xa, 0xc, 0xd, 0xe, 0xf};
    2094 
    2095     if (!audio) {
    2096         LogFlowFunc(("No audio state\n"));
    2097         return -1;
    2098     }
    2099 
    2100     s = qemu_mallocz (sizeof (*s));
    2101     if (!s) {
    2102         LogFlowFunc(("Could not allocate memory for SB16 (%zu bytes)\n",
    2103                sizeof (*s));
    2104         return -1;
    2105     }
    2106 
    2107     pThis->cmd = -1;
    2108     pThis->pic = pic;
    2109     pThis->irq = conf.irq;
    2110     pThis->dma = conf.dma;
    2111     pThis->hdma = conf.hdma;
    2112     pThis->port = conf.port;
    2113     pThis->ver = conf.ver_lo | (conf.ver_hi << 8);
    2114 
    2115     pThis->mixer_regs[0x80] = magic_of_irq (pThis->irq);
    2116     pThis->mixer_regs[0x81] = (1 << pThis->dma) | (1 << pThis->hdma);
    2117     pThis->mixer_regs[0x82] = 2 << 5;
    2118 
    2119     pThis->csp_regs[5] = 1;
    2120     pThis->csp_regs[9] = 0xf8;
    2121 
    2122     sb16MixerReset(pThis);
    2123     pThis->aux_ts = qemu_new_timer (vm_clock, aux_timer, s);
    2124     if (!pThis->aux_ts) {
    2125         LogFlowFunc(("warning: Could not create auxiliary timer\n"));
    2126     }
    2127 
    2128     for (i = 0; i < LENOFA (dsp_write_ports); i++) {
    2129         register_ioport_write (pThis->port + dsp_write_ports[i], 1, 1, dsp_write, s);
    2130     }
    2131 
    2132     for (i = 0; i < LENOFA (dsp_read_ports); i++) {
    2133         register_ioport_read (pThis->port + dsp_read_ports[i], 1, 1, dsp_read, s);
    2134     }
    2135 
    2136     register_ioport_write (pThis->port + 0x4, 1, 1, mixer_write_indexb, s);
    2137     register_ioport_write (pThis->port + 0x4, 1, 2, mixer_write_indexw, s);
    2138     register_ioport_read (pThis->port + 0x5, 1, 1, mixer_read, s);
    2139     register_ioport_write (pThis->port + 0x5, 1, 1, mixer_write_datab, s);
    2140 
    2141     DMA_register_channel (pThis->hdma, sb16DMARead, s);
    2142     DMA_register_channel (pThis->dma, sb16DMARead, s);
    2143     pThis->can_write = 1;
    2144 
    2145     register_savevm ("sb16", 0, 1, SB_save, SB_load, s);
    2146     AUD_register_card (audio, "sb16", &pThis->card);
    2147     return 0;
    2148 }
    2149 
    2150 #else /* VBOX */
     1940}
    21511941
    21521942static DECLCALLBACK(int) sb16LiveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uPass)
     
    21661956    PSB16STATE pThis = PDMINS_2_DATA(pDevIns, PSB16STATE);
    21671957
    2168     sb16LiveExec (pDevIns, pSSM, 0);
    2169     SB_save (pSSM, pThis);
     1958    sb16LiveExec(pDevIns, pSSM, 0);
     1959    sb16Save(pSSM, pThis);
    21701960    return VINF_SUCCESS;
    21711961}
     
    22122002        return VINF_SUCCESS;
    22132003
    2214     SB_load(pSSM, pThis, uVersion);
     2004    sb16Load(pSSM, pThis, uVersion);
    22152005    return VINF_SUCCESS;
    22162006}
     
    25662356    PDM_DEVREG_VERSION
    25672357};
    2568 #endif /* VBOX */
    2569 
  • trunk/src/VBox/Devices/Audio/DrvAudio.cpp

    r55340 r55355  
    6363
    6464#include "VBoxDD.h"
    65 #include "vl_vbox.h"
    6665
    6766#include <ctype.h>
     
    342341
    343342                if (pPCMInfo->fSwapEndian)
    344                     s = bswap16(s);
     343                    s = RT_BSWAP_U16(s);
    345344
    346345                for (i = 0; i < len << shift; i++)
     
    357356
    358357                if (pPCMInfo->fSwapEndian)
    359                     s = bswap32(s);
     358                    s = RT_BSWAP_U32(s);
    360359
    361360                for (i = 0; i < len << shift; i++)
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