Add a new rollover table for Original Xbox (base frequency is 1.125000 MHz).
This fixes potential time issues in kernel and drivers.
CORE-16216
--- /dev/null
+/*
+ * PROJECT: ReactOS Hardware Abstraction Layer
+ * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
+ * PURPOSE: PIT rollover table
+ * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
+ * Timo Kreuzer (timo.kreuzer@reactos.org)
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <hal.h>
+
+/* GLOBALS *******************************************************************/
+
+HALP_ROLLOVER HalpRolloverTable[15] =
+{
+ {1197, 10032}, /* 1 ms */
+ {2394, 20064},
+ {3591, 30096},
+ {4767, 39952},
+ {5964, 49984},
+ {7161, 60016},
+ {8358, 70048},
+ {9555, 80080},
+ {10731, 89936},
+ {11949, 100144},
+ {13125, 110000},
+ {14322, 120032},
+ {15519, 130064},
+ {16695, 139920},
+ {17892, 149952} /* 15 ms */
+};
/* INCLUDES ******************************************************************/
#include <hal.h>
+
#define NDEBUG
#include <debug.h>
#define PIT_LATCH 0x00
+extern HALP_ROLLOVER HalpRolloverTable[15];
+
LARGE_INTEGER HalpLastPerfCounter;
LARGE_INTEGER HalpPerfCounter;
ULONG HalpPerfCounterCutoff;
ULONG HalpNextMSRate = 14;
ULONG HalpLargestClockMS = 15;
-static struct _HALP_ROLLOVER
-{
- ULONG RollOver;
- ULONG Increment;
-} HalpRolloverTable[15] =
-{
- {1197, 10032},
- {2394, 20064},
- {3591, 30096},
- {4767, 39952},
- {5964, 49984},
- {7161, 60016},
- {8358, 70048},
- {9555, 80080},
- {10731, 89936},
- {11949, 100144},
- {13125, 110000},
- {14322, 120032},
- {15519, 130064},
- {16695, 139920},
- {17892, 149952}
-};
-
/* PRIVATE FUNCTIONS *********************************************************/
FORCEINLINE
TimerControl.BcdMode = FALSE;
/*
- * Program the PIT to generate a normal rate wave (Mode 3) on channel 0.
+ * Program the PIT to generate a normal rate wave (Mode 2) on channel 0.
* Channel 0 is used for the IRQ0 clock interval timer, and channel
* 1 is used for DRAM refresh.
*
VOID __cdecl HalpClockInterrupt(VOID);
VOID __cdecl HalpProfileInterrupt(VOID);
+typedef struct _HALP_ROLLOVER
+{
+ ULONG RollOver;
+ ULONG Increment;
+} HALP_ROLLOVER, *PHALP_ROLLOVER;
+
VOID
NTAPI
HalpCalibrateStallExecution(VOID);
../legacy/bussupp.c
../generic/beep.c
../generic/bios.c
+ ../generic/clock.c
../generic/cmos.c
../generic/dma.c
../generic/display.c
up/pic.S)
list(APPEND HAL_PIC_SOURCE
+ generic/clock.c
generic/profil.c
generic/timer.c
up/halinit_up.c
legacy/halpcat.c
generic/profil.c
generic/timer.c
+ xbox/clock.c
xbox/part_xbox.c
xbox/halinit_xbox.c
xbox/reboot.c
--- /dev/null
+/*
+ * PROJECT: Xbox HAL
+ * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
+ * PURPOSE: PIT rollover table
+ * COPYRIGHT: Copyright 2020 Dmitry Borisov (di.sean@protonmail.com)
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <hal.h>
+
+/* GLOBALS *******************************************************************/
+
+HALP_ROLLOVER HalpRolloverTable[15] =
+{
+ {1125, 10000}, /* 1 ms */
+ {2250, 20000},
+ {3375, 30000},
+ {4500, 40000},
+ {5625, 50000},
+ {6750, 60000},
+ {7875, 70000},
+ {9000, 80000},
+ {10125, 90000},
+ {11250, 100000},
+ {12375, 110000},
+ {13500, 120000},
+ {14625, 130000},
+ {15750, 140000},
+ {16875, 150000} /* 15 ms */
+};