DevHelp TickCount

This service registers a new timer handler or modifies a previously registered timer handler to be called on every n timer ticks instead of every timer tick.

C


USHORT APIENTRY DevHelp_TickCount( NPFN  TimerHandler,                                   USHORT TickCount ); 

Assembler
 MOV  AX,OFFSET CS:timer_handler  ; Offset to timer handler MOV  BX,count                    ; Value of n;  the number of tick counts ; (0 - FFFF) ; 0 means FFFFH+1 ticks MOV  DL,DevHlp_TickCount

CALL [Device_Help] 

C

 * TimerHandler (NPFN)     :  Offset to timer handler.


 * TickCount (USHORT)      :  The number of ticks between calls to timer handler

Assembler
 MOV  AX,OFFSET CS:timer_handler  ; Offset to timer handler MOV  BX,count                    ; Value of n;  the number of tick counts ; (0 - FFFF) ; 0 means FFFFH+1 ticks 

C
Success Indicator: 0

Possible errors: Timer handler cannot be modified or set.

Assembler
 'C' Clear if successful.

'C' Set if error. AX = Error code.

Possible errors: Timer handler cannot be modified or set 

Remarks
A physical device driver can use a timer handler to drive a non-interrupt device instead of using timeouts with the ProcBlock and ProcRun services. ProcBlock and ProcRun are costly on a character-by-character basis; the cost is one or more task switches for each character I/O. Timer handlers are required to save and restore registers. While a timer handler is in the format of a far call/return routine, it operates at interrupt time. The timer handler is analogous to the user timer (INT 1Ch) handler. As with any handler that runs in an interrupt context, care must be taken to make the execution path as short as possible.

For a new timer handler, TickCount registers the timer handler to be called on every n timer ticks instead of every timer tick. For a previously registered timer handler, TickCount changes the number of ticks that must take place before the timer handler gets control. This allows physical device drivers to support the timeout function without needing to count ticks.

At task time, this DevHlp can be used to modify a timer handler registered through SetTimer, or to register a new timer handler that is initially invoked every n ticks. In user mode (task time), TickCount can be used only to modify a timer handler already registered. In interrupt mode (interrupt time), this service can be used only to modify a timer handler already registered. This allows an interrupt handler to reset the timing condition at interrupt time.

Notice that SetTimer sets a default of n ticks to 1. Multiple TickCount requests can be issued for a given timer handler, but only the last TickCount setting will be in effect. TickCount affects only the specified registered timer handler. It has no effect on other timer handlers. Timer handlers are responsible for saving and restoring registers on entry to and exit from this service. A maximum of 32 timer handlers are available in the system.

DS should be set to the physical device driver's data segment. If the physical device driver did a call to PhysToVirt referencing the DS register, it will restore DS to the original value.

C

 * 1) include "dhcalls.h"

USHORT APIENTRY DevHelp_TickCount( NPFN  TimerHandler,                                   USHORT TickCount ); 