Jump to content

DevHlp SchedClock

From EDM2
Revision as of 23:21, 29 July 2018 by Martini (talk | contribs) (Created page with "This service allows the physical Clock$ device driver to obtain a pointer to the address of the system's clock tick handler, SchedClock. SchedClock must be called on each occu...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This service allows the physical Clock$ device driver to obtain a pointer to the address of the system's clock tick handler, SchedClock. SchedClock must be called on each occurrence of a periodic clock tick.

Syntax

C

USHORT APIENTRY DevHelp_SchedClock( PFN Near * SchedRoutineAddr );

Assembler

MOV   AX,Pointer_Save         ; Offset in DS to a DWORD where the
                                   pointer is returned
MOV   DL,DevHlp_SchedClock

CALL  [Device_Help]

Parameters

C

SchedRoutineAddr (NPFN)
Address of the system tick handler to be returned.

Assembler

MOV   AX,Pointer_Save         ; Offset in DS to a DWORD where the pointer is returned

Return Code

C

Success Indicator: SchedRoutineAddr will contain the address of the

                       system tick handler.

Possible errors: None.

Assembler

Pointer_Save will contain the address of the system tick handler.

Remarks

The physical Clock$ device driver calls this function during the physical Clock$ device driver's initialization. For input to this DevHlp, the physical Clock$ device driver must ensure that its DS points to its data segment, and it must supply the offset to a DWORD area. SchedClock then fills in the physical device driver's save area with a pointer to a DWORD in system memory. The DWORD in system memory contains the pointer to the SchedClock routine. This is shown in the following example:

  Device driver
  data segment
                    System SchedClock          System Timer
  Pointer_Save          pointer                  Handler
  ÚÄÄÄÄÄÄÄÄÄÄÄ¿    ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿    ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
  ³  pointer  ÃÄÄÄÄ� SchedClock_Addr ÃÄÄÄÄ� SchedClock routine ³
  ÀÄÄÄÄÄÄÄÄÄÄÄÙ    ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ    ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ

DWORD in System Memory

The physical device driver can use the pointer that is returned in Pointer_Save to call SchedClock. SchedClock is called by the physical Clock$ device driver with a CALL FAR INDIRECT, using the pointer to the area that contains the actual address of the SchedClock routine.

SchedClock must be called at interrupt time for each periodic clock tick to indicate the passage of system time. The tick is then dispersed to the appropriate components of the system. A definition of the interface to SchedClock follows:

MOV   AL,millisecs               ; Milliseconds since last call
MOV   DH,EOIflag                 ; Indicator of EOI
                                 ; = 0 prior to EOI
                                 ; = 1 after EOI
CALL  [pointer]                  ; Pointer to the area which contains the actual
                                 ; address of SchedClock

The Clock$ device driver's interrupt handler must run with interrupts enabled as the convention, prior to issuing an End-Of-Interrupt (EOI) for the timer interrupt. Any critical processing, such as updating the fraction-of-seconds count, must be done prior to calling SchedClock. SchedClock must then be called to allow system processing prior to the dismissal of the interrupt. When SchedClock returns, the Clock$ device driver must issue the EOI and call SchedClock again. Notice that once the EOI has been issued, the device driver's interrupt handler can be reentered. SchedClock is also reentrant.

The physical device driver must not get the actual address of the SchedClock routine, but instead use the pointer returned by SchedClock.

Example Code

C

 #include  "dhcalls.h"

USHORT APIENTRY DevHelp_SchedClock( PFN Near * SchedRoutineAddr );

Related Functions