DevHelp SetTimer

From EDM2
Jump to: navigation, search

This service adds a timer handler to the list of timer handlers to be called on a timer tick.

Syntax

C

USHORT APIENTRY DevHelp_SetTimer( NPFN TimerHandler );

Assembler

MOV   AX,OFFSET CS:timer_handler     ; Offset of timer handler.
MOV   DL,DevHlp_SetTimer

CALL  [Device_Help]

Parameters

C

Timerhandler (NPFN)
Offset of timer handler

Assembler

MOV   AX,OFFSET CS:timer_handler     ; Offset of timer handler.

Return Code

C

Success Indicator: Clear if successful.

Possible errors: Timer handler disallowed (The maximum number of handlers has been reached or the timer handler is already set).

Assembler

 'C' Clear if successful.

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

Possible errors: Timer handler disallowed (the maximum number of handlers has been reached or the timer handler is already set)

Remarks

This function is a subset of the DevHlp_TickCount. SetTimer allows a physical device driver to add a timer handler to a list of timer handlers called on every timer tick. 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.

A maximum of 32 timer handlers are available in the system. While a timer handler is in the format of a far call/return routine, it operates in interrupt state. The timer handler is analogous to the user timer (INT 1Ch) handler. Care should be taken not to remain in the handler very long. Timer handlers are responsible for saving and restoring registers on entry to and exit from this function.

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

Example Code

C

#include  "dhcalls.h"

USHORT APIENTRY DevHelp_SetTimer( NPFN TimerHandler );

Related Functions