Changeset 59186 in vbox
- Timestamp:
- Dec 18, 2015 2:11:44 PM (9 years ago)
- svn:sync-xref-src-repo-rev:
- 104804
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DevIchAc97.cpp
r59171 r59186 304 304 typedef struct AC97DRIVER 305 305 { 306 union 307 { 308 /** Node for storing this driver in our device driver 309 * list of AC97STATE. */ 310 RTLISTNODE Node; 311 struct 312 { 313 R3PTRTYPE(void *) dummy1; 314 R3PTRTYPE(void *) dummy2; 315 } dummy; 316 }; 317 306 /** Node for storing this driver in our device driver list of AC97STATE. */ 307 RTLISTNODER3 Node; 318 308 /** Pointer to AC97 controller (state). */ 319 309 R3PTRTYPE(PAC97STATE) pAC97State; … … 356 346 AC97STREAM StrmStOut; 357 347 #ifndef VBOX_WITH_AUDIO_CALLBACKS 358 /** The emulation timer for handling the attached 359 * LUN drivers. */ 348 /** The timer for pumping data thru the attached LUN drivers. */ 360 349 PTMTIMERR3 pTimer; 361 /** Timer ticks for handling the LUN drivers. */ 362 uint64_t uTimerTicks; 363 /** Timestamp (delta) since last timer call. */ 350 /** The timer interval for pumping data thru the LUN drivers in timer ticks. */ 351 uint64_t cTimerTicks; 352 /** Timestamp of the last timer callback (ac97Timer). 353 * Used to calculate the time actually elapsed between two timer callbacks. */ 364 354 uint64_t uTimerTS; 365 355 #endif … … 369 359 STAMCOUNTER StatBytesWritten; 370 360 #endif 371 /** List of associated LUN drivers . */361 /** List of associated LUN drivers (AC97DRIVER). */ 372 362 RTLISTANCHOR lstDrv; 373 363 /** The device' software mixer. */ … … 1177 1167 static DECLCALLBACK(void) ichac97Timer(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser) 1178 1168 { 1179 PAC97STATE pThis = PDMINS_2_DATA(pDevIns, PAC97STATE); 1180 AssertPtrReturnVoid(pThis); 1169 PAC97STATE pThis = (PAC97STATE)pvUser; 1170 Assert(pThis == PDMINS_2_DATA(pDevIns, PAC97STATE)); 1171 AssertPtr(pThis); 1181 1172 1182 1173 STAM_PROFILE_START(&pThis->StatTimer, a); … … 1191 1182 uint32_t cbIn, cbOut; 1192 1183 1193 uint64_t uTicksNow = PDMDevHlpTMTimeVirtGet(pDevIns);1194 uint64_t uTicksElapsed = uTicksNow - pThis->uTimerTS;1195 uint64_t uTicksPerSec = PDMDevHlpTMTimeVirtGetFreq(pDevIns);1196 1197 pThis->uTimerTS = uTicksNow;1184 uint64_t cTicksNow = TMTimerGet(pTimer); 1185 uint64_t cTicksElapsed = cTicksNow - pThis->uTimerTS; 1186 uint64_t cTicksPerSec = TMTimerGetFreq(pTimer); 1187 1188 pThis->uTimerTS = cTicksNow; 1198 1189 1199 1190 RTListForEach(&pThis->lstDrv, pDrv, AC97DRIVER, Node) 1200 1191 { 1201 cbIn = cbOut = 0; 1192 uint32_t cbIn = 0; 1193 uint32_t cbOut = 0; 1194 1202 1195 rc = pDrv->pConnector->pfnQueryStatus(pDrv->pConnector, 1203 1196 &cbIn, &cbOut, NULL /* cSamplesLive */); … … 1219 1212 || !fIsActiveOut) 1220 1213 { 1221 uint32_t cSamplesMin = (int)((2 * uTicksElapsed * pDrv->Out.pStrmOut->Props.uHz + uTicksPerSec) / uTicksPerSec / 2);1214 uint32_t cSamplesMin = (int)((2 * cTicksElapsed * pDrv->Out.pStrmOut->Props.uHz + cTicksPerSec) / cTicksPerSec / 2); 1222 1215 uint32_t cbSamplesMin = AUDIOMIXBUF_S2B(&pDrv->Out.pStrmOut->MixBuf, cSamplesMin); 1223 1216 … … 1254 1247 ichac97TransferAudio(pThis, PI_INDEX, cbInMax); /** @todo Add rc! */ 1255 1248 1256 TMTimerSet(pThis->pTimer, TMTimerGet(pThis->pTimer) + pThis->uTimerTicks); 1249 /* Kick the timer again. */ 1250 uint64_t cTicks = pThis->cTimerTicks; 1251 /** @todo adjust cTicks down by now much cbOutMin represents. */ 1252 TMTimerSet(pThis->pTimer, cTicksNow + cTicks); 1257 1253 1258 1254 STAM_PROFILE_STOP(&pThis->StatTimer, a); … … 2485 2481 if (RT_SUCCESS(rc)) 2486 2482 { 2487 pThis->uTimerTicks = PDMDevHlpTMTimeVirtGetFreq(pDevIns) / 200; /** Hz. @todo Make this configurable! */ 2488 pThis->uTimerTS = PDMDevHlpTMTimeVirtGet(pDevIns); 2489 if (pThis->uTimerTicks < 100) 2490 pThis->uTimerTicks = 100; 2491 LogFunc(("Timer ticks=%RU64\n", pThis->uTimerTicks)); 2483 pThis->cTimerTicks = TMTimerGetFreq(pThis->pTimer) / 200; /** @todo Make this configurable! */ 2484 pThis->uTimerTS = TMTimerGet(pThis->pTimer); 2485 LogFunc(("Timer ticks=%RU64\n", pThis->cTimerTicks)); 2492 2486 2493 2487 /* Fire off timer. */ 2494 TMTimerSet(pThis->pTimer, TMTimerGet(pThis->pTimer) + pThis-> uTimerTicks);2488 TMTimerSet(pThis->pTimer, TMTimerGet(pThis->pTimer) + pThis->cTimerTicks); 2495 2489 } 2496 2490 }
Note:
See TracChangeset
for help on using the changeset viewer.