Fix naughty enum typedefs.

This commit is contained in:
James Benton 2016-01-08 07:28:52 -08:00
parent 33247b5034
commit fddf6f2532
9 changed files with 38 additions and 36 deletions

View File

@ -11,15 +11,14 @@
extern "C" { extern "C" {
#endif #endif
typedef uint32_t MEMBaseHeapType;
typedef void *MEMHeapHandle; typedef void *MEMHeapHandle;
enum MEMBaseHeapType typedef enum MEMBaseHeapType
{ {
MEM_BASE_HEAP_MEM1 = 0, MEM_BASE_HEAP_MEM1 = 0,
MEM_BASE_HEAP_MEM2 = 1, MEM_BASE_HEAP_MEM2 = 1,
MEM_BASE_HEAP_FG = 8, MEM_BASE_HEAP_FG = 8,
}; } MEMBaseHeapType;
MEMBaseHeapType MEMBaseHeapType
MEMGetArena(MEMHeapHandle handle); MEMGetArena(MEMHeapHandle handle);

View File

@ -18,16 +18,15 @@ extern "C" {
#endif #endif
typedef struct OSEvent OSEvent; typedef struct OSEvent OSEvent;
typedef uint32_t OSEventMode;
enum OSEventMode typedef enum OSEventMode
{ {
//! A manual event will only reset when OSResetEvent is called. //! A manual event will only reset when OSResetEvent is called.
OS_EVENT_MODE_MANUAL = 0, OS_EVENT_MODE_MANUAL = 0,
//! An auto event will reset everytime a thread is woken. //! An auto event will reset everytime a thread is woken.
OS_EVENT_MODE_AUTO = 1, OS_EVENT_MODE_AUTO = 1,
}; } OSEventMode;
#define OS_EVENT_TAG 0x65566E54u #define OS_EVENT_TAG 0x65566E54u

View File

@ -14,7 +14,7 @@ extern "C" {
typedef uint32_t OSExceptionType; typedef uint32_t OSExceptionType;
typedef BOOL (*OSExceptionCallbackFn)(OSContext *context); typedef BOOL (*OSExceptionCallbackFn)(OSContext *context);
enum OSExceptionType typedef enum OSExceptionType
{ {
OS_EXCEPTION_TYPE_SYSTEM_RESET = 0, OS_EXCEPTION_TYPE_SYSTEM_RESET = 0,
OS_EXCEPTION_TYPE_MACHINE_CHECK = 1, OS_EXCEPTION_TYPE_MACHINE_CHECK = 1,
@ -31,7 +31,7 @@ enum OSExceptionType
OS_EXCEPTION_TYPE_BREAKPOINT = 12, OS_EXCEPTION_TYPE_BREAKPOINT = 12,
OS_EXCEPTION_TYPE_SYSTEM_INTERRUPT = 13, OS_EXCEPTION_TYPE_SYSTEM_INTERRUPT = 13,
OS_EXCEPTION_TYPE_ICI = 14, OS_EXCEPTION_TYPE_ICI = 14,
}; } OSExceptionType;
OSExceptionCallbackFn OSExceptionCallbackFn
OSSetExceptionCallback(OSExceptionType exceptionType, OSSetExceptionCallback(OSExceptionType exceptionType,

View File

@ -11,27 +11,24 @@
extern "C" { extern "C" {
#endif #endif
typedef struct MEMExpandedHeap MEMExpandedHeap; typedef struct MEMExpandedHeap MEMExpandedHeap;;
typedef uint32_t MEMExpHeapMode;
typedef uint32_t MEMExpHeapDirection;
struct MEMExpandedHeap struct MEMExpandedHeap
{ {
}; };
UNKNOWN_SIZE(MEMExpandedHeap); UNKNOWN_SIZE(MEMExpandedHeap);
enum MEMExpHeapMode typedef enum MEMExpHeapMode
{ {
MEM_EXP_HEAP_MODE_FIRST_FREE = 0, MEM_EXP_HEAP_MODE_FIRST_FREE = 0,
MEM_EXP_HEAP_MODE_NEAREST_SIZE = 1, MEM_EXP_HEAP_MODE_NEAREST_SIZE = 1,
}; } MEMExpHeapMode;
enum MEMExpHeapDirection typedef enum MEMExpHeapDirection
{ {
MEM_EXP_HEAP_DIR_FROM_TOP = 0, MEM_EXP_HEAP_DIR_FROM_TOP = 0,
MEM_EXP_HEAP_DIR_FROM_BOTTOM = 1, MEM_EXP_HEAP_DIR_FROM_BOTTOM = 1,
}; } MEMExpHeapDirection;
MEMExpandedHeap * MEMExpandedHeap *
MEMCreateExpHeap(MEMExpandedHeap *heap, uint32_t size); MEMCreateExpHeap(MEMExpandedHeap *heap, uint32_t size);

View File

@ -11,13 +11,11 @@
extern "C" { extern "C" {
#endif #endif
typedef uint32_t MEMFrameHeapFreeMode; typedef enum MEMFrameHeapFreeMode
enum MEMFrameHeapFreeMode
{ {
MEM_FRAME_HEAP_FREE_FROM_BOTTOM = 1 << 0, MEM_FRAME_HEAP_FREE_FROM_BOTTOM = 1 << 0,
MEM_FRAME_HEAP_FREE_FROM_TOP = 1 << 1, MEM_FRAME_HEAP_FREE_FROM_TOP = 1 << 1,
}; } MEMFrameHeapFreeMode;
MEMFrameHeap * MEMFrameHeap *
MEMCreateFrmHeap(MEMFrameHeap *heap, MEMCreateFrmHeap(MEMFrameHeap *heap,

View File

@ -11,13 +11,11 @@
extern "C" { extern "C" {
#endif #endif
typedef uint32_t OSMessageFlags; typedef enum OSMessageFlags
enum OSMessageFlags
{ {
OS_MESSAGE_QUEUE_BLOCKING = 1 << 0, OS_MESSAGE_QUEUE_BLOCKING = 1 << 0,
OS_MESSAGE_QUEUE_HIGH_PRIORITY = 1 << 1, OS_MESSAGE_QUEUE_HIGH_PRIORITY = 1 << 1,
}; } OSMessageFlags;
struct OSMessage struct OSMessage
{ {

View File

@ -17,17 +17,15 @@ typedef struct MPTaskInfo MPTaskInfo;
typedef struct MPTaskQueue MPTaskQueue; typedef struct MPTaskQueue MPTaskQueue;
typedef struct MPTaskQueueInfo MPTaskQueueInfo; typedef struct MPTaskQueueInfo MPTaskQueueInfo;
typedef uint32_t MPTaskState;
typedef uint32_t (*MPTaskFunc)(uint32_t, uint32_t); typedef uint32_t (*MPTaskFunc)(uint32_t, uint32_t);
enum MPTaskState typedef enum MPTaskState
{ {
MP_TASK_STATE_INITIALISED = 1 << 0, MP_TASK_STATE_INITIALISED = 1 << 0,
MP_TASK_STATE_READY = 1 << 1, MP_TASK_STATE_READY = 1 << 1,
MP_TASK_STATE_RUNNING = 1 << 2, MP_TASK_STATE_RUNNING = 1 << 2,
MP_TASK_STATE_FINISHED = 1 << 3, MP_TASK_STATE_FINISHED = 1 << 3,
}; } MPTaskState;
struct MPTaskInfo struct MPTaskInfo
{ {

View File

@ -34,15 +34,20 @@ typedef struct OSMutex OSMutex;
typedef struct OSMutexQueue OSMutexQueue; typedef struct OSMutexQueue OSMutexQueue;
typedef struct OSThread OSThread; typedef struct OSThread OSThread;
//! A value from enum OS_THREAD_STATE.
typedef uint8_t OSThreadState; typedef uint8_t OSThreadState;
//! A value from enum OS_THREAD_REQUEST.
typedef uint32_t OSThreadRequest; typedef uint32_t OSThreadRequest;
//! A bitfield of enum OS_THREAD_ATTRIB.
typedef uint8_t OSThreadAttributes; typedef uint8_t OSThreadAttributes;
typedef int (*OSThreadEntryPointFn)(int argc, const char **argv); typedef int (*OSThreadEntryPointFn)(int argc, const char **argv);
typedef void (*OSThreadCleanupCallbackFn)(OSThread *thread, void *stack); typedef void (*OSThreadCleanupCallbackFn)(OSThread *thread, void *stack);
typedef void (*OSThreadDeallocatorFn)(OSThread *thread, void *stack); typedef void (*OSThreadDeallocatorFn)(OSThread *thread, void *stack);
enum OSThreadState enum OS_THREAD_STATE
{ {
OS_THREAD_STATE_NONE = 0, OS_THREAD_STATE_NONE = 0,
@ -59,14 +64,14 @@ enum OSThreadState
OS_THREAD_STATE_MORIBUND = 1 << 3, OS_THREAD_STATE_MORIBUND = 1 << 3,
}; };
enum OSThreadRequest enum OS_THREAD_REQUEST
{ {
OS_THREAD_REQUEST_NONE = 0, OS_THREAD_REQUEST_NONE = 0,
OS_THREAD_REQUEST_SUSPEND = 1, OS_THREAD_REQUEST_SUSPEND = 1,
OS_THREAD_REQUEST_CANCEL = 2, OS_THREAD_REQUEST_CANCEL = 2,
}; };
enum OSThreadAttributes enum OS_THREAD_ATTRIB
{ {
//! Allow the thread to run on CPU0. //! Allow the thread to run on CPU0.
OS_THREAD_ATTRIB_AFFINITY_CPU0 = 1 << 0, OS_THREAD_ATTRIB_AFFINITY_CPU0 = 1 << 0,
@ -167,13 +172,21 @@ CHECK_OFFSET(OSFastMutexQueue, 0x04, tail);
CHECK_SIZE(OSFastMutexQueue, 0x08); CHECK_SIZE(OSFastMutexQueue, 0x08);
#define OS_THREAD_TAG 0x74487244u #define OS_THREAD_TAG 0x74487244u
#pragma pack(push, 1)
struct OSThread struct OSThread
{ {
OSContext context; OSContext context;
//! Should always be set to the value OS_THREAD_TAG.
uint32_t tag; uint32_t tag;
//! Bitfield of OS_THREAD_STATE
OSThreadState state; OSThreadState state;
//! Bitfield of OS_THREAD_ATTRIB
OSThreadAttributes attr; OSThreadAttributes attr;
//! Unique thread ID
uint16_t id; uint16_t id;
//! Suspend count (increased by OSSuspendThread). //! Suspend count (increased by OSSuspendThread).
@ -252,8 +265,10 @@ struct OSThread
//! Queue of threads waiting for a thread to be suspended. //! Queue of threads waiting for a thread to be suspended.
OSThreadQueue suspendQueue; OSThreadQueue suspendQueue;
UNKNOWN(0x69c - 0x5f4); UNKNOWN(0x69c - 0x5f4);
}; };
#pragma pack(pop)
CHECK_OFFSET(OSThread, 0x320, tag); CHECK_OFFSET(OSThread, 0x320, tag);
CHECK_OFFSET(OSThread, 0x324, state); CHECK_OFFSET(OSThread, 0x324, state);
CHECK_OFFSET(OSThread, 0x325, attr); CHECK_OFFSET(OSThread, 0x325, attr);

View File

@ -11,16 +11,14 @@
extern "C" { extern "C" {
#endif #endif
typedef uint32_t GX2InitAttributes; typedef enum GX2InitAttributes
enum GX2InitAttributes
{ {
GX2_INIT_END = 0, GX2_INIT_END = 0,
GX2_INIT_CMD_BUF_BASE = 1, GX2_INIT_CMD_BUF_BASE = 1,
GX2_INIT_CMD_BUF_POOL_SIZE = 2, GX2_INIT_CMD_BUF_POOL_SIZE = 2,
GX2_INIT_ARGC = 7, GX2_INIT_ARGC = 7,
GX2_INIT_ARGV = 8, GX2_INIT_ARGV = 8,
}; } GX2InitAttributes;
void void
GX2Init(uint32_t *attributes); GX2Init(uint32_t *attributes);