use core::ffi::c_void;
use bitflag_attr::bitflag;
use pspsdk_macros::psp_stub;
use crate::sys::{
mem::MemoryPartitionId, time::SystemClock, SceError, SceIntoOkValue, SceRawUid, SceResult,
SceResultOk, SceSize, SceUid,
};
pub use crate::sys::usersystemlib::{
sceKernelGetTlsAddr, sceKernelLockLwMutex, sceKernelLockLwMutexCB, sceKernelReferLwMutexStatus,
sceKernelTryLockLwMutex, sceKernelUnlockLwMutex,
};
#[repr(transparent)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
pub struct ThreadId(SceRawUid);
pub type ThreadEntryFn = unsafe extern "C" fn(args: SceSize, argp: *mut c_void) -> SceResult<u32>;
#[bitflag(u32)]
#[non_exhaustive]
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
pub enum ThreadAttributes {
UserMode = 0x80000000,
UsbWlanMode = 0xA0000000,
VshMode = 0xC0000000,
AppMode = 0xB0000000,
MsMode = 0x90000000,
NoFillStack = 0x00100000,
ClearStack = 0x00200000,
LowStack = 0x00400000,
UseScratchSRAM = 0x00008000,
UseVFPU = 0x00004000,
NeverUseFPU = 0x00002000,
}
#[bitflag(u32)]
#[non_exhaustive]
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
#[doc(alias("PspThreadStatus"))]
pub enum ThreadState {
#[doc(alias("PSP_THREAD_RUNNING"))]
Run = 0x01,
#[doc(alias("PSP_THREAD_READY"))]
Ready = 0x02,
#[doc(alias("PSP_THREAD_WAITING"))]
Wait = 0x04,
#[doc(alias("PSP_THREAD_SUSPEND"))]
Suspend = 0x08,
#[doc(alias("PSP_THREAD_STOPPED"))]
Dormant = 0x10,
#[doc(alias("PSP_THREAD_KILLED"))]
Dead = 0x20,
WaitSuspend = Wait | Suspend,
}
#[repr(u32)]
#[non_exhaustive]
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
pub enum ThreadWaitKind {
#[default]
#[doc(hidden)]
Unknown = 0x00,
Sleep = 0x01,
Delay = 0x02,
Semaphore = 0x03,
EventFlag = 0x04,
MessageBox = 0x05,
VariablePoolLength = 0x06,
FixedPoolLength = 0x07,
MessagePipe = 0x08,
WaitThreadEnd = 0x09,
ReleaseThreadEventHandler = 0x0A,
DeleteCallback = 0x0B,
Mutex = 0x0C,
LightweightMutex = 0x0D,
TLSPool = 0x0E,
SleepCallback = 0x101,
DelayCallback = 0x102,
SemaphoreCallback = 0x103,
EventFlagCallback = 0x104,
MessageBoxCallback = 0x105,
VariablePoolLengthCallback = 0x106,
FixedPoolLengthCallback = 0x107,
MessagePipeCallback = 0x108,
WaitThreadEndCallback = 0x109,
MutexCallback = 0x10C,
LightweightMutexCallback = 0x10D,
}
#[repr(C)]
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[doc(alias = "SceKernelThreadOptParam")]
pub struct ThreadOptions {
pub size: SceSize,
pub stack_mem_partition: MemoryPartitionId,
}
#[repr(C)]
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[doc(alias = "SceKernelThreadInfo")]
#[allow(unpredictable_function_pointer_comparisons)]
pub struct ThreadInfo {
pub size: SceSize,
pub name: [u8; 32],
pub attr: ThreadAttributes,
pub status: ThreadState,
pub entry: Option<ThreadEntryFn>,
pub stack: *mut c_void,
pub stack_size: SceSize,
pub gp_reg: *mut c_void,
pub init_priority: u32,
pub curr_priority: u32,
pub wait_kind: ThreadWaitKind,
pub wait_id: SceUid,
pub wakeup_count: u32,
pub exit_status: u32,
pub run_clocks: SystemClock,
pub intr_preempt_count: u32,
pub thread_preempt_count: u32,
pub release_count: u32,
pub notify_callback: u32,
}
#[repr(C)]
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[doc(alias = "SceKernelThreadRunStatus")]
pub struct ThreadRunStatus {
pub size: SceSize,
pub status: u32,
pub curr_priority: u32,
pub wait_kind: ThreadWaitKind,
pub wait_id: SceUid,
pub wakeup_count: u32,
pub run_clocks: SystemClock,
pub intr_preempt_count: u32,
pub thread_preempt_count: u32,
pub release_count: u32,
pub notify_callback: u32,
}
#[repr(transparent)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
pub struct SemaId(SceUid);
#[repr(C)]
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[doc(alias = "SceKernelSemaOptParam")]
pub struct SemaphoreOptions {
pub size: SceSize,
}
#[bitflag(u32)]
#[non_exhaustive]
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
pub enum SemaphoreAttributes {
#[default]
WaitByFIFO = 0x000,
WaitByPriority = 0x100,
}
#[repr(C)]
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[doc(alias = "SceKernelSemaInfo")]
pub struct SemaphoreInfo {
pub size: SceSize,
pub name: [u8; 32],
pub attr: SemaphoreAttributes,
pub init_val: i32,
pub curr_val: i32,
pub max_val: i32,
pub num_wait_threads: u32,
}
#[repr(transparent)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
pub struct EventFlagId(SceUid);
#[repr(C)]
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[doc(alias = "SceKernelEventFlagOptParam")]
pub struct EventFlagOptions {
pub size: SceSize,
}
#[bitflag(u32)]
#[non_exhaustive]
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
pub enum EventFlagAttributes {
#[default]
WaitSingle = 0x000,
WaitMultiple = 0x200,
}
#[bitflag(u32)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
pub enum EventFlagWaitKinds {
#[default]
And = 0x00,
Or = 0x01,
ClearAll = 0x10,
ClearPat = 0x20,
}
#[repr(C)]
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct EventFlagInfo {
pub size: SceSize,
pub name: [u8; 32],
pub attr: EventFlagAttributes,
pub init_pattern: u32,
pub curr_pattern: u32,
pub num_wait_threads: u32,
}
#[repr(transparent)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
pub struct MutexId(SceUid);
#[repr(C)]
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[doc(alias = "SceKernelMutexOptParam")]
pub struct MutexOptions {
pub size: SceSize,
}
#[bitflag(u32)]
#[non_exhaustive]
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
pub enum MutexAttributes {
#[default]
WaitByFIFO = 0x000,
WaitByPriority = 0x100,
ReentrantLock = 0x200,
}
#[repr(C)]
#[derive(Debug, Clone)]
#[doc(alias = "SceKernelMutexInfo")]
pub struct MutexInfo {
pub size: SceSize,
pub name: [u8; 32],
pub attr: MutexAttributes,
pub init_count: i32,
pub curr_count: i32,
pub curr_owner: SceUid,
pub num_wait_threads: u32,
}
#[repr(transparent)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
pub struct LwMutexId(SceUid);
#[repr(C)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
#[doc(alias = "SceKernelLwMutexWork")]
pub struct LwMutexWorkArea {
pub lock_count: i32,
pub lock_thread: ThreadId,
pub attr: MutexAttributes,
pub num_wait_threads: u32,
pub uid: LwMutexId,
pub pad: [u32; 3],
}
#[repr(C)]
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[doc(alias = "SceKernelLwMutexOptParam")]
pub struct LwMutexOptions {
pub size: SceSize,
}
#[repr(C)]
#[derive(Debug, Clone)]
#[doc(alias = "SceKernelLwMutexInfo")]
pub struct LwMutexInfo {
pub size: SceSize,
pub name: [u8; 32],
pub attr: MutexAttributes,
pub uid: LwMutexId,
pub work_addr: *mut LwMutexWorkArea,
pub init_count: i32,
pub curr_count: i32,
pub curr_owner: SceUid,
pub num_wait_threads: u32,
}
#[repr(transparent)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
pub struct MsgBoxId(SceUid);
#[repr(C)]
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[doc(alias = "SceKernelMbxOptParam")]
pub struct MsgBoxOptions {
pub size: SceSize,
}
#[repr(C)]
#[derive(Debug, Clone)]
#[doc(alias = "SceKernelMsgPacket")]
pub struct MsgPacket {
pub next: *mut MsgPacket,
pub msg_priority: u8,
pub dummy: [u8; 3],
}
#[bitflag(u32)]
#[non_exhaustive]
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
pub enum MsgBoxAttributes {
#[default]
WaitByFIFO = 0x000,
WaitByPriority = 0x100,
MsgByFIFO = 0x000,
MsgByPriority = 0x400,
}
#[repr(C)]
#[derive(Debug, Clone)]
#[doc(alias = "SceKernelMbxInfo")]
pub struct MsgBoxInfo {
pub size: SceSize,
pub name: [u8; 32],
pub attr: MsgBoxAttributes,
pub num_wait_threads: u32,
pub num_messages: u32,
pub top_msg: *mut MsgPacket,
}
#[repr(transparent)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
pub struct MsgPipeId(SceUid);
#[repr(C)]
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[doc(alias = "SceKernelMppOptParam")]
pub struct MsgPipeOptions {
pub size: SceSize,
}
#[bitflag(u32)]
#[non_exhaustive]
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
pub enum MsgPipeAttributes {
#[default]
SenderWaitByFIFO = 0x0000,
SenderWaitByPriority = 0x0100,
ReceiverWaitByFIFO = 0x0000,
ReceiverWaitByPriority = 0x1000,
MemBottom = 0x4000,
BothWaitByFIFO = SenderWaitByFIFO | ReceiverWaitByFIFO,
BothWaitByPriority = SenderWaitByPriority | ReceiverWaitByPriority,
}
#[repr(u32)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
pub enum MsgPipeWaitKind {
#[default]
Entire = 0x00,
Imediate = 0x01,
}
#[repr(C)]
#[derive(Debug, Clone)]
#[doc(alias = "SceKernelMppInfo")]
pub struct MsgPipeInfo {
pub size: SceSize,
pub name: [u8; 32],
pub attr: MsgPipeAttributes,
pub buf_size: SceSize,
pub buf_free_size: SceSize,
pub num_send_wait_threads: u32,
pub num_recv_wait_threads: u32,
}
#[repr(transparent)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
pub struct VplId(SceUid);
#[repr(C)]
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[doc(alias = "SceKernelVplOptParam")]
pub struct VplOptions {
pub size: SceSize,
}
#[bitflag(u32)]
#[non_exhaustive]
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
pub enum VplAttributes {
#[default]
WaitByFIFO = 0x0000,
WaitByPriority = 0x0100,
ThreadPass = 0x0200,
MemBottom = 0x4000,
}
#[repr(C)]
#[derive(Debug, Clone)]
#[doc(alias = "SceKernelVplInfo")]
pub struct VplInfo {
pub size: SceSize,
pub name: [u8; 32],
pub attr: VplAttributes,
pub pool_size: SceSize,
pub pool_free_size: SceSize,
pub num_wait_threads: u32,
}
#[repr(transparent)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
pub struct FplId(SceUid);
#[repr(C)]
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[doc(alias = "SceKernelFplOptParam")]
pub struct FplOptions {
pub size: SceSize,
pub alignment: SceSize,
}
#[bitflag(u32)]
#[non_exhaustive]
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
pub enum FplAttributes {
#[default]
WaitByFIFO = 0x0000,
WaitByPriority = 0x0100,
MemBottom = 0x4000,
}
#[repr(C)]
#[derive(Debug, Clone)]
#[doc(alias = "SceKernelFplInfo")]
pub struct FplInfo {
pub size: SceSize,
pub name: [u8; 32],
pub attr: FplAttributes,
pub block_size: SceSize,
pub num_blocks: SceSize,
pub free_blocks: SceSize,
pub num_wait_threads: u32,
}
#[repr(transparent)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
pub struct TlsPoolId(SceUid);
#[repr(C)]
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[doc(alias = "SceKernelTlsplOptParam")]
pub struct TlsPoolOptions {
pub size: SceSize,
pub alignment: SceSize,
}
#[bitflag(u32)]
#[non_exhaustive]
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
pub enum TlsPoolAttributes {
#[default]
WaitByFIFO = 0x0000,
WaitByPriority = 0x0100,
MemBottom = 0x4000,
}
#[repr(C)]
#[derive(Debug, Clone)]
#[doc(alias = "SceKernelTlsplInfo")]
pub struct TlsPoolInfo {
pub size: SceSize,
pub name: [u8; 32],
pub attr: TlsPoolAttributes,
pub block_size: SceSize,
pub num_blocks: SceSize,
pub free_blocks: SceSize,
pub num_wait_threads: u32,
}
#[repr(transparent)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
pub struct AlarmId(SceUid);
#[doc(alias("SceKernelAlarmHandler"))]
pub type AlarmHandler = unsafe extern "C" fn(common: *mut c_void) -> u32;
#[repr(C)]
#[derive(Debug, Clone)]
#[doc(alias = "SceKernelAlarmInfo")]
pub struct AlarmInfo {
pub size: SceSize,
pub schedule: SystemClock,
pub handler: Option<AlarmHandler>,
pub common: *mut c_void,
}
#[repr(transparent)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
pub struct VirtualTimerId(SceUid);
#[doc(alias("SceKernelVTimerHandler"))]
pub type VirtualTimerHandler = unsafe extern "C" fn(
id: VirtualTimerId,
schedule: *mut SystemClock,
actual: *mut SystemClock,
common: *mut c_void,
) -> u32;
#[doc(alias("SceKernelVTimerHandlerWide"))]
pub type VirtualTimerHandlerWide = unsafe extern "C" fn(
id: VirtualTimerId,
schedule: *mut u64,
actual: *mut u64,
common: *mut c_void,
) -> u32;
#[repr(C)]
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[doc(alias = "SceKernelVTimerOptParam")]
pub struct VirtualTimerOptions {
pub size: SceSize,
}
#[repr(u32)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
pub enum VirtualTimerState {
#[default]
NotRunning = 0,
Running = 1,
}
#[repr(C)]
#[derive(Debug, Clone)]
#[doc(alias = "SceKernelVTimerInfo")]
pub struct VirtualTimerInfo {
pub size: SceSize,
pub name: [u8; 32],
pub state: VirtualTimerState,
pub base: SystemClock,
pub current: SystemClock,
pub schedule: SystemClock,
pub handler: Option<VirtualTimerHandler>,
pub common: *mut c_void,
}
#[repr(transparent)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
pub struct CallbackId(SceUid);
#[repr(u32)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
pub enum CallbackTermState {
#[default]
NormalTermination = 0x00,
DeletedCallback = 0x01,
}
#[doc(alias = "SceKernelCallbackFunction")]
pub type CallbackFunction =
unsafe extern "C" fn(count: u32, arg: u32, common: *mut c_void) -> CallbackTermState;
#[repr(C)]
#[derive(Debug, Clone)]
#[doc(alias = "SceKernelCallbackInfo")]
pub struct CallbackInfo {
pub size: SceSize,
pub name: [u8; 32],
pub thread_id: ThreadId,
pub entry: Option<CallbackFunction>,
pub notify_count: u32,
pub notify_arg: i32,
}
#[repr(u32)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
pub enum CallbackCheckStatus {
#[default]
NoCallback = 0x00,
CallbackCalled = 0x01,
}
#[bitflag(u32)]
#[non_exhaustive]
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
pub enum SystemStatus {
#[default]
AllEnabled = 0x00,
DisabledDispatch = 0x01,
DisabledInterrupt = 0x03,
NoThread = 0x04,
}
#[repr(C)]
#[derive(Debug, Clone)]
#[doc(alias = "SceKernelSystemStatus")]
pub struct SystemInfo {
pub size: SceSize,
pub status: SystemStatus,
pub idle_clocks: SystemClock,
pub comes_out_of_idle_count: u32,
pub thread_switch_count: u32,
pub vfpu_switch_count: u32,
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
#[doc(alias = "SceKernelIdListType")]
pub enum ThreadIdKind {
#[default]
Any = 1,
Semaphore = 2,
EventFlag = 3,
MessageBox = 4,
VariablepMemoryPool = 5,
FixeMemoryPool = 6,
MessagePipe = 7,
Callback = 8,
ThreadEventHandler = 9,
Alarm = 10,
VirtualTimer = 11,
Mutex = 12,
LightweightMutex = 13,
TlsMemoryPool = 14,
SleepThread = 64,
DelayThread = 65,
SuspendThread = 66,
DormantThread = 67,
}
#[repr(transparent)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
pub struct ThreadEventId(SceUid);
#[bitflag(u32)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
pub enum ThreadEvents {
Create = 0x01,
Start = 0x02,
Exit = 0x04,
Delete = 0x08,
All = Create | Start | Exit | Delete,
}
#[repr(u32)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
pub enum ThreadEventHandlerTermState {
#[default]
NormalTermination = 0x00,
Release = 0x01,
}
#[doc(alias = "SceKernelThreadEventHandler")]
pub type ThreadEventHandler = unsafe extern "C" fn(
kind: ThreadEvents,
id: ThreadId,
common: *mut c_void,
) -> ThreadEventHandlerTermState;
#[repr(C)]
#[derive(Debug, Clone)]
#[doc(alias = "SceKernelThreadEventHandlerInfo")]
pub struct ThreadEventInfo {
pub size: SceSize,
pub name: [u8; 32],
pub thread_id: ThreadId,
pub event_mask: ThreadEvents,
pub handler: Option<ThreadEventHandler>,
pub common: *mut c_void,
}
pub type ExtendStackFunc = unsafe extern "C" fn(common: *mut c_void) -> SceResult<u32>;
#[repr(transparent)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
pub struct KtlsId(SceUid);
pub type KtlsAllocFunc = unsafe extern "C" fn(size: SceSize, common: *mut c_void) -> SceResult<u32>;
#[psp_stub(libname = "ThreadManForUser", flags = 0x4009, use_crate)]
unsafe extern "C" {
#[eabi(i6)]
#[nid(0x446D8DE6)]
#[cfg(not(feature = "kernel"))]
pub unsafe fn sceKernelCreateThread(
name: *const u8, entry: ThreadEntryFn, init_priority: i32, stack_size: SceSize,
attr: ThreadAttributes, options: Option<&ThreadOptions>,
) -> SceResult<ThreadId>;
#[nid(0x9FA03CD3)]
#[cfg(not(feature = "kernel"))]
pub unsafe fn sceKernelDeleteThread(id: ThreadId) -> SceResult<()>;
#[nid(0xF475845D)]
#[cfg(not(feature = "kernel"))]
pub unsafe fn sceKernelStartThread(
id: ThreadId, arg_len: SceSize, argp: *const c_void,
) -> SceResult<()>;
#[nid(0xAA73C935)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelExitThread(status: u32) -> SceResult<()>;
#[nid(0x809CE29B)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelExitDeleteThread(status: u32) -> SceResult<()>;
#[nid(0x616403BA)]
#[cfg(not(feature = "kernel"))]
pub unsafe fn sceKernelTerminateThread(id: ThreadId) -> SceResult<()>;
#[nid(0x383F7BCC)]
#[cfg(not(feature = "kernel"))]
pub unsafe fn sceKernelTerminateDeleteThread(id: ThreadId) -> SceResult<()>;
#[nid(0x3AD58B8C)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelSuspendDispatchThread() -> SceResult<ThreadState>;
#[nid(0x27E22EC2)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelResumeDispatchThread(state: ThreadState) -> SceResult<()>;
#[nid(0xEA748E31)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelChangeCurrentThreadAttr(
clear_attr: ThreadAttributes, set_attr: ThreadAttributes,
) -> SceResult<()>;
#[nid(0x94AA61EE)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelGetThreadCurrentPriority() -> SceResult<i32>;
#[nid(0x293B45B8)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelGetThreadId() -> SceResult<ThreadId>;
#[nid(0x9ACE131E)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelSleepThread() -> SceResult<()>;
#[nid(0x82826F70)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelSleepThreadCB() -> SceResult<()>;
#[nid(0xD59EAD2F)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelWakeupThread(id: ThreadId) -> SceResult<()>;
#[nid(0x1AF94D03)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelDonateWakeupThread(donate_id: ThreadId) -> SceResult<()>;
#[nid(0x2C34E053)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelReleaseWaitThread(id: ThreadId) -> SceResult<()>;
#[nid(0xFCCFAD26)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelCancelWakeupThread(id: ThreadId) -> SceResult<u32>;
#[nid(0x9944F31F)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelSuspendThread(id: ThreadId) -> SceResult<()>;
#[nid(0x75156E8F)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelResumeThread(id: ThreadId) -> SceResult<()>;
#[nid(0x278C0DF5)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelWaitThreadEnd(id: ThreadId, timeout: Option<&mut u32>) -> SceResult<u32>;
#[nid(0x840E8133)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelWaitThreadEndCB(id: ThreadId, timeout: Option<&mut u32>)
-> SceResult<u32>;
#[nid(0xCEADEB47)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelDelayThread(delay: u32) -> SceResult<()>;
#[nid(0x68DA9E36)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelDelayThreadCB(delay: u32) -> SceResult<()>;
#[nid(0xBD123D9E)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelDelaySysClockThread(delay: &SystemClock) -> SceResult<()>;
#[nid(0x1181E963)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelDelaySysClockThreadCB(delay: &SystemClock) -> SceResult<()>;
#[nid(0x912354A7)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelRotateThreadReadyQueue(priority: u32) -> SceResult<()>;
#[nid(0x3B183E26)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelGetThreadExitStatus(id: ThreadId) -> SceResult<u32>;
#[nid(0xD13BDE95)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelCheckThreadStack() -> SceSize;
#[nid(0x52089CA1)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelGetThreadStackFreeSize(id: ThreadId) -> SceResult<SceSize>;
#[nid(0x17C1684E)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelReferThreadStatus(id: ThreadId, info: &mut ThreadInfo) -> SceResult<()>;
#[nid(0xFFC36A14)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelReferThreadRunStatus(
id: ThreadId, run_status: &mut ThreadRunStatus,
) -> SceResult<()>;
#[eabi(i5)]
#[nid(0xD6DA4BA1)]
#[cfg(not(feature = "kernel"))]
pub unsafe fn sceKernelCreateSema(
name: *const u8, attr: SemaphoreAttributes, init_val: i32, max_val: i32,
options: Option<&SemaphoreOptions>,
) -> SceResult<SemaId>;
#[nid(0x28B6489C)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelDeleteSema(id: SemaId) -> SceResult<()>;
#[nid(0x3F53E640)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelSignalSema(id: SemaId, signal: i32) -> SceResult<()>;
#[nid(0x4E3A1105)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelWaitSema(
id: SemaId, target_value: i32, timeout: Option<&mut u32>,
) -> SceResult<()>;
#[nid(0x6D212BAC)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelWaitSemaCB(
id: SemaId, target_value: i32, timeout: Option<&mut u32>,
) -> SceResult<()>;
#[nid(0x58B1F937)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelPollSema(id: SemaId, target_value: i32) -> SceResult<()>;
#[nid(0x8FFDF9A2)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelCancelSema(
id: SemaId, set_val: i32, num_wait_threads: &mut u32,
) -> SceResult<()>;
#[nid(0xBC6FEBC5)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelReferSemaStatus(id: SemaId, info: &mut SemaphoreInfo) -> SceResult<()>;
#[nid(0x55C20A00)]
#[cfg(not(feature = "kernel"))]
pub unsafe fn sceKernelCreateEventFlag(
name: *const u8, attr: EventFlagAttributes, init_bitmask: u32,
options: Option<&EventFlagOptions>,
) -> SceResult<EventFlagId>;
#[nid(0xEF9E4C70)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelDeleteEventFlag(id: EventFlagId) -> SceResult<()>;
#[nid(0x1FB15A32)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelSetEventFlag(id: EventFlagId, bit_pat: u32) -> SceResult<()>;
#[nid(0x812346E4)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelClearEventFlag(id: EventFlagId, bit_pat: u32) -> SceResult<()>;
#[eabi(i5)]
#[nid(0x402FCF22)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelWaitEventFlag(
id: EventFlagId, bit_pat: u32, wait_kind: EventFlagWaitKinds, out_bits: &mut u32,
timeout: Option<&mut u32>,
) -> SceResult<()>;
#[eabi(i5)]
#[nid(0x328C546A)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelWaitEventFlagCB(
id: EventFlagId, bit_pat: u32, wait_kind: EventFlagWaitKinds, out_bits: &mut u32,
timeout: Option<&mut u32>,
) -> SceResult<()>;
#[nid(0x30FD48F0)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelPollEventFlag(
id: EventFlagId, bit_pat: u32, wait_kind: EventFlagWaitKinds, out_bits: &mut u32,
) -> SceResult<()>;
#[nid(0xCD203292)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelCancelEventFlag(id: EventFlagId, set_pat: u32, num_wait_threads: &mut u32);
#[nid(0xA66B0120)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelReferEventFlagStatus(
id: EventFlagId, info: &mut EventFlagInfo,
) -> SceResult<()>;
#[nid(0xB7D098C6)]
#[cfg(not(feature = "kernel"))]
pub unsafe fn sceKernelCreateMutex(
name: *const u8, attr: MutexAttributes, init_count: i32, options: Option<&MutexOptions>,
) -> SceResult<MutexId>;
#[nid(0xF8170FBE)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelDeleteMutex(id: MutexId) -> SceResult<()>;
#[nid(0xB011B11F)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelLockMutex(
id: MutexId, lock_count: u32, timeout: Option<&mut u32>,
) -> SceResult<()>;
#[nid(0x5BF4DD27)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelLockMutexCB(
id: MutexId, lock_count: u32, timeout: Option<&mut u32>,
) -> SceResult<()>;
#[nid(0x0DDCD2C9)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelTryLockMutex(id: MutexId, lock_count: u32) -> SceResult<()>;
#[nid(0x6B30100F)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelUnlockMutex(id: MutexId, unlock_count: u32) -> SceResult<()>;
#[nid(0x87D9223C)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelCancelMutex(id: MutexId, new_lock_count: u32, numWaitThreads: &mut u32);
#[nid(0xA9C2CB9A)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelReferMutexStatus(id: MutexId, info: &mut MutexInfo) -> SceResult<()>;
#[eabi(i5)]
#[nid(0x19CFF145)]
pub unsafe fn sceKernelCreateLwMutex(
work_area: *mut LwMutexWorkArea, name: *const u8, attr: MutexAttributes, init_count: i32,
options: Option<&LwMutexOptions>,
) -> SceResult<()>;
#[nid(0x60107536)]
pub safe fn sceKernelDeleteLwMutex(work_area: &mut LwMutexWorkArea) -> SceResult<()>;
#[nid(0x7CFF8CF3)]
pub safe fn _sceKernelLockLwMutex(
work_area: &mut LwMutexWorkArea, lock_count: u32, timeout: Option<&mut u32>,
) -> SceResult<()>;
#[nid(0x31327F19)]
pub safe fn _sceKernelLockLwMutexCB(
work_area: &mut LwMutexWorkArea, lock_count: u32, timeout: Option<&mut u32>,
) -> SceResult<()>;
#[nid(0x71040D5C)]
pub safe fn _sceKernelTryLockLwMutex(
work_area: &mut LwMutexWorkArea, lock_count: u32,
) -> SceResult<()>;
#[nid(0xBEED3A47)]
pub safe fn _sceKernelUnlockLwMutex(
work_area: &mut LwMutexWorkArea, unlock_count: u32,
) -> SceResult<()>;
#[nid(0x4C145944)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelReferLwMutexStatusByID(
id: LwMutexId, info: &mut LwMutexInfo,
) -> SceResult<()>;
#[nid(0x8125221D)]
#[cfg(not(feature = "kernel"))]
pub unsafe fn sceKernelCreateMbx(
name: *const u8, attr: MsgBoxAttributes, options: Option<&mut MsgBoxOptions>,
) -> SceResult<MsgBoxId>;
#[nid(0x86255ADA)]
#[cfg(not(feature = "kernel"))]
pub unsafe fn sceKernelDeleteMbx(id: MsgBoxId) -> SceResult<()>;
#[nid(0xE9B3061E)]
#[cfg(not(feature = "kernel"))]
pub unsafe fn sceKernelSendMbx(id: MsgBoxId, msg: *mut MsgPacket) -> SceResult<()>;
#[nid(0x18260574)]
#[cfg(not(feature = "kernel"))]
pub unsafe fn sceKernelReceiveMbx(
id: MsgBoxId, msg: *mut *mut MsgPacket, timeout: Option<&mut u32>,
) -> SceResult<()>;
#[nid(0xF3986382)]
#[cfg(not(feature = "kernel"))]
pub unsafe fn sceKernelReceiveMbxCB(
id: MsgBoxId, msg: *mut *mut MsgPacket, timeout: Option<&mut u32>,
) -> SceResult<()>;
#[nid(0x0D81716A)]
#[cfg(not(feature = "kernel"))]
pub unsafe fn sceKernelPollMbx(id: MsgBoxId, msg: *mut *mut MsgPacket) -> SceResult<()>;
#[nid(0x87D4DD36)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelCancelReceiveMbx(
id: MsgBoxId, num_wait_threads: &mut u32,
) -> SceResult<()>;
#[nid(0xA8E8C846)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelReferMbxStatus(id: MsgBoxId, info: &mut MsgBoxInfo) -> SceResult<()>;
#[eabi(i5)]
#[nid(0x7C0DC2A0)]
#[cfg(not(feature = "kernel"))]
pub unsafe fn sceKernelCreateMsgPipe(
name: *const u8, partition_id: MemoryPartitionId, attr: MsgPipeAttributes,
buf_size: SceSize, options: Option<&SemaphoreOptions>,
) -> SceResult<MsgPipeId>;
#[nid(0xF0B7DA1C)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelDeleteMsgPipe(id: MsgPipeId) -> SceResult<()>;
#[eabi(i6)]
#[nid(0x876DBFAD)]
#[cfg(not(feature = "kernel"))]
pub unsafe fn sceKernelSendMsgPipe(
id: MsgPipeId, msg_buf: *const c_void, msg_size: SceSize, wait_kind: MsgPipeWaitKind,
data_send_size: &mut u32, timeout: Option<&mut u32>,
) -> SceResult<()>;
#[eabi(i6)]
#[nid(0x7C41F2C2)]
#[cfg(not(feature = "kernel"))]
pub unsafe fn sceKernelSendMsgPipeCB(
id: MsgPipeId, msg_buf: *const c_void, msg_size: SceSize, wait_kind: MsgPipeWaitKind,
data_send_size: &mut u32, timeout: Option<&mut u32>,
) -> SceResult<()>;
#[eabi(i5)]
#[nid(0x884C9F90)]
#[cfg(not(feature = "kernel"))]
pub unsafe fn sceKernelTrySendMsgPipe(
id: MsgPipeId, msg_buf: *const c_void, msg_size: SceSize, wait_kind: MsgPipeWaitKind,
data_send_size: &mut u32,
) -> SceResult<()>;
#[eabi(i6)]
#[nid(0x74829B76)]
#[cfg(not(feature = "kernel"))]
pub unsafe fn sceKernelReceiveMsgPipe(
id: MsgPipeId, msg_buf: *mut c_void, msg_size: SceSize, wait_kind: MsgPipeWaitKind,
data_send_size: &mut u32, timeout: Option<&mut u32>,
) -> SceResult<()>;
#[eabi(i6)]
#[nid(0xFBFA697D)]
#[cfg(not(feature = "kernel"))]
pub unsafe fn sceKernelReceiveMsgPipeCB(
id: MsgPipeId, msg_buf: *mut c_void, msg_size: SceSize, wait_kind: MsgPipeWaitKind,
data_send_size: &mut u32, timeout: Option<&mut u32>,
) -> SceResult<()>;
#[eabi(i5)]
#[nid(0xDF52098F)]
#[cfg(not(feature = "kernel"))]
pub unsafe fn sceKernelTryReceiveMsgPipe(
id: MsgPipeId, msg_buf: *mut c_void, msg_size: SceSize, wait_kind: MsgPipeWaitKind,
data_send_size: &mut u32,
) -> SceResult<()>;
#[nid(0x349B864D)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelCancelMsgPipe(
id: MsgPipeId, num_send_wait_threads: &mut u32, num_recv_wait_threads: &mut u32,
) -> SceResult<()>;
#[nid(0x33BE4024)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelReferMsgPipeStatus(id: MsgPipeId, info: &mut MsgPipeInfo)
-> SceResult<()>;
#[nid(0x56C039B5)]
#[cfg(not(feature = "kernel"))]
pub unsafe fn sceKernelCreateVpl(
name: *const u8, partition_id: MemoryPartitionId, attr: VplAttributes, size: SceSize,
options: Option<&VplOptions>,
) -> SceResult<VplId>;
#[nid(0x89B3D48C)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelDeleteVpl(id: VplId) -> SceResult<()>;
#[nid(0xBED27435)]
#[cfg(not(feature = "kernel"))]
pub unsafe fn sceKernelAllocateVpl(
id: VplId, size: SceSize, mem_block: *mut *mut c_void, timeout: Option<&mut u32>,
) -> SceResult<()>;
#[nid(0xEC0A693F)]
#[cfg(not(feature = "kernel"))]
pub unsafe fn sceKernelAllocateVplCB(
id: VplId, size: SceSize, mem_block: *mut *mut c_void, timeout: Option<&mut u32>,
) -> SceResult<()>;
#[nid(0xAF36D708)]
#[cfg(not(feature = "kernel"))]
pub unsafe fn sceKernelTryAllocateVpl(
id: VplId, size: SceSize, mem_block: *mut *mut c_void,
) -> SceResult<()>;
#[cfg(not(feature = "kernel"))]
pub unsafe fn sceKernelFreeVpl(id: VplId, mem_block: *mut c_void) -> SceResult<()>;
#[nid(0x1D371B8A)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelCancelVpl(id: VplId, num_wait_threads: &mut u32) -> SceResult<()>;
#[nid(0x39810265)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelReferVplStatus(id: VplId, info: &mut VplInfo) -> SceResult<()>;
#[eabi(i6)]
#[nid(0xC07BB470)]
#[cfg(not(feature = "kernel"))]
pub unsafe fn sceKernelCreateFpl(
name: *const u8, partition_id: MemoryPartitionId, attr: FplAttributes, block_size: SceSize,
num_blocks: SceSize, options: Option<&FplOptions>,
) -> SceResult<FplId>;
#[nid(0xED1410E0)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelDeleteFpl(id: FplId) -> SceResult<()>;
#[nid(0xD979E9BF)]
#[cfg(not(feature = "kernel"))]
pub unsafe fn sceKernelAllocateFpl(
id: FplId, mem_block: *mut *mut c_void, timeout: Option<&mut u32>,
) -> SceResult<()>;
#[nid(0xE7282CB6)]
#[cfg(not(feature = "kernel"))]
pub unsafe fn sceKernelAllocateFplCB(
id: FplId, mem_block: *mut *mut c_void, timeout: Option<&mut u32>,
) -> SceResult<()>;
#[nid(0x623AE665)]
#[cfg(not(feature = "kernel"))]
pub unsafe fn sceKernelTryAllocateFpl(id: FplId, mem_block: *mut *mut c_void) -> SceResult<()>;
#[nid(0xF6414A71)]
#[cfg(not(feature = "kernel"))]
pub unsafe fn sceKernelFreeFpl(id: FplId, mem_block: *mut c_void) -> SceResult<()>;
#[nid(0xA8AA591F)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelCancelFpl(id: FplId, num_wait_threads: &mut u32) -> SceResult<()>;
#[nid(0xD8199E4C)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelReferFplStatus(id: FplId, info: &mut FplInfo) -> SceResult<()>;
#[eabi(i6)]
#[nid(0x8DAFF657)]
pub unsafe fn sceKernelCreateTlspl(
name: *const u8, partition_id: MemoryPartitionId, attr: TlsPoolAttributes,
block_size: SceSize, num_blocks: SceSize, options: Option<&TlsPoolOptions>,
) -> SceResult<TlsPoolId>;
#[nid(0x32BF938E)]
pub safe fn sceKernelDeleteTlspl(id: TlsPoolId) -> SceResult<()>;
#[nid(0x65F54FFB)]
pub unsafe fn _sceKernelAllocateTlspl(
id: TlsPoolId, tls_addr: *mut *mut c_void, unk: u32,
) -> SceResult<()>;
#[nid(0x721067F3)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelReferTlsplStatus(id: TlsPoolId, info: &mut TlsPoolInfo) -> SceResult<()>;
#[nid(0xDB738F35)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelGetSystemTime(clock: &mut SystemClock) -> SceResult<()>;
#[nid(0x82BC5777)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelGetSystemTimeWide() -> u64;
#[nid(0x369ED59D)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelGetSystemTimeLow() -> u32;
#[nid(0x6652B8CA)]
#[cfg(not(feature = "kernel"))]
pub unsafe fn sceKernelSetAlarm(
microsec: u32, handler: AlarmHandler, common: *mut c_void,
) -> SceResult<AlarmId>;
#[nid(0xB2C25152)]
#[cfg(not(feature = "kernel"))]
pub unsafe fn sceKernelSetSysClockAlarm(
clock: &SystemClock, handler: AlarmHandler, common: *mut c_void,
) -> SceResult<AlarmId>;
#[nid(0x7E65B999)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelCancelAlarm(id: AlarmId) -> SceResult<()>;
#[nid(0xDAA3F564)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelReferAlarmStatus(id: AlarmId, info: &mut AlarmInfo) -> SceResult<()>;
#[nid(0x110DEC9A)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelUSec2SysClock(microsec: u32, clock: &mut SystemClock) -> SceResult<()>;
#[nid(0xBA6B92E2)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelSysClock2USec(
clock: &SystemClock, sec: &mut u32, microsec: &mut u32,
) -> SceResult<()>;
#[nid(0xC8CD158C)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelUSec2SysClockWide(microsec: u32) -> u64;
#[nid(0xE1619D7C)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelSysClock2USecWide(
raw_clock: u64, sec: &mut u32, microsec: &mut u32,
) -> SceResult<()>;
#[nid(0x20FFF560)]
#[cfg(not(feature = "kernel"))]
pub unsafe fn sceKernelCreateVTimer(
name: *const u8, options: Option<&VirtualTimerOptions>,
) -> SceResult<VirtualTimerId>;
#[nid(0x328F9E52)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelDeleteVTimer(id: VirtualTimerId) -> SceResult<()>;
#[nid(0xB3A59970)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelGetVTimerBase(id: VirtualTimerId, base: &mut SystemClock)
-> SceResult<()>;
#[nid(0xB7C18B77)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelGetVTimerBaseWide(id: VirtualTimerId) -> u64;
#[nid(0x034A921F)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelGetVTimerTime(id: VirtualTimerId, time: &mut SystemClock)
-> SceResult<()>;
#[nid(0xC0B3FFD2)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelGetVTimerTimeWide(id: VirtualTimerId) -> u64;
#[nid(0x542AD630)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelSetVTimerTime(id: VirtualTimerId, time: &mut SystemClock)
-> SceResult<()>;
#[nid(0xFB6425C3)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelSetVTimerTimeWide(id: VirtualTimerId, time: u64) -> u64;
#[nid(0xC68D9437)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelStartVTimer(id: VirtualTimerId) -> SceResult<VirtualTimerState>;
#[nid(0xD0AEEE87)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelStopVTimer(id: VirtualTimerId) -> SceResult<VirtualTimerState>;
#[nid(0xD8B299AE)]
#[cfg(not(feature = "kernel"))]
pub unsafe fn sceKernelSetVTimerHandler(
id: VirtualTimerId, schedule: &mut SystemClock, handler: VirtualTimerHandler,
common: *mut c_void,
) -> SceResult<()>;
#[nid(0x53B00E9A)]
#[cfg(not(feature = "kernel"))]
pub unsafe fn sceKernelSetVTimerHandlerWide(
id: VirtualTimerId, schedule: u64, handler: VirtualTimerHandlerWide, common: *mut c_void,
) -> SceResult<()>;
#[nid(0xD2D615EF)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelCancelVTimerHandler(id: VirtualTimerId) -> SceResult<()>;
#[nid(0x5F32BEAA)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelReferVTimerStatus(
id: VirtualTimerId, info: &mut VirtualTimerInfo,
) -> SceResult<()>;
#[nid(0xE81CAF8F)]
#[cfg(not(feature = "kernel"))]
pub unsafe fn sceKernelCreateCallback(
name: *const u8, entry: CallbackFunction, common: *mut c_void,
) -> SceResult<CallbackId>;
#[nid(0xEDBA5844)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelDeleteCallback(id: CallbackId) -> SceResult<()>;
#[nid(0xC11BA8C4)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelNotifyCallback(id: CallbackId, arg: i32) -> SceResult<()>;
#[nid(0xBA4051D6)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelCancelCallback(id: CallbackId) -> SceResult<()>;
#[nid(0x2A3D44FF)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelGetCallbackCount(id: CallbackId) -> SceResult<u32>;
#[nid(0x349D6D6C)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelCheckCallback() -> SceResult<CallbackCheckStatus>;
#[nid(0x730ED8BC)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelReferCallbackStatus(
id: CallbackId, info: &mut CallbackInfo,
) -> SceResult<()>;
#[nid(0x627E6F3A)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelReferSystemStatus(info: &mut SystemInfo) -> SceResult<()>;
#[nid(0x94416130)]
#[cfg(not(feature = "kernel"))]
pub unsafe fn sceKernelGetThreadmanIdList(
kind: ThreadIdKind, buf: *mut SceUid, buf_size: SceSize, id_cound: Option<&mut u32>,
) -> SceResult<u32>;
#[nid(0x57CF62DD)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelGetThreadmanIdType(id: SceUid) -> SceResult<ThreadIdKind>;
#[eabi(i5)]
#[nid(0x0C106E53)]
#[cfg(not(feature = "kernel"))]
pub unsafe fn sceKernelRegisterThreadEventHandler(
name: *const u8, thread_id: ThreadId, event_mask: ThreadEvents,
handler: ThreadEventHandler, common: *mut c_void,
) -> SceResult<ThreadEventId>;
#[nid(0x72F3C145)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelReleaseThreadEventHandler(id: ThreadEventId) -> SceResult<()>;
#[nid(0x369EEB6B)]
#[cfg(not(feature = "kernel"))]
pub safe fn sceKernelReferThreadEventHandlerStatus(
id: ThreadEventId, info: &mut ThreadEventInfo,
) -> SceResult<()>;
#[nid(0xBC80EC7C)]
pub safe fn sceKernelExtendThreadStack(
stack_size: SceSize, func: ExtendStackFunc, common: *mut c_void,
) -> SceResult<u32>;
}
#[cfg(feature = "kernel")]
#[psp_stub(libname = "ThreadManForKernel", flags = 0x0009, use_crate)]
unsafe extern "C" {
#[eabi(i6)]
#[nid(0x446D8DE6)]
pub unsafe fn sceKernelCreateThread(
name: *const u8, entry: ThreadEntryFn, init_priority: i32, stack_size: SceSize,
attr: ThreadAttributes, options: Option<&ThreadOptions>,
) -> SceResult<ThreadId>;
#[nid(0x9FA03CD3)]
pub unsafe fn sceKernelDeleteThread(id: ThreadId) -> SceResult<()>;
#[nid(0xF475845D)]
pub unsafe fn sceKernelStartThread(
id: ThreadId, arg_len: SceSize, argp: *const c_void,
) -> SceResult<()>;
#[nid(0xAA73C935)]
pub safe fn sceKernelExitThread(status: u32) -> SceResult<!>;
#[nid(0x809CE29B)]
pub safe fn sceKernelExitDeleteThread(status: u32) -> SceResult<!>;
#[nid(0x616403BA)]
pub unsafe fn sceKernelTerminateThread(id: ThreadId) -> SceResult<()>;
#[nid(0x383F7BCC)]
pub unsafe fn sceKernelTerminateDeleteThread(id: ThreadId) -> SceResult<()>;
#[nid(0x3AD58B8C)]
pub safe fn sceKernelSuspendDispatchThread() -> SceResult<ThreadState>;
#[nid(0x27E22EC2)]
pub safe fn sceKernelResumeDispatchThread(state: ThreadState) -> SceResult<()>;
#[nid(0xEA748E31)]
pub safe fn sceKernelChangeCurrentThreadAttr(
clear_attr: ThreadAttributes, set_attr: ThreadAttributes,
) -> SceResult<()>;
#[nid(0x71BC9871)]
pub safe fn sceKernelChangeThreadPriority(id: ThreadId, priority: i32) -> SceResult<()>;
#[nid(0x94AA61EE)]
pub safe fn sceKernelGetThreadCurrentPriority() -> SceResult<i32>;
#[nid(0x293B45B8)]
pub safe fn sceKernelGetThreadId() -> SceResult<ThreadId>;
#[nid(0x9ACE131E)]
pub safe fn sceKernelSleepThread() -> SceResult<()>;
#[nid(0x82826F70)]
pub safe fn sceKernelSleepThreadCB() -> SceResult<()>;
#[nid(0xD59EAD2F)]
pub safe fn sceKernelWakeupThread(id: ThreadId) -> SceResult<()>;
#[nid(0x1AF94D03)]
pub safe fn sceKernelDonateWakeupThread(donate_id: ThreadId) -> SceResult<()>;
#[nid(0x2C34E053)]
pub safe fn sceKernelReleaseWaitThread(id: ThreadId) -> SceResult<()>;
#[nid(0xFCCFAD26)]
pub safe fn sceKernelCancelWakeupThread(id: ThreadId) -> SceResult<u32>;
#[nid(0x9944F31F)]
pub safe fn sceKernelSuspendThread(id: ThreadId) -> SceResult<()>;
#[nid(0x75156E8F)]
pub safe fn sceKernelResumeThread(id: ThreadId) -> SceResult<()>;
#[nid(0x278C0DF5)]
pub safe fn sceKernelWaitThreadEnd(id: ThreadId, timeout: Option<&mut u32>) -> SceResult<u32>;
#[nid(0x840E8133)]
pub safe fn sceKernelWaitThreadEndCB(id: ThreadId, timeout: Option<&mut u32>)
-> SceResult<u32>;
#[nid(0xCEADEB47)]
pub safe fn sceKernelDelayThread(delay: u32) -> SceResult<()>;
#[nid(0x68DA9E36)]
pub safe fn sceKernelDelayThreadCB(delay: u32) -> SceResult<()>;
#[nid(0xBD123D9E)]
pub safe fn sceKernelDelaySysClockThread(delay: &SystemClock) -> SceResult<()>;
#[nid(0x1181E963)]
pub safe fn sceKernelDelaySysClockThreadCB(delay: &SystemClock) -> SceResult<()>;
#[nid(0x912354A7)]
pub safe fn sceKernelRotateThreadReadyQueue(priority: u32) -> SceResult<()>;
#[nid(0x3B183E26)]
pub safe fn sceKernelGetThreadExitStatus(id: ThreadId) -> SceResult<u32>;
#[nid(0xD13BDE95)]
pub safe fn sceKernelCheckThreadStack() -> SceSize;
#[nid(0x52089CA1)]
pub safe fn sceKernelGetThreadStackFreeSize(id: ThreadId) -> SceResult<SceSize>;
#[nid(0x17C1684E)]
pub safe fn sceKernelReferThreadStatus(id: ThreadId, info: &mut ThreadInfo) -> SceResult<()>;
#[nid(0xFFC36A14)]
pub safe fn sceKernelReferThreadRunStatus(
id: ThreadId, run_status: &mut ThreadRunStatus,
) -> SceResult<()>;
#[nid(0x85A2A5BF)]
pub safe fn sceKernelIsUserModeThread() -> SceResult<bool>;
#[nid(0x8FD9F70C)]
pub safe fn sceKernelSuspendAllUserThreads() -> SceResult<()>;
#[nid(0xF6427665)]
pub safe fn sceKernelGetUserLevel() -> SceResult<u32>;
#[eabi(i5)]
#[nid(0xD6DA4BA1)]
pub unsafe fn sceKernelCreateSema(
name: *const u8, attr: SemaphoreAttributes, init_val: i32, max_val: i32,
options: Option<&SemaphoreOptions>,
) -> SceResult<SemaId>;
#[nid(0x28B6489C)]
pub safe fn sceKernelDeleteSema(id: SemaId) -> SceResult<()>;
#[nid(0x3F53E640)]
pub safe fn sceKernelSignalSema(id: SemaId, signal: i32) -> SceResult<()>;
#[nid(0x4E3A1105)]
pub safe fn sceKernelWaitSema(
id: SemaId, target_value: i32, timeout: Option<&mut u32>,
) -> SceResult<()>;
#[nid(0x6D212BAC)]
pub safe fn sceKernelWaitSemaCB(
id: SemaId, target_value: i32, timeout: Option<&mut u32>,
) -> SceResult<()>;
#[nid(0x58B1F937)]
pub safe fn sceKernelPollSema(id: SemaId, target_value: i32) -> SceResult<()>;
#[nid(0x8FFDF9A2)]
pub safe fn sceKernelCancelSema(
id: SemaId, set_val: i32, num_wait_threads: &mut u32,
) -> SceResult<()>;
#[nid(0xBC6FEBC5)]
pub safe fn sceKernelReferSemaStatus(id: SemaId, info: &mut SemaphoreInfo) -> SceResult<()>;
#[nid(0x55C20A00)]
pub unsafe fn sceKernelCreateEventFlag(
name: *const u8, attr: EventFlagAttributes, init_bitmask: u32,
options: Option<&EventFlagOptions>,
) -> SceResult<EventFlagId>;
#[nid(0xEF9E4C70)]
pub safe fn sceKernelDeleteEventFlag(id: EventFlagId) -> SceResult<()>;
#[nid(0x1FB15A32)]
pub safe fn sceKernelSetEventFlag(id: EventFlagId, bit_pat: u32) -> SceResult<()>;
#[nid(0x812346E4)]
pub safe fn sceKernelClearEventFlag(id: EventFlagId, bit_pat: u32) -> SceResult<()>;
#[eabi(i5)]
#[nid(0x402FCF22)]
pub safe fn sceKernelWaitEventFlag(
id: EventFlagId, bit_pat: u32, wait_kind: EventFlagWaitKinds, out_bits: &mut u32,
timeout: Option<&mut u32>,
) -> SceResult<()>;
#[eabi(i5)]
#[nid(0x328C546A)]
pub safe fn sceKernelWaitEventFlagCB(
id: EventFlagId, bit_pat: u32, wait_kind: EventFlagWaitKinds, out_bits: &mut u32,
timeout: Option<&mut u32>,
) -> SceResult<()>;
#[nid(0x30FD48F0)]
pub safe fn sceKernelPollEventFlag(
id: EventFlagId, bit_pat: u32, wait_kind: EventFlagWaitKinds, out_bits: &mut u32,
) -> SceResult<()>;
#[nid(0xCD203292)]
pub safe fn sceKernelCancelEventFlag(id: EventFlagId, set_pat: u32, num_wait_threads: &mut u32);
#[nid(0xA66B0120)]
pub safe fn sceKernelReferEventFlagStatus(
id: EventFlagId, info: &mut EventFlagInfo,
) -> SceResult<()>;
#[nid(0xB7D098C6)]
pub unsafe fn sceKernelCreateMutex(
name: *const u8, attr: MutexAttributes, init_count: i32, options: Option<&MutexOptions>,
) -> SceResult<MutexId>;
#[nid(0xF8170FBE)]
pub safe fn sceKernelDeleteMutex(id: MutexId) -> SceResult<()>;
#[nid(0xB011B11F)]
pub safe fn sceKernelLockMutex(
id: MutexId, lock_count: u32, timeout: Option<&mut u32>,
) -> SceResult<()>;
#[nid(0x5BF4DD27)]
pub safe fn sceKernelLockMutexCB(
id: MutexId, lock_count: u32, timeout: Option<&mut u32>,
) -> SceResult<()>;
#[nid(0x0DDCD2C9)]
pub safe fn sceKernelTryLockMutex(id: MutexId, lock_count: u32) -> SceResult<()>;
#[nid(0x6B30100F)]
pub safe fn sceKernelUnlockMutex(id: MutexId, unlock_count: u32) -> SceResult<()>;
#[nid(0x87D9223C)]
pub safe fn sceKernelCancelMutex(id: MutexId, new_lock_count: u32, numWaitThreads: &mut u32);
#[nid(0xA9C2CB9A)]
pub safe fn sceKernelReferMutexStatus(id: MutexId, info: &mut MutexInfo) -> SceResult<()>;
#[nid(0x4C145944)]
pub safe fn sceKernelReferLwMutexStatusByID(
id: LwMutexId, info: &mut LwMutexInfo,
) -> SceResult<()>;
#[nid(0x8125221D)]
pub unsafe fn sceKernelCreateMbx(
name: *const u8, attr: MsgBoxAttributes, options: Option<&mut MsgBoxOptions>,
) -> SceResult<MsgBoxId>;
#[nid(0x86255ADA)]
pub unsafe fn sceKernelDeleteMbx(id: MsgBoxId) -> SceResult<()>;
#[nid(0xE9B3061E)]
pub unsafe fn sceKernelSendMbx(id: MsgBoxId, msg: *mut MsgPacket) -> SceResult<()>;
#[nid(0x18260574)]
pub unsafe fn sceKernelReceiveMbx(
id: MsgBoxId, msg: *mut *mut MsgPacket, timeout: Option<&mut u32>,
) -> SceResult<()>;
#[nid(0xF3986382)]
pub unsafe fn sceKernelReceiveMbxCB(
id: MsgBoxId, msg: *mut *mut MsgPacket, timeout: Option<&mut u32>,
) -> SceResult<()>;
#[nid(0x0D81716A)]
pub unsafe fn sceKernelPollMbx(id: MsgBoxId, msg: *mut *mut MsgPacket) -> SceResult<()>;
#[nid(0x87D4DD36)]
pub safe fn sceKernelCancelReceiveMbx(
id: MsgBoxId, num_wait_threads: &mut u32,
) -> SceResult<()>;
#[nid(0xA8E8C846)]
pub safe fn sceKernelReferMbxStatus(id: MsgBoxId, info: &mut MsgBoxInfo) -> SceResult<()>;
#[eabi(i5)]
#[nid(0x7C0DC2A0)]
pub unsafe fn sceKernelCreateMsgPipe(
name: *const u8, partition_id: MemoryPartitionId, attr: MsgPipeAttributes,
buf_size: SceSize, options: Option<&SemaphoreOptions>,
) -> SceResult<MsgPipeId>;
#[nid(0xF0B7DA1C)]
pub safe fn sceKernelDeleteMsgPipe(id: MsgPipeId) -> SceResult<()>;
#[eabi(i6)]
#[nid(0x876DBFAD)]
pub unsafe fn sceKernelSendMsgPipe(
id: MsgPipeId, msg_buf: *const c_void, msg_size: SceSize, wait_kind: MsgPipeWaitKind,
data_send_size: &mut u32, timeout: Option<&mut u32>,
) -> SceResult<()>;
#[eabi(i6)]
#[nid(0x7C41F2C2)]
pub unsafe fn sceKernelSendMsgPipeCB(
id: MsgPipeId, msg_buf: *const c_void, msg_size: SceSize, wait_kind: MsgPipeWaitKind,
data_send_size: &mut u32, timeout: Option<&mut u32>,
) -> SceResult<()>;
#[eabi(i5)]
#[nid(0x884C9F90)]
pub unsafe fn sceKernelTrySendMsgPipe(
id: MsgPipeId, msg_buf: *const c_void, msg_size: SceSize, wait_kind: MsgPipeWaitKind,
data_send_size: &mut u32,
) -> SceResult<()>;
#[eabi(i6)]
#[nid(0x74829B76)]
pub unsafe fn sceKernelReceiveMsgPipe(
id: MsgPipeId, msg_buf: *mut c_void, msg_size: SceSize, wait_kind: MsgPipeWaitKind,
data_send_size: &mut u32, timeout: Option<&mut u32>,
) -> SceResult<()>;
#[eabi(i6)]
#[nid(0xFBFA697D)]
pub unsafe fn sceKernelReceiveMsgPipeCB(
id: MsgPipeId, msg_buf: *mut c_void, msg_size: SceSize, wait_kind: MsgPipeWaitKind,
data_send_size: &mut u32, timeout: Option<&mut u32>,
) -> SceResult<()>;
#[eabi(i5)]
#[nid(0xDF52098F)]
pub unsafe fn sceKernelTryReceiveMsgPipe(
id: MsgPipeId, msg_buf: *mut c_void, msg_size: SceSize, wait_kind: MsgPipeWaitKind,
data_send_size: &mut u32,
) -> SceResult<()>;
#[nid(0x349B864D)]
pub safe fn sceKernelCancelMsgPipe(
id: MsgPipeId, num_send_wait_threads: &mut u32, num_recv_wait_threads: &mut u32,
) -> SceResult<()>;
#[nid(0x33BE4024)]
pub safe fn sceKernelReferMsgPipeStatus(id: MsgPipeId, info: &mut MsgPipeInfo)
-> SceResult<()>;
#[nid(0x56C039B5)]
pub unsafe fn sceKernelCreateVpl(
name: *const u8, partition_id: MemoryPartitionId, attr: VplAttributes, size: SceSize,
options: Option<&VplOptions>,
) -> SceResult<VplId>;
#[nid(0x89B3D48C)]
pub safe fn sceKernelDeleteVpl(id: VplId) -> SceResult<()>;
#[nid(0xBED27435)]
pub unsafe fn sceKernelAllocateVpl(
id: VplId, size: SceSize, mem_block: *mut *mut c_void, timeout: Option<&mut u32>,
) -> SceResult<()>;
#[nid(0xEC0A693F)]
pub unsafe fn sceKernelAllocateVplCB(
id: VplId, size: SceSize, mem_block: *mut *mut c_void, timeout: Option<&mut u32>,
) -> SceResult<()>;
#[nid(0xAF36D708)]
pub unsafe fn sceKernelTryAllocateVpl(
id: VplId, size: SceSize, mem_block: *mut *mut c_void,
) -> SceResult<()>;
pub unsafe fn sceKernelFreeVpl(id: VplId, mem_block: *mut c_void) -> SceResult<()>;
#[nid(0x1D371B8A)]
pub safe fn sceKernelCancelVpl(id: VplId, num_wait_threads: &mut u32) -> SceResult<()>;
#[nid(0x39810265)]
pub safe fn sceKernelReferVplStatus(id: VplId, info: &mut VplInfo) -> SceResult<()>;
#[eabi(i6)]
#[nid(0xC07BB470)]
pub unsafe fn sceKernelCreateFpl(
name: *const u8, partition_id: MemoryPartitionId, attr: FplAttributes, block_size: SceSize,
num_blocks: SceSize, options: Option<&FplOptions>,
) -> SceResult<FplId>;
#[nid(0xED1410E0)]
pub safe fn sceKernelDeleteFpl(id: FplId) -> SceResult<()>;
#[nid(0xD979E9BF)]
pub unsafe fn sceKernelAllocateFpl(
id: FplId, mem_block: *mut *mut c_void, timeout: Option<&mut u32>,
) -> SceResult<()>;
#[nid(0xE7282CB6)]
pub unsafe fn sceKernelAllocateFplCB(
id: FplId, mem_block: *mut *mut c_void, timeout: Option<&mut u32>,
) -> SceResult<()>;
#[nid(0x623AE665)]
pub unsafe fn sceKernelTryAllocateFpl(id: FplId, mem_block: *mut *mut c_void) -> SceResult<()>;
#[nid(0xF6414A71)]
pub unsafe fn sceKernelFreeFpl(id: FplId, mem_block: *mut c_void) -> SceResult<()>;
#[nid(0xA8AA591F)]
pub safe fn sceKernelCancelFpl(id: FplId, num_wait_threads: &mut u32) -> SceResult<()>;
#[nid(0xD8199E4C)]
pub safe fn sceKernelReferFplStatus(id: FplId, info: &mut FplInfo) -> SceResult<()>;
#[nid(0x721067F3)]
pub safe fn sceKernelReferTlsplStatus(id: TlsPoolId, info: &mut TlsPoolInfo) -> SceResult<()>;
#[nid(0xDB738F35)]
pub safe fn sceKernelGetSystemTime(clock: &mut SystemClock) -> SceResult<()>;
#[nid(0x82BC5777)]
pub safe fn sceKernelGetSystemTimeWide() -> u64;
#[nid(0x369ED59D)]
pub safe fn sceKernelGetSystemTimeLow() -> u32;
#[nid(0x6652B8CA)]
pub unsafe fn sceKernelSetAlarm(
microsec: u32, handler: AlarmHandler, common: *mut c_void,
) -> SceResult<AlarmId>;
#[nid(0xB2C25152)]
pub unsafe fn sceKernelSetSysClockAlarm(
clock: &SystemClock, handler: AlarmHandler, common: *mut c_void,
) -> SceResult<AlarmId>;
#[nid(0x7E65B999)]
pub safe fn sceKernelCancelAlarm(id: AlarmId) -> SceResult<()>;
#[nid(0xDAA3F564)]
pub safe fn sceKernelReferAlarmStatus(id: AlarmId, info: &mut AlarmInfo) -> SceResult<()>;
#[nid(0x110DEC9A)]
pub safe fn sceKernelUSec2SysClock(microsec: u32, clock: &mut SystemClock) -> SceResult<()>;
#[nid(0xBA6B92E2)]
pub safe fn sceKernelSysClock2USec(
clock: &SystemClock, sec: &mut u32, microsec: &mut u32,
) -> SceResult<()>;
#[nid(0xC8CD158C)]
pub safe fn sceKernelUSec2SysClockWide(microsec: u32) -> u64;
#[nid(0xE1619D7C)]
pub safe fn sceKernelSysClock2USecWide(
raw_clock: u64, sec: &mut u32, microsec: &mut u32,
) -> SceResult<()>;
#[nid(0x20FFF560)]
pub unsafe fn sceKernelCreateVTimer(
name: *const u8, options: Option<&VirtualTimerOptions>,
) -> SceResult<VirtualTimerId>;
#[nid(0x328F9E52)]
pub safe fn sceKernelDeleteVTimer(id: VirtualTimerId) -> SceResult<()>;
#[nid(0xB3A59970)]
pub safe fn sceKernelGetVTimerBase(id: VirtualTimerId, base: &mut SystemClock)
-> SceResult<()>;
#[nid(0xB7C18B77)]
pub safe fn sceKernelGetVTimerBaseWide(id: VirtualTimerId) -> u64;
#[nid(0x034A921F)]
pub safe fn sceKernelGetVTimerTime(id: VirtualTimerId, time: &mut SystemClock)
-> SceResult<()>;
#[nid(0xC0B3FFD2)]
pub safe fn sceKernelGetVTimerTimeWide(id: VirtualTimerId) -> u64;
#[nid(0x542AD630)]
pub safe fn sceKernelSetVTimerTime(id: VirtualTimerId, time: &mut SystemClock)
-> SceResult<()>;
#[nid(0xFB6425C3)]
pub safe fn sceKernelSetVTimerTimeWide(id: VirtualTimerId, time: u64) -> u64;
#[nid(0xC68D9437)]
pub safe fn sceKernelStartVTimer(id: VirtualTimerId) -> SceResult<VirtualTimerState>;
#[nid(0xD0AEEE87)]
pub safe fn sceKernelStopVTimer(id: VirtualTimerId) -> SceResult<VirtualTimerState>;
#[nid(0xD8B299AE)]
pub unsafe fn sceKernelSetVTimerHandler(
id: VirtualTimerId, schedule: &mut SystemClock, handler: VirtualTimerHandler,
common: *mut c_void,
) -> SceResult<()>;
#[nid(0x53B00E9A)]
pub unsafe fn sceKernelSetVTimerHandlerWide(
id: VirtualTimerId, schedule: u64, handler: VirtualTimerHandlerWide, common: *mut c_void,
) -> SceResult<()>;
#[nid(0xD2D615EF)]
pub safe fn sceKernelCancelVTimerHandler(id: VirtualTimerId) -> SceResult<()>;
#[nid(0x5F32BEAA)]
pub safe fn sceKernelReferVTimerStatus(
id: VirtualTimerId, info: &mut VirtualTimerInfo,
) -> SceResult<()>;
#[nid(0xE81CAF8F)]
pub unsafe fn sceKernelCreateCallback(
name: *const u8, entry: CallbackFunction, common: *mut c_void,
) -> SceResult<CallbackId>;
#[nid(0xEDBA5844)]
pub safe fn sceKernelDeleteCallback(id: CallbackId) -> SceResult<()>;
#[nid(0xC11BA8C4)]
pub safe fn sceKernelNotifyCallback(id: CallbackId, arg: i32) -> SceResult<()>;
#[nid(0xBA4051D6)]
pub safe fn sceKernelCancelCallback(id: CallbackId) -> SceResult<()>;
#[nid(0x2A3D44FF)]
pub safe fn sceKernelGetCallbackCount(id: CallbackId) -> SceResult<u32>;
#[nid(0x349D6D6C)]
pub safe fn sceKernelCheckCallback() -> SceResult<CallbackCheckStatus>;
#[nid(0x730ED8BC)]
pub safe fn sceKernelReferCallbackStatus(
id: CallbackId, info: &mut CallbackInfo,
) -> SceResult<()>;
#[nid(0x627E6F3A)]
pub safe fn sceKernelReferSystemStatus(info: &mut SystemInfo) -> SceResult<()>;
#[nid(0x94416130)]
pub unsafe fn sceKernelGetThreadmanIdList(
kind: ThreadIdKind, buf: *mut SceUid, buf_size: SceSize, id_cound: Option<&mut u32>,
) -> SceResult<u32>;
#[nid(0x57CF62DD)]
pub safe fn sceKernelGetThreadmanIdType(id: SceUid) -> SceResult<ThreadIdKind>;
#[eabi(i5)]
#[nid(0x0C106E53)]
pub unsafe fn sceKernelRegisterThreadEventHandler(
name: *const u8, thread_id: ThreadId, event_mask: ThreadEvents,
handler: ThreadEventHandler, common: *mut c_void,
) -> SceResult<ThreadEventId>;
#[nid(0x72F3C145)]
pub safe fn sceKernelReleaseThreadEventHandler(id: ThreadEventId) -> SceResult<()>;
#[nid(0x369EEB6B)]
pub safe fn sceKernelReferThreadEventHandlerStatus(
id: ThreadEventId, info: &mut ThreadEventInfo,
) -> SceResult<()>;
#[nid(0xD890B370)]
pub safe fn sceKernelGetThreadKernelStackFreeSize(id: ThreadId) -> SceResult<u32>;
#[nid(0x4FE44D5E)]
pub safe fn sceKernelCheckThreadKernelStack() -> SceResult<i32>;
#[nid(0xBC31C1B9)]
pub safe fn sceKernelExtendKernelStack(
stack_size: SceSize, func: ExtendStackFunc, common: *mut c_void,
) -> SceResult<u32>;
#[nid(0xFCB5EB49)]
pub safe fn sceKernelGetSystemStatusFlag() -> u32;
#[nid(0x04E72261)]
pub unsafe fn sceKernelAllocateKTLS(
id: SceUid, func: KtlsAllocFunc, common: *mut c_void,
) -> SceResult<KtlsId>;
#[nid(0xD198B811)]
pub safe fn sceKernelFreeKTLS(id: KtlsId) -> SceResult<()>;
#[nid(0xA249EAAE)]
pub safe fn sceKernelGetKTLS(id: KtlsId) -> *mut c_void;
#[nid(0x3AD875C3)]
pub safe fn sceKernelGetThreadKTLS(id: KtlsId, thread_id: ThreadId, mode: u32) -> *mut c_void;
}
impl ThreadId {
pub const ALL_USER: Self = unsafe { Self::from_raw_unchecked(0xFFFFFFF0) };
pub const CALLING: Self = unsafe { Self::from_raw_unchecked(0) };
pub const fn from_raw(raw: u32) -> Option<Self> {
if let 0..=0x7FFFFFFF = raw {
Some(unsafe { Self::from_raw_unchecked(raw) })
} else {
None
}
}
#[inline]
pub const unsafe fn from_raw_unchecked(raw: u32) -> Self {
Self(raw)
}
#[inline]
pub const fn to_inner(self) -> u32 {
unsafe { core::mem::transmute(self) }
}
}
impl crate::private::Sealed for ThreadId {}
unsafe impl SceResultOk for ThreadId {
unsafe fn handle_ok_value(ok_value: u32) -> Result<Self, SceError> {
unsafe {
SceUid::handle_ok_value(ok_value).map(|id| Self::from_raw_unchecked(id.to_inner()))
}
}
}
unsafe impl SceIntoOkValue for ThreadId {
fn into_ok_value(self) -> u32 {
self.to_inner()
}
}
impl SemaId {
pub const fn from_raw(raw: u32) -> Option<Self> {
if let 0..=0x7FFFFFFF = raw {
Some(unsafe { Self::from_raw_unchecked(raw) })
} else {
None
}
}
#[inline]
pub const unsafe fn from_raw_unchecked(raw: u32) -> Self {
Self(unsafe { SceUid::from_raw_unchecked(raw) })
}
#[inline]
pub const fn to_inner(self) -> u32 {
unsafe { core::mem::transmute(self) }
}
}
impl crate::private::Sealed for SemaId {}
unsafe impl SceResultOk for SemaId {
unsafe fn handle_ok_value(ok_value: u32) -> Result<Self, SceError> {
unsafe { SceUid::handle_ok_value(ok_value).map(Self) }
}
}
unsafe impl SceIntoOkValue for SemaId {
fn into_ok_value(self) -> u32 {
self.to_inner()
}
}
impl EventFlagId {
pub const fn from_raw(raw: u32) -> Option<Self> {
if let 0..=0x7FFFFFFF = raw {
Some(unsafe { Self::from_raw_unchecked(raw) })
} else {
None
}
}
#[inline]
pub const unsafe fn from_raw_unchecked(raw: u32) -> Self {
Self(unsafe { SceUid::from_raw_unchecked(raw) })
}
#[inline]
pub const fn to_inner(self) -> u32 {
unsafe { core::mem::transmute(self) }
}
}
impl crate::private::Sealed for EventFlagId {}
unsafe impl SceResultOk for EventFlagId {
unsafe fn handle_ok_value(ok_value: u32) -> Result<Self, SceError> {
unsafe { SceUid::handle_ok_value(ok_value).map(Self) }
}
}
unsafe impl SceIntoOkValue for EventFlagId {
fn into_ok_value(self) -> u32 {
self.to_inner()
}
}
impl CallbackId {
pub const fn from_raw(raw: u32) -> Option<Self> {
if let 0..=0x7FFFFFFF = raw {
Some(unsafe { Self::from_raw_unchecked(raw) })
} else {
None
}
}
#[inline]
pub const unsafe fn from_raw_unchecked(raw: u32) -> Self {
Self(unsafe { SceUid::from_raw_unchecked(raw) })
}
#[inline]
pub const fn to_inner(self) -> u32 {
unsafe { core::mem::transmute(self) }
}
}
impl crate::private::Sealed for CallbackId {}
unsafe impl SceResultOk for CallbackId {
unsafe fn handle_ok_value(ok_value: u32) -> Result<Self, SceError> {
unsafe { SceUid::handle_ok_value(ok_value).map(Self) }
}
}
unsafe impl SceIntoOkValue for CallbackId {
fn into_ok_value(self) -> u32 {
self.to_inner()
}
}
impl crate::private::Sealed for ThreadState {}
unsafe impl SceResultOk for ThreadState {
unsafe fn handle_ok_value(ok_value: u32) -> Result<Self, SceError> {
Ok(Self::from_bits_retain(ok_value))
}
}
unsafe impl SceIntoOkValue for ThreadState {
fn into_ok_value(self) -> u32 {
self.bits()
}
}
impl MutexId {
pub const fn from_raw(raw: u32) -> Option<Self> {
if let 0..=0x7FFFFFFF = raw {
Some(unsafe { Self::from_raw_unchecked(raw) })
} else {
None
}
}
#[inline]
pub const unsafe fn from_raw_unchecked(raw: u32) -> Self {
Self(unsafe { SceUid::from_raw_unchecked(raw) })
}
#[inline]
pub const fn to_inner(self) -> u32 {
unsafe { core::mem::transmute(self) }
}
}
impl crate::private::Sealed for MutexId {}
unsafe impl SceResultOk for MutexId {
unsafe fn handle_ok_value(ok_value: u32) -> Result<Self, SceError> {
unsafe { SceUid::handle_ok_value(ok_value).map(Self) }
}
}
unsafe impl SceIntoOkValue for MutexId {
fn into_ok_value(self) -> u32 {
self.to_inner()
}
}
impl Default for ThreadOptions {
fn default() -> Self {
Self {
size: size_of::<Self>(),
stack_mem_partition: Default::default(),
}
}
}
impl Default for ThreadInfo {
fn default() -> Self {
Self {
size: size_of::<Self>(),
name: Default::default(),
attr: Default::default(),
status: Default::default(),
entry: Default::default(),
stack: Default::default(),
stack_size: Default::default(),
gp_reg: Default::default(),
init_priority: Default::default(),
curr_priority: Default::default(),
wait_kind: Default::default(),
wait_id: Default::default(),
wakeup_count: Default::default(),
exit_status: Default::default(),
run_clocks: Default::default(),
intr_preempt_count: Default::default(),
thread_preempt_count: Default::default(),
release_count: Default::default(),
notify_callback: Default::default(),
}
}
}
impl Default for ThreadRunStatus {
fn default() -> Self {
Self {
size: size_of::<Self>(),
status: Default::default(),
curr_priority: Default::default(),
wait_kind: Default::default(),
wait_id: Default::default(),
wakeup_count: Default::default(),
run_clocks: Default::default(),
intr_preempt_count: Default::default(),
thread_preempt_count: Default::default(),
release_count: Default::default(),
notify_callback: Default::default(),
}
}
}
impl Default for SemaphoreOptions {
fn default() -> Self {
Self {
size: size_of::<Self>(),
}
}
}
impl Default for SemaphoreInfo {
fn default() -> Self {
Self {
size: size_of::<Self>(),
name: Default::default(),
attr: Default::default(),
init_val: Default::default(),
curr_val: Default::default(),
max_val: Default::default(),
num_wait_threads: Default::default(),
}
}
}
impl Default for EventFlagOptions {
fn default() -> Self {
Self {
size: size_of::<Self>(),
}
}
}
impl Default for EventFlagInfo {
fn default() -> Self {
Self {
size: size_of::<Self>(),
name: Default::default(),
attr: Default::default(),
init_pattern: Default::default(),
curr_pattern: Default::default(),
num_wait_threads: Default::default(),
}
}
}
impl Default for MutexOptions {
fn default() -> Self {
Self {
size: size_of::<Self>(),
}
}
}
impl Default for MutexInfo {
fn default() -> Self {
Self {
size: size_of::<Self>(),
name: Default::default(),
attr: Default::default(),
init_count: Default::default(),
curr_count: Default::default(),
curr_owner: Default::default(),
num_wait_threads: Default::default(),
}
}
}
impl LwMutexId {
pub const fn from_raw(raw: u32) -> Option<Self> {
if let 0..=0x7FFFFFFF = raw {
Some(unsafe { Self::from_raw_unchecked(raw) })
} else {
None
}
}
#[inline]
pub const unsafe fn from_raw_unchecked(raw: u32) -> Self {
Self(unsafe { SceUid::from_raw_unchecked(raw) })
}
#[inline]
pub const fn to_inner(self) -> u32 {
unsafe { core::mem::transmute(self) }
}
}
impl crate::private::Sealed for LwMutexId {}
unsafe impl SceResultOk for LwMutexId {
unsafe fn handle_ok_value(ok_value: u32) -> Result<Self, SceError> {
unsafe { SceUid::handle_ok_value(ok_value).map(Self) }
}
}
unsafe impl SceIntoOkValue for LwMutexId {
fn into_ok_value(self) -> u32 {
self.to_inner()
}
}
impl LwMutexWorkArea {
#[inline]
pub const fn default_new() -> Self {
Self {
lock_count: 0,
lock_thread: unsafe { ThreadId::from_raw_unchecked(0) },
attr: MutexAttributes::from_bits_retain(0),
num_wait_threads: 0,
uid: unsafe { LwMutexId::from_raw_unchecked(0) },
pad: [0; 3],
}
}
}
impl Default for LwMutexInfo {
fn default() -> Self {
Self {
size: size_of::<Self>(),
name: Default::default(),
attr: Default::default(),
uid: Default::default(),
work_addr: Default::default(),
init_count: Default::default(),
curr_count: Default::default(),
curr_owner: Default::default(),
num_wait_threads: Default::default(),
}
}
}
impl MsgBoxId {
pub const fn from_raw(raw: u32) -> Option<Self> {
if let 0..=0x7FFFFFFF = raw {
Some(unsafe { Self::from_raw_unchecked(raw) })
} else {
None
}
}
#[inline]
pub const unsafe fn from_raw_unchecked(raw: u32) -> Self {
Self(unsafe { SceUid::from_raw_unchecked(raw) })
}
#[inline]
pub const fn to_inner(self) -> u32 {
unsafe { core::mem::transmute(self) }
}
}
impl crate::private::Sealed for MsgBoxId {}
unsafe impl SceResultOk for MsgBoxId {
unsafe fn handle_ok_value(ok_value: u32) -> Result<Self, SceError> {
unsafe { SceUid::handle_ok_value(ok_value).map(Self) }
}
}
unsafe impl SceIntoOkValue for MsgBoxId {
fn into_ok_value(self) -> u32 {
self.to_inner()
}
}
impl Default for MsgBoxInfo {
fn default() -> Self {
Self {
size: size_of::<Self>(),
name: Default::default(),
attr: Default::default(),
num_wait_threads: Default::default(),
num_messages: Default::default(),
top_msg: Default::default(),
}
}
}
impl MsgPipeId {
pub const fn from_raw(raw: u32) -> Option<Self> {
if let 0..=0x7FFFFFFF = raw {
Some(unsafe { Self::from_raw_unchecked(raw) })
} else {
None
}
}
#[inline]
pub const unsafe fn from_raw_unchecked(raw: u32) -> Self {
Self(unsafe { SceUid::from_raw_unchecked(raw) })
}
#[inline]
pub const fn to_inner(self) -> u32 {
unsafe { core::mem::transmute(self) }
}
}
impl crate::private::Sealed for MsgPipeId {}
unsafe impl SceResultOk for MsgPipeId {
unsafe fn handle_ok_value(ok_value: u32) -> Result<Self, SceError> {
unsafe { SceUid::handle_ok_value(ok_value).map(Self) }
}
}
unsafe impl SceIntoOkValue for MsgPipeId {
fn into_ok_value(self) -> u32 {
self.to_inner()
}
}
impl Default for MsgPipeOptions {
fn default() -> Self {
Self {
size: size_of::<Self>(),
}
}
}
impl Default for MsgPipeInfo {
fn default() -> Self {
Self {
size: size_of::<Self>(),
name: Default::default(),
attr: Default::default(),
buf_size: Default::default(),
buf_free_size: Default::default(),
num_send_wait_threads: Default::default(),
num_recv_wait_threads: Default::default(),
}
}
}
impl VplId {
pub const fn from_raw(raw: u32) -> Option<Self> {
if let 0..=0x7FFFFFFF = raw {
Some(unsafe { Self::from_raw_unchecked(raw) })
} else {
None
}
}
#[inline]
pub const unsafe fn from_raw_unchecked(raw: u32) -> Self {
Self(unsafe { SceUid::from_raw_unchecked(raw) })
}
#[inline]
pub const fn to_inner(self) -> u32 {
unsafe { core::mem::transmute(self) }
}
}
impl crate::private::Sealed for VplId {}
unsafe impl SceResultOk for VplId {
unsafe fn handle_ok_value(ok_value: u32) -> Result<Self, SceError> {
unsafe { SceUid::handle_ok_value(ok_value).map(Self) }
}
}
unsafe impl SceIntoOkValue for VplId {
fn into_ok_value(self) -> u32 {
self.to_inner()
}
}
impl Default for VplOptions {
fn default() -> Self {
Self {
size: size_of::<Self>(),
}
}
}
impl FplId {
pub const fn from_raw(raw: u32) -> Option<Self> {
if let 0..=0x7FFFFFFF = raw {
Some(unsafe { Self::from_raw_unchecked(raw) })
} else {
None
}
}
#[inline]
pub const unsafe fn from_raw_unchecked(raw: u32) -> Self {
Self(unsafe { SceUid::from_raw_unchecked(raw) })
}
#[inline]
pub const fn to_inner(self) -> u32 {
unsafe { core::mem::transmute(self) }
}
}
impl crate::private::Sealed for FplId {}
unsafe impl SceResultOk for FplId {
unsafe fn handle_ok_value(ok_value: u32) -> Result<Self, SceError> {
unsafe { SceUid::handle_ok_value(ok_value).map(Self) }
}
}
unsafe impl SceIntoOkValue for FplId {
fn into_ok_value(self) -> u32 {
self.to_inner()
}
}
impl Default for FplOptions {
fn default() -> Self {
Self {
size: size_of::<Self>(),
alignment: Default::default(),
}
}
}
impl TlsPoolId {
pub const fn from_raw(raw: u32) -> Option<Self> {
if let 0..=0x7FFFFFFF = raw {
Some(unsafe { Self::from_raw_unchecked(raw) })
} else {
None
}
}
#[inline]
pub const unsafe fn from_raw_unchecked(raw: u32) -> Self {
Self(unsafe { SceUid::from_raw_unchecked(raw) })
}
#[inline]
pub const fn to_inner(self) -> u32 {
unsafe { core::mem::transmute(self) }
}
}
impl crate::private::Sealed for TlsPoolId {}
unsafe impl SceResultOk for TlsPoolId {
unsafe fn handle_ok_value(ok_value: u32) -> Result<Self, SceError> {
unsafe { SceUid::handle_ok_value(ok_value).map(Self) }
}
}
unsafe impl SceIntoOkValue for TlsPoolId {
fn into_ok_value(self) -> u32 {
self.to_inner()
}
}
impl Default for TlsPoolOptions {
fn default() -> Self {
Self {
size: size_of::<Self>(),
alignment: Default::default(),
}
}
}
impl Default for TlsPoolInfo {
fn default() -> Self {
Self {
size: size_of::<Self>(),
name: Default::default(),
attr: Default::default(),
block_size: Default::default(),
num_blocks: Default::default(),
free_blocks: Default::default(),
num_wait_threads: Default::default(),
}
}
}
impl AlarmId {
pub const fn from_raw(raw: u32) -> Option<Self> {
if let 0..=0x7FFFFFFF = raw {
Some(unsafe { Self::from_raw_unchecked(raw) })
} else {
None
}
}
#[inline]
pub const unsafe fn from_raw_unchecked(raw: u32) -> Self {
Self(unsafe { SceUid::from_raw_unchecked(raw) })
}
#[inline]
pub const fn to_inner(self) -> u32 {
unsafe { core::mem::transmute(self) }
}
}
impl crate::private::Sealed for AlarmId {}
unsafe impl SceResultOk for AlarmId {
unsafe fn handle_ok_value(ok_value: u32) -> Result<Self, SceError> {
unsafe { SceUid::handle_ok_value(ok_value).map(Self) }
}
}
unsafe impl SceIntoOkValue for AlarmId {
fn into_ok_value(self) -> u32 {
self.to_inner()
}
}
impl Default for AlarmInfo {
fn default() -> Self {
Self {
size: size_of::<Self>(),
schedule: Default::default(),
handler: Default::default(),
common: Default::default(),
}
}
}
impl VirtualTimerId {
pub const fn from_raw(raw: u32) -> Option<Self> {
if let 0..=0x7FFFFFFF = raw {
Some(unsafe { Self::from_raw_unchecked(raw) })
} else {
None
}
}
#[inline]
pub const unsafe fn from_raw_unchecked(raw: u32) -> Self {
Self(unsafe { SceUid::from_raw_unchecked(raw) })
}
#[inline]
pub const fn to_inner(self) -> u32 {
unsafe { core::mem::transmute(self) }
}
}
impl crate::private::Sealed for VirtualTimerId {}
unsafe impl SceResultOk for VirtualTimerId {
unsafe fn handle_ok_value(ok_value: u32) -> Result<Self, SceError> {
unsafe { SceUid::handle_ok_value(ok_value).map(Self) }
}
}
unsafe impl SceIntoOkValue for VirtualTimerId {
fn into_ok_value(self) -> u32 {
self.to_inner()
}
}
impl Default for VirtualTimerOptions {
fn default() -> Self {
Self {
size: size_of::<Self>(),
}
}
}
impl Default for VirtualTimerInfo {
fn default() -> Self {
Self {
size: size_of::<Self>(),
name: Default::default(),
state: Default::default(),
base: Default::default(),
current: Default::default(),
schedule: Default::default(),
handler: Default::default(),
common: Default::default(),
}
}
}
impl crate::private::Sealed for VirtualTimerState {}
unsafe impl SceResultOk for VirtualTimerState {
unsafe fn handle_ok_value(ok_value: u32) -> Result<Self, SceError> {
match ok_value {
0x00 => Ok(Self::NotRunning),
0x01 => Ok(Self::Running),
_ => Err(SceError::INVALID_VALUE),
}
}
}
unsafe impl SceIntoOkValue for VirtualTimerState {
fn into_ok_value(self) -> u32 {
match self {
VirtualTimerState::NotRunning => 0x00,
VirtualTimerState::Running => 0x01,
}
}
}
impl crate::private::Sealed for CallbackTermState {}
unsafe impl SceResultOk for CallbackTermState {
unsafe fn handle_ok_value(ok_value: u32) -> Result<Self, SceError> {
match ok_value {
0x00 => Ok(Self::NormalTermination),
0x01 => Ok(Self::DeletedCallback),
_ => Err(SceError::INVALID_VALUE),
}
}
}
unsafe impl SceIntoOkValue for CallbackTermState {
fn into_ok_value(self) -> u32 {
match self {
CallbackTermState::NormalTermination => 0x00,
CallbackTermState::DeletedCallback => 0x01,
}
}
}
impl Default for CallbackInfo {
fn default() -> Self {
Self {
size: size_of::<Self>(),
name: Default::default(),
thread_id: Default::default(),
entry: Default::default(),
notify_count: Default::default(),
notify_arg: Default::default(),
}
}
}
impl crate::private::Sealed for CallbackCheckStatus {}
unsafe impl SceResultOk for CallbackCheckStatus {
unsafe fn handle_ok_value(ok_value: u32) -> Result<Self, SceError> {
match ok_value {
0x00 => Ok(Self::NoCallback),
0x01 => Ok(Self::CallbackCalled),
_ => Err(SceError::INVALID_VALUE),
}
}
}
impl Default for SystemInfo {
fn default() -> Self {
Self {
size: size_of::<Self>(),
status: Default::default(),
idle_clocks: Default::default(),
comes_out_of_idle_count: Default::default(),
thread_switch_count: Default::default(),
vfpu_switch_count: Default::default(),
}
}
}
impl crate::private::Sealed for ThreadIdKind {}
unsafe impl SceResultOk for ThreadIdKind {
unsafe fn handle_ok_value(ok_value: u32) -> Result<Self, SceError> {
match ok_value {
1 => Ok(Self::Any),
2 => Ok(Self::Semaphore),
3 => Ok(Self::EventFlag),
4 => Ok(Self::MessageBox),
5 => Ok(Self::VariablepMemoryPool),
6 => Ok(Self::FixeMemoryPool),
7 => Ok(Self::MessagePipe),
8 => Ok(Self::Callback),
9 => Ok(Self::ThreadEventHandler),
10 => Ok(Self::Alarm),
11 => Ok(Self::VirtualTimer),
12 => Ok(Self::Mutex),
13 => Ok(Self::LightweightMutex),
14 => Ok(Self::TlsMemoryPool),
64 => Ok(Self::SleepThread),
65 => Ok(Self::DelayThread),
66 => Ok(Self::SuspendThread),
67 => Ok(Self::DormantThread),
_ => Err(SceError::INVALID_VALUE),
}
}
}
unsafe impl SceIntoOkValue for ThreadIdKind {
fn into_ok_value(self) -> u32 {
self as u32
}
}
impl Default for ThreadEventInfo {
fn default() -> Self {
Self {
size: size_of::<Self>(),
name: Default::default(),
thread_id: Default::default(),
event_mask: Default::default(),
handler: Default::default(),
common: Default::default(),
}
}
}
impl KtlsId {
pub const fn from_raw(raw: u32) -> Option<Self> {
if let 0..=0x7FFFFFFF = raw {
Some(unsafe { Self::from_raw_unchecked(raw) })
} else {
None
}
}
#[inline]
pub const unsafe fn from_raw_unchecked(raw: u32) -> Self {
Self(unsafe { SceUid::from_raw_unchecked(raw) })
}
#[inline]
pub const fn to_inner(self) -> u32 {
unsafe { core::mem::transmute(self) }
}
}
impl crate::private::Sealed for KtlsId {}
unsafe impl SceResultOk for KtlsId {
unsafe fn handle_ok_value(ok_value: u32) -> Result<Self, SceError> {
unsafe { SceUid::handle_ok_value(ok_value).map(Self) }
}
}
unsafe impl SceIntoOkValue for KtlsId {
fn into_ok_value(self) -> u32 {
self.to_inner()
}
}
impl ThreadAttributes {
#[inline]
pub const fn main_default() -> Self {
cfg_select! {
any(prx, feature = "kernel") => Self::from_bits_retain(0),
eboot => Self::UserMode.union(Self::UseVFPU),
_ => Self::UserMode,
}
}
}