Changeset 28125 in vbox for trunk/src/VBox/Devices/Serial/DrvChar.cpp
- Timestamp:
- Apr 9, 2010 8:15:38 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Serial/DrvChar.cpp
r28103 r28125 22 22 * additional information or have any questions. 23 23 */ 24 25 24 26 25 … … 114 113 { 115 114 PDRVCHAR pThis = PDMICHAR_2_DRVCHAR(pInterface); 116 const char *p Buffer = (const char *)pvBuf;115 const char *pbBuffer = (const char *)pvBuf; 117 116 118 117 LogFlow(("%s: pvBuf=%#p cbWrite=%d\n", __FUNCTION__, pvBuf, cbWrite)); 119 118 120 for (uint32_t i =0; i<cbWrite; i++)119 for (uint32_t i = 0; i < cbWrite; i++) 121 120 { 122 121 uint32_t iOld = pThis->iSendQueueHead; 123 122 uint32_t iNew = (iOld + 1) & CHAR_MAX_SEND_QUEUE_MASK; 124 123 125 pThis->aSendQueue[iOld] = p Buffer[i];124 pThis->aSendQueue[iOld] = pbBuffer[i]; 126 125 127 126 STAM_COUNTER_INC(&pThis->StatBytesWritten); … … 129 128 ASMAtomicIncU32(&pThis->cEntries); 130 129 if (pThis->cEntries > CHAR_MAX_SEND_QUEUE_MASK / 2) 131 pThis->pDrvCharPort->pfnNotifyBufferFull(pThis->pDrvCharPort, true );130 pThis->pDrvCharPort->pfnNotifyBufferFull(pThis->pDrvCharPort, true /*fFull*/); 132 131 } 133 132 RTSemEventSignal(pThis->SendSem); … … 177 176 178 177 rc = pThis->pDrvStream->pfnWrite(pThis->pDrvStream, &pThis->aSendQueue[pThis->iSendQueueTail], &cbProcessed); 179 pThis->pDrvCharPort->pfnNotifyBufferFull(pThis->pDrvCharPort, false );178 pThis->pDrvCharPort->pfnNotifyBufferFull(pThis->pDrvCharPort, false /*fFull*/); 180 179 if (RT_SUCCESS(rc)) 181 180 { … … 213 212 static DECLCALLBACK(int) drvCharReceiveLoop(RTTHREAD ThreadSelf, void *pvUser) 214 213 { 215 PDRVCHAR pThis = (PDRVCHAR)pvUser; 216 char aBuffer[256], *pBuffer; 217 size_t cbRemaining, cbProcessed; 218 int rc; 219 220 cbRemaining = 0; 221 pBuffer = aBuffer; 214 PDRVCHAR pThis = (PDRVCHAR)pvUser; 215 char abBuffer[256]; 216 char *pbRemaining = abBuffer; 217 size_t cbRemaining = 0; 218 int rc; 219 222 220 while (!pThis->fShutdown) 223 221 { … … 227 225 if (pThis->pDrvStream) 228 226 { 229 cbRemaining = sizeof(aBuffer); 230 rc = pThis->pDrvStream->pfnRead(pThis->pDrvStream, aBuffer, &cbRemaining); 227 pbRemaining = abBuffer; 228 cbRemaining = sizeof(abBuffer); 229 rc = pThis->pDrvStream->pfnRead(pThis->pDrvStream, abBuffer, &cbRemaining); 231 230 if (RT_FAILURE(rc)) 232 231 { … … 236 235 } 237 236 else 238 {239 cbRemaining = 0;240 237 RTThreadSleep(100); 241 }242 pBuffer = aBuffer;243 238 } 244 239 else 245 240 { 246 241 /* Send data to guest. */ 247 cbProcessed = cbRemaining;248 rc = pThis->pDrvCharPort->pfnNotifyRead(pThis->pDrvCharPort, p Buffer, &cbProcessed);242 size_t cbProcessed = cbRemaining; 243 rc = pThis->pDrvCharPort->pfnNotifyRead(pThis->pDrvCharPort, pbRemaining, &cbProcessed); 249 244 if (RT_SUCCESS(rc)) 250 245 { 251 246 Assert(cbProcessed); 252 p Buffer+= cbProcessed;247 pbRemaining += cbProcessed; 253 248 cbRemaining -= cbProcessed; 254 249 STAM_COUNTER_ADD(&pThis->StatBytesRead, cbProcessed);
Note:
See TracChangeset
for help on using the changeset viewer.