https://git.reactos.org/?p=reactos.git;a=commitdiff;h=aedb97df472ef547443654...
commit aedb97df472ef5474436542a3bf0a81402ec5dd1 Author: Timo Kreuzer timo.kreuzer@reactos.org AuthorDate: Wed Jul 7 21:58:23 2021 +0200 Commit: Timo Kreuzer timo.kreuzer@reactos.org CommitDate: Mon Jul 19 23:05:03 2021 +0200
[HAL/APIC] Use APIC_CLOCK_VECTOR everywhere, instead of keeping separate definitions --- hal/halx86/apic/rtctimer.c | 4 ++-- hal/halx86/apic/tsc.c | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/hal/halx86/apic/rtctimer.c b/hal/halx86/apic/rtctimer.c index 2d30ad55c43..f4761c5d31f 100644 --- a/hal/halx86/apic/rtctimer.c +++ b/hal/halx86/apic/rtctimer.c @@ -12,12 +12,12 @@ /* INCLUDES *******************************************************************/
#include <hal.h> +#include "apicp.h" #define NDEBUG #include <debug.h>
/* GLOBALS ********************************************************************/
-const UCHAR HalpClockVector = 0xD1; BOOLEAN HalpClockSetMSRate; UCHAR HalpNextMSRate; UCHAR HalpCurrentRate = 9; /* Initial rate 9: 128 Hz / 7.8 ms */ @@ -141,7 +141,7 @@ HalpClockInterruptHandler(IN PKTRAP_FRAME TrapFrame) #endif
/* Start the interrupt */ - if (!HalBeginSystemInterrupt(CLOCK_LEVEL, HalpClockVector, &Irql)) + if (!HalBeginSystemInterrupt(CLOCK_LEVEL, APIC_CLOCK_VECTOR, &Irql)) { /* Spurious, just end the interrupt */ KiEoiHelper(TrapFrame); diff --git a/hal/halx86/apic/tsc.c b/hal/halx86/apic/tsc.c index 1ff881206fd..9963156caac 100644 --- a/hal/halx86/apic/tsc.c +++ b/hal/halx86/apic/tsc.c @@ -10,6 +10,7 @@
#include <hal.h> #include "tsc.h" +#include "apicp.h" #define NDEBUG #include <debug.h>
@@ -17,10 +18,9 @@ LARGE_INTEGER HalpCpuClockFrequency = {{INITIAL_STALL_COUNT * 1000000}};
UCHAR TscCalibrationPhase; ULONG64 TscCalibrationArray[NUM_SAMPLES]; -UCHAR HalpRtcClockVector = 0xD1;
#define RTC_MODE 6 /* Mode 6 is 1024 Hz */ -#define SAMPLE_FREQENCY ((32768 << 1) >> RTC_MODE) +#define SAMPLE_FREQUENCY ((32768 << 1) >> RTC_MODE)
/* PRIVATE FUNCTIONS *********************************************************/
@@ -44,7 +44,7 @@ DoLinearRegression( }
/* Account for sample frequency */ - SumXY *= SAMPLE_FREQENCY; + SumXY *= SAMPLE_FREQUENCY;
/* Return the quotient of the sums */ return (SumXY + (SumXX/2)) / SumXX; @@ -72,22 +72,22 @@ HalpInitializeTsc(VOID) RegisterB = HalpReadCmos(RTC_REGISTER_B); HalpWriteCmos(RTC_REGISTER_B, RegisterB | RTC_REG_B_PI);
- /* Modify register A to RTC_MODE to get SAMPLE_FREQENCY */ + /* Modify register A to RTC_MODE to get SAMPLE_FREQUENCY */ RegisterA = HalpReadCmos(RTC_REGISTER_A); RegisterA = (RegisterA & 0xF0) | RTC_MODE; HalpWriteCmos(RTC_REGISTER_A, RegisterA);
/* Save old IDT entry */ - PreviousHandler = KeQueryInterruptHandler(HalpRtcClockVector); + PreviousHandler = KeQueryInterruptHandler(APIC_CLOCK_VECTOR);
/* Set the calibration ISR */ - KeRegisterInterruptHandler(HalpRtcClockVector, TscCalibrationISR); + KeRegisterInterruptHandler(APIC_CLOCK_VECTOR, TscCalibrationISR);
/* Reset TSC value to 0 */ __writemsr(MSR_RDTSC, 0);
/* Enable the timer interrupt */ - HalEnableSystemInterrupt(HalpRtcClockVector, CLOCK_LEVEL, Latched); + HalEnableSystemInterrupt(APIC_CLOCK_VECTOR, CLOCK_LEVEL, Latched);
/* Read register C, so that the next interrupt can happen */ HalpReadCmos(RTC_REGISTER_C); @@ -101,10 +101,10 @@ HalpInitializeTsc(VOID) HalpWriteCmos(RTC_REGISTER_B, RegisterB & ~RTC_REG_B_PI);
/* Disable the timer interrupt */ - HalDisableSystemInterrupt(HalpRtcClockVector, CLOCK_LEVEL); + HalDisableSystemInterrupt(APIC_CLOCK_VECTOR, CLOCK_LEVEL);
/* Restore the previous handler */ - KeRegisterInterruptHandler(HalpRtcClockVector, PreviousHandler); + KeRegisterInterruptHandler(APIC_CLOCK_VECTOR, PreviousHandler);
/* Calculate an average, using simplified linear regression */ HalpCpuClockFrequency.QuadPart = DoLinearRegression(NUM_SAMPLES - 1,