26 #ifndef _SIFTEO_ABI_TYPES_H
27 #define _SIFTEO_ABI_TYPES_H
46 typedef signed char int8_t;
47 typedef unsigned char uint8_t;
48 typedef signed short int16_t;
49 typedef unsigned short uint16_t;
50 typedef signed int int32_t;
51 typedef unsigned int uint32_t;
52 typedef signed long long int64_t;
53 typedef unsigned long long uint64_t;
54 typedef signed long intptr_t;
55 typedef unsigned long uintptr_t;
67 #define _SYS_NUM_CUBE_SLOTS 24 // Total supported cube slots
68 #define _SYS_CUBE_ID_INVALID 0xFF // Reserved _SYSCubeID value
69 #define _SYS_BATTERY_MAX 0x10000 // Battery levels are 16.16 fixed point
71 typedef uint8_t _SYSCubeID;
72 typedef uint8_t _SYSNeighborID;
73 typedef int8_t _SYSSideID;
74 typedef uint32_t _SYSCubeIDVector;
75 typedef uint8_t _SYSAssetSlot;
100 #define _SYS_NEIGHBOR_TYPE_MASK 0xE0 // Mask for neighbor type bits
101 #define _SYS_NEIGHBOR_ID_MASK 0x1F // Mask for neighbor ID bits
103 #define _SYS_NEIGHBOR_CUBE 0x00 // Neighbored to normal cube
104 #define _SYS_NEIGHBOR_BASE 0x20 // Neighbored to base
106 #define _SYS_NEIGHBOR_NONE 0xFF // No neighbor
108 union _SYSNeighborState {
110 _SYSNeighborID sides[4];
117 #define _SYS_MOTION_MAX_ENTRIES 256 // Max size of motion buffer
118 #define _SYS_MOTION_TIMESTAMP_NS 250000 // Nanoseconds per timestamp unit (0.25 ms)
119 #define _SYS_MOTION_TIMESTAMP_HZ 4000 // Reciprocal of _SYS_MOTION_TIMESTAMP_NS
121 struct _SYSMotionBufferHeader {
136 struct _SYSMotionBuffer {
137 struct _SYSMotionBufferHeader header;
138 union _SYSByte4 samples[_SYS_MOTION_MAX_ENTRIES];
141 struct _SYSMotionMedianAxis {
147 struct _SYSMotionMedian {
148 struct _SYSMotionMedianAxis axes[3];
157 #define _SYS_LOGTYPE_FMT 0 // param = strtab offest
158 #define _SYS_LOGTYPE_STRING 1 // param = 0, v1 = ptr
159 #define _SYS_LOGTYPE_HEXDUMP 2 // param = length, v1 = ptr
160 #define _SYS_LOGTYPE_SCRIPT 3 // param = script type
162 #define _SYS_SCRIPT_NONE 0 // Normal logging
163 #define _SYS_SCRIPT_LUA 1 // Built-in Lua interpreter
169 struct _SYSPseudoRandomState {
181 #define _SYS_OS_VERSION_MASK 0xffffff
182 #define _SYS_HW_VERSION_SHIFT 24
185 #define _SYS_OS_VERSION_NONE 0x00
187 #define _SYS_HW_VERSION_NONE 0x00
188 #define _SYS_HW_VERSION_GEN_2 0x02
189 #define _SYS_HW_VERSION_GEN_2_5 0x04
191 #define _SYS_FEATURE_SYS_VERSION (1 << 0)
192 #define _SYS_FEATURE_BLUETOOTH (1 << 1)
193 #define _SYS_FEATURE_ALL (_SYS_FEATURE_SYS_VERSION | _SYS_FEATURE_BLUETOOTH)
200 #define _SYS_HWID_BYTES 8
201 #define _SYS_HWID_BITS 64
202 #define _SYS_INVALID_HWID ((uint64_t)-1)
208 #define _SYS_FS_VOL_GAME 0x4d47
209 #define _SYS_FS_VOL_LAUNCHER 0x4e4c
211 #define _SYS_FS_MAX_OBJECT_KEYS 256
212 #define _SYS_FS_MAX_OBJECT_SIZE 4080
215 typedef uint32_t _SYSVolumeHandle;
218 typedef uint8_t _SYSObjectKey;
220 struct _SYSFilesystemInfo {
224 uint32_t systemUnits;
225 uint32_t launcherElfUnits;
226 uint32_t launcherObjUnits;
227 uint32_t gameElfUnits;
228 uint32_t gameObjUnits;
229 uint32_t selfElfUnits;
230 uint32_t selfObjUnits;
238 struct _SYSIoQueueHeader {
251 #define _SYS_BT_PACKET_BYTES 19
252 #define _SYS_BT_MAX_QUEUED_PACKETS 256
254 struct _SYSBluetoothPacket {
257 uint8_t bytes[_SYS_BT_PACKET_BYTES];
260 struct _SYSBluetoothQueueHeader {
268 struct _SYSBluetoothQueue {
269 struct _SYSBluetoothQueueHeader header;
270 struct _SYSBluetoothPacket packets[_SYS_BT_MAX_QUEUED_PACKETS];
273 struct _SYSBluetoothCounters {
278 uint32_t rxUserDropped;
285 #define _SYS_USB_PACKET_BYTES 60
286 #define _SYS_USB_MAX_QUEUED_PACKETS 80
288 struct _SYSUsbPacket {
293 uint8_t bytes[_SYS_USB_PACKET_BYTES];
296 struct _SYSUsbQueue {
297 struct _SYSIoQueueHeader header;
298 struct _SYSUsbPacket packets[_SYS_USB_MAX_QUEUED_PACKETS];
301 struct _SYSUsbCounters {
306 uint32_t rxUserDropped;
322 uint16_t time_hi_and_version;
323 uint8_t clk_seq_hi_res;
341 #define _SYS_ENOENT -2 // No such object found
342 #define _SYS_EFAULT -14 // Bad address
343 #define _SYS_EINVAL -22 // Invalid argument
344 #define _SYS_ENOSPC -28 // No space left on device
350 #define _SYS_SHUTDOWN_WITH_UI (1 << 0) // Present shutdown user interface, allow cancellation