The hardware passes pen information into the system by issuing a hardware interrupt. The handler routine in the virtual pen driver that services the interrupt is cVpenD_Hw_Int, which is in the sample driver source file HWINT.C.
The cVpenD_Hw_Int function calls the cOEM_Hw_Int function to gather the hardware-dependent information into a pen packet. (The cOEM_Hw_Int function is located in the sample driver source file OEMHWINT.C). The return codes from the cOEM_Hw_Int function indicate the status of the gathering process. A complete list of return codes implemented by the sample driver is in the following table. All return codes except FF_INCOMPLETE have either the FF_ERROR or FF_SUCCESS flag set. The other flags listed in the following table give more information about the type of error or type of success.
Constant | Use |
FF_COM_BASE | The I/O base address for the COM port is invalid in the _HARDWAREINFO structure. The virtual pen driver needs to access a COM port to receive pen information. This is an error code. |
FF_DATANOTREADY | There is no data to read from the hardware. This is an error code. |
FF_ERROR | There is an error. |
FF_EXPECTING_SYNC | Received data in wrong order. A sync byte was expected and the byte received was not a sync byte. This is an error code. |
FF_INCOMPLETE | Data gathering is in process, but a complete packet has not been gathered yet. |
FF_OEMSPECIFIC | OEM-specific information. |
FF_OORPENPACKET | A complete out-of-range pen packet is ready. This is a success code. |
FF_OVERRUN | A data overrun occurred. This is an error code. |
FF_PENPACKET | A complete pen packet is ready. This is a success code. |
FF_RECORD_ERROR | The X or Y point value in a received packet are invalid. This is an error code that is sent after a complete packet is gathered. |
FF_SUCCESS | A data packet has been gathered and is ready to be serviced. |
FF_UNKNOWN | Unknown failure. This is an error code. |
If the cOEM_Hw_Int function returns one of the codes that indicates success, then pen data has been gathered for the cVpenD_HW_Int function to process and send on to the pen driver. When the cVpenD_Hw_Int function has a complete pen packet, it orients the point coordinates to the proper display orientation (either landscape or portrait) and calibrates the (x,y) point, converting it to a resolution of 0.001 inch.
The cVpenD_Hw_Int function also adds extra hardware-independent information to the packet, such as a time stamp. The debugging version of the virtual pen driver also adds to the packet a sequential number stamp, profile information, and other hardware-independent data pertinent to debugging. The virtual pen driver then schedules a callback to its cCall_Installable_Driver function (located in the TIMERCB.C source file) so the pen packet will be sent to the pen driver.
cCall_Installable_Driver determines the number of pen packets in the buffer waiting to be serviced and passes this number on to the pen driver along with the starting offset and index into the buffer. Finally, it calls the pen driver, which services the pen packet buffer.
When it receives control, the pen driver calls all its clients with the appropriate DT_ data type message. A complete list of DT_ data type messages is contained in the following table:
Constant | Use |
DT_OEM | Indicates an interrupt-time message returned by the virtual pen driver to the pen driver if OEM-specific information needs to be serviced. |
DT_OORPENPACKET | Indicates an interrupt-time message returned by the virtual pen driver to the pen driver if an out-of-range pen packet generated the interrupt. |
DT_PENPACKET | Indicates an interrupt-time message returned by the virtual pen driver to the pen driver when the virtual pen driver gathers a complete pen packet. |
DT_UPDATEPENINFO | Sent to all pen driver clients if the pen information structure changes. For example, the sample pen driver sends this data type to its clients if the sampling rate, sampling distance, distinct height, or distinct width values change. |