VirtualBox

Changeset 4142 in vbox


Ignore:
Timestamp:
Aug 14, 2007 8:33:05 AM (17 years ago)
Author:
vboxsync
Message:

Host serial port support for Linux by Alexander Eichner.

Location:
trunk
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/pdmifs.h

    r4071 r4142  
    11201120     */
    11211121    DECLR3CALLBACKMEMBER(int, pfnWrite,(PPDMICHAR pInterface, const void *pvBuf, size_t cbWrite));
     1122
     1123    /**
     1124     * Set device parameters.
     1125     *
     1126     * @returns VBox status code.
     1127     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
     1128     * @param   speed           Speed of the serial connection.
     1129     * @param   parity          Enable parity
     1130     * @param   data_bits       Number of data bits
     1131     * @param   stop_bits       Number of stop bits
     1132     * @thread  Any thread.
     1133     */
     1134    DECLR3CALLBACKMEMBER(int, pfnSetParameters,(PPDMICHAR pInterface, int speed, int parity, int data_bits, int stop_bits));
     1135
    11221136} PDMICHAR;
    11231137
  • trunk/src/VBox/Devices/Serial/DevSerial.cpp

    r4071 r4142  
    175175__END_DECLS
    176176
    177 
     177#ifdef IN_RING3
    178178static void serial_update_irq(SerialState *s)
    179179{
     
    223223    speed = 115200 / s->divider;
    224224    Log(("speed=%d parity=%c data=%d stop=%d\n", speed, parity, data_bits, stop_bits));
    225 }
     225    s->pDrvChar->pfnSetParameters(s->pDrvChar, speed, parity, data_bits, stop_bits);
     226}
     227#endif
    226228
    227229static int serial_ioport_write(void *opaque, uint32_t addr, uint32_t val)
     
    232234    addr &= 7;
    233235    LogFlow(("serial: write addr=0x%02x val=0x%02x\n", addr, val));
     236
     237#ifndef IN_RING3
     238    NOREF(ch);
     239    NOREF(s);
     240    return VINF_IOM_HC_IOPORT_WRITE;
     241#else
    234242    switch(addr) {
    235243    default:
     
    239247            serial_update_parameters(s);
    240248        } else {
    241 #ifndef IN_RING3
    242             NOREF(ch);
    243             return VINF_IOM_HC_IOPORT_WRITE;
    244 #else
    245249            s->thr_ipending = 0;
    246250            s->lsr &= ~UART_LSR_THRE;
     
    257261            s->lsr |= UART_LSR_TEMT;
    258262            serial_update_irq(s);
    259 #endif
    260263        }
    261264        break;
     
    297300    }
    298301    return VINF_SUCCESS;
     302#endif
    299303}
    300304
     
    335339        break;
    336340    case 2:
     341#ifndef IN_RING3
     342        *pRC = VINF_IOM_HC_IOPORT_READ;
     343#else
    337344        ret = s->iir;
    338345        /* reset THR pending bit */
     
    340347            s->thr_ipending = 0;
    341348        serial_update_irq(s);
     349#endif
    342350        break;
    343351    case 3:
  • trunk/src/VBox/Devices/Serial/DrvChar.cpp

    r4071 r4142  
    124124    }
    125125    RTSemEventSignal(pData->SendSem);
     126    return VINF_SUCCESS;
     127}
     128
     129/** @copydoc PDMICHAR::pfnSetParameters */
     130static DECLCALLBACK(int) drvCharSetParameters(PPDMICHAR pInterface, int speed, int parity, int data_bits, int stop_bits)
     131{
     132    PDRVCHAR pData = PDMICHAR_2_DRVCHAR(pInterface);
     133
     134    LogFlow(("%s: speed=%d parity=%c data_bits=%d stop_bits=%d\n", __FUNCTION__, speed, parity, data_bits, stop_bits));
    126135    return VINF_SUCCESS;
    127136}
     
    186195}
    187196
    188 
    189197/* -=-=-=-=- receive thread -=-=-=-=- */
    190198
     
    287295    /* IChar. */
    288296    pData->IChar.pfnWrite                   = drvCharWrite;
    289 
     297    pData->IChar.pfnSetParameters           = drvCharSetParameters;
    290298
    291299    /*
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