Share via


HW_VTBL

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

#ifdef USE_NEW_SERIAL_MODEL
typedef 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;

#else

typedef 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 function that performs the required initialization for the serial port driver's lower layer.
  • HWPostInit
    Pointer to a function that performs any required post-initialization. Defined when USE_NEW_SERIAL_MODEL is set.
  • HWDeinit
    Pointer to a function that performs any required work, such as freeing allocated data structures, when the driver is de-initialized.
  • HWOpen
    Pointer to a 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 function that executes when an application closes a serial port. Typically, this function is responsible for freeing any 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 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 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 function that the upper layer calls to handle an INTR_RX interrupt. Defined when USE_NEW_SERIAL_MODEL is set.
  • HWOtherIntrHandler
    Pointer to a 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 function that is called by the upper layer to handle an INTR_LINE interrupt.
  • HWGetRxBufferSize
    Pointer to a 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 function that the upper layer calls to handle an INTR_TX interrupt.
  • HWModemIntrHandler
    Pointer to a function that the upper layer calls to handle an INTR_MODEM interrupt. Defined when USE_NEW_SERIAL_MODEL is set.
  • HWPutBytes
    Pointer to a 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 function that is called as part of the system's power-down sequence. This function may make no system calls, and should perform the minimum work required to save the serial port hardware's status.
  • HWPowerOn
    Pointer to a 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 may not make system calls.
  • HWClearDTR
    Pointer to a function that clears the Data Terminal Ready (DTR) signal.
  • HWSetDTR
    Pointer to a function that sets the DTR signal.
  • HWClearRTS
    Pointer to a function that clears the request to send (RTS) line
  • HWSetRTS
    Pointer to a function that sets the RTS line.
  • HWEnableIR
    Pointer to a function that enables the infrared (IR) interface for ports that support IR mode. Typically, this involves switching the UART outputs from a standard line driver to an IR LED interface.
  • HWDisableIR
    Pointer to a function that disables IR mode on ports that support it.
  • HWClearBreak
    Pointer to a function that clears the break condition on the transmit line.
  • HWSetBreak
    Pointer to a function that sets the break condition on the transmit line. It is not supported by all UART chips.
  • HWXmitComChar
    Pointer to a function that transmits the specified character ahead of any other data that may already have been queued by the routine specified by HWPutBytes. Not supported by all hardware.
  • HWGetStatus
    Pointer to a 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 function that resets the ComStatus structure used by HWGetStatus.
  • HWGetModemStatus
    Pointer to a function that is called in response to the IOCTL_SERIAL_GET_MODEMSTATUS I/O control code. See the Microsoft® Win32® documentation for a description of the ModemStatus structure.
  • HWGetCommProperties
    Pointer to a function that fills in the CommProperties structure with information about the serial port's device capabilities.
  • HWPurgeComm
    Pointer to a function that clears the UART data as indicated by the TX_CLEAR, RX_CLEAR, TX_ABORT, and RX_ABORT flags.
  • HWSetDCB
    Pointer to a function that sets the port characteristics as indicated by the DCB structure passed as input to the function.
  • HWSetCommTimeouts
    Pointer to a function that sets communications time-out values as indicated. One of the primary tasks of the upper layer is to handle communications time-outs. The lower layer typically does not have to perform any action in its implementation of this function.
  • HWIoctl
    Pointer to a 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

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

COM_Write | HWGetIntrType | InterruptInitialize

 Last updated on Tuesday, May 18, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.