Changeset 55355 in vbox
- Timestamp:
- Apr 21, 2015 2:14:26 PM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 99689
- Location:
- trunk/src/VBox/Devices/Audio
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DevSB16.cpp
r55335 r55355 52 52 #include <VBox/vmm/pdmaudioifs.h> 53 53 54 #include " vl_vbox.h"54 #include "VBoxDD.h" 55 55 56 56 #ifdef LOG_GROUP … … 68 68 #endif 69 69 70 #ifndef VBOX71 #define LENOFA(a) ((int) (sizeof(a)/sizeof(a[0])))72 #else /* VBOX */73 70 /** Current saved state version. */ 74 71 #define SB16_SAVE_STATE_VERSION 2 75 72 /** The version used in VirtualBox version 3.0 and earlier. This didn't include the config dump. */ 76 73 #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 85 75 #define IO_READ_PROTO(name) \ 86 76 DECLCALLBACK(int) name (PPDMDEVINS pDevIns, void *opaque, \ … … 90 80 DECLCALLBACK(int) name (PPDMDEVINS pDevIns, void *opaque, \ 91 81 RTIOPORT nport, uint32_t val, unsigned cb) 92 #endif /* VBOX */93 82 94 83 static const char e3[] = "COPYRIGHT (C) CREATIVE TECHNOLOGY LTD, 1992."; 95 96 #ifndef VBOX97 static struct98 {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 */107 84 108 85 #ifdef VBOX_WITH_PDM_AUDIO_DRIVER … … 391 368 LogFlowFunc(("hold %d high %d dma %d\n", hold, pThis->use_hdma, dma)); 392 369 393 #ifndef VBOX394 if (hold)395 {396 DMA_hold_DREQ(dma);397 AUD_set_active_out(pThis->voice, 1);398 }399 else400 {401 DMA_release_DREQ(dma);402 AUD_set_active_out(pThis->voice, 0);403 }404 #else /* VBOX */405 370 # ifdef VBOX_WITH_PDM_AUDIO_DRIVER 406 371 PSB16DRIVER pDrv; … … 429 394 # endif 430 395 } 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 442 398 static DECLCALLBACK(void) sb16TimerIRQ(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvThis) 443 399 { … … 446 402 PDMDevHlpISASetIrq(pThis->pDevIns, pThis->irq, 1); 447 403 } 448 #endif /* VBOX */449 404 450 405 #define DMA8_AUTO 1 … … 873 828 dsp_out_data(pThis, 0xaa); 874 829 pThis->mixer_regs[0x82] |= (cmd == 0xf2) ? 1 : 2; 875 #ifndef VBOX876 qemu_irq_raise (pThis->pic[pThis->irq]);877 #else878 830 PDMDevHlpISASetIrq(pThis->pDevIns, pThis->irq, 1); 879 #endif880 831 break; 881 832 … … 1048 999 samples = dsp_get_lohi (pThis) + 1; 1049 1000 bytes = samples << pThis->fmt_stereo << ((pThis->fmt_bits == 16) ? 1 : 0); 1050 #ifndef VBOX1051 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) + ticks1060 );1061 }1062 }1063 LogFlowFunc(("mix silence %d %d %" PRId64 "\n", samples, bytes, ticks));1064 #else /* VBOX */1065 1001 ticks = (bytes * TMTimerGetFreq(pThis->pTimerIRQ)) / freq; 1066 1002 if (ticks < TMTimerGetFreq(pThis->pTimerIRQ) / 1024) … … 1069 1005 TMTimerSet(pThis->pTimerIRQ, TMTimerGet(pThis->pTimerIRQ) + ticks); 1070 1006 LogFlowFunc(("mix silence %d %d % %RU64\n", samples, bytes, ticks)); 1071 #endif /* VBOX */1072 1073 1007 break; 1074 1008 } … … 1161 1095 static void sb16Reset(PSB16STATE pThis) 1162 1096 { 1163 #ifndef VBOX1164 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 */1170 1097 PDMDevHlpISASetIrq(pThis->pDevIns, pThis->irq, 0); 1171 1098 if (pThis->dma_auto) … … 1174 1101 PDMDevHlpISASetIrq(pThis->pDevIns, pThis->irq, 0); 1175 1102 } 1176 #endif /* VBOX */1177 1103 1178 1104 pThis->mixer_regs[0x82] = 0; … … 1212 1138 { 1213 1139 pThis->highspeed = 0; 1214 #ifndef VBOX1215 qemu_irq_lower (pThis->pic[pThis->irq]);1216 #else1217 1140 PDMDevHlpISASetIrq(pThis->pDevIns, pThis->irq, 0); 1218 #endif1219 1141 sb16Control(pThis, 0); 1220 1142 } … … 1291 1213 } 1292 1214 1293 #ifdef VBOX1294 1215 return VINF_SUCCESS; 1295 #endif1296 1216 } 1297 1217 … … 1302 1222 1303 1223 iport = nport - pThis->port; 1304 #ifdef VBOX 1224 1305 1225 /** @todo reject non-byte access? 1306 1226 * The spec does not mention a non-byte access so we should check how real hardware behaves. */ 1307 #endif1308 1227 1309 1228 switch (iport) … … 1343 1262 ack = 1; 1344 1263 pThis->mixer_regs[0x82] &= ~1; 1345 #ifndef VBOX1346 qemu_irq_lower (pThis->pic[pThis->irq]);1347 #else1348 1264 PDMDevHlpISASetIrq(pThis->pDevIns, pThis->irq, 0); 1349 #endif1350 1265 } 1351 1266 break; … … 1357 1272 ack = 1; 1358 1273 pThis->mixer_regs[0x82] &= ~2; 1359 #ifndef VBOX1360 qemu_irq_lower (pThis->pic[pThis->irq]);1361 #else1362 1274 PDMDevHlpISASetIrq(pThis->pDevIns, pThis->irq, 0); 1363 #endif1364 1275 } 1365 1276 break; … … 1372 1283 LogFlowFunc(("read %#x -> %#x\n", nport, retval)); 1373 1284 1374 #ifndef VBOX1375 return retval;1376 #else1377 1285 *pu32 = retval; 1378 1286 return VINF_SUCCESS; 1379 #endif1380 1287 1381 1288 error: 1382 1289 LogFlowFunc(("warning: dsp_read %#x error\n", nport)); 1383 #ifndef VBOX1384 return 0xff;1385 #else1386 1290 return VERR_IOM_IOPORT_UNUSED; 1387 #endif1388 1291 } 1389 1292 … … 1457 1360 pThis->mixer_nreg = val; 1458 1361 1459 #ifdef VBOX1460 1362 return VINF_SUCCESS; 1461 #endif1462 1363 } 1463 1364 … … 1562 1463 case 0x82: 1563 1464 LogFlowFunc(("attempt to write into IRQ status register (val=%#x)\n", val)); 1564 #ifdef VBOX1565 1465 return VINF_SUCCESS; 1566 #endif1567 1466 1568 1467 default: … … 1574 1473 pThis->mixer_regs[pThis->mixer_nreg] = val; 1575 1474 1576 #ifdef VBOX1577 1475 /* Update the master (mixer) volume. */ 1578 1476 if (fUpdateMaster) … … 1604 1502 #endif /* VBOX_WITH_PDM_AUDIO_DRIVER */ 1605 1503 } 1606 #endif /* VBOX */ 1607 1608 #ifdef VBOX 1504 1609 1505 return VINF_SUCCESS; 1610 #endif1611 1506 } 1612 1507 1613 1508 static IO_WRITE_PROTO(mixer_write) 1614 1509 { 1615 #ifndef VBOX1616 mixer_write_indexb (opaque, nport, val & 0xff);1617 mixer_write_datab (opaque, nport, (val >> 8) & 0xff);1618 #else /* VBOX */1619 1510 PSB16STATE pThis = (PSB16STATE)opaque; 1620 1511 int iport = nport - pThis->port; … … 1641 1532 } 1642 1533 return VINF_SUCCESS; 1643 #endif /* VBOX */1644 1534 } 1645 1535 … … 1658 1548 pThis->mixer_nreg, pThis->mixer_regs[pThis->mixer_nreg])); 1659 1549 #endif 1660 #ifndef VBOX1661 return pThis->mixer_regs[pThis->mixer_nreg];1662 #else1663 1550 *pu32 = pThis->mixer_regs[pThis->mixer_nreg]; 1664 1551 return VINF_SUCCESS; 1665 #endif1666 1552 } 1667 1553 … … 1675 1561 while (cbToWrite) 1676 1562 { 1677 #ifndef VBOX1678 size_t cbToRead;1679 int cbRead;1680 #else1681 1563 uint32_t cbWrittenMin = UINT32_MAX; 1682 1564 uint32_t cbToRead; 1683 1565 uint32_t cbRead; 1684 #endif 1566 1685 1567 cbToRead = RT_MIN(dma_len - dma_pos, cbToWrite); 1686 1568 if (cbToRead > sizeof(tmpbuf)) 1687 1569 cbToRead = sizeof(tmpbuf); 1688 1570 1689 #ifndef VBOX1690 cbRead = DMA_read_memory (nchan, tmpbuf, dma_pos, cbToRead);1691 #else1692 1571 int rc = PDMDevHlpDMAReadMemory(pThis->pDevIns, nchan, tmpbuf, dma_pos, cbToRead, &cbRead); 1693 1572 AssertMsgRC(rc, ("DMAReadMemory -> %Rrc\n", rc)); 1694 #endif1695 1573 1696 1574 #ifdef VBOX_WITH_PDM_AUDIO_DRIVER … … 1727 1605 } 1728 1606 1729 #ifndef VBOX1730 static int sb16DMARead(void *opaque, int nchan, int dma_pos, int dma_len)1731 #else1732 1607 static DECLCALLBACK(uint32_t) sb16DMARead(PPDMDEVINS pDevIns, void *opaque, unsigned nchan, uint32_t dma_pos, uint32_t dma_len) 1733 #endif1734 1608 { 1735 1609 PSB16STATE pThis = (PSB16STATE)opaque; … … 1808 1682 { 1809 1683 pThis->mixer_regs[0x82] |= (nchan & 4) ? 2 : 1; 1810 #ifndef VBOX1811 qemu_irq_raise (pThis->pic[pThis->irq]);1812 #else1813 1684 PDMDevHlpISASetIrq(pThis->pDevIns, pThis->irq, 1); 1814 #endif1815 1685 if (0 == pThis->dma_auto) 1816 1686 { … … 1838 1708 AssertPtrReturnVoid(pState); 1839 1709 pState->audio_free = cbFree; 1840 #ifdef VBOX1841 1710 /* New space available, see if we can transfer more. There is no cyclic DMA timer in VBox. */ 1842 1711 PDMDevHlpDMASchedule(pState->pDevIns); 1843 #endif1844 1712 } 1845 1713 #else … … 1912 1780 #endif /* !VBOX_WITH_PDM_AUDIO_DRIVER */ 1913 1781 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); 1782 static 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 1836 static 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); 2030 1887 2031 1888 #ifdef VBOX_WITH_PDM_AUDIO_DRIVER … … 2080 1937 } 2081 1938 2082 #ifdef VBOX2083 1939 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 } 2151 1941 2152 1942 static DECLCALLBACK(int) sb16LiveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uPass) … … 2166 1956 PSB16STATE pThis = PDMINS_2_DATA(pDevIns, PSB16STATE); 2167 1957 2168 sb16LiveExec 2169 SB_save(pSSM, pThis);1958 sb16LiveExec(pDevIns, pSSM, 0); 1959 sb16Save(pSSM, pThis); 2170 1960 return VINF_SUCCESS; 2171 1961 } … … 2212 2002 return VINF_SUCCESS; 2213 2003 2214 SB_load(pSSM, pThis, uVersion);2004 sb16Load(pSSM, pThis, uVersion); 2215 2005 return VINF_SUCCESS; 2216 2006 } … … 2566 2356 PDM_DEVREG_VERSION 2567 2357 }; 2568 #endif /* VBOX */2569 -
trunk/src/VBox/Devices/Audio/DrvAudio.cpp
r55340 r55355 63 63 64 64 #include "VBoxDD.h" 65 #include "vl_vbox.h"66 65 67 66 #include <ctype.h> … … 342 341 343 342 if (pPCMInfo->fSwapEndian) 344 s = bswap16(s);343 s = RT_BSWAP_U16(s); 345 344 346 345 for (i = 0; i < len << shift; i++) … … 357 356 358 357 if (pPCMInfo->fSwapEndian) 359 s = bswap32(s);358 s = RT_BSWAP_U32(s); 360 359 361 360 for (i = 0; i < len << shift; i++)
Note:
See TracChangeset
for help on using the changeset viewer.