Partager via


HW_VTBL (Windows CE 5.0)

Send Feedback

This structure stores pointers to the functions that serial port drivers must implement.

#ifdef USE_NEW_SERIAL_MODELtypedef struct __HWOBJ HWOBJ, *PHWOBJ;typedef struct __HW_VTBL {  PVOID (*HWInit)(ULONG Identifier, PVOID pMDDContext, PHWOBJ pHWObj);  BOOL (*HWPostInit)(PVOID pHead);  ULONG (*HWDeinit)(PVOID pHead);  BOOL (*HWOpen)(PVOID pHead);  ULONG (*HWClose)(PVOID pHead);  INTERRUPT_TYPE (*HWGetIntrType)(PVOID pHead);  ULONG (*HWRxIntrHandler)(PVOID pHead, PUCHAR pTarget, PULONG pBytes);  VOID (*HWTxIntrHandler)(PVOID pHead, PUCHAR pSrc, PULONG pBytes);  VOID (*HWModemIntrHandler)(PVOID pHead);  VOID (*HWLineIntrHandler)(PVOID pHead);  ULONG (*HWGetRxBufferSize)(PVOID pHead);  BOOL (*HWPowerOff)(PVOID pHead);  BOOL (*HWPowerOn)(PVOID pHead);  VOID (*HWClearDTR)(PVOID pHead);  VOID (*HWSetDTR)(PVOID pHead);  VOID (*HWClearRTS)(PVOID pHead);  VOID (*HWSetRTS)(PVOID pHead);  BOOL (*HWEnableIR)(PVOID pHead, ULONG BaudRate);  BOOL (*HWDisableIR)(PVOID pHead);  VOID (*HWClearBreak)(PVOID pHead);  VOID (*HWSetBreak)(PVOID pHead);  BOOL (*HWXmitComChar)(PVOID pHead, UCHAR ComChar);  ULONG (*HWGetStatus)(PVOID pHead, LPCOMSTAT lpStat);  VOID (*HWReset)(PVOID pHead);  VOID (*HWGetModemStatus)(PVOID pHead, PULONG pModemStatus);  VOID (*HWGetCommProperties)(PVOID pHead, LPCOMMPROP pCommProp);  VOID (*HWPurgeComm)(PVOID pHead, DWORD fdwAction);  BOOL (*HWSetDCB)(PVOID pHead, LPDCB pDCB);  BOOL (*HWSetCommTimeouts)(PVOID pHead, LPCOMMTIMEOUTS lpCommTO);  BOOL (*HWIoctl)(PVOID pHead, DWORD dwCode,PBYTE pBufIn,DWORD dwLenIn, PBYTE pBufOut,DWORD dwLenOut,PDWORD pdwActualOut);} HW_VTBL, *PHW_VTBL;#elsetypedef struct __HW_VTBL {  PVOID (*HWInit)(ULONG Identifier, PVOID pMDDContext);  ULONG (*HWDeinit)(PVOID pHead);  BOOL (*HWOpen)(PVOID pHead);  ULONG (*HWClose)(PVOID pHead);  ULONG (*HWGetBytes)(PVOID pHead, PUCHAR pTarget, PULONG pBytes);  PVOID (*HWGetRxStart)(PVOID pHead);  INTERRUPT_TYPE (*HWGetIntrType)(PVOID pHead);  VOID (*HWOtherIntrHandler)(PVOID pHead);  VOID (*HWLineIntrHandler)(PVOID pHead);  ULONG (*HWGetRxBufferSize)(PVOID pHead);  VOID (*HWTxIntrHandler)(PVOID pHead);  ULONG (*HWPutBytes)(PVOID pHead, PUCHAR pSrc, ULONG NumBytes, PULONG pBytesSent);  BOOL (*HWPowerOff)(PVOID pHead);  BOOL (*HWPowerOn)(PVOID pHead);  VOID (*HWClearDTR)(PVOID pHead);  VOID (*HWSetDTR)(PVOID pHead);  VOID (*HWClearRTS)(PVOID pHead);  VOID (*HWSetRTS)(PVOID pHead);  BOOL (*HWEnableIR)(PVOID pHead, ULONG BaudRate);  BOOL (*HWDisableIR)(PVOID pHead);  VOID (*HWClearBreak)(PVOID pHead);  VOID (*HWSetBreak)(PVOID pHead);  BOOL (*HWXmitComChar)(PVOID pHead, UCHAR ComChar);  ULONG (*HWGetStatus)(PVOID pHead, LPCOMSTAT lpStat);  VOID (*HWReset)(PVOID pHead);  VOID (*HWGetModemStatus)(PVOID pHead, PULONG pModemStatus);  VOID (*HWGetCommProperties)(PVOID pHead, LPCOMMPROP pCommProp);  VOID (*HWPurgeComm)(PVOID pHead, DWORD fdwAction);  BOOL (*HWSetDCB)(PVOID pHead, LPDCB pDCB);  BOOL (*HWSetCommTimeouts)(PVOID pHead, LPCOMMTIMEOUTS lpCommTO);  BOOL (*HWIoctl)(PVOID pHead, DWORD dwCode,PBYTE pBufIn, DWORD dwLenIn, PBYTE pBufOut,DWORD dwLenOut,PDWORD pdwActualOut);} HW_VTBL, *PHW_VTBL;#endif

Members

  • HWInit
    Pointer to a HWInit function that performs the required initialization for the serial port driver's lower layer.
  • HWPostInit
    Pointer to a HWPostInit function that performs required post-initialization. Defined when USE_NEW_SERIAL_MODEL is set.
  • HWDeinit
    Pointer to a HWDeinit function that performs any required work, such as freeing allocated data structures, when the driver is de-initialized.
  • HWOpen
    Pointer to a HWOpen function that is called when an application opens a serial port. Typically, this function is responsible for powering the serial port hardware and initializing its state, if it is not already open.
  • HWClose
    Pointer to a HWClose function that executes when an application closes a serial port. Typically, this function is responsible for freeing data allocated in HWOpen and removing power from serial port hardware.
  • HWGetBytes
    Pointer to a function that is called by the upper layer to retrieve received characters from the universal asynchronous receiver-transmitter (UART) when RX_INTR is returned from the HWGetIntrType function. The return value indicates number of received bytes, if any, that were dropped by the UART or the lower layer. This member is not defined when USE_NEW_SERIAL_MODEL is set.
  • HWGetRxStart
    Pointer to a HWGetRxStart function that returns the address of the start of the hardware receive buffer. This is subsequently passed to the InterruptInitialize function. This member is not defined when USE_NEW_SERIAL_MODEL is set.
  • HWGetIntrType
    Pointer to a HWGetIntrType function that the upper layer calls when an interrupt event is signaled. This function determines the cause of the interrupt and returns an interrupt mask composed of the possible types INTR_RX, INTR_TX, INTR_MODEM, INTR_LINE, or INTR_NONE.
  • HWRxIntrHandler
    Pointer to a HWRxIntrHandler function that the upper layer calls to handle an INTR_RX interrupt. Defined when USE_NEW_SERIAL_MODEL is set.
  • HWOtherIntrHandler
    Pointer to a HWOtherIntrHandler function that is called by the upper layer to handle an INTR_MODEM interrupt. This member is not defined when USE_NEW_SERIAL_MODEL is set.
  • HWLineIntrHandler
    Pointer to a HWLineIntrHandler function that is called by the upper layer to handle an INTR_LINE interrupt.
  • HWGetRxBufferSize
    Pointer to a HWGetRxBufferSize function that returns the number of bytes that can be held in the receive buffer or in a first-in, first-out (FIFO) queue.
  • HWTxIntrHandler
    Pointer to a HWTxIntrHandler function that the upper layer calls to handle an INTR_TX interrupt.
  • HWModemIntrHandler
    Pointer to a HWModemIntrHandler function that the upper layer calls to handle an INTR_MODEM interrupt. Defined when USE_NEW_SERIAL_MODEL is set.
  • HWPutBytes
    Pointer to a HWPutBytes function that is called by the upper layer's COM_Write function to transmit data. It loads the data in FIFO order and returns to the upper layer. A non-zero return code indicates that the upper layer must perform polling to detect changes in the flow control state. Hardware which supports interrupt generation when the line state changes should return zero. The return value indicates number of milliseconds to wait before polling. This member is not defined when USE_NEW_SERIAL_MODEL is set.
  • HWPowerOff
    Pointer to a HWPowerOff function that is called as part of the system's power-down sequence. This function cannot make system calls, and should perform the minimum work required to save the serial port hardware's status.
  • HWPowerOn
    Pointer to a HWPowerOn function that is called as part of the system's power-on sequence. It should use data saved in HWPowerOff to restore the state of the serial port hardware. This function cannot make system calls.
  • HWClearDTR
    Pointer to a HWClearDTR function that clears the Data Terminal Ready (DTR) signal.
  • HWSetDTR
    Pointer to a HWSetDTR function that sets the DTR signal.
  • HWClearRTS
    Pointer to a HWClearRTS function that clears the request to send (RTS) signal.
  • HWSetRTS
    Pointer to a HWSetRTS function that sets the RTS line.
  • HWEnableIR
    Pointer to a HWEnableIR function that enables the infrared (IR) interface for ports that support IR mode. Typically, this involves switching the UART output from a standard line driver to an IR LED interface.
  • HWDisableIR
    Pointer to a HWDisableIR function that disables IR mode on ports that support it.
  • HWClearBreak
    Pointer to a HWClearBreak function that clears the break condition on the transmit line.
  • HWSetBreak
    Pointer to a HWSetBreak function that sets the break condition on the transmit line. It is not supported by all UART chips.
  • HWXmitComChar
    Pointer to a HWXmitComChar function that transmits the specified character ahead of any other data that may already have been queued by the routine specified by HWPutBytes. This pointer is not supported by all hardware.
  • HWGetStatus
    Pointer to a HWGetStatus function that is called in response to the IOCTL_SERIAL_GET_COMMSTATUS I/O control code. It returns the serial port's current status. This function must also clear the CommErrors member of the PERP_IO_SER_INFO structure.
  • HWReset
    Pointer to a HWReset function that resets the ComStatus structure used by HWGetStatus.
  • HWGetModemStatus
    Pointer to a HWGetModemStatus function that is called in response to the IOCTL_SERIAL_GET_MODEMSTATUS I/O control code. For a description of the ModemStatus structure, see Microsoft® Win32® documentation .
  • HWGetCommProperties
    Pointer to a HWGetCommProperties function that fills in the CommProperties structure with information about the serial port's device capabilities.
  • HWPurgeComm
    Pointer to a HWPurgeComm function that clears the UART data as indicated by the TX_CLEAR, RX_CLEAR, TX_ABORT, and RX_ABORT flags.
  • HWSetDCB
    Pointer to a HWSetDCB function that sets the port characteristics as indicated by the DCB structure passed as input to the function.
  • HWSetCommTimeouts
    Pointer to a HWSetCommTimeouts function that sets communications time-out values as indicated. One of the primary tasks of the upper layer is to handle communications time-out events. The lower layer typically does not have to perform actions in its implementation of this function.
  • HWIoctl
    Pointer to a HWIoctl function that handles any I/O control codes. In addition to the standard Win32 codes, you can implement additional hardware specific codes in the lower layer.

Remarks

These function names are listed as they are defined in the serial port sample code. You can change this set of functions or the function names by modifying the serial object table, which is a table of HWOBJ type objects, in the serial port lower layer.

Define USE_NEW_SERIAL_MODEL to use the updated serial driver model.

The following members are defined when USE_NEW_SERIAL_MODEL is set:

  • HWPostInit
  • HWRxIntrHandler
  • HWModemIntrHandler

The following members are not defined when USE_NEW_SERIAL_MODEL is set:

  • HWGetBytes
  • HWGetRxStart
  • HWOtherIntrHandler
  • HWPutBytes

Requirements

OS Versions: Windows CE 1.0 and later.
Header: Serhw.h.

See Also

Serial Port Driver Samples | COM_Write | HWClearBreak | HWClearDTR | HWClearRTS | HWClose | HWDeinit | HWDisableIR | HWEnableIR | HWGetCommProperties | HWGetIntrType | HWGetModemStatus | HWGetRxBufferSize | HWGetRxStart | HWGetStatus | HWInit | HWIoctl | HWLineIntrHandler | HWModemIntrHandler | HWOBJ | HWOpen | HWOtherIntrHandler | HWPostInit | HWPowerOff | HWPowerOn | HWPurgeComm | HWPutBytes | HWReset | HWRxIntrHandler | HWSetBreak | HWSetCommTimeouts | HWSetDCB | HWSetDTR | HWSetRTS | HWTxIntrHandler | HWXmitComChar | InterruptInitialize

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.