use crate::CriticalSection;
use core::ffi::CStr;
pub mod fs;
pub mod gamepad;
pub mod heap;
pub mod kernel;
pub mod rng;
pub mod tty;
pub unsafe fn critical_section<F: FnMut(&mut CriticalSection) -> R, R>(mut f: F) -> R {
let changed_state = unsafe { kernel::psx_enter_critical_section() };
let mut cs = unsafe { CriticalSection::new() };
let res = f(&mut cs);
if changed_state {
unsafe {
kernel::psx_exit_critical_section();
}
};
res
}
pub fn get_system_version() -> &'static CStr {
let version = unsafe { kernel::psx_get_system_info(2) as *const i8 };
unsafe { CStr::from_ptr(version) }
}
pub fn get_system_date() -> u32 {
unsafe { kernel::psx_get_system_info(0) }
}