#[cfg(any(target_env = "v5", target_env = "exp"))]
use core::ffi::c_void;
#[cfg(any(target_env = "v5", target_env = "exp"))]
use crate::{map_jump_table, JUMP_TABLE_START};
#[repr(C, packed)]
#[derive(Copy, Clone, Eq, PartialEq, Debug)]
pub struct vcodesig {
pub magic: u32,
pub r#type: u32,
pub owner: u32,
pub options: u32,
}
impl Default for vcodesig {
fn default() -> Self {
vcodesig {
magic: V5_SIG_MAGIC,
r#type: Default::default(),
owner: Default::default(),
options: Default::default(),
}
}
}
pub const V5_SIG_MAGIC: u32 = 0x35585658;
pub const EX_SIG_MAGIC: u32 = 0x45585658;
pub const V5_SIG_TYPE_USER: u32 = 0;
pub const V5_SIG_OWNER_SYS: u32 = 0;
pub const V5_SIG_OWNER_VEX: u32 = 1;
pub const V5_SIG_OWNER_PARTNER: u32 = 2;
pub const V5_SIG_OPTIONS_NONE: u32 = 0;
pub const V5_SIG_OPTIONS_INDG: u32 = 1 << 0;
pub const V5_SIG_OPTIONS_EXIT: u32 = 1 << 1;
pub const V5_SIG_OPTIONS_THDG: u32 = 1 << 2;
#[repr(C)]
#[derive(Default, Debug, Copy, Clone, Eq, PartialEq)]
pub struct time {
pub ti_hour: u8,
pub ti_min: u8,
pub ti_sec: u8,
pub ti_hund: u8,
}
#[repr(C)]
#[derive(Default, Debug, Copy, Clone, Eq, PartialEq)]
pub struct date {
pub da_year: u16,
pub da_day: u8,
pub da_mon: u8,
}
#[cfg(any(target_env = "v5", target_env = "exp"))]
map_jump_table! {
0x10 => pub fn vexStdlibMismatchError(param_1: u32, param_2: u32),
0x01c =>
pub fn vexScratchMemoryPtr(ptr: *mut *mut core::ffi::c_void) -> i32,
0x998 => pub fn vexScratchMemoryLock() -> bool,
0x99c => pub fn vexScratchMemoryUnock(),
0x118 =>
pub fn vexSystemTimeGet() -> u32,
0x11c => pub fn vexGettime() -> time,
0x120 => pub fn vexGetdate() -> date,
0x124 => pub fn vexSystemMemoryDump(),
0x128 => pub fn vexSystemDigitalIO(pin: u32, value: u32),
0x12c => pub fn vexSystemStartupOptions() -> u32,
0x130 =>
pub fn vexSystemExitRequest(),
0x134 =>
pub fn vexSystemHighResTimeGet() -> u64,
0x138 =>
pub fn vexSystemPowerupTimeGet() -> u64,
0x13c =>
pub fn vexSystemLinkAddrGet() -> u32,
0x174 => pub fn vexSystemUsbStatus() -> u32,
0x8c0 => pub fn vexSystemTimerStop(),
0x8c4 => pub fn vexSystemTimerClearInterrupt(),
0x8c8 => pub fn vexSystemTimerReinitForRtos(priority: u32, handler: extern "aapcs" fn(data: *mut c_void)) -> i32,
0x8cc => pub fn vexSystemApplicationIRQHandler(ulICCIAR: u32),
0x8d0 => pub fn vexSystemWatchdogReinitRtos() -> i32,
0x8d4 => pub fn vexSystemWatchdogGet() -> u32,
0x910 => pub fn vexSystemBoot(),
0x914 => pub fn vexSystemUndefinedException(),
0x918 => pub fn vexSystemFIQInterrupt(),
0x91c => pub fn vexSystemIQRQnterrupt(),
0x920 => pub fn vexSystemSWInterrupt(),
0x924 => pub fn vexSystemDataAbortInterrupt(),
0x928 => pub fn vexSystemPrefetchAbortInterrupt(),
}
#[cfg(any(target_env = "v5", target_env = "exp"))]
pub unsafe extern "aapcs" fn vexSystemVersion() -> u32 {
unsafe { core::ptr::read_volatile((JUMP_TABLE_START + 0x1000) as *const u32) }
}
#[cfg(any(target_env = "v5", target_env = "exp"))]
pub unsafe extern "aapcs" fn vexStdlibVersion() -> u32 {
unsafe { core::ptr::read_volatile((JUMP_TABLE_START + 0x1004) as *const u32) }
}