ReactOS 0.4.15-dev-8231-g29a56f3
timer.c File Reference
#include "precomp.h"
Include dependency graph for timer.c:

Go to the source code of this file.

Classes

struct  _CTE_TIMER
 

Typedefs

typedef void(* CTE_WORKER_ROUTINE) (struct _CTE_DELAYED_EVENT *, void *Context)
 
typedef struct _CTE_TIMER CTE_TIMER
 
typedef struct _CTE_TIMERPCTE_TIMER
 

Functions

VOID NTAPI InternalDpcRoutine (PKDPC Dpc, PVOID Context, PVOID SystemArgument1, PVOID SystemArgument2)
 
VOID NTAPI CTEInitTimer (PCTE_TIMER Timer)
 
BOOLEAN NTAPI CTEStartTimer (PCTE_TIMER Timer, ULONG DueTimeShort, CTE_WORKER_ROUTINE Callback, PVOID Context)
 
ULONG NTAPI CTESystemUpTime (VOID)
 
BOOLEAN NTAPI CTEInitialize (VOID)
 

Variables

LONG CteTimeIncrement
 

Typedef Documentation

◆ CTE_TIMER

◆ CTE_WORKER_ROUTINE

typedef void(* CTE_WORKER_ROUTINE) (struct _CTE_DELAYED_EVENT *, void *Context)

Definition at line 15 of file timer.c.

◆ PCTE_TIMER

Function Documentation

◆ CTEInitialize()

BOOLEAN NTAPI CTEInitialize ( VOID  )

Definition at line 112 of file timer.c.

113{
114 /* Just return success */
115 return TRUE;
116}
#define TRUE
Definition: types.h:120

◆ CTEInitTimer()

VOID NTAPI CTEInitTimer ( PCTE_TIMER  Timer)

Definition at line 49 of file timer.c.

50{
51 /* Zero all fields */
53
54 /* Create a DPC and a timer */
57}
VOID NTAPI KeInitializeDpc(IN PKDPC Dpc, IN PKDEFERRED_ROUTINE DeferredRoutine, IN PVOID DeferredContext)
Definition: dpc.c:712
VOID NTAPI InternalDpcRoutine(PKDPC Dpc, PVOID Context, PVOID SystemArgument1, PVOID SystemArgument2)
Definition: timer.c:33
VOID NTAPI KeInitializeTimer(OUT PKTIMER Timer)
Definition: timerobj.c:233
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262

◆ CTEStartTimer()

BOOLEAN NTAPI CTEStartTimer ( PCTE_TIMER  Timer,
ULONG  DueTimeShort,
CTE_WORKER_ROUTINE  Callback,
PVOID  Context 
)

Definition at line 64 of file timer.c.

68{
70
71 /* Make sure a callback was provided */
73
74 /* We need to convert due time, because DueTimeShort is in ms,
75 but NT timer expects 100s of ns, negative one */
76 DueTime.QuadPart = -Int32x32To64(DueTimeShort, 10000);
77
78 /* Set other timer members */
79 Timer->Callback = Callback;
80 Timer->Context = Context;
81
82 /* Set the timer */
84
85 return TRUE;
86}
#define ASSERT(a)
Definition: mode.c:44
#define Int32x32To64(a, b)
BOOLEAN NTAPI KeSetTimer(IN OUT PKTIMER Timer, IN LARGE_INTEGER DueTime, IN PKDPC Dpc OPTIONAL)
Definition: timerobj.c:281
_In_ WDFINTERRUPT _In_ PFN_WDF_INTERRUPT_SYNCHRONIZE Callback
Definition: wdfinterrupt.h:458
_In_ WDFTIMER _In_ LONGLONG DueTime
Definition: wdftimer.h:190

◆ CTESystemUpTime()

ULONG NTAPI CTESystemUpTime ( VOID  )

Definition at line 94 of file timer.c.

95{
96 LARGE_INTEGER Ticks;
97
98 /* Get the tick count */
99 KeQueryTickCount(&Ticks);
100
101 /* Convert to 100s of ns and then to ms*/
102 Ticks.QuadPart = (Ticks.QuadPart * CteTimeIncrement) / 10000ULL;
103
104 return Ticks.LowPart;
105}
LONG CteTimeIncrement
Definition: timer.c:27
#define KeQueryTickCount(CurrentCount)
Definition: ke.h:43
LONGLONG QuadPart
Definition: typedefs.h:114
ULONG LowPart
Definition: typedefs.h:106

◆ InternalDpcRoutine()

VOID NTAPI InternalDpcRoutine ( PKDPC  Dpc,
PVOID  Context,
PVOID  SystemArgument1,
PVOID  SystemArgument2 
)

Definition at line 33 of file timer.c.

37{
39
40 /* Call our registered callback */
41 Timer->Callback((struct _CTE_DELAYED_EVENT *)Timer, Timer->Context);
42}
struct _CTE_TIMER * PCTE_TIMER

Referenced by CTEInitTimer().

Variable Documentation

◆ CteTimeIncrement

LONG CteTimeIncrement

Definition at line 27 of file timer.c.

Referenced by CTESystemUpTime(), and DriverEntry().