wut  v1.7.0
Wii U Toolchain
taskqueue.h
Go to the documentation of this file.
1 #pragma once
2 #include <wut.h>
3 #include "time.h"
4 
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14 
15 typedef struct MPTask MPTask;
16 typedef struct MPTaskInfo MPTaskInfo;
17 typedef struct MPTaskQueue MPTaskQueue;
18 typedef struct MPTaskQueueInfo MPTaskQueueInfo;
19 
20 typedef uint32_t (*MPTaskFunc)(uint32_t, uint32_t);
21 
22 typedef enum MPTaskState
23 {
29 
30 typedef enum MPTaskQueueState
31 {
38 
39 #pragma pack(push, 1)
40 struct MPTaskInfo
41 {
43  uint32_t result;
44  uint32_t coreID;
46 };
47 #pragma pack(pop)
48 WUT_CHECK_OFFSET(MPTaskInfo, 0x00, state);
49 WUT_CHECK_OFFSET(MPTaskInfo, 0x04, result);
50 WUT_CHECK_OFFSET(MPTaskInfo, 0x08, coreID);
51 WUT_CHECK_OFFSET(MPTaskInfo, 0x0C, duration);
52 WUT_CHECK_SIZE(MPTaskInfo, 0x14);
53 
54 #pragma pack(push, 1)
55 struct MPTask
56 {
57  MPTask *self;
61  uint32_t userArg1;
62  uint32_t userArg2;
63  uint32_t result;
64  uint32_t coreID;
66  void *userData;
67 };
68 #pragma pack(pop)
69 WUT_CHECK_OFFSET(MPTask, 0x00, self);
70 WUT_CHECK_OFFSET(MPTask, 0x04, queue);
71 WUT_CHECK_OFFSET(MPTask, 0x08, state);
72 WUT_CHECK_OFFSET(MPTask, 0x0C, func);
73 WUT_CHECK_OFFSET(MPTask, 0x10, userArg1);
74 WUT_CHECK_OFFSET(MPTask, 0x14, userArg2);
75 WUT_CHECK_OFFSET(MPTask, 0x18, result);
76 WUT_CHECK_OFFSET(MPTask, 0x1C, coreID);
77 WUT_CHECK_OFFSET(MPTask, 0x20, duration);
78 WUT_CHECK_OFFSET(MPTask, 0x28, userData);
79 WUT_CHECK_SIZE(MPTask, 0x2C);
80 
82 {
84  uint32_t tasks;
85  uint32_t tasksReady;
86  uint32_t tasksRunning;
87  uint32_t tasksFinished;
88 };
89 WUT_CHECK_OFFSET(MPTaskQueueInfo, 0x00, state);
90 WUT_CHECK_OFFSET(MPTaskQueueInfo, 0x04, tasks);
91 WUT_CHECK_OFFSET(MPTaskQueueInfo, 0x08, tasksReady);
92 WUT_CHECK_OFFSET(MPTaskQueueInfo, 0x0C, tasksRunning);
93 WUT_CHECK_OFFSET(MPTaskQueueInfo, 0x10, tasksFinished);
94 WUT_CHECK_SIZE(MPTaskQueueInfo, 0x14);
95 
97 {
98  MPTaskQueue *self;
100  uint32_t tasks;
101  uint32_t tasksReady;
102  uint32_t tasksRunning;
103  WUT_UNKNOWN_BYTES(4);
104  uint32_t tasksFinished;
105  WUT_UNKNOWN_BYTES(8);
106  uint32_t queueIndex;
107  WUT_UNKNOWN_BYTES(8);
108  uint32_t queueSize;
109  WUT_UNKNOWN_BYTES(4);
111  uint32_t queueMaxSize;
113 };
114 WUT_CHECK_OFFSET(MPTaskQueue, 0x00, self);
115 WUT_CHECK_OFFSET(MPTaskQueue, 0x04, state);
116 WUT_CHECK_OFFSET(MPTaskQueue, 0x08, tasks);
117 WUT_CHECK_OFFSET(MPTaskQueue, 0x0C, tasksReady);
118 WUT_CHECK_OFFSET(MPTaskQueue, 0x10, tasksRunning);
119 WUT_CHECK_OFFSET(MPTaskQueue, 0x18, tasksFinished);
120 WUT_CHECK_OFFSET(MPTaskQueue, 0x24, queueIndex);
121 WUT_CHECK_OFFSET(MPTaskQueue, 0x30, queueSize);
122 WUT_CHECK_OFFSET(MPTaskQueue, 0x38, queue);
123 WUT_CHECK_OFFSET(MPTaskQueue, 0x3C, queueMaxSize);
124 WUT_CHECK_OFFSET(MPTaskQueue, 0x40, lock);
125 WUT_CHECK_SIZE(MPTaskQueue, 0x50);
126 
127 void
129  MPTask **queueBuffer,
130  uint32_t queueBufferLen);
131 
132 BOOL
134 
135 BOOL
137  MPTaskQueueInfo *info);
138 
139 BOOL
141 
142 BOOL
144 
145 BOOL
147 
148 BOOL
150  MPTask *task);
151 
152 MPTask *
154 
155 uint32_t
157  MPTask **queueBuffer,
158  uint32_t queueBufferLen);
159 
160 BOOL
162  MPTaskQueueState mask);
163 
164 BOOL
166  MPTaskQueueState wmask,
167  OSTime timeout);
168 
169 BOOL
171  uint32_t unk);
172 
173 void
175  MPTaskFunc func,
176  uint32_t userArg1,
177  uint32_t userArg2);
178 
179 BOOL
181 
182 BOOL
184  MPTaskInfo *info);
185 
186 void *
188 
189 void
191  void *userData);
192 
193 BOOL
195  uint32_t count);
196 
197 BOOL
199 
200 #ifdef __cplusplus
201 }
202 #endif
203 
uint32_t tasksReady
Definition: taskqueue.h:85
MPTask ** queue
Definition: taskqueue.h:109
MPTaskFunc func
Definition: taskqueue.h:60
uint32_t userArg1
Definition: taskqueue.h:61
void * userData
Definition: taskqueue.h:66
uint32_t result
Definition: taskqueue.h:43
uint32_t queueMaxSize
Definition: taskqueue.h:111
uint32_t userArg2
Definition: taskqueue.h:62
MPTaskState state
Definition: taskqueue.h:42
uint32_t tasksFinished
Definition: taskqueue.h:87
OSTime duration
Definition: taskqueue.h:45
OSSpinLock lock
Definition: taskqueue.h:112
uint32_t queueSize
Definition: taskqueue.h:107
uint32_t coreID
Definition: taskqueue.h:44
uint32_t tasksRunning
Definition: taskqueue.h:86
MPTaskQueue * queue
Definition: taskqueue.h:58
uint32_t tasks
Definition: taskqueue.h:84
uint32_t queueIndex
Definition: taskqueue.h:105
MPTaskQueueState state
Definition: taskqueue.h:83
uint32_t(* MPTaskFunc)(uint32_t, uint32_t)
Definition: taskqueue.h:20
void MPSetTaskUserData(MPTask *task, void *userData)
MPTaskQueueState
Definition: taskqueue.h:31
MPTaskState
Definition: taskqueue.h:23
BOOL MPResetTaskQ(MPTaskQueue *queue)
BOOL MPWaitTaskQ(MPTaskQueue *queue, MPTaskQueueState mask)
BOOL MPRunTasksFromTaskQ(MPTaskQueue *queue, uint32_t count)
BOOL MPStopTaskQ(MPTaskQueue *queue)
BOOL MPRunTask(MPTask *task)
void * MPGetTaskUserData(MPTask *task)
BOOL MPPrintTaskQStats(MPTaskQueue *queue, uint32_t unk)
BOOL MPTermTask(MPTask *task)
void MPInitTask(MPTask *task, MPTaskFunc func, uint32_t userArg1, uint32_t userArg2)
BOOL MPWaitTaskQWithTimeout(MPTaskQueue *queue, MPTaskQueueState wmask, OSTime timeout)
BOOL MPEnqueTask(MPTaskQueue *queue, MPTask *task)
MPTask * MPDequeTask(MPTaskQueue *queue)
BOOL MPGetTaskInfo(MPTask *task, MPTaskInfo *info)
BOOL MPTermTaskQ(MPTaskQueue *queue)
BOOL MPGetTaskQInfo(MPTaskQueue *queue, MPTaskQueueInfo *info)
BOOL MPStartTaskQ(MPTaskQueue *queue)
uint32_t MPDequeTasks(MPTaskQueue *queue, MPTask **queueBuffer, uint32_t queueBufferLen)
void MPInitTaskQ(MPTaskQueue *queue, MPTask **queueBuffer, uint32_t queueBufferLen)
@ MP_TASK_QUEUE_STATE_INITIALISED
Definition: taskqueue.h:32
@ MP_TASK_QUEUE_STATE_FINISHED
Definition: taskqueue.h:36
@ MP_TASK_QUEUE_STATE_READY
Definition: taskqueue.h:33
@ MP_TASK_QUEUE_STATE_STOPPING
Definition: taskqueue.h:34
@ MP_TASK_QUEUE_STATE_STOPPED
Definition: taskqueue.h:35
@ MP_TASK_STATE_RUNNING
Definition: taskqueue.h:26
@ MP_TASK_STATE_INITIALISED
Definition: taskqueue.h:24
@ MP_TASK_STATE_FINISHED
Definition: taskqueue.h:27
@ MP_TASK_STATE_READY
Definition: taskqueue.h:25
int64_t OSTime
Definition: time.h:18
int32_t BOOL
Definition: wut_types.h:7