VirtualBox

Changeset 33716 in vbox


Ignore:
Timestamp:
Nov 3, 2010 5:11:12 AM (14 years ago)
Author:
vboxsync
Message:

Audio/HDA: some clean up.

File:
1 edited

Legend:

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

    r33710 r33716  
    7373#define CODEC_SET_AMP_IS_RIGHT_SIDE(cmd)     (((cmd) & CODEC_VERB_SET_AMP_RIGHT_SIDE) != 0)
    7474#define CODEC_SET_AMP_INDEX(cmd)             (((cmd) & CODEC_VERB_SET_AMP_INDEX) >> 7)
     75
     76/* HDA spec 7.3.3.1 defines layout of configuration registers/verbs (0xF00) */
     77/* VendorID */
     78#define CODEC_MAKE_F00_00(vendorID, deviceID) (((vendorID) << 16) | (deviceID))
     79/* RevisionID */
     80#define CODEC_MAKE_F00_02(MajRev, MinRev, RevisionID, SteppingID) (((MajRev) << 20)|((MinRev) << 16)|((RevisionID) << 8)|(SteppingID))
     81/* Subordinate node count */
     82#define CODEC_MAKE_F00_04(startNodeNumber, totalNodeNumber) ((((startNodeNumber) & 0xFF) << 16)|(((totalNodeNumber) & 0xFF) << 8))
     83/*
     84 * Function Group Type
     85 * 0 & [0x3-0x7f] are reserved types
     86 * [0x80 - 0xff] are vendor defined function groups
     87 */
     88#define CODEC_MAKE_F00_05(UnSol, NodeType) ((UnSol)|(NodeType))
     89#define CODEC_F00_05_UNSOL  RT_BIT(8)
     90#define CODEC_F00_05_AFG    (0x1)
     91#define CODEC_F00_05_MFG    (0x2)
    7592
    7693/* HDA spec 7.3.3.31 defines layout of configuration registers/verbs (0xF1C) */
     
    243260        case 0:
    244261            pNode->root.node.name = "Root";
    245             //** @todo r=michaln: I fear the use of RT_MAKE_U32_FROM_U8() here makes the
    246             // code much harder to read, not easier.
    247             pNode->node.au32F00_param[0] = RT_MAKE_U32_FROM_U8(0x80, 0x76, 0x84, 0x83); /* VendorID = STAC9220/ DevId = 0x7680 */
    248             pNode->node.au32F00_param[2] = RT_MAKE_U32_FROM_U8(0x1, 0x34, 0x10, 0x00); /* rev id */
    249             pNode->node.au32F00_param[4] = RT_MAKE_U32_FROM_U8(0x1, 0x00, 0x01, 0x00); /* node info (start node: 1, start id = 1) */
     262            pNode->node.au32F00_param[2] = CODEC_MAKE_F00_02(0x1, 0x0, 0x31, 0x1); /* rev id */
    250263            break;
    251264        case 1:
    252265            pNode->afg.node.name = "AFG";
    253             pNode->node.au32F00_param[4] = 2 << 16 | 0x1A; /* starting node - 2; total numbers of nodes  0x1A */
    254             pNode->node.au32F00_param[5] = RT_BIT(8)|RT_BIT(0);
    255266            pNode->node.au32F00_param[8] = RT_MAKE_U32_FROM_U8(0x0d, 0x0d, 0x01, 0x0); /* Capabilities */
    256267            pNode->node.au32F00_param[0xC] = (17 << 8)|RT_BIT(6)|RT_BIT(5)|RT_BIT(2)|RT_BIT(1)|RT_BIT(0);
     
    590601    {
    591602        case 0: /* Root */
    592             pNode->node.au32F00_param[0] = (0x10EC /* Realtek */ << 16) | 0x885 /* device */;
    593             pNode->node.au32F00_param[2] = RT_BIT(20); /* Realtek 889 (8.1.9)*/
    594             pNode->node.au32F00_param[4] = (1 << 16)|0x1; /* start node 1, total 1*/
     603            pNode->node.au32F00_param[2] = CODEC_MAKE_F00_02(0x1, 0x0, 0x0, 0x0); /* Realtek 889 (8.1.9)*/
    595604            pNode->node.au32F00_param[0xA] = pState->pNodes[1].node.au32F00_param[0xA];
    596605
    597606            break;
    598607        case 0x1: /* AFG */
    599             pNode->node.au32F00_param[4] = (2 << 16)|0x25; /* start node 1, total 1*/
    600             pNode->node.au32F00_param[5] = RT_BIT(8) | 0x1; /* UnSol: enabled, function group type: AFG */
    601608            pNode->afg.u32F20_param = pState->u16VendorId << 16 | pState->u16DeviceId;
    602609            pNode->node.au32F00_param[0xB] = 0x1;
     
    20682075        pState->pfnCodecNodeReset(pState, i, &pState->pNodes[i]);
    20692076    }
     2077    /* common root node initializers */
     2078    pState->pNodes[0].node.au32F00_param[0] = CODEC_MAKE_F00_00(pState->u16VendorId, pState->u16DeviceId);
     2079    pState->pNodes[0].node.au32F00_param[4] = CODEC_MAKE_F00_04(0x1, 0x1);
     2080    /* common AFG node initializers */
     2081    pState->pNodes[1].node.au32F00_param[4] = CODEC_MAKE_F00_04(0x2, pState->cTotalNodes - 2);
     2082    pState->pNodes[1].node.au32F00_param[5] = CODEC_MAKE_F00_05(CODEC_F00_05_UNSOL, CODEC_F00_05_AFG);
     2083
    20702084    //** @todo r=michaln: Was this meant to be 'HDA' or something like that? (AC'97 was on ICH0)
    20712085    AUD_register_card ("ICH0", &pState->card);
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