Changeset 82222 in vbox for trunk/src/VBox
- Timestamp:
- Nov 26, 2019 2:13:27 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DevSB16.cpp
r81765 r82222 2286 2286 } 2287 2287 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/"); 2291 2292 2292 2293 /* Remove LUN branch. */ 2293 CFGMR3RemoveNode( CFGMR3GetChildF(pDev0, "LUN#%u/", uLUN));2294 CFGMR3RemoveNode(pHlp->pfnCFGMGetChildF(pDev0, "LUN#%u/", uLUN)); 2294 2295 2295 2296 if (pDrv) … … 2402 2403 static DECLCALLBACK(int) sb16Construct(PPDMDEVINS pDevIns, int iInstance, PCFGMNODE pCfg) 2403 2404 { 2405 PDMDEV_CHECK_VERSIONS_RETURN(pDevIns); /* this shall come first */ 2406 PSB16STATE pThis = PDMDEVINS_2_DATA(pDevIns, PSB16STATE); 2407 PCPDMDEVHLPR3 pHlp = pDevIns->pHlpR3; 2404 2408 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); 2407 2411 2408 2412 /* … … 2419 2423 2420 2424 /* 2421 * Validat ions.2425 * Validate and read config data. 2422 2426 */ 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); 2438 2429 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")); 2441 2431 pThis->irqCfg = pThis->irq; 2442 2432 2443 rc = CFGMR3QuerySIntDef(pCfg, "DMA", &pThis->dma, 1);2433 rc = pHlp->pfnCFGMQuerySIntDef(pCfg, "DMA", &pThis->dma, 1); 2444 2434 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")); 2447 2436 pThis->dmaCfg = pThis->dma; 2448 2437 2449 rc = CFGMR3QuerySIntDef(pCfg, "DMA16", &pThis->hdma, 5);2438 rc = pHlp->pfnCFGMQuerySIntDef(pCfg, "DMA16", &pThis->hdma, 5); 2450 2439 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")); 2453 2441 pThis->hdmaCfg = pThis->hdma; 2454 2442 2455 2443 RTIOPORT Port; 2456 rc = CFGMR3QueryPortDef(pCfg, "Port", &Port, 0x220);2444 rc = pHlp->pfnCFGMQueryPortDef(pCfg, "Port", &Port, 0x220); 2457 2445 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")); 2460 2447 pThis->port = Port; 2461 2448 pThis->portCfg = Port; 2462 2449 2463 2450 uint16_t u16Version; 2464 rc = CFGMR3QueryU16Def(pCfg, "Version", &u16Version, 0x0405);2451 rc = pHlp->pfnCFGMQueryU16Def(pCfg, "Version", &u16Version, 0x0405); 2465 2452 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")); 2468 2454 pThis->ver = u16Version; 2469 2455 pThis->verCfg = u16Version; 2470 2456 2471 2457 uint16_t uTimerHz; 2472 rc = CFGMR3QueryU16Def(pCfg, "TimerHz", &uTimerHz, 100 /* Hz */);2458 rc = pHlp->pfnCFGMQueryU16Def(pCfg, "TimerHz", &uTimerHz, 100 /* Hz */); 2473 2459 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 2476 2462 /* 2477 2463 * Setup the mixer now that we've got the irq and dma channel numbers. … … 2568 2554 2569 2555 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")); 2572 2557 } 2573 2558 }
Note:
See TracChangeset
for help on using the changeset viewer.