ReactOS 0.4.15-dev-8102-g108db8f
timer.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS TDI driver
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: drivers/network/tdi/cte/timer.c
5 * PURPOSE: CTE timer support
6 * PROGRAMMERS: Oleg Baikalow (obaikalow@gmail.com)
7 */
8
9/* INCLUDES *****************************************************************/
10
11#include "precomp.h"
12
13/* FIXME: Move to a common header! */
16
17typedef struct _CTE_TIMER
18{
26
28
29/* FUNCTIONS *****************************************************************/
30
31VOID
37{
39
40 /* Call our registered callback */
41 Timer->Callback((struct _CTE_DELAYED_EVENT *)Timer, Timer->Context);
42}
43
44/*
45 * @implemented
46 */
47VOID
50{
51 /* Zero all fields */
53
54 /* Create a DPC and a timer */
57}
58
59/*
60 * @implemented
61 */
65 ULONG DueTimeShort,
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}
87
88
89/*
90 * @implemented
91 */
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}
106
107/*
108 * @implemented
109 */
111NTAPI
113{
114 /* Just return success */
115 return TRUE;
116}
117
118/* EOF */
unsigned char BOOLEAN
#define TRUE
Definition: types.h:120
VOID NTAPI KeInitializeDpc(IN PKDPC Dpc, IN PKDEFERRED_ROUTINE DeferredRoutine, IN PVOID DeferredContext)
Definition: dpc.c:712
void(* CTE_WORKER_ROUTINE)(struct _CTE_DELAYED_EVENT *, void *Context)
Definition: timer.c:15
BOOLEAN NTAPI CTEInitialize(VOID)
Definition: timer.c:112
LONG CteTimeIncrement
Definition: timer.c:27
BOOLEAN NTAPI CTEStartTimer(PCTE_TIMER Timer, ULONG DueTimeShort, CTE_WORKER_ROUTINE Callback, PVOID Context)
Definition: timer.c:64
VOID NTAPI CTEInitTimer(PCTE_TIMER Timer)
Definition: timer.c:49
struct _CTE_TIMER CTE_TIMER
VOID NTAPI InternalDpcRoutine(PKDPC Dpc, PVOID Context, PVOID SystemArgument1, PVOID SystemArgument2)
Definition: timer.c:33
ULONG NTAPI CTESystemUpTime(VOID)
Definition: timer.c:94
struct _CTE_TIMER * PCTE_TIMER
ULONG KSPIN_LOCK
Definition: env_spec_w32.h:72
#define ASSERT(a)
Definition: mode.c:44
#define Int32x32To64(a, b)
long LONG
Definition: pedump.c:60
#define KeQueryTickCount(CurrentCount)
Definition: ke.h:43
KTIMER Timer
Definition: timer.c:24
PVOID Context
Definition: timer.c:22
CTE_WORKER_ROUTINE Callback
Definition: timer.c:21
KDPC Dpc
Definition: timer.c:23
KSPIN_LOCK Lock
Definition: timer.c:20
BOOLEAN Queued
Definition: timer.c:19
Definition: ketypes.h:699
BOOLEAN NTAPI KeSetTimer(IN OUT PKTIMER Timer, IN LARGE_INTEGER DueTime, IN PKDPC Dpc OPTIONAL)
Definition: timerobj.c:281
VOID NTAPI KeInitializeTimer(OUT PKTIMER Timer)
Definition: timerobj.c:233
#define NTAPI
Definition: typedefs.h:36
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint32_t ULONG
Definition: typedefs.h:59
LONGLONG QuadPart
Definition: typedefs.h:114
ULONG LowPart
Definition: typedefs.h:106
_Must_inspect_result_ _In_ PWDF_DPC_CONFIG _In_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFDPC * Dpc
Definition: wdfdpc.h:112
_In_ WDFINTERRUPT _In_ PFN_WDF_INTERRUPT_SYNCHRONIZE Callback
Definition: wdfinterrupt.h:458
_In_ WDFTIMER _In_ LONGLONG DueTime
Definition: wdftimer.h:190
_In_opt_ PVOID _In_opt_ PVOID SystemArgument1
Definition: ketypes.h:688
_In_opt_ PVOID _In_opt_ PVOID _In_opt_ PVOID SystemArgument2
Definition: ketypes.h:689