VirtualBox

Ignore:
Timestamp:
Oct 25, 2010 3:16:48 AM (14 years ago)
Author:
vboxsync
Message:

Audio/HDA: flexible audio format support (disabled).

File:
1 edited

Legend:

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

    r33327 r33400  
    320320#define ICH6_HDA_REG_SD6FMT     (HDA_STREAM_REG_DEF(FMT, 0) + 60) /* 0x152 */
    321321#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))
    322332
    323333#define ICH6_HDA_REG_SD0BDPL     40 /* 0x98 */
     
    392402#define ICH6_HDASTATE_2_DEVINS(pINTELHD)   ((pINTELHD)->pDevIns)
    393403#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)))
    394409
    395410
     
    972987        Log(("hda: DMA(%x) switched on\n", offset));
    973988        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);
    978990        if (offset == 0x100)
    979991        {
     
    981993            u64BaseDMA |= (((uint64_t)SDBDPU(pState, 4)) << 32);
    982994            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);
    988996        }
    989997    }
     
    9931001        if (offset == 0x80)
    9941002        {
    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);
    9971004        }
    9981005        if (offset == 0x100)
    9991006        {
    10001007            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);
    10021009        }
    1003         //SSYNC(pState) &= ~(1<< (offset - 0x80));
    10041010    }
    10051011    int rc = hdaRegWriteU24(pState, offset, index, u32Value);
     
    11841190    /* todo: add input line detection */
    11851191    PHDABDLEDESC pBdle = &pState->stInBdle;
    1186     SWVoiceIn *voice = pState->Codec.voice_pi;
     1192    SWVoiceIn *voice = ISD0FMT_TO_AUDIO_SELECTOR(pState);
    11871193    u32Rest = pBdle->u32BdleCviLen - pBdle->u32BdleCviPos;
    11881194    temp = audio_MIN(u32Rest, (uint32_t)avail);
     
    12311237        to_copy = audio_MIN(temp, 4096U);
    12321238        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);
    12341240        Log (("hda: write_audio max=%x to_copy=%x copied=%x\n",
    12351241              avail, to_copy, copied));
     
    14971503    SSMR3PutMem (pSSMHandle, &pThis->hda.stMicBdle, sizeof (HDABDLEDESC));
    14981504    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;
    15021508    SSMR3PutU8(pSSMHandle, voices);
    15031509    return VINF_SUCCESS;
     
    15301536    uint8_t voices;
    15311537    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));
    15351541    pThis->hda.u64CORBBase = CORBLBASE(&pThis->hda);
    15361542    pThis->hda.u64CORBBase |= ((uint64_t)CORBUBASE(&pThis->hda)) << 32;
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