Download kernel/src/timer/mod.rs from monika-p/VyronOS: direct link, hf CLI and curl.
- Browser
- Download file 868 Bytes
-
https://huggingface.co/datasets/monika-p/VyronOS/resolve/main/kernel/src/timer/mod.rs
- Command line
-
hf download hf://datasets/monika-p/VyronOS/kernel/src/timer/mod.rs
-
curl -L -o mod.rs https://huggingface.co/datasets/monika-p/VyronOS/resolve/main/kernel/src/timer/mod.rs
868 Bytes
| // ============================================================================== | |
| // VYRON Micro-OS - Timer Interrupt & Preemption Subsystem | |
| // Layer 6: Timer-Driven Scheduling | |
| // ============================================================================== | |
| pub struct HardwareTimer { | |
| pub tick_interval_ms: u32, | |
| pub ticks_fired: u64, | |
| pub is_enabled: bool, | |
| } | |
| impl HardwareTimer { | |
| pub fn new(interval_ms: u32) -> Self { | |
| Self { | |
| tick_interval_ms: interval_ms, | |
| ticks_fired: 0, | |
| is_enabled: true, | |
| } | |
| } | |
| pub fn trigger_interrupt(&mut self) -> u64 { | |
| if self.is_enabled { | |
| self.ticks_fired += 1; | |
| } | |
| self.ticks_fired | |
| } | |
| pub fn disable(&mut self) { | |
| self.is_enabled = false; | |
| } | |
| pub fn enable(&mut self) { | |
| self.is_enabled = true; | |
| } | |
| } | |