7 #ifndef _SIFTEO_ABI_TYPES_H
8 #define _SIFTEO_ABI_TYPES_H
27 typedef signed char int8_t;
28 typedef unsigned char uint8_t;
29 typedef signed short int16_t;
30 typedef unsigned short uint16_t;
31 typedef signed int int32_t;
32 typedef unsigned int uint32_t;
33 typedef signed long long int64_t;
34 typedef unsigned long long uint64_t;
35 typedef signed long intptr_t;
36 typedef unsigned long uintptr_t;
48 #define _SYS_NUM_CUBE_SLOTS 24 // Total supported cube slots
49 #define _SYS_CUBE_ID_INVALID 0xFF // Reserved _SYSCubeID value
50 #define _SYS_BATTERY_MAX 0x10000 // Battery levels are 16.16 fixed point
52 typedef uint8_t _SYSCubeID;
53 typedef uint8_t _SYSNeighborID;
54 typedef int8_t _SYSSideID;
55 typedef uint32_t _SYSCubeIDVector;
56 typedef uint8_t _SYSAssetSlot;
81 #define _SYS_NEIGHBOR_TYPE_MASK 0xE0 // Mask for neighbor type bits
82 #define _SYS_NEIGHBOR_ID_MASK 0x1F // Mask for neighbor ID bits
84 #define _SYS_NEIGHBOR_CUBE 0x00 // Neighbored to normal cube
85 #define _SYS_NEIGHBOR_BASE 0x20 // Neighbored to base
87 #define _SYS_NEIGHBOR_NONE 0xFF // No neighbor
89 union _SYSNeighborState {
91 _SYSNeighborID sides[4];
98 #define _SYS_MOTION_MAX_ENTRIES 256 // Max size of motion buffer
99 #define _SYS_MOTION_TIMESTAMP_NS 250000 // Nanoseconds per timestamp unit (0.25 ms)
100 #define _SYS_MOTION_TIMESTAMP_HZ 4000 // Reciprocal of _SYS_MOTION_TIMESTAMP_NS
102 struct _SYSMotionBufferHeader {
117 struct _SYSMotionBuffer {
118 struct _SYSMotionBufferHeader header;
119 union _SYSByte4 samples[_SYS_MOTION_MAX_ENTRIES];
122 struct _SYSMotionMedianAxis {
128 struct _SYSMotionMedian {
129 struct _SYSMotionMedianAxis axes[3];
138 #define _SYS_LOGTYPE_FMT 0 // param = strtab offest
139 #define _SYS_LOGTYPE_STRING 1 // param = 0, v1 = ptr
140 #define _SYS_LOGTYPE_HEXDUMP 2 // param = length, v1 = ptr
141 #define _SYS_LOGTYPE_SCRIPT 3 // param = script type
143 #define _SYS_SCRIPT_NONE 0 // Normal logging
144 #define _SYS_SCRIPT_LUA 1 // Built-in Lua interpreter
150 struct _SYSPseudoRandomState {
162 #define _SYS_OS_VERSION_MASK 0xffffff
163 #define _SYS_HW_VERSION_SHIFT 24
166 #define _SYS_OS_VERSION_NONE 0x00
168 #define _SYS_HW_VERSION_NONE 0x00
169 #define _SYS_HW_VERSION_GEN_2 0x02
170 #define _SYS_HW_VERSION_GEN_2_5 0x04
172 #define _SYS_FEATURE_SYS_VERSION (1 << 0)
173 #define _SYS_FEATURE_BLUETOOTH (1 << 1)
174 #define _SYS_FEATURE_ALL (_SYS_FEATURE_SYS_VERSION | _SYS_FEATURE_BLUETOOTH)
181 #define _SYS_HWID_BYTES 8
182 #define _SYS_HWID_BITS 64
183 #define _SYS_INVALID_HWID ((uint64_t)-1)
189 #define _SYS_FS_VOL_GAME 0x4d47
190 #define _SYS_FS_VOL_LAUNCHER 0x4e4c
192 #define _SYS_FS_MAX_OBJECT_KEYS 256
193 #define _SYS_FS_MAX_OBJECT_SIZE 4080
196 typedef uint32_t _SYSVolumeHandle;
199 typedef uint8_t _SYSObjectKey;
201 struct _SYSFilesystemInfo {
205 uint32_t systemUnits;
206 uint32_t launcherElfUnits;
207 uint32_t launcherObjUnits;
208 uint32_t gameElfUnits;
209 uint32_t gameObjUnits;
210 uint32_t selfElfUnits;
211 uint32_t selfObjUnits;
219 struct _SYSIoQueueHeader {
232 #define _SYS_BT_PACKET_BYTES 19
233 #define _SYS_BT_MAX_QUEUED_PACKETS 256
235 struct _SYSBluetoothPacket {
238 uint8_t bytes[_SYS_BT_PACKET_BYTES];
241 struct _SYSBluetoothQueueHeader {
249 struct _SYSBluetoothQueue {
250 struct _SYSBluetoothQueueHeader header;
251 struct _SYSBluetoothPacket packets[_SYS_BT_MAX_QUEUED_PACKETS];
254 struct _SYSBluetoothCounters {
259 uint32_t rxUserDropped;
266 #define _SYS_USB_PACKET_BYTES 60
267 #define _SYS_USB_MAX_QUEUED_PACKETS 80
269 struct _SYSUsbPacket {
274 uint8_t bytes[_SYS_USB_PACKET_BYTES];
277 struct _SYSUsbQueue {
278 struct _SYSIoQueueHeader header;
279 struct _SYSUsbPacket packets[_SYS_USB_MAX_QUEUED_PACKETS];
282 struct _SYSUsbCounters {
287 uint32_t rxUserDropped;
303 uint16_t time_hi_and_version;
304 uint8_t clk_seq_hi_res;
322 #define _SYS_ENOENT -2 // No such object found
323 #define _SYS_EFAULT -14 // Bad address
324 #define _SYS_EINVAL -22 // Invalid argument
325 #define _SYS_ENOSPC -28 // No space left on device
331 #define _SYS_SHUTDOWN_WITH_UI (1 << 0) // Present shutdown user interface, allow cancellation