Changeset 31263 in vbox for trunk/src/VBox/Devices/Audio
- Timestamp:
- Aug 2, 2010 4:53:50 AM (14 years ago)
- Location:
- trunk/src/VBox/Devices/Audio
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DevCodec.cpp
r31215 r31263 91 91 || CODEC_NID(cmd) == 0x13) 92 92 93 #define STAC9220_IS_PCBEEP_CMD(cmd) (CODEC_NID((cmd)) == 0x14) 93 94 #define STAC9220_IS_SPDIFOUT_CMD(cmd) (CODEC_NID((cmd)) == 0x8) 95 #define STAC9220_IS_SPDIFIN_CMD(cmd) (CODEC_NID((cmd)) == 0x9) 94 96 95 97 #define STAC9220_IS_DIGINPIN_CMD(cmd) (CODEC_NID((cmd)) == 0x11) … … 98 100 #define STAC9220_IS_CD_CMD(cmd) (CODEC_NID((cmd)) == 0x15) 99 101 100 #define STAC9220_IS_VOLKNOB_CMD(cmd) (CODEC_NID((cmd)) == 0x1 5)102 #define STAC9220_IS_VOLKNOB_CMD(cmd) (CODEC_NID((cmd)) == 0x16) 101 103 102 104 /* STAC9220 6.2 & 6.12 */ 103 105 #define STAC9220_IS_RESERVED_CMD(cmd) ( \ 104 CODEC_NID((cmd)) == 0x9 \ 105 || CODEC_NID((cmd)) == 0x19 \ 106 CODEC_NID((cmd)) == 0x19 \ 106 107 || CODEC_NID((cmd)) == 0x1A \ 107 108 || CODEC_NID((cmd)) == 0x1B) … … 145 146 CODEC_B_SIDE(cmd), 146 147 CODEC_B_INDEX(cmd)); 147 else { 148 else if (STAC9220_IS_PCBEEP_CMD(cmd)) 149 *pResp = AMPLIFIER_REGISTER(pNode->pcbeep.B_params, 150 CODEC_B_DIRECTION(cmd), 151 CODEC_B_SIDE(cmd), 152 CODEC_B_INDEX(cmd)); 153 else{ 148 154 *pResp = 0; 149 155 AssertMsgReturn(0, ("access to fields of %x need to be implemented\n", CODEC_NID(cmd)), VINF_SUCCESS); … … 173 179 CODEC_B_SIDE(cmd), 174 180 CODEC_B_INDEX(cmd)); 181 else if (STAC9220_IS_PCBEEP_CMD(cmd)) 182 pu32Bparam = &LIFIER_REGISTER(pNode->pcbeep.B_params, 183 CODEC_B_DIRECTION(cmd), 184 CODEC_B_SIDE(cmd), 185 CODEC_B_INDEX(cmd)); 175 186 Assert(pu32Bparam); 176 187 if (pu32Bparam) … … 194 205 { 195 206 Assert((CODEC_CAD(cmd) == pState->id)); 207 *pResp = 0; 196 208 if (STAC9220_IS_ADCMUX_CMD(cmd)) 197 209 *pResp = pState->pNodes[CODEC_NID(cmd)].adcmux.u32F01_param; 198 210 else if (STAC9220_IS_DIGOUTPIN_CMD(cmd)) 199 //** @todo r=michaln: Is that really u32F07, or should it be u32F01? 200 *pResp = pState->pNodes[CODEC_NID(cmd)].digout.u32F07_param; 211 *pResp = pState->pNodes[CODEC_NID(cmd)].digout.u32F01_param; 201 212 //** @todo r=michaln: Else what? We must always fill out *pResp! 202 213 return VINF_SUCCESS; … … 362 373 if (STAC9220_IS_SPDIFOUT_CMD(cmd)) 363 374 *pResp = pState->pNodes[CODEC_NID(cmd)].spdifout.u32F0d_param; 375 else if (STAC9220_IS_SPDIFIN_CMD(cmd)) 376 *pResp = pState->pNodes[CODEC_NID(cmd)].spdifin.u32F0d_param; 364 377 return VINF_SUCCESS; 365 378 } … … 373 386 pState->pNodes[CODEC_NID(cmd)].spdifout.u32F0d_param |= cmd & CODEC_VERB_8BIT_DATA; 374 387 } 388 else if (STAC9220_IS_SPDIFIN_CMD(cmd)) 389 { 390 pState->pNodes[CODEC_NID(cmd)].spdifin.u32F0d_param &= ~CODEC_VERB_8BIT_DATA; 391 pState->pNodes[CODEC_NID(cmd)].spdifin.u32F0d_param |= cmd & CODEC_VERB_8BIT_DATA; 392 } 375 393 *pResp = 0; 376 394 return VINF_SUCCESS; … … 384 402 pState->pNodes[CODEC_NID(cmd)].spdifout.u32F0d_param &= ~(CODEC_VERB_8BIT_DATA << 8); 385 403 pState->pNodes[CODEC_NID(cmd)].spdifout.u32F0d_param |= cmd & (CODEC_VERB_8BIT_DATA << 8); 404 } 405 else if (STAC9220_IS_SPDIFIN_CMD(cmd)) 406 { 407 pState->pNodes[CODEC_NID(cmd)].spdifin.u32F0d_param &= ~(CODEC_VERB_8BIT_DATA << 8); 408 pState->pNodes[CODEC_NID(cmd)].spdifin.u32F0d_param |= cmd & (CODEC_VERB_8BIT_DATA << 8); 386 409 } 387 410 *pResp = 0; … … 453 476 return VINF_SUCCESS; 454 477 *pu32Reg &= ~CODEC_VERB_8BIT_DATA; 455 *pu32Reg |= cmd & CODEC_VERB_8BIT_DATA; 478 *pu32Reg |= cmd & CODEC_VERB_4BIT_DATA; 479 *pu32Reg |= (cmd & CODEC_VERB_4BIT_DATA) << 4; 456 480 return VINF_SUCCESS; 457 481 } … … 473 497 { 474 498 Assert((CODEC_CAD(cmd) == pState->id)); 499 uint32_t *pu32addr = NULL; 500 *pResp = 0; 475 501 if (STAC9220_IS_DAC_CMD(cmd)) 476 { 477 pState->pNodes[CODEC_NID(cmd)].dac.u32F06_param &= ~CODEC_VERB_8BIT_DATA; 478 pState->pNodes[CODEC_NID(cmd)].dac.u32F06_param |= cmd & CODEC_VERB_8BIT_DATA; 479 } 502 pu32addr = &pState->pNodes[CODEC_NID(cmd)].dac.u32F06_param; 480 503 else if (STAC9220_IS_ADC_CMD(cmd)) 481 { 482 pState->pNodes[CODEC_NID(cmd)].adc.u32F06_param &= ~CODEC_VERB_8BIT_DATA; 483 pState->pNodes[CODEC_NID(cmd)].adc.u32F06_param |= cmd & CODEC_VERB_8BIT_DATA; 484 } 485 else 486 AssertMsgFailed(("Unsupported")); 487 *pResp = 0; 504 pu32addr = &pState->pNodes[CODEC_NID(cmd)].adc.u32F06_param; 505 else if (STAC9220_IS_SPDIFOUT_CMD(cmd)) 506 pu32addr = &pState->pNodes[CODEC_NID(cmd)].spdifout.u32F06_param; 507 Assert((pu32addr)); 508 if (pu32addr) 509 { 510 *pu32addr &= ~CODEC_VERB_8BIT_DATA; 511 *pu32addr |= cmd & CODEC_VERB_8BIT_DATA; 512 } 488 513 return VINF_SUCCESS; 489 514 } … … 497 522 else if (STAC9220_IS_SPDIFOUT_CMD(cmd)) 498 523 *pResp = pState->pNodes[CODEC_NID(cmd)].spdifout.u32A_param; 524 else if (STAC9220_IS_SPDIFIN_CMD(cmd)) 525 *pResp = pState->pNodes[CODEC_NID(cmd)].spdifin.u32A_param; 499 526 else 500 527 *pResp = 0; … … 520 547 pState->pNodes[CODEC_NID(cmd)].spdifout.u32A_param |= cmd & CODEC_VERB_16BIT_DATA; 521 548 } 549 else if (STAC9220_IS_SPDIFIN_CMD(cmd)) 550 { 551 pState->pNodes[CODEC_NID(cmd)].spdifin.u32A_param &= ~CODEC_VERB_16BIT_DATA; 552 pState->pNodes[CODEC_NID(cmd)].spdifin.u32A_param |= cmd & CODEC_VERB_16BIT_DATA; 553 } 522 554 *pResp = 0; 523 555 return VINF_SUCCESS; … … 528 560 { 529 561 Assert((CODEC_CAD(cmd) == pState->id)); 562 *pResp = 0; 530 563 if (STAC9220_IS_ADCVOL_CMD(cmd)) 531 564 *pResp = pState->pNodes[CODEC_NID(cmd)].adcvol.u32F0c_param; … … 534 567 else if (STAC9220_IS_DIGINPIN_CMD(cmd)) 535 568 *pResp = pState->pNodes[CODEC_NID(cmd)].digin.u32F0c_param; 536 //** @todo r=michaln: Do we really always want to return zero?537 *pResp = 0;538 569 return VINF_SUCCESS; 539 570 } … … 665 696 // code much harder to read, not easier. 666 697 pNode->node.au32F00_param[0] = RT_MAKE_U32_FROM_U8(0x80, 0x76, 0x84, 0x83); /* VendorID = STAC9220/ DevId = 0x7680 */ 667 pNode->node.au32F00_param[2] = RT_MAKE_U32_FROM_U8(0x1, 0x3 1, 0x10, 0x00); /* rev id */698 pNode->node.au32F00_param[2] = RT_MAKE_U32_FROM_U8(0x1, 0x34, 0x10, 0x00); /* rev id */ 668 699 pNode->node.au32F00_param[4] = RT_MAKE_U32_FROM_U8(0x1, 0x00, 0x01, 0x00); /* node info (start node: 1, start id = 1) */ 669 700 break; 670 701 case 1: 671 702 pNode->afg.node.name = "AFG"; 672 pNode->node.au32F00_param[4] = RT_MAKE_U32_FROM_U8(0x1a, 0x00, 0x02, 0x00);703 pNode->node.au32F00_param[4] = 2 << 16 | 0x17; /* starting node - 2; total numbers of nodes 0x17 */ 673 704 pNode->node.au32F00_param[5] = RT_BIT(8)|RT_BIT(0); 674 705 pNode->node.au32F00_param[8] = RT_MAKE_U32_FROM_U8(0x0d, 0x0d, 0x01, 0x0); /* Capabilities */ … … 680 711 pNode->node.au32F00_param[0x12] = RT_BIT(31)|(0x2 << 16)|(0x7f << 8)|0x7f; 681 712 pNode->node.au32F00_param[0x11] = 0; 682 pNode->afg.u32F05_param = 0x3 << 4; /* PS-Act: D3 -> D0 */ 713 pNode->node.au32F00_param[0xF] = RT_BIT(30)|RT_BIT(3)|RT_BIT(0); /* Power statest Supported: D0-yes, D1, D2, D3-no*/ 714 pNode->afg.u32F05_param = 0x3 << 4| 0x3; /* PS-Act: D3, PS->Set D3 */ 683 715 pNode->afg.u32F20_param = 0x83847882; 684 pNode->afg.u32F08_param = RT_BIT(7);716 pNode->afg.u32F08_param = 0; 685 717 break; 686 718 case 2: … … 697 729 dac_init: 698 730 memset(pNode->dac.B_params, 0, AMPLIFIER_SIZE); 699 pNode->dac.u32A_param = RT_BIT(14)|(0x1 << 3)|0x2; /* 441000Hz/16bit/2ch */731 pNode->dac.u32A_param = RT_BIT(14)|(0x1 << 4)|0x2; /* 441000Hz/16bit/2ch */ 700 732 701 733 AMPLIFIER_REGISTER(pNode->dac.B_params, AMPLIFIER_OUT, AMPLIFIER_LEFT, 0) = 0x7F | RT_BIT(7); … … 705 737 pNode->dac.node.au32F00_param[5] = (0x3 << 4) | 0x3; 706 738 pNode->dac.u32F0c_param = 0; 707 pNode->dac.u32F05_param = 0x3 << 4 ; /* PS-Act: D3 -> D0*/739 pNode->dac.u32F05_param = 0x3 << 4 | 0x3; /* PS-Act: D3, Set: D3 */ 708 740 break; 709 741 case 6: … … 718 750 pNode->adc.node.au32F00_param[0xE] = RT_BIT(0); 719 751 pNode->adc.u32F03_param = RT_BIT(0); 720 pNode->adc.u32F05_param = 0x3 << 4 ; /* PS-Act: D3 -> D0*/752 pNode->adc.u32F05_param = 0x3 << 4 | 0x3; /* PS-Act: D3 Set: D3 */ 721 753 pNode->adc.u32F06_param = 0; 722 754 pNode->adc.node.au32F00_param[9] = RT_BIT(20)| (0xd << 16) | RT_BIT(10) | RT_BIT(8) | RT_BIT(6)| RT_BIT(0); … … 724 756 case 8: 725 757 pNode->spdifout.node.name = "SPDIFOut"; 726 pNode->spdifout.u32A_param = ( 0x3<<4) | 0x1;758 pNode->spdifout.u32A_param = (1<<14)|(0x1<<4) | 0x1; 727 759 pNode->spdifout.node.au32F00_param[9] = (4 << 16) | RT_BIT(9)|RT_BIT(4)|0x1; 728 //pNode->spdifout.node.au32F00_param[0xA] = RT_BIT(19)|RT_BIT(18)|RT_BIT(17)|RT_BIT(10)|RT_BIT(9)|RT_BIT(8)|RT_BIT(7)|RT_BIT(6);729 760 pNode->node.au32F00_param[0xa] = RT_BIT(17)|RT_BIT(5); 730 761 pNode->spdifout.node.au32F00_param[0xB] = RT_BIT(2)|RT_BIT(0); 731 762 pNode->spdifout.u32F06_param = 0; 732 763 pNode->spdifout.u32F0d_param = 0; 764 //pNode->spdifout.node.au32F00_param[0xA] = RT_BIT(19)|RT_BIT(18)|RT_BIT(17)|RT_BIT(10)|RT_BIT(9)|RT_BIT(8)|RT_BIT(7)|RT_BIT(6); 733 765 break; 734 766 case 9: 735 767 pNode->node.name = "Reserved_0"; 768 pNode->spdifin.u32A_param = (0x1<<4) | 0x1; 769 pNode->spdifin.node.au32F00_param[9] = (0x1 << 20)|(4 << 16) | RT_BIT(9)|RT_BIT(4)|0x1; 770 pNode->node.au32F00_param[0xa] = RT_BIT(17)|RT_BIT(5); 771 pNode->spdifin.node.au32F00_param[0xB] = RT_BIT(2)|RT_BIT(0); 772 pNode->spdifin.u32F06_param = 0; 773 pNode->spdifin.u32F0d_param = 0; 736 774 break; 737 775 case 0xA: 738 776 pNode->node.name = "PortA"; 739 pNode->node.au32F00_param[0xC] = 0x173 d;777 pNode->node.au32F00_param[0xC] = 0x173f; 740 778 *(uint32_t *)pNode->node.au8F02_param = 0x2; 741 779 pNode->port.u32F07_param = RT_BIT(6); 742 pNode->port.u32F08_param = RT_BIT(7);780 pNode->port.u32F08_param = 0; 743 781 pNode->port.u32F09_param = RT_BIT(31)|RT_BIT(30); /* 39.2 kOm */ 744 782 pNode->port.u32F1c_param = RT_MAKE_U32_FROM_U8(0x20, 0x40, 0x21, 0x02); … … 763 801 pNode->node.name = "PortD"; 764 802 pNode->port.u32F09_param = 0; 803 pNode->node.au32F00_param[0xC] = 0x173f; 765 804 *(uint32_t *)pNode->node.au8F02_param = 0x2; 766 805 port_init: … … 791 830 case 0x10: 792 831 pNode->node.name = "DigOut_0"; 793 pNode->node.au32F00_param[9] = RT_BIT(9)|RT_BIT(8)|RT_BIT(0);832 pNode->node.au32F00_param[9] = (4<<20)|RT_BIT(9)|RT_BIT(8)|RT_BIT(0); 794 833 pNode->node.au32F00_param[0xC] = RT_BIT(4); 795 pNode->node.au32F00_param[0xE] = 0x 3;834 pNode->node.au32F00_param[0xE] = 0x2; 796 835 pNode->digout.u32F01_param = 0; 797 *(uint32_t *)pNode->node.au8F02_param = RT_MAKE_U32_FROM_U8(0x08, 0x17, 0x19, 0); 836 /* STAC9220 spec defines default connection list containing reserved nodes, that confuses some drivers. */ 837 *(uint32_t *)pNode->node.au8F02_param = RT_MAKE_U32_FROM_U8(0x08, 0x17, 0x0, 0); 798 838 pNode->digout.u32F07_param = 0; 799 839 pNode->digout.u32F1c_param = RT_MAKE_U32_FROM_U8(0x30, 0x10, 0x45, 0x01); … … 803 843 pNode->node.au32F00_param[9] = (4 << 20)|(3<<16)|RT_BIT(10)|RT_BIT(9)|RT_BIT(7)|RT_BIT(0); 804 844 pNode->node.au32F00_param[0xC] = /* RT_BIT(16)|*/ RT_BIT(5)|RT_BIT(2); 805 pNode->digin.u32F05_param = 0x3 << 4 ; /* PS-Act: D3 -> D0*/845 pNode->digin.u32F05_param = 0x3 << 4 | 0x3; /* PS-Act: D3 -> D3 */ 806 846 pNode->digin.u32F07_param = 0; 807 847 pNode->digin.u32F08_param = 0; … … 861 901 pNode->node.au32F00_param[0x9] = (0x3 << 20)|RT_BIT(11)|RT_BIT(8)|RT_BIT(1)|RT_BIT(0); 862 902 pNode->node.au32F00_param[0xe] = 0x1; 863 AMPLIFIER_REGISTER(pNode->adcvol.B_params, AMPLIFIER_IN, AMPLIFIER_LEFT, 0) = RT_BIT( 1);864 AMPLIFIER_REGISTER(pNode->adcvol.B_params, AMPLIFIER_IN, AMPLIFIER_RIGHT, 0) = RT_BIT( 1);903 AMPLIFIER_REGISTER(pNode->adcvol.B_params, AMPLIFIER_IN, AMPLIFIER_LEFT, 0) = RT_BIT(7); 904 AMPLIFIER_REGISTER(pNode->adcvol.B_params, AMPLIFIER_IN, AMPLIFIER_RIGHT, 0) = RT_BIT(7); 865 905 pNode->adcvol.u32F0c_param = 0; 866 906 default: -
trunk/src/VBox/Devices/Audio/DevCodec.h
r31156 r31263 94 94 } SPDIFOUTNODE, *PSPDIFOUTNODE; 95 95 96 typedef struct SPDIFINNODE 97 { 98 CODECCOMMONNODE node; 99 uint32_t u32F06_param; 100 uint32_t u32F09_param; 101 uint32_t u32F0d_param; 102 103 uint32_t u32A_param; 104 AMPLIFIER B_params; 105 } SPDIFINNODE, *PSPDIFINNODE; 106 96 107 typedef struct AFGCODECNODE 97 108 { … … 180 191 ADCNODE adc; 181 192 SPDIFOUTNODE spdifout; 193 SPDIFINNODE spdifin; 182 194 PORTNODE port; 183 195 DIGOUTNODE digout; -
trunk/src/VBox/Devices/Audio/DevIchIntelHDA.cpp
r31172 r31263 1280 1280 } 1281 1281 Assert( index != -1 1282 && u32Offset == s_ichIntelHDRegMap[index].offset1283 1282 && cb <= 4); 1284 1283 if (index != -1) 1285 1284 { 1286 1285 uint32_t mask = 0; 1286 uint32_t shift = (u32Offset - s_ichIntelHDRegMap[index].offset) % sizeof(uint32_t) * 8; 1287 1287 uint32_t v = 0; 1288 1288 switch(cb) … … 1293 1293 case 4: mask = 0xffffffff; break; 1294 1294 } 1295 Assert(u32Offset == s_ichIntelHDRegMap[index].offset);1295 mask <<= shift; 1296 1296 rc = s_ichIntelHDRegMap[index].pfnRead(&pThis->hda, u32Offset, index, &v); 1297 *(uint32_t *)pv = v & mask;1297 *(uint32_t *)pv = (v & mask) >> shift; 1298 1298 Log(("hda: read %s[%x/%x]\n", s_ichIntelHDRegMap[index].abbrev, v, *(uint32_t *)pv)); 1299 1299 return rc; … … 1504 1504 PCIDevSetRevisionId (&pThis->dev, 0x01); /* 08 ro - rid. */ 1505 1505 PCIDevSetClassProg (&pThis->dev, 0x00); /* 09 ro - pi. */ 1506 PCIDevSetClassSub (&pThis->dev, 0x0 2); /* 0a ro - scc; 02== HDA. */1506 PCIDevSetClassSub (&pThis->dev, 0x03); /* 0a ro - scc; 03 == HDA. */ 1507 1507 PCIDevSetClassBase (&pThis->dev, 0x04); /* 0b ro - bcc; 04 == multimedia. */ 1508 1508 PCIDevSetHeaderType (&pThis->dev, 0x00); /* 0e ro - headtyp. */
Note:
See TracChangeset
for help on using the changeset viewer.