From 111606ccdcfc40d336f21b32614c4926f3fba73c Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Tue, 15 Nov 2022 11:50:23 -0700 Subject: [PATCH] Increase PIT divisor again to reduce wasted interrupt handling time --- src/arch/x86/device/pit.rs | 4 ++-- src/arch/x86_64/device/pit.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/arch/x86/device/pit.rs b/src/arch/x86/device/pit.rs index 7cd74a5..3e0c519 100644 --- a/src/arch/x86/device/pit.rs +++ b/src/arch/x86/device/pit.rs @@ -13,8 +13,8 @@ const MODE_2: u8 = 0b010 << 1; // 1 / (1.193182 MHz) = 838,095,110 femtoseconds ~= 838.095 ns pub const PERIOD_FS: u128 = 838_095_110; -// 461 / (1.193182 MHz) = 3863618.00071 ns ~= 386 us or 2.588 kHz -pub const CHAN0_DIVISOR: u16 = 461; +// 4847 / (1.193182 MHz) = 4,062,247 ns ~= 4.1 ms or 246 Hz +pub const CHAN0_DIVISOR: u16 = 4847; // Calculated interrupt period in nanoseconds based on divisor and period pub const RATE: u128 = (CHAN0_DIVISOR as u128 * PERIOD_FS) / 1_000_000; diff --git a/src/arch/x86_64/device/pit.rs b/src/arch/x86_64/device/pit.rs index 7cd74a5..3e0c519 100644 --- a/src/arch/x86_64/device/pit.rs +++ b/src/arch/x86_64/device/pit.rs @@ -13,8 +13,8 @@ const MODE_2: u8 = 0b010 << 1; // 1 / (1.193182 MHz) = 838,095,110 femtoseconds ~= 838.095 ns pub const PERIOD_FS: u128 = 838_095_110; -// 461 / (1.193182 MHz) = 3863618.00071 ns ~= 386 us or 2.588 kHz -pub const CHAN0_DIVISOR: u16 = 461; +// 4847 / (1.193182 MHz) = 4,062,247 ns ~= 4.1 ms or 246 Hz +pub const CHAN0_DIVISOR: u16 = 4847; // Calculated interrupt period in nanoseconds based on divisor and period pub const RATE: u128 = (CHAN0_DIVISOR as u128 * PERIOD_FS) / 1_000_000;