Changeset 4429 in vbox for trunk/src/VBox/Devices/PC
- Timestamp:
- Aug 30, 2007 3:41:19 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/PC/DevPit-i8254.cpp
r4071 r4429 68 68 #define PIT_SAVED_STATE_VERSION 2 69 69 70 /** @def FAKE_REFRESH_CLOCK 71 * Define this to flip the 15usec refresh bit on every read. 72 * If not defined, it will be flipped correctly. */ 73 //#define FAKE_REFRESH_CLOCK 70 74 71 75 /******************************************************************************* … … 118 122 /** Speaker data. */ 119 123 int32_t speaker_data_on; 124 #ifdef FAKE_REFRESH_CLOCK 120 125 /** Speaker dummy. */ 121 126 int32_t dummy_refresh_clock; 127 #endif 122 128 /** Pointer to the device instance. */ 123 129 HCPTRTYPE(PPDMDEVINS) pDevIns; … … 298 304 if ( s->pTimerHC /* ch 0 */ 299 305 && s->cRelLogEntries++ < 32) 300 LogRel(("PIT: mode=%d count=%#x (%u) - %d.%02d Hz (ch=0)\n", 306 LogRel(("PIT: mode=%d count=%#x (%u) - %d.%02d Hz (ch=0)\n", 301 307 s->mode, s->count, s->count, PIT_FREQ / s->count, (PIT_FREQ * 100 / s->count) % 100)); 302 308 } … … 627 633 { 628 634 PITState *pData = PDMINS2DATA(pDevIns, PITState *); 629 int out = pit_get_out(pData, 2, TMTimerGet(pData->channels[0].CTXSUFF(pTimer))); 635 const uint64_t u64Now = TMTimerGet(pData->channels[0].CTXSUFF(pTimer)); 636 Assert(TMTimerGetFreq(pData->channels[0].CTXSUFF(pTimer)) == 1000000000); /* lazy bird. */ 637 638 /* bit 6,7 Parity error stuff. */ 639 /* bit 5 - mirrors timer 2 output condition. */ 640 const int fOut = pit_get_out(pData, 2, u64Now); 641 /* bit 4 - toggled every with each (DRAM?) refresh request, every 15.085 µs. */ 642 #ifdef FAKE_REFRESH_CLOCK 630 643 pData->dummy_refresh_clock ^= 1; 631 *pu32 = (pData->speaker_data_on << 1) | pit_get_gate(pData, 2) | (out << 5) | (pData->dummy_refresh_clock << 4); 644 const int fRefresh = pData->dummy_refresh_clock; 645 #else 646 const int fRefresh = (u64Now / 15085) & 1; 647 #endif 648 /* bit 2,3 NMI / parity status stuff. */ 649 /* bit 1 - speaker data status */ 650 const int fSpeakerStatus = pData->speaker_data_on; 651 /* bit 0 - timer 2 clock gate to speaker status. */ 652 const int fTimer2GateStatus = pit_get_gate(pData, 2); 653 654 *pu32 = fTimer2GateStatus 655 | (fSpeakerStatus << 1) 656 | (fRefresh << 4) 657 | (fOut << 5); 632 658 Log(("pitIOPortSpeakerRead: Port=%#x cb=%x *pu32=%#x\n", Port, cb, *pu32)); 633 659 return VINF_SUCCESS; … … 700 726 701 727 SSMR3PutS32(pSSMHandle, pData->speaker_data_on); 728 #ifdef FAKE_REFRESH_CLOCK 702 729 return SSMR3PutS32(pSSMHandle, pData->dummy_refresh_clock); 730 #else 731 return SSMR3PutS32(pSSMHandle, 0); 732 #endif 703 733 } 704 734 … … 742 772 { 743 773 TMR3TimerLoad(s->CTXSUFF(pTimer), pSSMHandle); 744 LogRel(("PIT: mode=%d count=%#x (%u) - %d.%02d Hz (ch=%d) (restore)\n", 774 LogRel(("PIT: mode=%d count=%#x (%u) - %d.%02d Hz (ch=%d) (restore)\n", 745 775 s->mode, s->count, s->count, PIT_FREQ / s->count, (PIT_FREQ * 100 / s->count) % 100, i)); 746 776 } … … 749 779 750 780 SSMR3GetS32(pSSMHandle, &pData->speaker_data_on); 781 #ifdef FAKE_REFRESH_CLOCK 751 782 return SSMR3GetS32(pSSMHandle, &pData->dummy_refresh_clock); 783 #else 784 int32_t u32Dummy; 785 return SSMR3GetS32(pSSMHandle, &u32Dummy); 786 #endif 752 787 } 753 788 … … 861 896 pCh->u64ReloadTS, pCh->u64NextTS); 862 897 } 898 #ifdef FAKE_REFRESH_CLOCK 863 899 pHlp->pfnPrintf(pHlp, "speaker_data_on=%#x dummy_refresh_clock=%#x\n", 864 900 pData->speaker_data_on, pData->dummy_refresh_clock); 901 #else 902 pHlp->pfnPrintf(pHlp, "speaker_data_on=%#x\n", pData->speaker_data_on); 903 #endif 865 904 } 866 905
Note:
See TracChangeset
for help on using the changeset viewer.