aboutsummaryrefslogtreecommitdiff
path: root/ctru-sys/src
diff options
context:
space:
mode:
authorFenrir <[email protected]>2016-10-28 12:08:28 -0600
committerFenrir <[email protected]>2016-10-28 12:08:28 -0600
commit539fa2a42587ee34e192dabc43475634e0a21135 (patch)
tree672c3b72216a9555953c18c960856c819ca56b18 /ctru-sys/src
parentlibstd prelude, take 2 (diff)
downloadarchived-ctru-rs-539fa2a42587ee34e192dabc43475634e0a21135.tar.xz
archived-ctru-rs-539fa2a42587ee34e192dabc43475634e0a21135.zip
Split out libstd crate
Diffstat (limited to 'ctru-sys/src')
-rw-r--r--ctru-sys/src/svc.rs407
-rw-r--r--ctru-sys/src/synchronization.rs37
-rw-r--r--ctru-sys/src/sys/libc.rs2
-rw-r--r--ctru-sys/src/sys/lock.rs23
4 files changed, 262 insertions, 207 deletions
diff --git a/ctru-sys/src/svc.rs b/ctru-sys/src/svc.rs
index 12efcca..88a6992 100644
--- a/ctru-sys/src/svc.rs
+++ b/ctru-sys/src/svc.rs
@@ -1,13 +1,17 @@
-//TODO: Implement static functions
+/* automatically generated by rust-bindgen */
-use {Handle, Result};
-use libc::c_void;
-use ThreadFunc;
-use types::*;
+#![allow(dead_code,
+ non_camel_case_types,
+ non_upper_case_globals,
+ non_snake_case)]
-#[derive(Clone, Copy)]
-#[repr(C)]
-pub enum Enum_Unnamed1 {
+use ::{Handle, Result};
+use ::ThreadFunc;
+
+#[derive(Copy, Clone)]
+#[repr(u32)]
+#[derive(Debug)]
+pub enum MemOp {
MEMOP_FREE = 1,
MEMOP_RESERVE = 2,
MEMOP_ALLOC = 3,
@@ -22,10 +26,10 @@ pub enum Enum_Unnamed1 {
MEMOP_LINEAR_FLAG = 65536,
MEMOP_ALLOC_LINEAR = 65539,
}
-pub type MemOp = Enum_Unnamed1;
-#[derive(Clone, Copy)]
-#[repr(C)]
-pub enum Enum_Unnamed2 {
+#[derive(Copy, Clone)]
+#[repr(u32)]
+#[derive(Debug)]
+pub enum MemState {
MEMSTATE_FREE = 0,
MEMSTATE_RESERVED = 1,
MEMSTATE_IO = 2,
@@ -39,142 +43,128 @@ pub enum Enum_Unnamed2 {
MEMSTATE_ALIASCODE = 10,
MEMSTATE_LOCKED = 11,
}
-pub type MemState = Enum_Unnamed2;
-#[derive(Clone, Copy)]
-#[repr(C)]
-pub enum Enum_Unnamed3 {
+#[derive(Copy, Clone)]
+#[repr(u32)]
+#[derive(Debug)]
+pub enum MemPerm {
MEMPERM_READ = 1,
MEMPERM_WRITE = 2,
MEMPERM_EXECUTE = 4,
MEMPERM_DONTCARE = 268435456,
}
-pub type MemPerm = Enum_Unnamed3;
#[repr(C)]
-#[derive(Copy)]
-pub struct Struct_Unnamed4 {
+#[derive(Copy, Clone)]
+#[derive(Debug)]
+pub struct MemInfo {
pub base_addr: u32,
pub size: u32,
pub perm: u32,
pub state: u32,
}
-impl ::core::clone::Clone for Struct_Unnamed4 {
- fn clone(&self) -> Self { *self }
-}
-impl ::core::default::Default for Struct_Unnamed4 {
+impl ::core::default::Default for MemInfo {
fn default() -> Self { unsafe { ::core::mem::zeroed() } }
}
-pub type MemInfo = Struct_Unnamed4;
#[repr(C)]
-#[derive(Copy)]
-pub struct Struct_Unnamed5 {
+#[derive(Copy, Clone)]
+#[derive(Debug)]
+pub struct PageInfo {
pub flags: u32,
}
-impl ::core::clone::Clone for Struct_Unnamed5 {
- fn clone(&self) -> Self { *self }
-}
-impl ::core::default::Default for Struct_Unnamed5 {
+impl ::core::default::Default for PageInfo {
fn default() -> Self { unsafe { ::core::mem::zeroed() } }
}
-pub type PageInfo = Struct_Unnamed5;
-#[derive(Clone, Copy)]
-#[repr(C)]
-pub enum Enum_Unnamed6 {
+#[derive(Copy, Clone)]
+#[repr(u32)]
+#[derive(Debug)]
+pub enum ArbitrationType {
ARBITRATION_SIGNAL = 0,
ARBITRATION_WAIT_IF_LESS_THAN = 1,
ARBITRATION_DECREMENT_AND_WAIT_IF_LESS_THAN = 2,
ARBITRATION_WAIT_IF_LESS_THAN_TIMEOUT = 3,
ARBITRATION_DECREMENT_AND_WAIT_IF_LESS_THAN_TIMEOUT = 4,
}
-pub type ArbitrationType = Enum_Unnamed6;
-#[derive(Clone, Copy)]
-#[repr(C)]
-pub enum Enum_Unnamed7 { THREADINFO_TYPE_UNKNOWN = 0, }
-pub type ThreadInfoType = Enum_Unnamed7;
-#[derive(Clone, Copy)]
+#[derive(Copy, Clone)]
+#[repr(u32)]
+#[derive(Debug)]
+pub enum ResetType { RESET_ONESHOT = 0, RESET_STICKY = 1, RESET_PULSE = 2, }
+#[derive(Copy, Clone)]
+#[repr(u32)]
+#[derive(Debug)]
+pub enum ThreadInfoType { THREADINFO_TYPE_UNKNOWN = 0, }
+#[derive(Copy, Clone)]
+#[repr(u32)]
+#[derive(Debug)]
+pub enum ProcessEventReason { REASON_CREATE = 1, REASON_ATTACH = 2, }
#[repr(C)]
-pub enum Enum_Unnamed8 { REASON_CREATE = 1, REASON_ATTACH = 2, }
-pub type ProcessEventReason = Enum_Unnamed8;
-#[repr(C)]
-#[derive(Copy)]
-pub struct Struct_Unnamed9 {
+#[derive(Copy, Clone)]
+#[derive(Debug)]
+pub struct ProcessEvent {
pub program_id: u64,
pub process_name: [u8; 8usize],
pub process_id: u32,
pub reason: u32,
}
-impl ::core::clone::Clone for Struct_Unnamed9 {
- fn clone(&self) -> Self { *self }
-}
-impl ::core::default::Default for Struct_Unnamed9 {
+impl ::core::default::Default for ProcessEvent {
fn default() -> Self { unsafe { ::core::mem::zeroed() } }
}
-pub type ProcessEvent = Struct_Unnamed9;
-#[derive(Clone, Copy)]
-#[repr(C)]
-pub enum Enum_Unnamed10 {
+#[derive(Copy, Clone)]
+#[repr(u32)]
+#[derive(Debug)]
+pub enum ExitProcessEventReason {
EXITPROCESS_EVENT_NONE = 0,
EXITPROCESS_EVENT_TERMINATE = 1,
EXITPROCESS_EVENT_UNHANDLED_EXCEPTION = 2,
}
-pub type ExitProcessEventReason = Enum_Unnamed10;
#[repr(C)]
-#[derive(Copy)]
-pub struct Struct_Unnamed11 {
+#[derive(Copy, Clone)]
+#[derive(Debug)]
+pub struct ExitProcessEvent {
pub reason: u32,
}
-impl ::core::clone::Clone for Struct_Unnamed11 {
- fn clone(&self) -> Self { *self }
-}
-impl ::core::default::Default for Struct_Unnamed11 {
+impl ::core::default::Default for ExitProcessEvent {
fn default() -> Self { unsafe { ::core::mem::zeroed() } }
}
-pub type ExitProcessEvent = Struct_Unnamed11;
#[repr(C)]
-#[derive(Copy)]
-pub struct Struct_Unnamed12 {
+#[derive(Copy, Clone)]
+#[derive(Debug)]
+pub struct CreateThreadEvent {
pub creator_thread_id: u32,
pub base_addr: u32,
pub entry_point: u32,
}
-impl ::core::clone::Clone for Struct_Unnamed12 {
- fn clone(&self) -> Self { *self }
-}
-impl ::core::default::Default for Struct_Unnamed12 {
+impl ::core::default::Default for CreateThreadEvent {
fn default() -> Self { unsafe { ::core::mem::zeroed() } }
}
-pub type CreateThreadEvent = Struct_Unnamed12;
-#[derive(Clone, Copy)]
-#[repr(C)]
-pub enum Enum_Unnamed13 {
+#[derive(Copy, Clone)]
+#[repr(u32)]
+#[derive(Debug)]
+pub enum ExitThreadEventReason {
EXITTHREAD_EVENT_NONE = 0,
EXITTHREAD_EVENT_TERMINATE = 1,
EXITTHREAD_EVENT_UNHANDLED_EXC = 2,
EXITTHREAD_EVENT_TERMINATE_PROCESS = 3,
}
-pub type ExitThreadEventReason = Enum_Unnamed13;
#[repr(C)]
-#[derive(Copy)]
-pub struct Struct_Unnamed14 {
+#[derive(Copy, Clone)]
+#[derive(Debug)]
+pub struct ExitThreadEvent {
pub reason: u32,
}
-impl ::core::clone::Clone for Struct_Unnamed14 {
- fn clone(&self) -> Self { *self }
-}
-impl ::core::default::Default for Struct_Unnamed14 {
+impl ::core::default::Default for ExitThreadEvent {
fn default() -> Self { unsafe { ::core::mem::zeroed() } }
}
-pub type ExitThreadEvent = Struct_Unnamed14;
-#[derive(Clone, Copy)]
-#[repr(C)]
-pub enum Enum_Unnamed15 {
+#[derive(Copy, Clone)]
+#[repr(u32)]
+#[derive(Debug)]
+pub enum UserBreakType {
USERBREAK_PANIC = 0,
USERBREAK_ASSERT = 1,
USERBREAK_USER = 2,
}
-pub type UserBreakType = Enum_Unnamed15;
-#[derive(Clone, Copy)]
-#[repr(C)]
-pub enum Enum_Unnamed16 {
+#[derive(Copy, Clone)]
+#[repr(u32)]
+#[derive(Debug)]
+pub enum ExceptionEventType {
EXC_EVENT_UNDEFINED_INSTRUCTION = 0,
EXC_EVENT_UNKNOWN1 = 1,
EXC_EVENT_UNKNOWN2 = 2,
@@ -185,77 +175,63 @@ pub enum Enum_Unnamed16 {
EXC_EVENT_DEBUGGER_BREAK = 7,
EXC_EVENT_UNDEFINED_SYSCALL = 8,
}
-pub type ExceptionEventType = Enum_Unnamed16;
#[repr(C)]
-#[derive(Copy)]
-pub struct Struct_Unnamed17 {
- pub _type: u32,
+#[derive(Copy, Clone)]
+#[derive(Debug)]
+pub struct ExceptionEvent {
+ pub type_: u32,
pub address: u32,
pub argument: u32,
}
-impl ::core::clone::Clone for Struct_Unnamed17 {
- fn clone(&self) -> Self { *self }
-}
-impl ::core::default::Default for Struct_Unnamed17 {
+impl ::core::default::Default for ExceptionEvent {
fn default() -> Self { unsafe { ::core::mem::zeroed() } }
}
-pub type ExceptionEvent = Struct_Unnamed17;
#[repr(C)]
-#[derive(Copy)]
-pub struct Struct_Unnamed18 {
+#[derive(Copy, Clone)]
+#[derive(Debug)]
+pub struct SchedulerInOutEvent {
pub clock_tick: u64,
}
-impl ::core::clone::Clone for Struct_Unnamed18 {
- fn clone(&self) -> Self { *self }
-}
-impl ::core::default::Default for Struct_Unnamed18 {
+impl ::core::default::Default for SchedulerInOutEvent {
fn default() -> Self { unsafe { ::core::mem::zeroed() } }
}
-pub type SchedulerInOutEvent = Struct_Unnamed18;
#[repr(C)]
-#[derive(Copy)]
-pub struct Struct_Unnamed19 {
+#[derive(Copy, Clone)]
+#[derive(Debug)]
+pub struct SyscallInOutEvent {
pub clock_tick: u64,
pub syscall: u32,
+ _bindgen_padding_0_: [u8; 4usize],
}
-impl ::core::clone::Clone for Struct_Unnamed19 {
- fn clone(&self) -> Self { *self }
-}
-impl ::core::default::Default for Struct_Unnamed19 {
+impl ::core::default::Default for SyscallInOutEvent {
fn default() -> Self { unsafe { ::core::mem::zeroed() } }
}
-pub type SyscallInOutEvent = Struct_Unnamed19;
#[repr(C)]
-#[derive(Copy)]
-pub struct Struct_Unnamed20 {
+#[derive(Copy, Clone)]
+#[derive(Debug)]
+pub struct OutputStringEvent {
pub string_addr: u32,
pub string_size: u32,
}
-impl ::core::clone::Clone for Struct_Unnamed20 {
- fn clone(&self) -> Self { *self }
-}
-impl ::core::default::Default for Struct_Unnamed20 {
+impl ::core::default::Default for OutputStringEvent {
fn default() -> Self { unsafe { ::core::mem::zeroed() } }
}
-pub type OutputStringEvent = Struct_Unnamed20;
#[repr(C)]
-#[derive(Copy)]
-pub struct Struct_Unnamed21 {
+#[derive(Copy, Clone)]
+#[derive(Debug)]
+pub struct MapEvent {
pub mapped_addr: u32,
pub mapped_size: u32,
pub memperm: u32,
pub memstate: u32,
}
-impl ::core::clone::Clone for Struct_Unnamed21 {
- fn clone(&self) -> Self { *self }
-}
-impl ::core::default::Default for Struct_Unnamed21 {
+impl ::core::default::Default for MapEvent {
fn default() -> Self { unsafe { ::core::mem::zeroed() } }
}
-pub type MapEvent = Struct_Unnamed21;
-#[derive(Clone, Copy)]
-#[repr(C)]
-pub enum Enum_Unnamed22 {
+#[derive(Copy, Clone)]
+#[repr(u32)]
+#[derive(Debug)]
+pub enum DebugEventType {
DBG_EVENT_PROCESS = 0,
DBG_EVENT_CREATE_THREAD = 1,
DBG_EVENT_EXIT_THREAD = 2,
@@ -270,16 +246,16 @@ pub enum Enum_Unnamed22 {
DBG_EVENT_OUTPUT_STRING = 11,
DBG_EVENT_MAP = 12,
}
-pub type DebugEventType = Enum_Unnamed22;
#[repr(C)]
-#[derive(Copy)]
-pub struct Struct_Unnamed23 {
- pub _type: u32,
+#[derive(Copy, Clone)]
+#[derive(Debug)]
+pub struct DebugEventInfo {
+ pub type_: u32,
pub thread_id: u32,
pub unknown: [u32; 2usize],
pub _bindgen_data_1_: [u64; 3usize],
}
-impl Struct_Unnamed23 {
+impl DebugEventInfo {
pub unsafe fn process(&mut self) -> *mut ProcessEvent {
let raw: *mut u8 = ::core::mem::transmute(&self._bindgen_data_1_);
::core::mem::transmute(raw.offset(0))
@@ -317,18 +293,50 @@ impl Struct_Unnamed23 {
::core::mem::transmute(raw.offset(0))
}
}
-impl ::core::clone::Clone for Struct_Unnamed23 {
- fn clone(&self) -> Self { *self }
+impl ::core::default::Default for DebugEventInfo {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
+#[repr(C)]
+#[derive(Copy, Clone)]
+#[derive(Debug)]
+pub struct CodeSetInfo {
+ pub name: [u8; 8usize],
+ pub unk1: u16,
+ pub unk2: u16,
+ pub unk3: u32,
+ pub text_addr: u32,
+ pub text_size: u32,
+ pub ro_addr: u32,
+ pub ro_size: u32,
+ pub rw_addr: u32,
+ pub rw_size: u32,
+ pub text_size_total: u32,
+ pub ro_size_total: u32,
+ pub rw_size_total: u32,
+ pub unk4: u32,
+ pub program_id: u64,
}
-impl ::core::default::Default for Struct_Unnamed23 {
+impl ::core::default::Default for CodeSetInfo {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
+#[repr(C)]
+#[derive(Copy, Clone)]
+#[derive(Debug)]
+pub struct StartupInfo {
+ pub priority: ::libc::c_int,
+ pub stack_size: u32,
+ pub argc: ::libc::c_int,
+ pub argv: *mut u16,
+ pub envp: *mut u16,
+}
+impl ::core::default::Default for StartupInfo {
fn default() -> Self { unsafe { ::core::mem::zeroed() } }
}
-pub type DebugEventInfo = Struct_Unnamed23;
extern "C" {
pub fn svcControlMemory(addr_out: *mut u32, addr0: u32, addr1: u32,
size: u32, op: MemOp, perm: MemPerm) -> Result;
pub fn svcControlProcessMemory(process: Handle, addr0: u32, addr1: u32,
- size: u32, _type: u32, perm: u32)
+ size: u32, type_: u32, perm: u32)
-> Result;
pub fn svcCreateMemoryBlock(memblock: *mut Handle, addr: u32, size: u32,
my_perm: MemPerm, other_perm: MemPerm)
@@ -341,102 +349,125 @@ extern "C" {
endAddr: u32) -> Result;
pub fn svcUnmapMemoryBlock(memblock: Handle, addr: u32) -> Result;
pub fn svcStartInterProcessDma(dma: *mut Handle, dstProcess: Handle,
- dst: *mut c_void,
+ dst: *mut ::libc::c_void,
srcProcess: Handle,
- src: *const c_void,
- size: u32,
- dmaConfig: *mut c_void)
- -> Result;
+ src: *const ::libc::c_void, size: u32,
+ dmaConfig: *mut ::libc::c_void) -> Result;
pub fn svcStopDma(dma: Handle) -> Result;
- pub fn svcGetDmaState(dmaState: *mut c_void, dma: Handle)
+ pub fn svcGetDmaState(dmaState: *mut ::libc::c_void, dma: Handle)
-> Result;
pub fn svcQueryMemory(info: *mut MemInfo, out: *mut PageInfo, addr: u32)
-> Result;
pub fn svcQueryProcessMemory(info: *mut MemInfo, out: *mut PageInfo,
process: Handle, addr: u32) -> Result;
pub fn svcInvalidateProcessDataCache(process: Handle,
- addr: *mut c_void,
+ addr: *mut ::libc::c_void,
size: u32) -> Result;
pub fn svcFlushProcessDataCache(process: Handle,
- addr: *const c_void,
- size: u32) -> Result;
- pub fn svcReadProcessMemory(buffer: *mut c_void,
- debug: Handle, addr: u32, size: u32)
+ addr: *const ::libc::c_void, size: u32)
-> Result;
- pub fn svcWriteProcessMemory(debug: Handle,
- buffer: *const c_void,
+ pub fn svcReadProcessMemory(buffer: *mut ::libc::c_void, debug: Handle,
+ addr: u32, size: u32) -> Result;
+ pub fn svcWriteProcessMemory(debug: Handle, buffer: *const ::libc::c_void,
addr: u32, size: u32) -> Result;
pub fn svcOpenProcess(process: *mut Handle, processId: u32) -> Result;
pub fn svcExitProcess();
pub fn svcTerminateProcess(process: Handle) -> Result;
- pub fn svcGetProcessInfo(out: *mut s64, process: Handle, _type: u32)
+ pub fn svcGetProcessInfo(out: *mut i64, process: Handle, type_: u32)
-> Result;
pub fn svcGetProcessId(out: *mut u32, handle: Handle) -> Result;
- pub fn svcGetProcessList(processCount: *mut s32, processIds: *mut u32,
- processIdMaxCount: s32) -> Result;
+ pub fn svcGetProcessList(processCount: *mut i32, processIds: *mut u32,
+ processIdMaxCount: i32) -> Result;
pub fn svcCreatePort(portServer: *mut Handle, portClient: *mut Handle,
- name: *const u8,
- maxSessions: s32) -> Result;
- pub fn svcConnectToPort(out: *mut Handle,
- portName: *const u8)
+ name: *const ::libc::c_char, maxSessions: i32)
+ -> Result;
+ pub fn svcConnectToPort(out: *mut Handle, portName: *const ::libc::c_char)
-> Result;
+ pub fn svcCreateCodeSet(out: *mut Handle, info: *const CodeSetInfo,
+ code_ptr: *mut ::libc::c_void,
+ ro_ptr: *mut ::libc::c_void,
+ data_ptr: *mut ::libc::c_void) -> Result;
+ pub fn svcCreateProcess(out: *mut Handle, codeset: Handle,
+ arm11kernelcaps: *const u32,
+ arm11kernelcaps_num: u32) -> Result;
+ pub fn svcSetProcessAffinityMask(process: Handle,
+ affinitymask: *const u8,
+ processorcount: i32) -> Result;
+ pub fn svcSetProcessIdealProcessor(process: Handle, processorid: i32)
+ -> Result;
+ pub fn svcRun(process: Handle, info: *const StartupInfo) -> Result;
pub fn svcCreateThread(thread: *mut Handle, entrypoint: ThreadFunc,
arg: u32, stack_top: *mut u32,
- thread_priority: s32, processor_id: s32) -> Result;
+ thread_priority: i32, processor_id: i32) -> Result;
pub fn svcOpenThread(thread: *mut Handle, process: Handle, threadId: u32)
-> Result;
pub fn svcExitThread();
- pub fn svcSleepThread(ns: s64);
- pub fn svcGetThreadPriority(out: *mut s32, handle: Handle) -> Result;
- pub fn svcSetThreadPriority(thread: Handle, prio: s32) -> Result;
+ pub fn svcSleepThread(ns: i64);
+ pub fn svcGetThreadPriority(out: *mut i32, handle: Handle) -> Result;
+ pub fn svcSetThreadPriority(thread: Handle, prio: i32) -> Result;
pub fn svcGetThreadAffinityMask(affinitymask: *mut u8, thread: Handle,
- processorcount: s32) -> Result;
- pub fn svcSetThreadAffinityMask(thread: Handle, affinitymask: *mut u8,
- processorcount: s32) -> Result;
- pub fn svcGetThreadIdealProcessor(processorid: *mut s32, thread: Handle)
+ processorcount: i32) -> Result;
+ pub fn svcSetThreadAffinityMask(thread: Handle, affinitymask: *const u8,
+ processorcount: i32) -> Result;
+ pub fn svcGetThreadIdealProcessor(processorid: *mut i32, thread: Handle)
-> Result;
- pub fn svcSetThreadIdealProcessor(thread: Handle, processorid: s32)
+ pub fn svcSetThreadIdealProcessor(thread: Handle, processorid: i32)
-> Result;
- pub fn svcGetProcessorID() -> s32;
+ pub fn svcGetProcessorID() -> i32;
pub fn svcGetThreadId(out: *mut u32, handle: Handle) -> Result;
+ pub fn svcGetResourceLimit(resourceLimit: *mut Handle, process: Handle)
+ -> Result;
+ pub fn svcGetResourceLimitLimitValues(values: *mut i64,
+ resourceLimit: Handle,
+ names: *mut u32, nameCount: i32)
+ -> Result;
+ pub fn svcGetResourceLimitCurrentValues(values: *mut i64,
+ resourceLimit: Handle,
+ names: *mut u32, nameCount: i32)
+ -> Result;
pub fn svcGetProcessIdOfThread(out: *mut u32, handle: Handle) -> Result;
- pub fn svcGetThreadInfo(out: *mut s64, thread: Handle,
- _type: ThreadInfoType) -> Result;
+ pub fn svcGetThreadInfo(out: *mut i64, thread: Handle,
+ type_: ThreadInfoType) -> Result;
pub fn svcCreateMutex(mutex: *mut Handle, initially_locked: u8) -> Result;
pub fn svcReleaseMutex(handle: Handle) -> Result;
- pub fn svcCreateSemaphore(semaphore: *mut Handle, initial_count: s32,
- max_count: s32) -> Result;
- pub fn svcReleaseSemaphore(count: *mut s32, semaphore: Handle,
- release_count: s32) -> Result;
- pub fn svcCreateEvent(event: *mut Handle, reset_type: u8) -> Result;
+ pub fn svcCreateSemaphore(semaphore: *mut Handle, initial_count: i32,
+ max_count: i32) -> Result;
+ pub fn svcReleaseSemaphore(count: *mut i32, semaphore: Handle,
+ release_count: i32) -> Result;
+ pub fn svcCreateEvent(event: *mut Handle, reset_type: ResetType)
+ -> Result;
pub fn svcSignalEvent(handle: Handle) -> Result;
pub fn svcClearEvent(handle: Handle) -> Result;
- pub fn svcWaitSynchronization(handle: Handle, nanoseconds: s64) -> Result;
- pub fn svcWaitSynchronizationN(out: *mut s32, handles: *mut Handle,
- handles_num: s32, wait_all: u8,
- nanoseconds: s64) -> Result;
+ pub fn svcWaitSynchronization(handle: Handle, nanoseconds: i64) -> Result;
+ pub fn svcWaitSynchronizationN(out: *mut i32, handles: *mut Handle,
+ handles_num: i32, wait_all: u8,
+ nanoseconds: i64) -> Result;
pub fn svcCreateAddressArbiter(arbiter: *mut Handle) -> Result;
pub fn svcArbitrateAddress(arbiter: Handle, addr: u32,
- _type: ArbitrationType, value: s32,
- nanoseconds: s64) -> Result;
+ type_: ArbitrationType, value: i32,
+ nanoseconds: i64) -> Result;
pub fn svcSendSyncRequest(session: Handle) -> Result;
pub fn svcAcceptSession(session: *mut Handle, port: Handle) -> Result;
- pub fn svcReplyAndReceive(index: *mut s32, handles: *mut Handle,
- handleCount: s32, replyTarget: Handle)
+ pub fn svcReplyAndReceive(index: *mut i32, handles: *mut Handle,
+ handleCount: i32, replyTarget: Handle)
+ -> Result;
+ pub fn svcBindInterrupt(interruptId: u32, event: Handle, priority: i32,
+ isManualClear: u8) -> Result;
+ pub fn svcUnbindInterrupt(interruptId: u32, event: Handle) -> Result;
+ pub fn svcCreateTimer(timer: *mut Handle, reset_type: ResetType)
-> Result;
- pub fn svcCreateTimer(timer: *mut Handle, reset_type: u8) -> Result;
- pub fn svcSetTimer(timer: Handle, initial: s64, interval: s64) -> Result;
+ pub fn svcSetTimer(timer: Handle, initial: i64, interval: i64) -> Result;
pub fn svcCancelTimer(timer: Handle) -> Result;
pub fn svcClearTimer(timer: Handle) -> Result;
pub fn svcGetSystemTick() -> u64;
pub fn svcCloseHandle(handle: Handle) -> Result;
pub fn svcDuplicateHandle(out: *mut Handle, original: Handle) -> Result;
- pub fn svcGetSystemInfo(out: *mut s64, _type: u32, param: s32) -> Result;
- pub fn svcKernelSetState(_type: u32, param0: u32, param1: u32,
+ pub fn svcGetSystemInfo(out: *mut i64, type_: u32, param: i32) -> Result;
+ pub fn svcKernelSetState(type_: u32, param0: u32, param1: u32,
param2: u32) -> Result;
pub fn svcBreak(breakReason: UserBreakType);
- pub fn svcOutputDebugString(str: *const u8,
- length: i32) -> Result;
+ pub fn svcOutputDebugString(str: *const ::libc::c_char,
+ length: ::libc::c_int) -> Result;
pub fn svcDebugActiveProcess(debug: *mut Handle, processId: u32)
-> Result;
pub fn svcBreakDebugProcess(debug: Handle) -> Result;
@@ -445,6 +476,6 @@ extern "C" {
-> Result;
pub fn svcContinueDebugEvent(debug: Handle, flags: u32) -> Result;
pub fn svcBackdoor(callback:
- ::core::option::Option<extern "C" fn() -> s32>)
+ ::core::option::Option<extern "C" fn() -> i32>)
-> Result;
}
diff --git a/ctru-sys/src/synchronization.rs b/ctru-sys/src/synchronization.rs
index 6715d53..0626394 100644
--- a/ctru-sys/src/synchronization.rs
+++ b/ctru-sys/src/synchronization.rs
@@ -1,19 +1,40 @@
-//TODO: Implement stuff that bindgen doesn't catch
+/* automatically generated by rust-bindgen */
-use Handle;
+#![allow(dead_code,
+ non_camel_case_types,
+ non_upper_case_globals,
+ non_snake_case)]
+use Handle;
+use svc::ResetType;
use super::lock::*;
pub type LightLock = _LOCK_T;
pub type RecursiveLock = _LOCK_RECURSIVE_T;
+#[repr(C)]
+#[derive(Copy, Clone)]
+#[derive(Debug)]
+pub struct LightEvent {
+ pub state: i32,
+ pub lock: LightLock,
+}
+impl ::core::default::Default for LightEvent {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
extern "C" {
pub fn __sync_get_arbiter() -> Handle;
pub fn LightLock_Init(lock: *mut LightLock);
- pub fn LightLock_Lock(lock: *mut LightLock);
- pub fn LightLock_TryLock(lock: *mut LightLock) -> i32;
- pub fn LightLock_Unlock(lock: *mut LightLock);
+ pub fn LightLock_Lock(lock: *const LightLock);
+ pub fn LightLock_TryLock(lock: *const LightLock) -> ::libc::c_int;
+ pub fn LightLock_Unlock(lock: *const LightLock);
pub fn RecursiveLock_Init(lock: *mut RecursiveLock);
- pub fn RecursiveLock_Lock(lock: *mut RecursiveLock);
- pub fn RecursiveLock_TryLock(lock: *mut RecursiveLock) -> i32;
- pub fn RecursiveLock_Unlock(lock: *mut RecursiveLock);
+ pub fn RecursiveLock_Lock(lock: *const RecursiveLock);
+ pub fn RecursiveLock_TryLock(lock: *const RecursiveLock) -> ::libc::c_int;
+ pub fn RecursiveLock_Unlock(lock: *const RecursiveLock);
+ pub fn LightEvent_Init(event: *mut LightEvent, reset_type: ResetType);
+ pub fn LightEvent_Clear(event: *mut LightEvent);
+ pub fn LightEvent_Pulse(event: *mut LightEvent);
+ pub fn LightEvent_Signal(event: *mut LightEvent);
+ pub fn LightEvent_TryWait(event: *mut LightEvent) -> ::libc::c_int;
+ pub fn LightEvent_Wait(event: *mut LightEvent);
}
diff --git a/ctru-sys/src/sys/libc.rs b/ctru-sys/src/sys/libc.rs
index 743e064..e7870a9 100644
--- a/ctru-sys/src/sys/libc.rs
+++ b/ctru-sys/src/sys/libc.rs
@@ -17,6 +17,8 @@ pub type c_long = i32;
pub type c_ulong = u32;
pub type c_longlong = i64;
pub type c_ulonglong = u64;
+pub type c_float = f32;
+pub type c_double = f64;
pub type size_t = usize;
pub type ssize_t = isize;
diff --git a/ctru-sys/src/sys/lock.rs b/ctru-sys/src/sys/lock.rs
index dcab2d7..0fece83 100644
--- a/ctru-sys/src/sys/lock.rs
+++ b/ctru-sys/src/sys/lock.rs
@@ -1,20 +1,22 @@
-//<sys/lock.h> from devkitArm, needed for synchronization.rs to compile
+/* automatically generated by rust-bindgen */
+#![allow(dead_code,
+ non_camel_case_types,
+ non_upper_case_globals,
+ non_snake_case)]
pub type _LOCK_T = i32;
#[repr(C)]
-#[derive(Copy)]
-pub struct Struct___lock_t {
+#[derive(Copy, Clone)]
+#[derive(Debug)]
+pub struct __lock_t {
pub lock: _LOCK_T,
pub thread_tag: u32,
pub counter: u32,
}
-impl ::core::clone::Clone for Struct___lock_t {
- fn clone(&self) -> Self { *self }
-}
-impl ::core::default::Default for Struct___lock_t {
+impl ::core::default::Default for __lock_t {
fn default() -> Self { unsafe { ::core::mem::zeroed() } }
}
-pub type _LOCK_RECURSIVE_T = Struct___lock_t;
+pub type _LOCK_RECURSIVE_T = __lock_t;
extern "C" {
pub fn __libc_lock_init(lock: *mut _LOCK_T);
pub fn __libc_lock_init_recursive(lock: *mut _LOCK_RECURSIVE_T);
@@ -24,8 +26,7 @@ extern "C" {
pub fn __libc_lock_acquire_recursive(lock: *mut _LOCK_RECURSIVE_T);
pub fn __libc_lock_release(lock: *mut _LOCK_T);
pub fn __libc_lock_release_recursive(lock: *mut _LOCK_RECURSIVE_T);
- pub fn __libc_lock_try_acquire(lock: *mut _LOCK_T)
- -> i32;
+ pub fn __libc_lock_try_acquire(lock: *mut _LOCK_T) -> ::libc::c_int;
pub fn __libc_lock_try_acquire_recursive(lock: *mut _LOCK_RECURSIVE_T)
- -> i32;
+ -> ::libc::c_int;
}