VirtualBox

Changeset 82222 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Nov 26, 2019 2:13:27 PM (5 years ago)
Author:
vboxsync
Message:

DevSB16: CFGM -> devhlp. bugref:9218

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Audio/DevSB16.cpp

    r81765 r82222  
    22862286    }
    22872287
    2288     PVM pVM = PDMDevHlpGetVM(pThis->pDevInsR3);
    2289     PCFGMNODE pRoot = CFGMR3GetRoot(pVM);
    2290     PCFGMNODE pDev0 = CFGMR3GetChild(pRoot, "Devices/sb16/0/");
     2288    PCPDMDEVHLPR3 pHlp  = pThis->pDevInsR3->pHlpR3;
     2289    PVM           pVM   = PDMDevHlpGetVM(pThis->pDevInsR3);
     2290    PCFGMNODE     pRoot = CFGMR3GetRoot(pVM);
     2291    PCFGMNODE     pDev0 = pHlp->pfnCFGMGetChild(pRoot, "Devices/sb16/0/");
    22912292
    22922293    /* Remove LUN branch. */
    2293     CFGMR3RemoveNode(CFGMR3GetChildF(pDev0, "LUN#%u/", uLUN));
     2294    CFGMR3RemoveNode(pHlp->pfnCFGMGetChildF(pDev0, "LUN#%u/", uLUN));
    22942295
    22952296    if (pDrv)
     
    24022403static DECLCALLBACK(int) sb16Construct(PPDMDEVINS pDevIns, int iInstance, PCFGMNODE pCfg)
    24032404{
     2405    PDMDEV_CHECK_VERSIONS_RETURN(pDevIns); /* this shall come first */
     2406    PSB16STATE      pThis = PDMDEVINS_2_DATA(pDevIns, PSB16STATE);
     2407    PCPDMDEVHLPR3   pHlp  = pDevIns->pHlpR3;
    24042408    RT_NOREF(iInstance);
    2405     PDMDEV_CHECK_VERSIONS_RETURN(pDevIns); /* this shall come first */
    2406     PSB16STATE pThis = PDMDEVINS_2_DATA(pDevIns, PSB16STATE);
     2409
     2410    Assert(iInstance == 0);
    24072411
    24082412    /*
     
    24192423
    24202424    /*
    2421      * Validations.
     2425     * Validate and read config data.
    24222426     */
    2423     Assert(iInstance == 0);
    2424     if (!CFGMR3AreValuesValid(pCfg,
    2425                               "IRQ\0"
    2426                               "DMA\0"
    2427                               "DMA16\0"
    2428                               "Port\0"
    2429                               "Version\0"
    2430                               "TimerHz\0"))
    2431         return PDMDEV_SET_ERROR(pDevIns, VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES,
    2432                                 N_("Invalid configuration for SB16 device"));
    2433 
    2434     /*
    2435      * Read config data.
    2436      */
    2437     int rc = CFGMR3QuerySIntDef(pCfg, "IRQ", &pThis->irq, 5);
     2427    PDMDEV_VALIDATE_CONFIG_RETURN(pDevIns, "IRQ|DMA|DMA16|Port|Version|TimerHz", "");
     2428    int rc = pHlp->pfnCFGMQuerySIntDef(pCfg, "IRQ", &pThis->irq, 5);
    24382429    if (RT_FAILURE(rc))
    2439         return PDMDEV_SET_ERROR(pDevIns, rc,
    2440                                 N_("SB16 configuration error: Failed to get the \"IRQ\" value"));
     2430        return PDMDEV_SET_ERROR(pDevIns, rc, N_("SB16 configuration error: Failed to get the \"IRQ\" value"));
    24412431    pThis->irqCfg  = pThis->irq;
    24422432
    2443     rc = CFGMR3QuerySIntDef(pCfg, "DMA", &pThis->dma, 1);
     2433    rc = pHlp->pfnCFGMQuerySIntDef(pCfg, "DMA", &pThis->dma, 1);
    24442434    if (RT_FAILURE(rc))
    2445         return PDMDEV_SET_ERROR(pDevIns, rc,
    2446                                 N_("SB16 configuration error: Failed to get the \"DMA\" value"));
     2435        return PDMDEV_SET_ERROR(pDevIns, rc, N_("SB16 configuration error: Failed to get the \"DMA\" value"));
    24472436    pThis->dmaCfg  = pThis->dma;
    24482437
    2449     rc = CFGMR3QuerySIntDef(pCfg, "DMA16", &pThis->hdma, 5);
     2438    rc = pHlp->pfnCFGMQuerySIntDef(pCfg, "DMA16", &pThis->hdma, 5);
    24502439    if (RT_FAILURE(rc))
    2451         return PDMDEV_SET_ERROR(pDevIns, rc,
    2452                                 N_("SB16 configuration error: Failed to get the \"DMA16\" value"));
     2440        return PDMDEV_SET_ERROR(pDevIns, rc, N_("SB16 configuration error: Failed to get the \"DMA16\" value"));
    24532441    pThis->hdmaCfg = pThis->hdma;
    24542442
    24552443    RTIOPORT Port;
    2456     rc = CFGMR3QueryPortDef(pCfg, "Port", &Port, 0x220);
     2444    rc = pHlp->pfnCFGMQueryPortDef(pCfg, "Port", &Port, 0x220);
    24572445    if (RT_FAILURE(rc))
    2458         return PDMDEV_SET_ERROR(pDevIns, rc,
    2459                                 N_("SB16 configuration error: Failed to get the \"Port\" value"));
     2446        return PDMDEV_SET_ERROR(pDevIns, rc, N_("SB16 configuration error: Failed to get the \"Port\" value"));
    24602447    pThis->port    = Port;
    24612448    pThis->portCfg = Port;
    24622449
    24632450    uint16_t u16Version;
    2464     rc = CFGMR3QueryU16Def(pCfg, "Version", &u16Version, 0x0405);
     2451    rc = pHlp->pfnCFGMQueryU16Def(pCfg, "Version", &u16Version, 0x0405);
    24652452    if (RT_FAILURE(rc))
    2466         return PDMDEV_SET_ERROR(pDevIns, rc,
    2467                                 N_("SB16 configuration error: Failed to get the \"Version\" value"));
     2453        return PDMDEV_SET_ERROR(pDevIns, rc, N_("SB16 configuration error: Failed to get the \"Version\" value"));
    24682454    pThis->ver     = u16Version;
    24692455    pThis->verCfg  = u16Version;
    24702456
    24712457    uint16_t uTimerHz;
    2472     rc = CFGMR3QueryU16Def(pCfg, "TimerHz", &uTimerHz, 100 /* Hz */);
     2458    rc = pHlp->pfnCFGMQueryU16Def(pCfg, "TimerHz", &uTimerHz, 100 /* Hz */);
    24732459    if (RT_FAILURE(rc))
    2474         return PDMDEV_SET_ERROR(pDevIns, rc,
    2475                                 N_("SB16 configuration error: failed to read Hertz (Hz) rate as unsigned integer"));
     2460        return PDMDEV_SET_ERROR(pDevIns, rc, N_("SB16 configuration error: failed to read Hertz (Hz) rate as unsigned integer"));
     2461
    24762462    /*
    24772463     * Setup the mixer now that we've got the irq and dma channel numbers.
     
    25682554
    25692555            PDMDevHlpVMSetRuntimeError(pDevIns, 0 /*fFlags*/, "HostAudioNotResponding",
    2570                 N_("No audio devices could be opened. Selecting the NULL audio backend "
    2571                    "with the consequence that no sound is audible"));
     2556                                       N_("No audio devices could be opened. Selecting the NULL audio backend with the consequence that no sound is audible"));
    25722557        }
    25732558    }
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