diff --git a/ableos/src/scratchpad.rs b/ableos/src/scratchpad.rs index 6c36f288..93b55149 100644 --- a/ableos/src/scratchpad.rs +++ b/ableos/src/scratchpad.rs @@ -1,14 +1,49 @@ -use core::alloc::Layout; - use crate::arch::interrupts::{reset_pit_for_cpu, set_pit_2}; -use crate::devices::{pci, pci_inner}; -use crate::encoding::bin; -use crate::port_io::{read32, read8, write8}; +use crate::filesystem::FILE_SYSTEM; use crate::rhai_shell::shell; +use crate::rhai_shell::KEYBUFF; use crate::wasm_jumploader::run_program; use acpi::{AcpiTables, PlatformInfo}; +use cpuio::inb; use cpuio::outb; use genfs::Fs; +use genfs::OpenOptions; + +// TODO: move to a better place +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct AcpiStruct {} +impl acpi::AcpiHandler for AcpiStruct { + unsafe fn map_physical_region( + &self, + physical_address: usize, + size: usize, + ) -> acpi::PhysicalMapping { + info!("PHYS ADDR: {:?}", physical_address); + info!("Size: {:?}", size); + todo!("map_physical_region"); + } + fn unmap_physical_region(_region: &acpi::PhysicalMapping) { + todo!("unmap_physical_region"); + } +} + +pub struct Path { + pub path: Vec, +} + +impl Path { + pub fn new(path: String) -> Self { + let mut path_vec_string = vec![]; + + for part in path.split(&['\\', '/'][..]) { + path_vec_string.push(part.to_string()); + } + + Path { + path: path_vec_string, + } + } +} /// Experimental scratchpad for testing. pub fn scratchpad() { @@ -50,7 +85,6 @@ pub fn scratchpad() { real_shell(); } -use crate::port_io::write16; pub fn acpi() { let acpi_handler = AcpiStruct {}; @@ -62,33 +96,13 @@ pub fn acpi() { PlatformInfo { power_profile, interrupt_model, - processor_info, - pm_timer, + .. } => { info!("{:?}", power_profile); info!("{:?}", interrupt_model); // info!("{:?}", processor_info.unwrap()); // info!("{:?}", pm_timer.unwrap()); } - - _ => todo!(), - } -} -// TODO: move to a better place -#[derive(Clone, Copy, Debug, PartialEq, Eq)] -pub struct AcpiStruct {} -impl acpi::AcpiHandler for AcpiStruct { - unsafe fn map_physical_region( - &self, - physical_address: usize, - size: usize, - ) -> acpi::PhysicalMapping { - info!("PHYS ADDR: {:?}", physical_address); - info!("Size: {:?}", size); - todo!("map_physical_region"); - } - fn unmap_physical_region(_region: &acpi::PhysicalMapping) { - todo!("unmap_physical_region"); } } @@ -130,7 +144,6 @@ pub fn real_shell() { } } } -use crate::rhai_shell::KEYBUFF; pub fn command_parser(user: String, command: String) { let fs = &*FILE_SYSTEM.lock(); @@ -201,9 +214,6 @@ pub fn command_parser(user: String, command: String) { } } -use crate::filesystem::FILE_SYSTEM; -use genfs::OpenOptions; - pub fn sound(n_frequency: u32) { let div: u32; let tmp: u8; @@ -229,22 +239,3 @@ pub fn sound_off() { }; reset_pit_for_cpu(); } - -use cpuio::inb; - -pub struct Path { - pub path: Vec, -} -impl Path { - pub fn new(path: String) -> Self { - let mut path_vec_string = vec![]; - - for part in path.split(&['\\', '/'][..]) { - path_vec_string.push(part.to_string()); - } - - Path { - path: path_vec_string, - } - } -}