Changeset 11252 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Aug 8, 2008 2:09:19 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/PC/DevPit-i8254.cpp
r11251 r11252 446 446 } 447 447 448 PITState *pit = PDMINS 2DATA(pDevIns, PITState *);448 PITState *pit = PDMINS_2_DATA(pDevIns, PITState *); 449 449 int ret; 450 450 PITChannelState *s = &pit->channels[Port]; … … 524 524 return VINF_SUCCESS; 525 525 526 PITState *pit = PDMINS 2DATA(pDevIns, PITState *);526 PITState *pit = PDMINS_2_DATA(pDevIns, PITState *); 527 527 Port &= 3; 528 528 if (Port == 3) … … 551 551 { 552 552 /* read-back command */ 553 for (channel = 0; channel < ELEMENTS(pit->channels); channel++)553 for (channel = 0; channel < RT_ELEMENTS(pit->channels); channel++) 554 554 { 555 555 PITChannelState *s = &pit->channels[channel]; … … 638 638 if (cb == 1) 639 639 { 640 PITState *pData = PDMINS 2DATA(pDevIns, PITState *);640 PITState *pData = PDMINS_2_DATA(pDevIns, PITState *); 641 641 const uint64_t u64Now = TMTimerGet(pData->channels[0].CTX_SUFF(pTimer)); 642 642 Assert(TMTimerGetFreq(pData->channels[0].CTX_SUFF(pTimer)) == 1000000000); /* lazy bird. */ … … 687 687 if (cb == 1) 688 688 { 689 PITState *pData = PDMINS 2DATA(pDevIns, PITState *);689 PITState *pData = PDMINS_2_DATA(pDevIns, PITState *); 690 690 pData->speaker_data_on = (u32 >> 1) & 1; 691 691 pit_set_gate(pData, 2, u32 & 1); … … 705 705 static DECLCALLBACK(int) pitSaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle) 706 706 { 707 PITState *pData = PDMINS 2DATA(pDevIns, PITState *);707 PITState *pData = PDMINS_2_DATA(pDevIns, PITState *); 708 708 unsigned i; 709 709 710 for (i = 0; i < ELEMENTS(pData->channels); i++)710 for (i = 0; i < RT_ELEMENTS(pData->channels); i++) 711 711 { 712 712 PITChannelState *s = &pData->channels[i]; … … 750 750 static DECLCALLBACK(int) pitLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle, uint32_t u32Version) 751 751 { 752 PITState *pData = PDMINS 2DATA(pDevIns, PITState *);752 PITState *pData = PDMINS_2_DATA(pDevIns, PITState *); 753 753 unsigned i; 754 754 … … 756 756 return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION; 757 757 758 for (i = 0; i < ELEMENTS(pData->channels); i++)758 for (i = 0; i < RT_ELEMENTS(pData->channels); i++) 759 759 { 760 760 PITChannelState *s = &pData->channels[i]; … … 802 802 static DECLCALLBACK(void) pitTimer(PPDMDEVINS pDevIns, PTMTIMER pTimer) 803 803 { 804 PITState *pData = PDMINS 2DATA(pDevIns, PITState *);804 PITState *pData = PDMINS_2_DATA(pDevIns, PITState *); 805 805 PITChannelState *s = &pData->channels[0]; 806 806 STAM_PROFILE_ADV_START(&s->CTX_SUFF(pPit)->StatPITHandler, a); … … 819 819 static DECLCALLBACK(void) pitRelocate(PPDMDEVINS pDevIns, RTGCINTPTR offDelta) 820 820 { 821 PITState *pData = PDMINS 2DATA(pDevIns, PITState *);821 PITState *pData = PDMINS_2_DATA(pDevIns, PITState *); 822 822 unsigned i; 823 823 LogFlow(("pitRelocate: \n")); … … 843 843 static DECLCALLBACK(void) pitReset(PPDMDEVINS pDevIns) 844 844 { 845 PITState *pData = PDMINS 2DATA(pDevIns, PITState *);845 PITState *pData = PDMINS_2_DATA(pDevIns, PITState *); 846 846 unsigned i; 847 847 LogFlow(("pitReset: \n")); 848 848 849 for (i = 0; i < ELEMENTS(pData->channels); i++)849 for (i = 0; i < RT_ELEMENTS(pData->channels); i++) 850 850 { 851 851 PITChannelState *s = &pData->channels[i]; … … 879 879 static DECLCALLBACK(void) pitInfo(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs) 880 880 { 881 PITState *pData = PDMINS 2DATA(pDevIns, PITState *);881 PITState *pData = PDMINS_2_DATA(pDevIns, PITState *); 882 882 unsigned i; 883 for (i = 0; i < ELEMENTS(pData->channels); i++)883 for (i = 0; i < RT_ELEMENTS(pData->channels); i++) 884 884 { 885 885 const PITChannelState *pCh = &pData->channels[i]; … … 926 926 static DECLCALLBACK(int) pitConstruct(PPDMDEVINS pDevIns, int iInstance, PCFGMNODE pCfgHandle) 927 927 { 928 PITState *pData = PDMINS 2DATA(pDevIns, PITState *);928 PITState *pData = PDMINS_2_DATA(pDevIns, PITState *); 929 929 int rc; 930 930 uint8_t u8Irq; … … 946 946 */ 947 947 rc = CFGMR3QueryU8Def(pCfgHandle, "Irq", &u8Irq, 0); 948 if ( VBOX_FAILURE(rc))948 if (RT_FAILURE(rc)) 949 949 return PDMDEV_SET_ERROR(pDevIns, rc, 950 950 N_("Configuration error: Querying \"Irq\" as a uint8_t failed")); 951 951 952 952 rc = CFGMR3QueryU16Def(pCfgHandle, "Base", &u16Base, 0x40); 953 if ( VBOX_FAILURE(rc))953 if (RT_FAILURE(rc)) 954 954 return PDMDEV_SET_ERROR(pDevIns, rc, 955 955 N_("Configuration error: Querying \"Base\" as a uint16_t failed")); 956 956 957 957 rc = CFGMR3QueryBoolDef(pCfgHandle, "SpeakerEnabled", &fSpeaker, true); 958 if ( VBOX_FAILURE(rc))958 if (RT_FAILURE(rc)) 959 959 return PDMDEV_SET_ERROR(pDevIns, rc, 960 960 N_("Configuration error: Querying \"SpeakerEnabled\" as a bool failed")); 961 961 962 962 rc = CFGMR3QueryBoolDef(pCfgHandle, "GCEnabled", &fGCEnabled, true); 963 if ( VBOX_FAILURE(rc))963 if (RT_FAILURE(rc)) 964 964 return PDMDEV_SET_ERROR(pDevIns, rc, 965 965 N_("Configuration error: Querying \"GCEnabled\" as a bool failed")); 966 966 967 967 rc = CFGMR3QueryBoolDef(pCfgHandle, "R0Enabled", &fR0Enabled, true); 968 if ( VBOX_FAILURE(rc))968 if (RT_FAILURE(rc)) 969 969 return PDMDEV_SET_ERROR(pDevIns, rc, 970 970 N_("Configuration error: failed to read R0Enabled as boolean")); … … 984 984 rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL_SYNC, pitTimer, "i8254 Programmable Interval Timer", 985 985 &pData->channels[0].pTimerR3); 986 if (VBOX_FAILURE(rc)) 987 { 988 AssertMsgFailed(("pfnTMTimerCreate -> %Vrc\n", rc)); 986 if (RT_FAILURE(rc)) 989 987 return rc; 990 }991 988 pData->channels[0].pTimerRC = TMTimerRCPtr(pData->channels[0].pTimerR3); 992 989 pData->channels[0].pTimerR0 = TMTimerR0Ptr(pData->channels[0].pTimerR3); 993 990 994 991 rc = PDMDevHlpIOPortRegister(pDevIns, u16Base, 4, NULL, pitIOPortWrite, pitIOPortRead, NULL, NULL, "i8254 Programmable Interval Timer"); 995 if ( VBOX_FAILURE(rc))992 if (RT_FAILURE(rc)) 996 993 return rc; 997 994 if (fGCEnabled) 998 995 { 999 996 rc = PDMDevHlpIOPortRegisterGC(pDevIns, u16Base, 4, 0, "pitIOPortWrite", "pitIOPortRead", NULL, NULL, "i8254 Programmable Interval Timer"); 1000 if ( VBOX_FAILURE(rc))997 if (RT_FAILURE(rc)) 1001 998 return rc; 1002 999 } … … 1004 1001 { 1005 1002 rc = PDMDevHlpIOPortRegisterR0(pDevIns, u16Base, 4, 0, "pitIOPortWrite", "pitIOPortRead", NULL, NULL, "i8254 Programmable Interval Timer"); 1006 if ( VBOX_FAILURE(rc))1003 if (RT_FAILURE(rc)) 1007 1004 return rc; 1008 1005 } … … 1011 1008 { 1012 1009 rc = PDMDevHlpIOPortRegister(pDevIns, 0x61, 1, NULL, pitIOPortSpeakerWrite, pitIOPortSpeakerRead, NULL, NULL, "PC Speaker"); 1013 if ( VBOX_FAILURE(rc))1010 if (RT_FAILURE(rc)) 1014 1011 return rc; 1015 1012 if (fGCEnabled) 1016 1013 { 1017 1014 rc = PDMDevHlpIOPortRegisterGC(pDevIns, 0x61, 1, 0, NULL, "pitIOPortSpeakerRead", NULL, NULL, "PC Speaker"); 1018 if ( VBOX_FAILURE(rc))1015 if (RT_FAILURE(rc)) 1019 1016 return rc; 1020 1017 } … … 1024 1021 NULL, pitSaveExec, NULL, 1025 1022 NULL, pitLoadExec, NULL); 1026 if ( VBOX_FAILURE(rc))1023 if (RT_FAILURE(rc)) 1027 1024 return rc; 1028 1025
Note:
See TracChangeset
for help on using the changeset viewer.