Changeset 31771 in vbox for trunk/src/VBox/Devices/Audio
- Timestamp:
- Aug 19, 2010 9:15:42 AM (14 years ago)
- Location:
- trunk/src/VBox/Devices/Audio
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DevCodec.cpp
r31760 r31771 1271 1271 return VINF_SUCCESS; 1272 1272 } 1273 1274 int stac9220SaveState(CODECState *pCodecState, PSSMHANDLE pSSMHandle) 1275 { 1276 SSMR3PutMem (pSSMHandle, pCodecState->pNodes, sizeof(CODECNODE) * STAC9220_NODE_COUNT); 1277 return VINF_SUCCESS; 1278 } 1279 int stac9220LoadState(CODECState *pCodecState, PSSMHANDLE pSSMHandle) 1280 { 1281 SSMR3GetMem (pSSMHandle, pCodecState->pNodes, sizeof(CODECNODE) * STAC9220_NODE_COUNT); 1282 codecToAudVolume(&pCodecState->pNodes[2].dac.B_params, AUD_MIXER_VOLUME); 1283 codecToAudVolume(&pCodecState->pNodes[0x17].adcvol.B_params, AUD_MIXER_PCM); 1284 return VINF_SUCCESS; 1285 } -
trunk/src/VBox/Devices/Audio/DevCodec.h
r31507 r31771 233 233 int stac9220Construct(CODECState *pCodecState); 234 234 int stac9220Destruct(CODECState *pCodecState); 235 int stac9220SaveState(CODECState *pCodecState, PSSMHANDLE pSSMHandle); 236 int stac9220LoadState(CODECState *pCodecState, PSSMHANDLE pSSMHandle); 235 237 236 238 #endif -
trunk/src/VBox/Devices/Audio/DevIchIntelHDA.cpp
r31760 r31771 41 41 #endif 42 42 43 #define INTELHD_SSM_VERSION 143 #define HDA_SSM_VERSION 1 44 44 PDMBOTHCBDECL(int) hdaMMIORead(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhysAddr, void *pv, unsigned cb); 45 45 PDMBOTHCBDECL(int) hdaMMIOWrite(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhysAddr, void *pv, unsigned cb); … … 133 133 134 134 #define ICH6_HDA_REG_CORBLBASE 13 /* 0x40 */ 135 #define CORBLBASE(pState) (HDA_REG((pState), CORBLBASE)) 135 136 #define ICH6_HDA_REG_CORBUBASE 14 /* 0x44 */ 137 #define CORBUBASE(pState) (HDA_REG((pState), CORBUBASE)) 136 138 #define ICH6_HDA_REG_CORBWP 15 /* 48 */ 137 139 #define ICH6_HDA_REG_CORBRP 16 /* 4A */ … … 162 164 163 165 #define ICH6_HDA_REG_RIRLBASE 20 /* 0x50 */ 166 #define RIRLBASE(pState) (HDA_REG((pState), RIRLBASE)) 167 164 168 #define ICH6_HDA_REG_RIRUBASE 21 /* 0x54 */ 169 #define RIRUBASE(pState) (HDA_REG((pState), RIRUBASE)) 165 170 166 171 #define ICH6_HDA_REG_RIRBWP 22 /* 0x58 */ … … 367 372 uint64_t u64RIRBBase; 368 373 uint64_t u64DPBase; 369 uint8_t u8CORBRP;370 374 /* pointer on CORB buf */ 371 375 uint32_t *pu32CorbBuf; … … 909 913 { 910 914 if (u32Value & HDA_REG_FIELD_FLAG_MASK(CORBRP, RST)) 911 {912 pState->u8CORBRP = 0;913 915 CORBRP(pState) = 0; 914 }915 916 else 916 917 return hdaRegWriteU8(pState, offset, index, u32Value); … … 1490 1491 } 1491 1492 1493 /** 1494 * Saves a state of the HDA device. 1495 * 1496 * @returns VBox status code. 1497 * @param pDevIns The device instance. 1498 * @param pSSMHandle The handle to save the state to. 1499 */ 1500 static DECLCALLBACK(int) hdaSaveExec (PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle) 1501 { 1502 PCIINTELHDLinkState *pThis = PDMINS_2_DATA(pDevIns, PCIINTELHDLinkState *); 1503 /* Save Codec nodes states */ 1504 stac9220SaveState(&pThis->hda.Codec, pSSMHandle); 1505 /* Save MMIO registers */ 1506 SSMR3PutMem (pSSMHandle, pThis->hda.au32Regs, sizeof (pThis->hda.au32Regs)); 1507 /* Save HDA dma counters */ 1508 SSMR3PutMem (pSSMHandle, &pThis->hda.stOutBdle, sizeof (HDABDLEDESC)); 1509 SSMR3PutMem (pSSMHandle, &pThis->hda.stMicBdle, sizeof (HDABDLEDESC)); 1510 SSMR3PutMem (pSSMHandle, &pThis->hda.stInBdle, sizeof (HDABDLEDESC)); 1511 uint8_t voices = AUD_is_active_in(pThis->hda.Codec.voice_pi)? RT_BIT(0):0; 1512 voices |= AUD_is_active_in(pThis->hda.Codec.voice_mc)? RT_BIT(1):0; 1513 voices |= AUD_is_active_out(pThis->hda.Codec.voice_po)? RT_BIT(2):0; 1514 SSMR3PutU8(pSSMHandle, voices); 1515 return VINF_SUCCESS; 1516 } 1517 1518 /** 1519 * Loads a saved HDA device state. 1520 * 1521 * @returns VBox status code. 1522 * @param pDevIns The device instance. 1523 * @param pSSMHandle The handle to the saved state. 1524 * @param uVersion The data unit version number. 1525 * @param uPass The data pass. 1526 */ 1527 static DECLCALLBACK(int) hdaLoadExec (PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle, 1528 uint32_t uVersion, uint32_t uPass) 1529 { 1530 PCIINTELHDLinkState *pThis = PDMINS_2_DATA(pDevIns, PCIINTELHDLinkState *); 1531 /* Load Codec nodes states */ 1532 stac9220LoadState(&pThis->hda.Codec, pSSMHandle); 1533 /* Load MMIO registers */ 1534 SSMR3GetMem (pSSMHandle, pThis->hda.au32Regs, sizeof (pThis->hda.au32Regs)); 1535 /* Load HDA dma counters */ 1536 SSMR3GetMem (pSSMHandle, &pThis->hda.stOutBdle, sizeof (HDABDLEDESC)); 1537 SSMR3GetMem (pSSMHandle, &pThis->hda.stMicBdle, sizeof (HDABDLEDESC)); 1538 SSMR3GetMem (pSSMHandle, &pThis->hda.stInBdle, sizeof (HDABDLEDESC)); 1539 uint8_t voices; 1540 SSMR3GetU8(pSSMHandle, &voices); 1541 AUD_set_active_in(pThis->hda.Codec.voice_pi, voices & RT_BIT(0)); 1542 AUD_set_active_in(pThis->hda.Codec.voice_mc, voices & RT_BIT(1)); 1543 AUD_set_active_out(pThis->hda.Codec.voice_po, voices & RT_BIT(2)); 1544 pThis->hda.u64CORBBase = CORBLBASE(&pThis->hda); 1545 pThis->hda.u64CORBBase |= ((uint64_t)CORBUBASE(&pThis->hda)) << 32; 1546 pThis->hda.u64RIRBBase = RIRLBASE(&pThis->hda); 1547 pThis->hda.u64RIRBBase |= ((uint64_t)RIRUBASE(&pThis->hda)) << 32; 1548 pThis->hda.u64DPBase = DPLBASE(&pThis->hda); 1549 pThis->hda.u64DPBase |= ((uint64_t)DPUBASE(&pThis->hda)) << 32; 1550 return VINF_SUCCESS; 1551 } 1492 1552 1493 1553 /** … … 1646 1706 rc = PDMDevHlpPCIIORegionRegister (pDevIns, 0, 0x4000, PCI_ADDRESS_SPACE_MEM, 1647 1707 hdaMap); 1708 if (RT_FAILURE (rc)) 1709 return rc; 1710 1711 rc = PDMDevHlpSSMRegister (pDevIns, HDA_SSM_VERSION, sizeof(*pThis), hdaSaveExec, hdaLoadExec); 1648 1712 if (RT_FAILURE (rc)) 1649 1713 return rc;
Note:
See TracChangeset
for help on using the changeset viewer.