Ticket #1548: serial.patch
| File serial.patch, 3.9 KB (added by , 14 years ago) |
|---|
-
include/VBox/pdmifs.h
1495 1495 DECLR3CALLBACKMEMBER(int, pfnNotifyStatusLinesChanged,(PPDMICHARPORT pInterface, uint32_t fNewStatusLines)); 1496 1496 1497 1497 /** 1498 * Notify the device/driver when the lsr changed. 1499 * 1500 * @returns VBox status code. 1501 * @param pInterface Pointer to the interface structure containing the called function pointer. 1502 * @param fNewStatusLine New state of the status line pins. 1503 * @thread Any thread. 1504 */ 1505 DECLR3CALLBACKMEMBER(int, pfnNotifyLsrChanged,(PPDMICHARPORT pInterface, uint32_t fNewLsr)); 1506 1507 /** 1498 1508 * Notify the device/driver that a break occurred. 1499 1509 * 1500 1510 * @returns VBox statsus code. … … 1514 1524 #define PDMICHARPORT_STATUS_LINES_CTS RT_BIT(3) 1515 1525 /** @} */ 1516 1526 1527 /** @name Bit mask definitions for lsr type. 1528 * @{ */ 1529 #define PDMICHARPORT_LSR_THRE RT_BIT(0) 1530 /** @} */ 1517 1531 1518 1532 /** Pointer to a char interface. */ 1519 1533 typedef struct PDMICHARCONNECTOR *PPDMICHARCONNECTOR; -
src/VBox/Devices/Serial/DevSerial.cpp
273 273 if (s->lcr & UART_LCR_DLAB) { 274 274 s->divider = (s->divider & 0xff00) | val; 275 275 serial_update_parameters(s); 276 } else {276 } else if (s->lsr & UART_LSR_THRE) { 277 277 s->thr_ipending = 0; 278 278 s->lsr &= ~UART_LSR_THRE; 279 279 serial_update_irq(s); … … 285 285 AssertRC(rc); 286 286 } 287 287 s->thr_ipending = 1; 288 s->lsr |= UART_LSR_THRE;289 288 s->lsr |= UART_LSR_TEMT; 290 289 serial_update_irq(s); 290 } else { 291 /* Transmitter Holding Register is not empty! */ 292 Log(("serial_ioport_write: THR not empty\n", ch)); 291 293 } 292 294 break; 293 295 case 1: … … 507 509 return VINF_SUCCESS; 508 510 } 509 511 512 static DECLCALLBACK(int) serialNotifyLsrChanged(PPDMICHARPORT pInterface, uint32_t newStatusLines) 513 { 514 SerialState *pThis = PDMICHARPORT_2_SERIALSTATE(pInterface); 515 uint8_t newLsr = s->lsr; 516 517 PDMCritSectEnter(&pThis->CritSect, VERR_PERMISSION_DENIED); 518 519 /* Set new states. */ 520 if (newStatusLines & PDMICHARPORT_LSR_THRE) 521 newLsr |= UART_LSR_THRE; 522 else 523 newLsr &= ~UART_LSR_THRE; 524 525 s->lsr = newLsr; 526 527 PDMCritSectLeave(&pThis->CritSect); 528 529 return VINF_SUCCESS; 530 } 531 510 532 static DECLCALLBACK(int) serialNotifyBreak(PPDMICHARPORT pInterface) 511 533 { 512 534 SerialState *pThis = PDMICHARPORT_2_SERIALSTATE(pInterface); … … 797 819 /* ICharPort */ 798 820 pThis->ICharPort.pfnNotifyRead = serialNotifyRead; 799 821 pThis->ICharPort.pfnNotifyStatusLinesChanged = serialNotifyStatusLinesChanged; 822 pThis->ICharPort.pfnNotifyLsrChanged = serialNotifyLsrChanged; 800 823 pThis->ICharPort.pfnNotifyBreak = serialNotifyBreak; 801 824 802 825 #ifdef VBOX_SERIAL_PCI -
src/VBox/Devices/Serial/DrvChar.cpp
178 178 Assert(cbProcessed); 179 179 pThis->iSendQueueTail++; 180 180 pThis->iSendQueueTail &= CHAR_MAX_SEND_QUEUE_MASK; 181 182 rc = pThis->pDrvCharPort->pfnNotifyLsrChanged(pThis->pDrvCharPort, PDMICHARPORT_LSR_THRE); 183 if (RT_FAILURE(rc)) 184 { 185 /* Notifying device failed, continue but log it */ 186 LogRel(("HostSerial#%d: Notifying device failed with error %Rrc; continuing.\n", pDrvIns->iInstance, rc)); 187 } 181 188 } 182 189 else if (rc == VERR_TIMEOUT) 183 190 {

