WUT  0.1
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;
19 
20 typedef uint32_t (*MPTaskFunc)(uint32_t, uint32_t);
21 
22 typedef enum MPTaskState
23 {
28 } MPTaskState;
29 
30 struct MPTaskInfo
31 {
33  uint32_t result;
34  uint32_t coreID;
36 };
37 CHECK_OFFSET(MPTaskInfo, 0x00, state);
38 CHECK_OFFSET(MPTaskInfo, 0x04, result);
39 CHECK_OFFSET(MPTaskInfo, 0x08, coreID);
40 CHECK_OFFSET(MPTaskInfo, 0x0C, duration);
41 CHECK_SIZE(MPTaskInfo, 0x14);
42 
43 struct MPTask
44 {
45  MPTask *self;
49  uint32_t userArg1;
50  uint32_t userArg2;
51  uint32_t result;
52  uint32_t coreID;
54  void *userData;
55 };
56 CHECK_OFFSET(MPTask, 0x00, self);
57 CHECK_OFFSET(MPTask, 0x04, queue);
58 CHECK_OFFSET(MPTask, 0x08, state);
59 CHECK_OFFSET(MPTask, 0x0C, func);
60 CHECK_OFFSET(MPTask, 0x10, userArg1);
61 CHECK_OFFSET(MPTask, 0x14, userArg2);
62 CHECK_OFFSET(MPTask, 0x18, result);
63 CHECK_OFFSET(MPTask, 0x1C, coreID);
64 CHECK_OFFSET(MPTask, 0x20, duration);
65 CHECK_OFFSET(MPTask, 0x28, userData);
66 CHECK_SIZE(MPTask, 0x2C);
67 
69 {
70  MPTaskQueueState state;
71  uint32_t tasks;
72  uint32_t tasksReady;
73  uint32_t tasksRunning;
74  uint32_t tasksFinished;
75 };
76 CHECK_OFFSET(MPTaskQueueInfo, 0x00, state);
77 CHECK_OFFSET(MPTaskQueueInfo, 0x04, tasks);
78 CHECK_OFFSET(MPTaskQueueInfo, 0x08, tasksReady);
79 CHECK_OFFSET(MPTaskQueueInfo, 0x0C, tasksRunning);
80 CHECK_OFFSET(MPTaskQueueInfo, 0x10, tasksFinished);
81 CHECK_SIZE(MPTaskQueueInfo, 0x14);
82 
84 {
85  MPTaskQueue *self;
86  MPTaskQueueState state;
87  uint32_t tasks;
88  uint32_t tasksReady;
89  uint32_t tasksRunning;
90  UNKNOWN(4);
91  uint32_t tasksFinished;
92  UNKNOWN(8);
93  uint32_t queueIndex;
94  UNKNOWN(8);
95  uint32_t queueSize;
96  UNKNOWN(4);
98  uint32_t queueMaxSize;
100 };
101 CHECK_OFFSET(MPTaskQueue, 0x00, self);
102 CHECK_OFFSET(MPTaskQueue, 0x04, state);
103 CHECK_OFFSET(MPTaskQueue, 0x08, tasks);
104 CHECK_OFFSET(MPTaskQueue, 0x0C, tasksReady);
105 CHECK_OFFSET(MPTaskQueue, 0x10, tasksRunning);
106 CHECK_OFFSET(MPTaskQueue, 0x18, tasksFinished);
107 CHECK_OFFSET(MPTaskQueue, 0x24, queueIndex);
108 CHECK_OFFSET(MPTaskQueue, 0x30, queueSize);
109 CHECK_OFFSET(MPTaskQueue, 0x38, queue);
110 CHECK_OFFSET(MPTaskQueue, 0x3C, queueMaxSize);
111 CHECK_OFFSET(MPTaskQueue, 0x40, lock);
112 CHECK_SIZE(MPTaskQueue, 0x50);
113 
114 void
115 MPInitTaskQ(MPTaskQueue *queue,
116  MPTask **queueBuffer,
117  uint32_t queueBufferLen);
118 
119 BOOL
120 MPTermTaskQ(MPTaskQueue *queue);
121 
122 BOOL
124  MPTaskQueueInfo *info);
125 
126 BOOL
127 MPStartTaskQ(MPTaskQueue *queue);
128 
129 BOOL
130 MPStopTaskQ(MPTaskQueue *queue);
131 
132 BOOL
133 MPResetTaskQ(MPTaskQueue *queue);
134 
135 BOOL
136 MPEnqueTask(MPTaskQueue *queue,
137  MPTask *task);
138 
139 MPTask *
140 MPDequeTask(MPTaskQueue *queue);
141 
142 uint32_t
144  MPTask **queueBuffer,
145  uint32_t queueBufferLen);
146 
147 BOOL
148 MPWaitTaskQ(MPTaskQueue *queue,
149  MPTaskQueueState mask);
150 
151 BOOL
153  MPTaskQueueState wmask,
154  OSTime timeout);
155 
156 BOOL
158  uint32_t unk);
159 
160 void
161 MPInitTask(MPTask *task,
162  MPTaskFunc func,
163  uint32_t userArg1,
164  uint32_t userArg2);
165 
166 BOOL
167 MPTermTask(MPTask* task);
168 
169 BOOL
170 MPGetTaskInfo(MPTask *task,
171  MPTaskInfo *info);
172 
173 void *
175 
176 void
178  void *userData);
179 
180 BOOL
182  uint32_t count);
183 
184 BOOL
185 MPRunTask(MPTask *task);
186 
187 #ifdef __cplusplus
188 }
189 #endif
190 
MPTaskState
Definition: taskqueue.h:22
BOOL MPEnqueTask(MPTaskQueue *queue, MPTask *task)
uint32_t tasksFinished
Definition: taskqueue.h:74
void MPInitTaskQ(MPTaskQueue *queue, MPTask **queueBuffer, uint32_t queueBufferLen)
uint32_t MPDequeTasks(MPTaskQueue *queue, MPTask **queueBuffer, uint32_t queueBufferLen)
BOOL MPStartTaskQ(MPTaskQueue *queue)
MPTask * MPDequeTask(MPTaskQueue *queue)
uint32_t tasks
Definition: taskqueue.h:87
void * MPGetTaskUserData(MPTask *task)
int64_t OSTime
Definition: time.h:17
MPTaskQueueState state
Definition: taskqueue.h:70
uint32_t tasksRunning
Definition: taskqueue.h:89
uint32_t tasksFinished
Definition: taskqueue.h:91
BOOL MPWaitTaskQ(MPTaskQueue *queue, MPTaskQueueState mask)
uint32_t tasksRunning
Definition: taskqueue.h:73
BOOL MPTermTask(MPTask *task)
BOOL MPRunTask(MPTask *task)
BOOL MPPrintTaskQStats(MPTaskQueue *queue, uint32_t unk)
uint32_t queueMaxSize
Definition: taskqueue.h:98
void * userData
Definition: taskqueue.h:54
BOOL MPResetTaskQ(MPTaskQueue *queue)
BOOL MPGetTaskQInfo(MPTaskQueue *queue, MPTaskQueueInfo *info)
BOOL MPStopTaskQ(MPTaskQueue *queue)
uint32_t tasksReady
Definition: taskqueue.h:88
BOOL MPRunTasksFromTaskQ(MPTaskQueue *queue, uint32_t count)
uint32_t coreID
Definition: taskqueue.h:34
BOOL MPGetTaskInfo(MPTask *task, MPTaskInfo *info)
OSSpinLock lock
Definition: taskqueue.h:99
uint32_t result
Definition: taskqueue.h:33
uint32_t userArg2
Definition: taskqueue.h:50
BOOL MPTermTaskQ(MPTaskQueue *queue)
MPTaskFunc func
Definition: taskqueue.h:48
uint32_t queueSize
Definition: taskqueue.h:95
uint32_t tasksReady
Definition: taskqueue.h:72
uint32_t result
Definition: taskqueue.h:51
MPTaskState state
Definition: taskqueue.h:32
OSTime duration
Definition: taskqueue.h:53
int BOOL
Definition: wut_types.h:4
void MPSetTaskUserData(MPTask *task, void *userData)
uint32_t tasks
Definition: taskqueue.h:71
uint32_t queueIndex
Definition: taskqueue.h:93
MPTaskState state
Definition: taskqueue.h:47
MPTaskQueueState state
Definition: taskqueue.h:86
uint32_t coreID
Definition: taskqueue.h:52
void MPInitTask(MPTask *task, MPTaskFunc func, uint32_t userArg1, uint32_t userArg2)
MPTask ** queue
Definition: taskqueue.h:97
uint32_t(* MPTaskFunc)(uint32_t, uint32_t)
Definition: taskqueue.h:20
BOOL MPWaitTaskQWithTimeout(MPTaskQueue *queue, MPTaskQueueState wmask, OSTime timeout)
MPTaskQueue * queue
Definition: taskqueue.h:46
OSTime duration
Definition: taskqueue.h:35
uint32_t userArg1
Definition: taskqueue.h:49