Changeset 33400 in vbox for trunk/src/VBox/Devices/Audio/DevIchIntelHDA.cpp
- Timestamp:
- Oct 25, 2010 3:16:48 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DevIchIntelHDA.cpp
r33327 r33400 320 320 #define ICH6_HDA_REG_SD6FMT (HDA_STREAM_REG_DEF(FMT, 0) + 60) /* 0x152 */ 321 321 #define ICH6_HDA_REG_SD7FMT (HDA_STREAM_REG_DEF(FMT, 0) + 70) /* 0x172 */ 322 323 #define SDFMT(pState, num) (HDA_REG((pState), SD(FMT, num))) 324 #define ICH6_HDA_SDFMT_BASE_RATE_SHIFT (14) 325 #define ICH6_HDA_SDFMT_MULT_SHIFT (11) 326 #define ICH6_HDA_SDFMT_MULT_MASK (0x7) 327 #define ICH6_HDA_SDFMT_DIV_SHIFT (8) 328 #define ICH6_HDA_SDFMT_DIV_MASK (0x7) 329 #define SDFMT_BASE_RATE(pState, num) ((SDFMT(pState, num) & HDA_REG_FIELD_FLAG_MASK(SDFMT, BASE_RATE)) >> HDA_REG_FIELD_SHIFT(SDFMT, BASE_RATE)) 330 #define SDFMT_MULT(pState, num) ((SDFMT((pState), num) & HDA_REG_FIELD_MASK(SDFMT,MULT)) >> HDA_REG_FIELD_SHIFT(SDFMT, MULT)) 331 #define SDFMT_DIV(pState, num) ((SDFMT((pState), num) & HDA_REG_FIELD_MASK(SDFMT,DIV)) >> HDA_REG_FIELD_SHIFT(SDFMT, DIV)) 322 332 323 333 #define ICH6_HDA_REG_SD0BDPL 40 /* 0x98 */ … … 392 402 #define ICH6_HDASTATE_2_DEVINS(pINTELHD) ((pINTELHD)->pDevIns) 393 403 #define PCIDEV_2_ICH6_HDASTATE(pPciDev) ((PCIINTELHDLinkState *)(pPciDev)) 404 405 #define ISD0FMT_TO_AUDIO_SELECTOR(pState) (AUDIO_FORMAT_SELECTOR(&(pState)->Codec, In, \ 406 SDFMT_BASE_RATE(pState, 0), SDFMT_MULT(pState, 0), SDFMT_DIV(pState, 0))) 407 #define OSD0FMT_TO_AUDIO_SELECTOR(pState) (AUDIO_FORMAT_SELECTOR(&(pState)->Codec, Out, \ 408 SDFMT_BASE_RATE(pState, 4), SDFMT_MULT(pState, 4), SDFMT_DIV(pState, 4))) 394 409 395 410 … … 972 987 Log(("hda: DMA(%x) switched on\n", offset)); 973 988 if (offset == 0x80) 974 { 975 AUD_set_active_in(pState->Codec.voice_pi, 1); 976 //AUD_set_active_in(pState->Codec.voice_mc, 1); 977 } 989 AUD_set_active_in(ISD0FMT_TO_AUDIO_SELECTOR(pState), 1); 978 990 if (offset == 0x100) 979 991 { … … 981 993 u64BaseDMA |= (((uint64_t)SDBDPU(pState, 4)) << 32); 982 994 if (u64BaseDMA) 983 { 984 //fetch_bd(pState, u64BaseDMA); 985 AUD_set_active_out(pState->Codec.voice_po, 1); 986 } 987 //SDSTS(pState, 4) |= (1<<5); 995 AUD_set_active_out(OSD0FMT_TO_AUDIO_SELECTOR(pState), 1); 988 996 } 989 997 } … … 993 1001 if (offset == 0x80) 994 1002 { 995 AUD_set_active_in(pState->Codec.voice_pi, 0); 996 //AUD_set_active_in(pState->Codec.voice_mc, 0); 1003 AUD_set_active_in(ISD0FMT_TO_AUDIO_SELECTOR(pState), 0); 997 1004 } 998 1005 if (offset == 0x100) 999 1006 { 1000 1007 SDSTS(pState, 4) &= ~(1<<5); 1001 AUD_set_active_out( pState->Codec.voice_po, 0);1008 AUD_set_active_out(OSD0FMT_TO_AUDIO_SELECTOR(pState), 0); 1002 1009 } 1003 //SSYNC(pState) &= ~(1<< (offset - 0x80));1004 1010 } 1005 1011 int rc = hdaRegWriteU24(pState, offset, index, u32Value); … … 1184 1190 /* todo: add input line detection */ 1185 1191 PHDABDLEDESC pBdle = &pState->stInBdle; 1186 SWVoiceIn *voice = pState->Codec.voice_pi;1192 SWVoiceIn *voice = ISD0FMT_TO_AUDIO_SELECTOR(pState); 1187 1193 u32Rest = pBdle->u32BdleCviLen - pBdle->u32BdleCviPos; 1188 1194 temp = audio_MIN(u32Rest, (uint32_t)avail); … … 1231 1237 to_copy = audio_MIN(temp, 4096U); 1232 1238 PDMDevHlpPhysRead(ICH6_HDASTATE_2_DEVINS(pState), pBdle->u64BdleCviAddr + pBdle->u32BdleCviPos, tmpbuf, to_copy); 1233 copied = AUD_write ( pState->Codec.voice_po, tmpbuf, to_copy);1239 copied = AUD_write (OSD0FMT_TO_AUDIO_SELECTOR(pState), tmpbuf, to_copy); 1234 1240 Log (("hda: write_audio max=%x to_copy=%x copied=%x\n", 1235 1241 avail, to_copy, copied)); … … 1497 1503 SSMR3PutMem (pSSMHandle, &pThis->hda.stMicBdle, sizeof (HDABDLEDESC)); 1498 1504 SSMR3PutMem (pSSMHandle, &pThis->hda.stInBdle, sizeof (HDABDLEDESC)); 1499 uint8_t voices = AUD_is_active_in( pThis->hda.Codec.voice_pi)? RT_BIT(0):0;1500 voices |= AUD_is_active_in(pThis->hda.Codec.voice_mc)? RT_BIT(1):0;1501 voices |= AUD_is_active_out( pThis->hda.Codec.voice_po)? RT_BIT(2):0;1505 uint8_t voices = AUD_is_active_in(ISD0FMT_TO_AUDIO_SELECTOR(&pThis->hda))? RT_BIT(0):0; 1506 //voices |= AUD_is_active_in(pThis->hda.Codec.voice_mc)? RT_BIT(1):0; 1507 voices |= AUD_is_active_out(OSD0FMT_TO_AUDIO_SELECTOR(&pThis->hda))? RT_BIT(2):0; 1502 1508 SSMR3PutU8(pSSMHandle, voices); 1503 1509 return VINF_SUCCESS; … … 1530 1536 uint8_t voices; 1531 1537 SSMR3GetU8(pSSMHandle, &voices); 1532 AUD_set_active_in( pThis->hda.Codec.voice_pi, voices & RT_BIT(0));1533 AUD_set_active_in(pThis->hda.Codec.voice_mc, voices & RT_BIT(1));1534 AUD_set_active_out( pThis->hda.Codec.voice_po, voices & RT_BIT(2));1538 AUD_set_active_in(ISD0FMT_TO_AUDIO_SELECTOR(&pThis->hda), voices & RT_BIT(0)); 1539 //AUD_set_active_in(pThis->hda.Codec.voice_mc, voices & RT_BIT(1)); 1540 AUD_set_active_out(OSD0FMT_TO_AUDIO_SELECTOR(&pThis->hda), voices & RT_BIT(2)); 1535 1541 pThis->hda.u64CORBBase = CORBLBASE(&pThis->hda); 1536 1542 pThis->hda.u64CORBBase |= ((uint64_t)CORBUBASE(&pThis->hda)) << 32;
Note:
See TracChangeset
for help on using the changeset viewer.