wut v1.8.0
Wii U Toolchain
Loading...
Searching...
No Matches
smd.h
Go to the documentation of this file.
1#pragma once
2#include <wut.h>
3#include <coreinit/mutex.h>
4
13#ifdef __cplusplus
14extern "C" {
15#endif
16
18typedef struct SmdVector SmdVector;
19typedef struct SmdElement SmdElement;
24typedef struct SmdPpc SmdPpc;
26
36
44
50
57
59{
60 void *ptr;
61 uint32_t size;
62};
63WUT_CHECK_OFFSET(SmdVectorSpec, 0x00, ptr);
64WUT_CHECK_OFFSET(SmdVectorSpec, 0x04, size);
65WUT_CHECK_SIZE(SmdVectorSpec, 0x8);
66
68{
69 uint32_t command;
70 int32_t count;
72};
73WUT_CHECK_OFFSET(SmdVector, 0x00, command);
74WUT_CHECK_OFFSET(SmdVector, 0x04, count);
75WUT_CHECK_OFFSET(SmdVector, 0x08, vecs);
76WUT_CHECK_SIZE(SmdVector, 0x28);
77
79{
81 uint32_t size;
82 union {
83 uint8_t data[0xf8];
84 SmdVector spec;
85 uint32_t vectorPaddr;
86 };
87};
88WUT_CHECK_OFFSET(SmdElement, 0x00, type);
89WUT_CHECK_OFFSET(SmdElement, 0x04, size);
90WUT_CHECK_OFFSET(SmdElement, 0x08, data);
91WUT_CHECK_OFFSET(SmdElement, 0x08, spec);
92WUT_CHECK_OFFSET(SmdElement, 0x08, vectorPaddr);
93WUT_CHECK_SIZE(SmdElement, 0x100);
94
96{
98 uint32_t size;
99 union {
100 uint8_t message[0x80];
101 SmdVector spec;
102 SmdVector *vector;
103 };
104};
105WUT_CHECK_OFFSET(SmdReceiveData, 0x00, type);
106WUT_CHECK_OFFSET(SmdReceiveData, 0x04, size);
107WUT_CHECK_OFFSET(SmdReceiveData, 0x08, message);
108WUT_CHECK_OFFSET(SmdReceiveData, 0x08, spec);
109WUT_CHECK_OFFSET(SmdReceiveData, 0x08, vector);
110WUT_CHECK_SIZE(SmdReceiveData, 0x88);
111
113{
115 WUT_PADDING_BYTES(0x7C);
116 uint32_t elementCount;
117 WUT_PADDING_BYTES(0x7C);
118 int32_t readOffset;
119 WUT_PADDING_BYTES(0x7C);
120 int32_t writeOffset;
121 WUT_PADDING_BYTES(0x7C);
122 uint32_t bufPaddr;
123 WUT_PADDING_BYTES(0x7C);
124};
125WUT_CHECK_OFFSET(SmdInterface, 0x000, state);
126WUT_CHECK_OFFSET(SmdInterface, 0x080, elementCount);
127WUT_CHECK_OFFSET(SmdInterface, 0x100, readOffset);
128WUT_CHECK_OFFSET(SmdInterface, 0x180, writeOffset);
129WUT_CHECK_OFFSET(SmdInterface, 0x200, bufPaddr);
130WUT_CHECK_SIZE(SmdInterface, 0x280);
131
133{
134 char name[0x10];
135 uint32_t reusedCount;
136 WUT_PADDING_BYTES(0x6C);
138 WUT_PADDING_BYTES(0x40);
140 WUT_PADDING_BYTES(0x40);
141};
142WUT_CHECK_OFFSET(SmdCtrlTable, 0x000, name);
143WUT_CHECK_OFFSET(SmdCtrlTable, 0x010, reusedCount);
144WUT_CHECK_OFFSET(SmdCtrlTable, 0x080, iopInterface);
145WUT_CHECK_OFFSET(SmdCtrlTable, 0x340, ppcInterface);
146WUT_CHECK_SIZE(SmdCtrlTable, 0x600);
147
157WUT_CHECK_OFFSET(SmdPpcCtrlTableVectors, 0x00, ctrlTable);
158WUT_CHECK_OFFSET(SmdPpcCtrlTableVectors, 0x04, ctrlTableSize);
159WUT_CHECK_OFFSET(SmdPpcCtrlTableVectors, 0x08, writeBuf);
160WUT_CHECK_OFFSET(SmdPpcCtrlTableVectors, 0x0C, writeBufSize);
161WUT_CHECK_OFFSET(SmdPpcCtrlTableVectors, 0x10, readBuf);
162WUT_CHECK_OFFSET(SmdPpcCtrlTableVectors, 0x14, readBufSize);
163WUT_CHECK_SIZE(SmdPpcCtrlTableVectors, 0x18);
164
177WUT_CHECK_OFFSET(SmdPpc, 0x00, self);
178WUT_CHECK_OFFSET(SmdPpc, 0x04, ctrlTable);
179WUT_CHECK_OFFSET(SmdPpc, 0x08, lockType);
180WUT_CHECK_OFFSET(SmdPpc, 0x0C, mutex);
181WUT_CHECK_OFFSET(SmdPpc, 0x38, messageCount);
182WUT_CHECK_OFFSET(SmdPpc, 0x3C, writeBuf);
183WUT_CHECK_OFFSET(SmdPpc, 0x40, readBuf);
184WUT_CHECK_OFFSET(SmdPpc, 0x44, state);
185WUT_CHECK_SIZE(SmdPpc, 0x80);
186
203WUT_CHECK_OFFSET(SmdSimpleBufPool, 0x00, self);
204WUT_CHECK_OFFSET(SmdSimpleBufPool, 0x04, mutex);
205WUT_CHECK_OFFSET(SmdSimpleBufPool, 0x30, poolData);
206WUT_CHECK_OFFSET(SmdSimpleBufPool, 0x34, poolDataSize);
207WUT_CHECK_OFFSET(SmdSimpleBufPool, 0x38, lockType);
208WUT_CHECK_OFFSET(SmdSimpleBufPool, 0x3C, allocSize);
209WUT_CHECK_OFFSET(SmdSimpleBufPool, 0x40, realAllocSize);
210WUT_CHECK_OFFSET(SmdSimpleBufPool, 0x44, maxAllocCount);
211WUT_CHECK_OFFSET(SmdSimpleBufPool, 0x48, allocPoolStart);
212WUT_CHECK_OFFSET(SmdSimpleBufPool, 0x4C, allocPoolEnd);
213WUT_CHECK_OFFSET(SmdSimpleBufPool, 0x50, elementsIn);
214WUT_CHECK_OFFSET(SmdSimpleBufPool, 0x54, freeErrorCount);
215WUT_CHECK_SIZE(SmdSimpleBufPool, 0x80);
216
217SmdPpc *
218smdPpcInit(void *buf,
219 uint32_t bufSize,
220 uint32_t messageCount,
221 const char *name,
222 SmdLockType lockType);
223
224int32_t
226 SmdPpcCtrlTableVectors *outVectors);
227
228int32_t
230
231int32_t
233
234int32_t
236 SmdInterfaceState *outPpcState,
237 SmdInterfaceState *outIopState);
238
239int32_t
241 SmdReceiveData *data);
242
243int32_t
245 void *message,
246 uint32_t messageSize);
247
248int32_t
250 uint32_t command,
251 SmdVectorSpec *specs,
252 int32_t specsCount);
253
254int32_t
256 SmdVector *vector);
257
260 uint32_t poolDataSize,
261 uint32_t allocSize,
262 uint32_t allocCount,
263 SmdLockType lockType);
264
265int32_t
267 void **outAlloc);
268
269int32_t
271 void *alloc);
272
273int32_t
275 uint32_t *allocCount,
276 uint32_t *freeErrorCount);
277
278#ifdef __cplusplus
279}
280#endif
281
void * allocPoolEnd
Definition smd.h:198
SmdElementType type
Definition smd.h:80
uint32_t poolDataSize
Definition smd.h:192
int32_t count
Definition smd.h:70
uint32_t ctrlTableSize
Definition smd.h:151
uint32_t reusedCount
Definition smd.h:135
SmdCtrlTable * ctrlTable
Definition smd.h:150
SmdSimpleBufPool * self
Definition smd.h:189
SmdVectorSpec vecs[4]
Definition smd.h:71
uint32_t bufPaddr
Definition smd.h:122
SmdElement * readBuf
Definition smd.h:154
uint32_t freeErrorCount
Definition smd.h:200
SmdInterface ppcInterface
Definition smd.h:139
SmdPpcState state
Definition smd.h:174
uint32_t writeBufSize
Definition smd.h:153
uint32_t realAllocSize
Definition smd.h:195
void * poolData
Definition smd.h:191
uint32_t allocSize
Definition smd.h:194
int32_t writeOffset
Definition smd.h:120
char name[0x10]
Definition smd.h:134
SmdPpc * self
Definition smd.h:167
SmdLockType lockType
Definition smd.h:169
uint32_t size
Definition smd.h:61
int32_t readOffset
Definition smd.h:118
OSMutex mutex
Definition smd.h:170
uint32_t elementsIn
Definition smd.h:199
uint32_t readBufSize
Definition smd.h:155
void * allocPoolStart
Definition smd.h:197
void * ptr
Definition smd.h:60
SmdElement * writeBuf
Definition smd.h:152
uint32_t elementCount
Definition smd.h:116
uint32_t messageCount
Definition smd.h:171
uint32_t command
Definition smd.h:69
SmdInterfaceState state
Definition smd.h:114
SmdInterface iopInterface
Definition smd.h:137
uint32_t maxAllocCount
Definition smd.h:196
SmdPpcState
Definition smd.h:38
int32_t smdPpcGetInterfaceState(SmdPpc *smd, SmdInterfaceState *outPpcState, SmdInterfaceState *outIopState)
int32_t smdPpcSendMessage(SmdPpc *smd, void *message, uint32_t messageSize)
int32_t smdPpcClose(SmdPpc *smd)
int32_t smdPpcSendVector(SmdPpc *smd, SmdVector *vector)
int32_t smdSimpleBufFree(SmdSimpleBufPool *pool, void *alloc)
SmdSimpleBufPool * smdSimpleBufPoolCreate(void *poolData, uint32_t poolDataSize, uint32_t allocSize, uint32_t allocCount, SmdLockType lockType)
int32_t smdSimpleBufAlloc(SmdSimpleBufPool *pool, void **outAlloc)
SmdInterfaceState
Definition smd.h:46
SmdElementType
Definition smd.h:52
int32_t smdSimpleBufGetStatistics(SmdSimpleBufPool *pool, uint32_t *allocCount, uint32_t *freeErrorCount)
int32_t smdPpcOpen(SmdPpc *smd)
int32_t smdPpcSendVectorSpec(SmdPpc *smd, uint32_t command, SmdVectorSpec *specs, int32_t specsCount)
SmdPpc * smdPpcInit(void *buf, uint32_t bufSize, uint32_t messageCount, const char *name, SmdLockType lockType)
int32_t smdPpcReceive(SmdPpc *smd, SmdReceiveData *data)
SmdLockType
Definition smd.h:28
int32_t smdPpcGetCtrlTableVectors(SmdPpc *smd, SmdPpcCtrlTableVectors *outVectors)
@ SMD_PPC_STATE_INVALID
Definition smd.h:39
@ SMD_PPC_STATE_CLOSED
Definition smd.h:41
@ SMD_PPC_STATE_OPENED
Definition smd.h:42
@ SMD_PPC_STATE_INITIALIZED
Definition smd.h:40
@ SMD_INTERFACE_STATE_OPENED
Definition smd.h:47
@ SMD_INTERFACE_STATE_CLOSED
Definition smd.h:48
@ SMD_ELEMENT_TYPE_VECTOR_SPEC
Definition smd.h:54
@ SMD_ELEMENT_TYPE_VECTOR
Definition smd.h:55
@ SMD_ELEMENT_TYPE_MESSAGE
Definition smd.h:53
@ SMD_LOCK_TYPE_NONE
No locking is done.
Definition smd.h:34
@ SMD_LOCK_TYPE_DISABLE_INTERRUPTS
Locking is done by disabling interrupts.
Definition smd.h:32
@ SMD_LOCK_TYPE_MUTEX
Locking is done with a mutex.
Definition smd.h:30
Definition smd.h:166