Skip to content

Commit aedb97d

Browse files
committed
[HAL/APIC] Use APIC_CLOCK_VECTOR everywhere, instead of keeping separate definitions
1 parent a559d83 commit aedb97d

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

hal/halx86/apic/rtctimer.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
/* INCLUDES *******************************************************************/
1313

1414
#include <hal.h>
15+
#include "apicp.h"
1516
#define NDEBUG
1617
#include <debug.h>
1718

1819
/* GLOBALS ********************************************************************/
1920

20-
const UCHAR HalpClockVector = 0xD1;
2121
BOOLEAN HalpClockSetMSRate;
2222
UCHAR HalpNextMSRate;
2323
UCHAR HalpCurrentRate = 9; /* Initial rate 9: 128 Hz / 7.8 ms */
@@ -141,7 +141,7 @@ HalpClockInterruptHandler(IN PKTRAP_FRAME TrapFrame)
141141
#endif
142142

143143
/* Start the interrupt */
144-
if (!HalBeginSystemInterrupt(CLOCK_LEVEL, HalpClockVector, &Irql))
144+
if (!HalBeginSystemInterrupt(CLOCK_LEVEL, APIC_CLOCK_VECTOR, &Irql))
145145
{
146146
/* Spurious, just end the interrupt */
147147
KiEoiHelper(TrapFrame);

hal/halx86/apic/tsc.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@
1010

1111
#include <hal.h>
1212
#include "tsc.h"
13+
#include "apicp.h"
1314
#define NDEBUG
1415
#include <debug.h>
1516

1617
LARGE_INTEGER HalpCpuClockFrequency = {{INITIAL_STALL_COUNT * 1000000}};
1718

1819
UCHAR TscCalibrationPhase;
1920
ULONG64 TscCalibrationArray[NUM_SAMPLES];
20-
UCHAR HalpRtcClockVector = 0xD1;
2121

2222
#define RTC_MODE 6 /* Mode 6 is 1024 Hz */
23-
#define SAMPLE_FREQENCY ((32768 << 1) >> RTC_MODE)
23+
#define SAMPLE_FREQUENCY ((32768 << 1) >> RTC_MODE)
2424

2525
/* PRIVATE FUNCTIONS *********************************************************/
2626

@@ -44,7 +44,7 @@ DoLinearRegression(
4444
}
4545

4646
/* Account for sample frequency */
47-
SumXY *= SAMPLE_FREQENCY;
47+
SumXY *= SAMPLE_FREQUENCY;
4848

4949
/* Return the quotient of the sums */
5050
return (SumXY + (SumXX/2)) / SumXX;
@@ -72,22 +72,22 @@ HalpInitializeTsc(VOID)
7272
RegisterB = HalpReadCmos(RTC_REGISTER_B);
7373
HalpWriteCmos(RTC_REGISTER_B, RegisterB | RTC_REG_B_PI);
7474

75-
/* Modify register A to RTC_MODE to get SAMPLE_FREQENCY */
75+
/* Modify register A to RTC_MODE to get SAMPLE_FREQUENCY */
7676
RegisterA = HalpReadCmos(RTC_REGISTER_A);
7777
RegisterA = (RegisterA & 0xF0) | RTC_MODE;
7878
HalpWriteCmos(RTC_REGISTER_A, RegisterA);
7979

8080
/* Save old IDT entry */
81-
PreviousHandler = KeQueryInterruptHandler(HalpRtcClockVector);
81+
PreviousHandler = KeQueryInterruptHandler(APIC_CLOCK_VECTOR);
8282

8383
/* Set the calibration ISR */
84-
KeRegisterInterruptHandler(HalpRtcClockVector, TscCalibrationISR);
84+
KeRegisterInterruptHandler(APIC_CLOCK_VECTOR, TscCalibrationISR);
8585

8686
/* Reset TSC value to 0 */
8787
__writemsr(MSR_RDTSC, 0);
8888

8989
/* Enable the timer interrupt */
90-
HalEnableSystemInterrupt(HalpRtcClockVector, CLOCK_LEVEL, Latched);
90+
HalEnableSystemInterrupt(APIC_CLOCK_VECTOR, CLOCK_LEVEL, Latched);
9191

9292
/* Read register C, so that the next interrupt can happen */
9393
HalpReadCmos(RTC_REGISTER_C);
@@ -101,10 +101,10 @@ HalpInitializeTsc(VOID)
101101
HalpWriteCmos(RTC_REGISTER_B, RegisterB & ~RTC_REG_B_PI);
102102

103103
/* Disable the timer interrupt */
104-
HalDisableSystemInterrupt(HalpRtcClockVector, CLOCK_LEVEL);
104+
HalDisableSystemInterrupt(APIC_CLOCK_VECTOR, CLOCK_LEVEL);
105105

106106
/* Restore the previous handler */
107-
KeRegisterInterruptHandler(HalpRtcClockVector, PreviousHandler);
107+
KeRegisterInterruptHandler(APIC_CLOCK_VECTOR, PreviousHandler);
108108

109109
/* Calculate an average, using simplified linear regression */
110110
HalpCpuClockFrequency.QuadPart = DoLinearRegression(NUM_SAMPLES - 1,

0 commit comments

Comments
 (0)