xref: /reactos/hal/halx86/apic/apictimer.c (revision 60eea2d7)
1 /*
2  * PROJECT:         ReactOS HAL
3  * LICENSE:         GPL - See COPYING in the top level directory
4  * FILE:            hal/halx86/apic/apictimer.c
5  * PURPOSE:         System Profiling
6  * PROGRAMMERS:     Timo Kreuzer (timo.kreuzer@reactos.org)
7  */
8 
9 /* INCLUDES ******************************************************************/
10 
11 #include <hal.h>
12 #define NDEBUG
13 #include <debug.h>
14 
15 #include "apic.h"
16 
17 extern LARGE_INTEGER HalpCpuClockFrequency;
18 
19 /* TIMER FUNCTIONS ************************************************************/
20 
21 VOID
22 NTAPI
23 ApicSetTimerInterval(ULONG MicroSeconds)
24 {
25     LVT_REGISTER LvtEntry;
26     ULONGLONG TimerInterval;
27 
28     /* Calculate the Timer interval */
29     TimerInterval = HalpCpuClockFrequency.QuadPart * MicroSeconds / 1000000;
30 
31     /* Set the count interval */
32     ApicWrite(APIC_TICR, (ULONG)TimerInterval);
33 
34     /* Set to periodic */
35     LvtEntry.Long = 0;
36     LvtEntry.TimerMode = 1;
37     LvtEntry.Vector = APIC_PROFILE_VECTOR;
38     LvtEntry.Mask = 0;
39     ApicWrite(APIC_TMRLVTR, LvtEntry.Long);
40 
41 }
42 
43 VOID
44 NTAPI
45 ApicInitializeTimer(ULONG Cpu)
46 {
47 
48     /* Initialize the TSC */
49     //HalpInitializeTsc();
50 
51     /* Set clock multiplier to 1 */
52     ApicWrite(APIC_TDCR, TIMER_DV_DivideBy1);
53 
54     ApicSetTimerInterval(1000);
55 
56 // KeSetTimeIncrement
57 }
58 
59 
60 /* PUBLIC FUNCTIONS ***********************************************************/
61 
62 VOID
63 NTAPI
64 HalStartProfileInterrupt(IN KPROFILE_SOURCE ProfileSource)
65 {
66     UNIMPLEMENTED;
67     return;
68 }
69 
70 VOID
71 NTAPI
72 HalStopProfileInterrupt(IN KPROFILE_SOURCE ProfileSource)
73 {
74     UNIMPLEMENTED;
75     return;
76 }
77 
78 ULONG_PTR
79 NTAPI
80 HalSetProfileInterval(IN ULONG_PTR Interval)
81 {
82     UNIMPLEMENTED;
83     return Interval;
84 }
85