VirtualBox

Changeset 11252 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Aug 8, 2008 2:09:19 PM (16 years ago)
Author:
vboxsync
Message:

DevPit-i8254: Cosmetics.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/PC/DevPit-i8254.cpp

    r11251 r11252  
    446446    }
    447447
    448     PITState *pit = PDMINS2DATA(pDevIns, PITState *);
     448    PITState *pit = PDMINS_2_DATA(pDevIns, PITState *);
    449449    int ret;
    450450    PITChannelState *s = &pit->channels[Port];
     
    524524        return VINF_SUCCESS;
    525525
    526     PITState *pit = PDMINS2DATA(pDevIns, PITState *);
     526    PITState *pit = PDMINS_2_DATA(pDevIns, PITState *);
    527527    Port &= 3;
    528528    if (Port == 3)
     
    551551        {
    552552            /* read-back command */
    553             for (channel = 0; channel < ELEMENTS(pit->channels); channel++)
     553            for (channel = 0; channel < RT_ELEMENTS(pit->channels); channel++)
    554554            {
    555555                PITChannelState *s = &pit->channels[channel];
     
    638638    if (cb == 1)
    639639    {
    640         PITState *pData = PDMINS2DATA(pDevIns, PITState *);
     640        PITState *pData = PDMINS_2_DATA(pDevIns, PITState *);
    641641        const uint64_t u64Now = TMTimerGet(pData->channels[0].CTX_SUFF(pTimer));
    642642        Assert(TMTimerGetFreq(pData->channels[0].CTX_SUFF(pTimer)) == 1000000000); /* lazy bird. */
     
    687687    if (cb == 1)
    688688    {
    689         PITState *pData = PDMINS2DATA(pDevIns, PITState *);
     689        PITState *pData = PDMINS_2_DATA(pDevIns, PITState *);
    690690        pData->speaker_data_on = (u32 >> 1) & 1;
    691691        pit_set_gate(pData, 2, u32 & 1);
     
    705705static DECLCALLBACK(int) pitSaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle)
    706706{
    707     PITState *pData = PDMINS2DATA(pDevIns, PITState *);
     707    PITState *pData = PDMINS_2_DATA(pDevIns, PITState *);
    708708    unsigned i;
    709709
    710     for (i = 0; i < ELEMENTS(pData->channels); i++)
     710    for (i = 0; i < RT_ELEMENTS(pData->channels); i++)
    711711    {
    712712        PITChannelState *s = &pData->channels[i];
     
    750750static DECLCALLBACK(int) pitLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle, uint32_t u32Version)
    751751{
    752     PITState *pData = PDMINS2DATA(pDevIns, PITState *);
     752    PITState *pData = PDMINS_2_DATA(pDevIns, PITState *);
    753753    unsigned i;
    754754
     
    756756        return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
    757757
    758     for (i = 0; i < ELEMENTS(pData->channels); i++)
     758    for (i = 0; i < RT_ELEMENTS(pData->channels); i++)
    759759    {
    760760        PITChannelState *s = &pData->channels[i];
     
    802802static DECLCALLBACK(void) pitTimer(PPDMDEVINS pDevIns, PTMTIMER pTimer)
    803803{
    804     PITState *pData = PDMINS2DATA(pDevIns, PITState *);
     804    PITState *pData = PDMINS_2_DATA(pDevIns, PITState *);
    805805    PITChannelState *s = &pData->channels[0];
    806806    STAM_PROFILE_ADV_START(&s->CTX_SUFF(pPit)->StatPITHandler, a);
     
    819819static DECLCALLBACK(void) pitRelocate(PPDMDEVINS pDevIns, RTGCINTPTR offDelta)
    820820{
    821     PITState *pData = PDMINS2DATA(pDevIns, PITState *);
     821    PITState *pData = PDMINS_2_DATA(pDevIns, PITState *);
    822822    unsigned i;
    823823    LogFlow(("pitRelocate: \n"));
     
    843843static DECLCALLBACK(void) pitReset(PPDMDEVINS pDevIns)
    844844{
    845     PITState *pData = PDMINS2DATA(pDevIns, PITState *);
     845    PITState *pData = PDMINS_2_DATA(pDevIns, PITState *);
    846846    unsigned i;
    847847    LogFlow(("pitReset: \n"));
    848848
    849     for (i = 0; i < ELEMENTS(pData->channels); i++)
     849    for (i = 0; i < RT_ELEMENTS(pData->channels); i++)
    850850    {
    851851        PITChannelState *s = &pData->channels[i];
     
    879879static DECLCALLBACK(void) pitInfo(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
    880880{
    881     PITState   *pData = PDMINS2DATA(pDevIns, PITState *);
     881    PITState   *pData = PDMINS_2_DATA(pDevIns, PITState *);
    882882    unsigned    i;
    883     for (i = 0; i < ELEMENTS(pData->channels); i++)
     883    for (i = 0; i < RT_ELEMENTS(pData->channels); i++)
    884884    {
    885885        const PITChannelState *pCh = &pData->channels[i];
     
    926926static DECLCALLBACK(int)  pitConstruct(PPDMDEVINS pDevIns, int iInstance, PCFGMNODE pCfgHandle)
    927927{
    928     PITState   *pData = PDMINS2DATA(pDevIns, PITState *);
     928    PITState   *pData = PDMINS_2_DATA(pDevIns, PITState *);
    929929    int         rc;
    930930    uint8_t     u8Irq;
     
    946946     */
    947947    rc = CFGMR3QueryU8Def(pCfgHandle, "Irq", &u8Irq, 0);
    948     if (VBOX_FAILURE(rc))
     948    if (RT_FAILURE(rc))
    949949        return PDMDEV_SET_ERROR(pDevIns, rc,
    950950                                N_("Configuration error: Querying \"Irq\" as a uint8_t failed"));
    951951
    952952    rc = CFGMR3QueryU16Def(pCfgHandle, "Base", &u16Base, 0x40);
    953     if (VBOX_FAILURE(rc))
     953    if (RT_FAILURE(rc))
    954954        return PDMDEV_SET_ERROR(pDevIns, rc,
    955955                                N_("Configuration error: Querying \"Base\" as a uint16_t failed"));
    956956
    957957    rc = CFGMR3QueryBoolDef(pCfgHandle, "SpeakerEnabled", &fSpeaker, true);
    958     if (VBOX_FAILURE(rc))
     958    if (RT_FAILURE(rc))
    959959        return PDMDEV_SET_ERROR(pDevIns, rc,
    960960                                N_("Configuration error: Querying \"SpeakerEnabled\" as a bool failed"));
    961961
    962962    rc = CFGMR3QueryBoolDef(pCfgHandle, "GCEnabled", &fGCEnabled, true);
    963     if (VBOX_FAILURE(rc))
     963    if (RT_FAILURE(rc))
    964964        return PDMDEV_SET_ERROR(pDevIns, rc,
    965965                                N_("Configuration error: Querying \"GCEnabled\" as a bool failed"));
    966966
    967967    rc = CFGMR3QueryBoolDef(pCfgHandle, "R0Enabled", &fR0Enabled, true);
    968     if (VBOX_FAILURE(rc))
     968    if (RT_FAILURE(rc))
    969969        return PDMDEV_SET_ERROR(pDevIns, rc,
    970970                                N_("Configuration error: failed to read R0Enabled as boolean"));
     
    984984    rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL_SYNC, pitTimer, "i8254 Programmable Interval Timer",
    985985                                &pData->channels[0].pTimerR3);
    986     if (VBOX_FAILURE(rc))
    987     {
    988         AssertMsgFailed(("pfnTMTimerCreate -> %Vrc\n", rc));
     986    if (RT_FAILURE(rc))
    989987        return rc;
    990     }
    991988    pData->channels[0].pTimerRC = TMTimerRCPtr(pData->channels[0].pTimerR3);
    992989    pData->channels[0].pTimerR0 = TMTimerR0Ptr(pData->channels[0].pTimerR3);
    993990
    994991    rc = PDMDevHlpIOPortRegister(pDevIns, u16Base, 4, NULL, pitIOPortWrite, pitIOPortRead, NULL, NULL, "i8254 Programmable Interval Timer");
    995     if (VBOX_FAILURE(rc))
     992    if (RT_FAILURE(rc))
    996993        return rc;
    997994    if (fGCEnabled)
    998995    {
    999996        rc = PDMDevHlpIOPortRegisterGC(pDevIns, u16Base, 4, 0, "pitIOPortWrite", "pitIOPortRead", NULL, NULL, "i8254 Programmable Interval Timer");
    1000         if (VBOX_FAILURE(rc))
     997        if (RT_FAILURE(rc))
    1001998            return rc;
    1002999    }
     
    10041001    {
    10051002        rc = PDMDevHlpIOPortRegisterR0(pDevIns, u16Base, 4, 0, "pitIOPortWrite", "pitIOPortRead", NULL, NULL, "i8254 Programmable Interval Timer");
    1006         if (VBOX_FAILURE(rc))
     1003        if (RT_FAILURE(rc))
    10071004            return rc;
    10081005    }
     
    10111008    {
    10121009        rc = PDMDevHlpIOPortRegister(pDevIns, 0x61, 1, NULL, pitIOPortSpeakerWrite, pitIOPortSpeakerRead, NULL, NULL, "PC Speaker");
    1013         if (VBOX_FAILURE(rc))
     1010        if (RT_FAILURE(rc))
    10141011            return rc;
    10151012        if (fGCEnabled)
    10161013        {
    10171014            rc = PDMDevHlpIOPortRegisterGC(pDevIns, 0x61, 1, 0, NULL, "pitIOPortSpeakerRead", NULL, NULL, "PC Speaker");
    1018             if (VBOX_FAILURE(rc))
     1015            if (RT_FAILURE(rc))
    10191016                return rc;
    10201017        }
     
    10241021                                          NULL, pitSaveExec, NULL,
    10251022                                          NULL, pitLoadExec, NULL);
    1026     if (VBOX_FAILURE(rc))
     1023    if (RT_FAILURE(rc))
    10271024        return rc;
    10281025
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