VirtualBox

Changeset 69907 in vbox for trunk/include/iprt


Ignore:
Timestamp:
Dec 3, 2017 8:54:16 AM (7 years ago)
Author:
vboxsync
Message:

Runtime/serialport-posix: Updates

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/serialport.h

    r69895 r69907  
    5353#define NIL_RTSERIALPORT             ((RTSERIALPORT)0)
    5454
    55 
    56 /**
    57  * Serial port event.
    58  */
    59 typedef enum RTSERIALPORTEVT
    60 {
    61     /** Invalid event. */
    62     RTSERIALPORTEVT_INVALID = 0,
    63     /** Data was received and can be read. */
    64     RTSERIALPORTEVT_DATA_RX,
    65     /** All data was transmitted and there is room again in the transmit buffer. */
    66     RTSERIALPORTEVT_DATA_TX,
    67     /** A BREAK condition was detected on the communication channel. */
    68     RTSERIALPORTEVT_BREAK_DETECTED,
    69     /** One of the monitored status lines changed, check with RTSerialPortQueryStatusLines(). */
    70     RTSERIALPORTEVT_STATUS_LINE_CHANGED,
    71     /** Status line monitor failed with an error and status line monitoring is disabled. */
    72     RTSERIALPORTEVT_STATUS_LINE_MONITOR_FAILED,
    73     /** 32bit hack. */
    74     RTSERIALPORTEVT_32BIT_HACK = 0x7fffffff
    75 } RTSERIALPORTEVT;
    76 /** Pointer to a serial port event enum. */
    77 typedef RTSERIALPORTEVT *PRTSERIALPORTEVT;
    7855
    7956/**
     
    160137 * @{ */
    161138/** Open the serial port with the receiver enabled to receive data. */
    162 #define RT_SERIALPORT_OPEN_F_READ                           RT_BIT(0)
     139#define RTSERIALPORT_OPEN_F_READ                           RT_BIT(0)
    163140/** Open the serial port with the transmitter enabled to transmit data. */
    164 #define RT_SERIALPORT_OPEN_F_WRITE                          RT_BIT(1)
     141#define RTSERIALPORT_OPEN_F_WRITE                          RT_BIT(1)
    165142/** Open the serial port with status line monitoring enabled to get notified about status line changes. */
    166 #define RT_SERIALPORT_OPEN_F_SUPPORT_STATUS_LINE_MONITORING RT_BIT(2)
     143#define RTSERIALPORT_OPEN_F_SUPPORT_STATUS_LINE_MONITORING RT_BIT(2)
    167144/** Open the serial port with BREAK condition detection enabled (Requires extra work on some hosts). */
    168 #define RT_SERIALPORT_OPEN_F_DETECT_BREAK_CONDITION         RT_BIT(3)
     145#define RTSERIALPORT_OPEN_F_DETECT_BREAK_CONDITION         RT_BIT(3)
    169146/** Open the serial port with loopback mode enabled. */
    170 #define RT_SERIALPORT_OPEN_F_ENABLE_LOOPBACK                RT_BIT(4)
     147#define RTSERIALPORT_OPEN_F_ENABLE_LOOPBACK                RT_BIT(4)
    171148/** Bitmask of valid flags. */
    172 #define RT_SERIALPORT_OPEN_F_VALID_MASK                     UINT32_C(0x0000001f)
     149#define RTSERIALPORT_OPEN_F_VALID_MASK                     UINT32_C(0x0000001f)
    173150/** @} */
    174151
     
    177154 * @{ */
    178155/** Change the RTS (Ready To Send) line signal. */
    179 #define RT_SERIALPORT_CHG_STS_LINES_F_RTS                   RT_BIT(0)
     156#define RTSERIALPORT_CHG_STS_LINES_F_RTS                   RT_BIT(0)
    180157/** Change the DTR (Data Terminal Ready) line signal. */
    181 #define RT_SERIALPORT_CHG_STS_LINES_F_DTR                   RT_BIT(1)
     158#define RTSERIALPORT_CHG_STS_LINES_F_DTR                   RT_BIT(1)
    182159/** Bitmask of valid flags. */
    183 #define RT_SERIALPORT_CHG_STS_LINES_F_VALID_MASK            UINT32_C(0x00000003)
     160#define RTSERIALPORT_CHG_STS_LINES_F_VALID_MASK            UINT32_C(0x00000003)
    184161/** @} */
    185162
     
    188165 * @{ */
    189166/** The DCD (Data Carrier Detect) signal is active. */
    190 #define RT_SERIALPORT_STS_LINE_DCD                          RT_BIT(0)
     167#define RTSERIALPORT_STS_LINE_DCD                          RT_BIT(0)
    191168/** The RI (Ring Indicator) signal is active. */
    192 #define RT_SERIALPORT_STS_LINE_RI                           RT_BIT(1)
     169#define RTSERIALPORT_STS_LINE_RI                           RT_BIT(1)
    193170/** The DSR (Data Set Ready) signal is active. */
    194 #define RT_SERIALPORT_STS_LINE_DSR                          RT_BIT(2)
     171#define RTSERIALPORT_STS_LINE_DSR                          RT_BIT(2)
    195172/** The CTS (Clear To Send) signal is active. */
    196 #define RT_SERIALPORT_STS_LINE_CTS                          RT_BIT(3)
     173#define RTSERIALPORT_STS_LINE_CTS                          RT_BIT(3)
     174/** @} */
     175
     176
     177/** @name RTSerialPortEvtPoll flags
     178 * @{ */
     179/** Data was received and can be read. */
     180#define RTSERIALPORT_EVT_F_DATA_RX                         RT_BIT(0)
     181/** All data was transmitted and there is room again in the transmit buffer. */
     182#define RTSERIALPORT_EVT_F_DATA_TX                         RT_BIT(1)
     183/** A BREAK condition was detected on the communication channel.
     184 * Only available when BREAK condition detection was enabled when opening the serial port .*/
     185#define RTSERIALPORT_EVT_F_BREAK_DETECTED                  RT_BIT(2)
     186/** One of the monitored status lines changed, check with RTSerialPortQueryStatusLines().
     187 * Only available if status line monitoring was enabled when opening the serial port. */
     188#define RTSERIALPORT_EVT_F_STATUS_LINE_CHANGED             RT_BIT(3)
     189/** Status line monitor failed with an error and status line monitoring is disabled,
     190 * this cannot be given in the event mask but will be set if status line
     191 * monitoring is enabled and the monitor failed. */
     192#define RTSERIALPORT_EVT_F_STATUS_LINE_MONITOR_FAILED      RT_BIT(4)
     193/** Bitmask of valid flags. */
     194#define RTSERIALPORT_EVT_F_VALID_MASK                      UINT32_C(0x0000001f)
    197195/** @} */
    198196
     
    204202 * @param   phSerialPort            Where to store the IPRT serial port handle on success.
    205203 * @param   pszPortAddress          The address of the serial port (host dependent).
    206  * @param   fFlags                  Flags to open the serial port with, see RT_SERIALPORT_OPEN_F_*.
     204 * @param   fFlags                  Flags to open the serial port with, see RTSERIALPORT_OPEN_F_*.
    207205 */
    208206RTDECL(int) RTSerialPortOpen(PRTSERIALPORT phSerialPort, const char *pszPortAddress, uint32_t fFlags);
     
    308306 * @retval VERR_INTERRUPTED if another thread interrupted the polling through RTSerialPortEvtPollInterrupt().
    309307 * @param   hSerialPort             The IPRT serial port handle.
    310  * @param   penmEvt                 Where to store the event on success.
     308 * @param   fEvtMask                The mask of events to receive, see RTSERIALPORT_EVT_F_*
     309 * @param   pfEvtsRecv              Where to store the bitmask of events received.
    311310 * @param   msTimeout               Number of milliseconds to wait for an event.
    312311 */
    313 RTDECL(int) RTSerialPortEvtPoll(RTSERIALPORT hSerialPort, RTSERIALPORTEVT *penmEvt, RTMSINTERVAL msTimeout);
     312RTDECL(int) RTSerialPortEvtPoll(RTSERIALPORT hSerialPort, uint32_t fEvtMask, uint32_t *pfEvtsRecv,
     313                                RTMSINTERVAL msTimeout);
    314314
    315315
     
    340340 * @returns IPRT status code.
    341341 * @param   hSerialPort             The IPRT serial port handle.
    342  * @param   fClear                  Combination of status lines to clear, see RT_SERIALPORT_CHG_STS_LINES_F_*.
    343  * @param   fSet                    Combination of status lines to set, see RT_SERIALPORT_CHG_STS_LINES_F_*.
     342 * @param   fClear                  Combination of status lines to clear, see RTSERIALPORT_CHG_STS_LINES_F_*.
     343 * @param   fSet                    Combination of status lines to set, see RTSERIALPORT_CHG_STS_LINES_F_*.
    344344 *
    345345 * @note fClear takes precedence over fSet in case the same status line bit is set in both arguments.
     
    354354 * @param   hSerialPort             The IPRT serial port handle.
    355355 * @param   pfStsLines              Where to store the bitmask of active status lines on success,
    356  *                                  see RT_SERIALPORT_STS_LINE_*.
     356 *                                  see RTSERIALPORT_STS_LINE_*.
    357357 */
    358358RTDECL(int) RTSerialPortQueryStatusLines(RTSERIALPORT hSerialPort, uint32_t *pfStsLines);
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