2024-12-04 18:28:27 +02:00
|
|
|
#![feature(trait_alias)]
|
2023-08-13 21:23:58 +03:00
|
|
|
#![no_std]
|
2024-07-27 14:49:20 +03:00
|
|
|
#![allow(clippy::new_without_default)]
|
2023-08-13 21:23:58 +03:00
|
|
|
|
|
|
|
extern crate alloc;
|
|
|
|
|
2024-12-13 23:35:17 +02:00
|
|
|
pub mod bus;
|
2024-12-16 22:06:40 +02:00
|
|
|
pub mod clock;
|
2023-08-13 21:23:58 +03:00
|
|
|
pub mod device;
|
|
|
|
pub mod interrupt;
|
|
|
|
pub mod serial;
|
|
|
|
pub mod timer;
|
|
|
|
|
2025-02-06 12:24:03 +02:00
|
|
|
pub mod dma;
|
|
|
|
|
2024-12-10 11:52:26 +02:00
|
|
|
use device::Device;
|
2023-08-13 21:23:58 +03:00
|
|
|
use yggdrasil_abi::error::Error;
|
|
|
|
|
|
|
|
pub trait CpuBringupDevice: Device {
|
|
|
|
/// Starts a CPU with given index, providing it with some argument value and instruction
|
|
|
|
/// pointer from which its execution should begin.
|
|
|
|
///
|
|
|
|
/// # Safety
|
|
|
|
///
|
|
|
|
/// This function is unsafe because it can have unexpected effects on the system state if
|
|
|
|
/// misused.
|
|
|
|
unsafe fn start_cpu(&self, id: usize, ip: usize, arg0: usize) -> Result<(), Error>;
|
|
|
|
}
|
2023-08-15 18:38:54 +03:00
|
|
|
|
|
|
|
pub trait ResetDevice: Device {
|
2023-08-21 17:26:44 +03:00
|
|
|
/// Performs a system reset.
|
|
|
|
///
|
|
|
|
/// # Safety
|
|
|
|
///
|
|
|
|
/// The kernel must ensure it is actually safe to perform a reset, no critical operations
|
|
|
|
/// are aborted and no data is lost.
|
2023-08-15 18:38:54 +03:00
|
|
|
unsafe fn reset(&self) -> !;
|
|
|
|
}
|