libtransistor
A userland library for the Nintendo Switch
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
types.h
Go to the documentation of this file.
1 
8 #pragma once
9 
10 #ifdef __cplusplus
11 extern "C" {
12 typedef bool _Bool;
13 #endif
14 
15 #include <stdint.h>
16 #include <stdbool.h>
17 #include <stddef.h>
18 
20 #define U64_MAX UINT64_MAX
21 
22 #ifndef SSIZE_MAX
23 #ifdef SIZE_MAX
24 #define SSIZE_MAX ((SIZE_MAX) >> 1)
25 #endif
26 #endif
27 
28 typedef volatile uint8_t vu8;
29 typedef volatile uint16_t vu16;
30 typedef volatile uint32_t vu32;
31 typedef volatile uint64_t vu64;
32 
33 typedef volatile int8_t vs8;
34 typedef volatile int16_t vs16;
35 typedef volatile int32_t vs32;
36 typedef volatile int64_t vs64;
37 
38 typedef uint32_t handle_t;
39 typedef handle_t thread_h;
40 typedef handle_t shared_memory_h;
41 typedef handle_t transfer_memory_h;
42 typedef handle_t session_h;
43 typedef handle_t port_h;
44 typedef handle_t dev_addr_space_h;
45 typedef handle_t process_h;
46 typedef handle_t debug_h;
47 typedef handle_t revent_h;
48 typedef handle_t wevent_h;
49 typedef handle_t event_h;
50 typedef handle_t resource_limit_h;
51 typedef uint32_t result_t;
52 typedef uint64_t aruid_t;
53 typedef void (*thread_entry)(void *);
54 typedef void (*voidfn)(void);
55 
57 #define BIT(n) (1U<<(n))
58 
60 #define ALIGN(m) __attribute__((aligned(m)))
61 #define PACKED __attribute__((packed))
63 
64 #ifndef LIBTRANSISTOR
65 #define DEPRECATED __attribute__ ((deprecated))
67 #else
68 #define DEPRECATED
70 #endif
71 
72 #define RESULT_OK 0
73 #define INVALID_HANDLE 0xFFFFFFFF
74 
75 #ifdef __cplusplus
76 }
77 #endif
volatile uint8_t vu8
8-bit volatile unsigned integer.
Definition: types.h:28
handle_t debug_h
Debug handle.
Definition: types.h:46
volatile int8_t vs8
8-bit volatile signed integer.
Definition: types.h:33
handle_t event_h
Either revent_h or wevent_h.
Definition: types.h:49
handle_t thread_h
Thread handle.
Definition: types.h:39
void(* thread_entry)(void *)
Thread entrypoint function.
Definition: types.h:53
handle_t shared_memory_h
Shared Memory handle.
Definition: types.h:40
uint32_t result_t
Function result.
Definition: types.h:51
handle_t revent_h
revent handle
Definition: types.h:47
handle_t session_h
Session handle.
Definition: types.h:42
handle_t process_h
Process handle.
Definition: types.h:45
volatile int32_t vs32
32-bit volatile signed integer.
Definition: types.h:35
volatile uint16_t vu16
16-bit volatile unsigned integer.
Definition: types.h:29
handle_t wevent_h
wevent handle
Definition: types.h:48
volatile int16_t vs16
16-bit volatile signed integer.
Definition: types.h:34
handle_t port_h
Port handle.
Definition: types.h:43
uint32_t handle_t
Resource handle.
Definition: types.h:38
handle_t resource_limit_h
Resource limit handle.
Definition: types.h:50
volatile uint64_t vu64
64-bit volatile unsigned integer.
Definition: types.h:31
handle_t dev_addr_space_h
Dev Address Space handle.
Definition: types.h:44
volatile uint32_t vu32
32-bit volatile unsigned integer.
Definition: types.h:30
volatile int64_t vs64
64-bit volatile signed integer.
Definition: types.h:36
handle_t transfer_memory_h
Transfer Memory handle.
Definition: types.h:41
uint64_t aruid_t
Applet resource user id.
Definition: types.h:52