https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e5c00524662f1396a88941...
commit e5c00524662f1396a889411fd7dfa81403121de7 Author: disean di.sean@protonmail.com AuthorDate: Tue Jan 14 23:47:36 2020 +0600 Commit: Hermès BÉLUSCA - MAÏTO hermes.belusca-maito@reactos.org CommitDate: Tue Jan 14 18:47:36 2020 +0100
[HAL][FREELDR] Fix system timer oscillator frequency on a Xbox (#2245)
See https://xboxdevwiki.net/Porting_an_Operating_System_to_the_Xbox_HOWTO#Timer_... --- boot/freeldr/freeldr/arch/i386/hardware.c | 7 ++++++- hal/halx86/include/halp.h | 10 +++++++++- 2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/boot/freeldr/freeldr/arch/i386/hardware.c b/boot/freeldr/freeldr/arch/i386/hardware.c index 0cac33d4986..67074c0fd30 100644 --- a/boot/freeldr/freeldr/arch/i386/hardware.c +++ b/boot/freeldr/freeldr/arch/i386/hardware.c @@ -27,8 +27,13 @@ DBG_DEFAULT_CHANNEL(HWDETECT); #define MILLISEC (10) #define PRECISION (8)
+#if defined(SARCH_XBOX) +#define CLOCK_TICK_RATE 1125000 +#else +#define CLOCK_TICK_RATE 1193182 +#endif + #define HZ (100) -#define CLOCK_TICK_RATE (1193182) #define LATCH (CLOCK_TICK_RATE / HZ)
static unsigned int delay_count = 1; diff --git a/hal/halx86/include/halp.h b/hal/halx86/include/halp.h index 9c03a96f43d..0ef52df2a93 100644 --- a/hal/halx86/include/halp.h +++ b/hal/halx86/include/halp.h @@ -86,11 +86,18 @@ VOID // #define GRAPHICS_MODE_12 0x12 /* 80x30 8x16 640x480 16/256K */
+#if defined(SARCH_XBOX) +// +// For some unknown reason the PIT of the Xbox is fixed at 1.125000 MHz, +// which is ~5.7% lower than on the PC. +// +#define PIT_FREQUENCY 1125000 +#else // // Commonly stated as being 1.19318MHz // // See ISA System Architecture 3rd Edition (Tom Shanley, Don Anderson, John Swindle) -// P. 471 +// p. 471 // // However, the true value is closer to 1.19318181[...]81MHz since this is 1/3rd // of the NTSC color subcarrier frequency which runs at 3.57954545[...]45MHz. @@ -104,6 +111,7 @@ VOID // number is quite long. // #define PIT_FREQUENCY 1193182 +#endif
// // These ports are controlled by the i8254 Programmable Interrupt Timer (PIT)