Changeset 31188 in vbox for trunk/src/VBox/Devices/Audio
- Timestamp:
- Jul 29, 2010 5:36:47 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DevCodec.cpp
r31172 r31188 489 489 return VINF_SUCCESS; 490 490 } 491 492 static int codecGetEAPD_BTLEnabled(struct CODECState *pState, uint32_t cmd, uint64_t *pResp) 493 { 494 Assert((CODEC_CAD(cmd) == pState->id)); 495 if (STAC9220_IS_ADCVOL_CMD(cmd)) 496 *pResp = pState->pNodes[CODEC_NID(cmd)].adcvol.u32F0c_param; 497 else if (STAC9220_IS_DAC_CMD(cmd)) 498 *pResp = pState->pNodes[CODEC_NID(cmd)].dac.u32F0c_param; 499 else if (STAC9220_IS_DIGPIN_CMD(cmd)) 500 *pResp = pState->pNodes[CODEC_NID(cmd)].digin.u32F0c_param; 501 *pResp = 0; 502 return VINF_SUCCESS; 503 } 504 505 static int codecSetEAPD_BTLEnabled(struct CODECState *pState, uint32_t cmd, uint64_t *pResp) 506 { 507 Assert((CODEC_CAD(cmd) == pState->id)); 508 uint32_t *pu32Reg = NULL; 509 *pResp = 0; 510 if (STAC9220_IS_ADCVOL_CMD(cmd)) 511 pu32Reg = &pState->pNodes[CODEC_NID(cmd)].adcvol.u32F0c_param; 512 else if (STAC9220_IS_DAC_CMD(cmd)) 513 pu32Reg = &pState->pNodes[CODEC_NID(cmd)].dac.u32F0c_param; 514 else if (STAC9220_IS_DIGPIN_CMD(cmd)) 515 pu32Reg = &pState->pNodes[CODEC_NID(cmd)].digin.u32F0c_param; 516 *pResp = 0; 517 Assert((pu32Reg)); 518 if (pu32Reg) 519 { 520 *pu32Reg &= ~CODEC_VERB_8BIT_DATA; 521 *pu32Reg |= cmd & CODEC_VERB_8BIT_DATA; 522 } 523 return VINF_SUCCESS; 524 } 525 526 /* F0F */ 527 static int codecGetVolumeKnobCtrl(struct CODECState *pState, uint32_t cmd, uint64_t *pResp) 528 { 529 Assert((CODEC_CAD(cmd) == pState->id)); 530 *pResp = 0; 531 if (STAC9220_IS_VOLKNOB_CMD(cmd)) 532 *pResp = pState->pNodes[CODEC_NID(cmd)].volumeKnob.u32F0f_param; 533 return VINF_SUCCESS; 534 } 535 536 /* 70F */ 537 static int codecSetVolumeKnobCtrl(struct CODECState *pState, uint32_t cmd, uint64_t *pResp) 538 { 539 Assert((CODEC_CAD(cmd) == pState->id)); 540 uint32_t *pu32Reg = NULL; 541 *pResp = 0; 542 if (STAC9220_IS_VOLKNOB_CMD(cmd)) 543 pu32Reg = &pState->pNodes[CODEC_NID(cmd)].volumeKnob.u32F0f_param; 544 *pResp = 0; 545 Assert((pu32Reg)); 546 if (pu32Reg) 547 { 548 *pu32Reg &= ~CODEC_VERB_8BIT_DATA; 549 *pu32Reg |= cmd & CODEC_VERB_8BIT_DATA; 550 } 551 return VINF_SUCCESS; 552 } 553 554 /* F1C */ 555 static int codecGetConfig (struct CODECState *pState, uint32_t cmd, uint64_t *pResp) 556 { 557 Assert((CODEC_CAD(cmd) == pState->id)); 558 *pResp = 0; 559 if (STAC9220_IS_PORT_CMD(cmd)) 560 *pResp = pState->pNodes[CODEC_NID(cmd)].port.u32F1c_param; 561 else if (STAC9220_IS_DIGPIN_CMD(cmd)) 562 *pResp = pState->pNodes[CODEC_NID(cmd)].digin.u32F1c_param; 563 else if (STAC9220_IS_CD_CMD(cmd)) 564 *pResp = pState->pNodes[CODEC_NID(cmd)].digin.u32F1c_param; 565 return VINF_SUCCESS; 566 } 567 static int codecSetConfigX(struct CODECState *pState, uint32_t cmd, uint32_t mask) 568 { 569 Assert((CODEC_CAD(cmd) == pState->id)); 570 uint32_t *pu32Reg = NULL; 571 if (STAC9220_IS_PORT_CMD(cmd)) 572 pu32Reg = &pState->pNodes[CODEC_NID(cmd)].port.u32F1c_param; 573 else if (STAC9220_IS_DIGPIN_CMD(cmd)) 574 pu32Reg = &pState->pNodes[CODEC_NID(cmd)].port.u32F1c_param; 575 else if (STAC9220_IS_CD_CMD(cmd)) 576 pu32Reg = &pState->pNodes[CODEC_NID(cmd)].cdnode.u32F1c_param; 577 Assert((pu32Reg)); 578 if (pu32Reg) 579 { 580 *pu32Reg &= ~mask; 581 *pu32Reg |= cmd & mask; 582 } 583 return VINF_SUCCESS; 584 } 585 /* 71C */ 586 static int codecSetConfig0 (struct CODECState *pState, uint32_t cmd, uint64_t *pResp) 587 { 588 uint32_t mask = CODEC_VERB_8BIT_DATA; 589 *pResp = 0; 590 return codecSetConfigX(pState, cmd, mask); 591 } 592 /* 71D */ 593 static int codecSetConfig1 (struct CODECState *pState, uint32_t cmd, uint64_t *pResp) 594 { 595 uint32_t mask = CODEC_VERB_8BIT_DATA << 8; 596 *pResp = 0; 597 return codecSetConfigX(pState, cmd, mask); 598 } 599 /* 71E */ 600 static int codecSetConfig2 (struct CODECState *pState, uint32_t cmd, uint64_t *pResp) 601 { 602 uint32_t mask = CODEC_VERB_8BIT_DATA << 16; 603 *pResp = 0; 604 return codecSetConfigX(pState, cmd, mask); 605 } 606 /* 71E */ 607 static int codecSetConfig3 (struct CODECState *pState, uint32_t cmd, uint64_t *pResp) 608 { 609 uint32_t mask = CODEC_VERB_8BIT_DATA << 24; 610 *pResp = 0; 611 return codecSetConfigX(pState, cmd, mask); 612 } 613 491 614 static int stac9220ResetNode(struct CODECState *pState, uint8_t nodenum, PCODECNODE pNode) 492 615 { … … 733 856 {0x000F0500, CODEC_VERB_8BIT_CMD , codecGetPowerState }, 734 857 {0x00070500, CODEC_VERB_8BIT_CMD , codecSetPowerState }, 858 {0x000F0C00, CODEC_VERB_8BIT_CMD , codecGetEAPD_BTLEnabled }, 859 {0x00070C00, CODEC_VERB_8BIT_CMD , codecSetEAPD_BTLEnabled }, 860 {0x000F0F00, CODEC_VERB_8BIT_CMD , codecGetVolumeKnobCtrl }, 861 {0x00070F00, CODEC_VERB_8BIT_CMD , codecSetVolumeKnobCtrl }, 862 {0x000F1C00, CODEC_VERB_8BIT_CMD , codecGetConfig }, 863 {0x00071C00, CODEC_VERB_8BIT_CMD , codecSetConfig0 }, 864 {0x00071D00, CODEC_VERB_8BIT_CMD , codecSetConfig1 }, 865 {0x00071E00, CODEC_VERB_8BIT_CMD , codecSetConfig2 }, 866 {0x00071F00, CODEC_VERB_8BIT_CMD , codecSetConfig3 }, 735 867 }; 736 868
Note:
See TracChangeset
for help on using the changeset viewer.