wut  v1.7.0
Wii U Toolchain
irda.h
Go to the documentation of this file.
1 #pragma once
2 #include <nsysccr/cdc.h>
3 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15 
16 typedef uint8_t CCRCDCIrdaCommand;
17 typedef uint8_t CCRCDCIrdaBitrate;
18 typedef uint8_t CCRCDCIrdaConnectionType;
29 
31 #define CCR_CDC_IRDA_DATA_TRANSFER_SIZE 0x208
32 
33 typedef enum
34 {
44 
45 typedef enum
46 {
80 
81 typedef enum
82 {
90 
91 struct WUT_PACKED CCRCDCIrdaConnectRequest
92 {
96  uint16_t timeout;
100  uint16_t receiveSize;
102  uint8_t targetId;
105 };
106 WUT_CHECK_OFFSET(CCRCDCIrdaConnectRequest, 0x0, command);
107 WUT_CHECK_OFFSET(CCRCDCIrdaConnectRequest, 0x1, timeout);
108 WUT_CHECK_OFFSET(CCRCDCIrdaConnectRequest, 0x3, bitrate);
109 WUT_CHECK_OFFSET(CCRCDCIrdaConnectRequest, 0x4, receiveSize);
110 WUT_CHECK_OFFSET(CCRCDCIrdaConnectRequest, 0x6, targetId);
111 WUT_CHECK_OFFSET(CCRCDCIrdaConnectRequest, 0x7, type);
112 WUT_CHECK_SIZE(CCRCDCIrdaConnectRequest, 0x8);
113 
114 struct WUT_PACKED CCRCDCIrdaConnectReply
115 {
117  uint8_t result;
118 };
119 WUT_CHECK_OFFSET(CCRCDCIrdaConnectReply, 0x0, result);
120 WUT_CHECK_SIZE(CCRCDCIrdaConnectReply, 0x1);
121 
122 struct WUT_PACKED CCRCDCIrdaSendRequest
123 {
127  uint16_t size;
129  uint8_t data[0];
130 };
131 WUT_CHECK_OFFSET(CCRCDCIrdaSendRequest, 0x0, command);
132 WUT_CHECK_OFFSET(CCRCDCIrdaSendRequest, 0x1, size);
133 WUT_CHECK_OFFSET(CCRCDCIrdaSendRequest, 0x3, data);
134 WUT_CHECK_SIZE(CCRCDCIrdaSendRequest, 0x3);
135 
136 struct WUT_PACKED CCRCDCIrdaSendReply
137 {
139  uint8_t result;
140 };
141 WUT_CHECK_OFFSET(CCRCDCIrdaSendReply, 0x0, result);
142 WUT_CHECK_SIZE(CCRCDCIrdaSendReply, 0x1);
143 
144 struct WUT_PACKED CCRCDCIrdaReceiveRequest
145 {
148 };
149 WUT_CHECK_OFFSET(CCRCDCIrdaReceiveRequest, 0x0, command);
150 WUT_CHECK_SIZE(CCRCDCIrdaReceiveRequest, 0x1);
151 
152 struct WUT_PACKED CCRCDCIrdaReceiveReply
153 {
155  uint8_t result;
157  uint16_t size;
159  uint8_t data[0];
160 };
161 WUT_CHECK_OFFSET(CCRCDCIrdaReceiveReply, 0x0, result);
162 WUT_CHECK_OFFSET(CCRCDCIrdaReceiveReply, 0x1, size);
163 WUT_CHECK_OFFSET(CCRCDCIrdaReceiveReply, 0x3, data);
164 WUT_CHECK_SIZE(CCRCDCIrdaReceiveReply, 0x3);
165 
167 {
170 };
171 WUT_CHECK_OFFSET(CCRCDCIrdaDisconnectRequest, 0x0, command);
172 WUT_CHECK_SIZE(CCRCDCIrdaDisconnectRequest, 0x1);
173 
174 struct WUT_PACKED CCRCDCIrdaDisconnectReply
175 {
177  uint8_t result;
178 };
179 WUT_CHECK_OFFSET(CCRCDCIrdaDisconnectReply, 0x0, result);
180 WUT_CHECK_SIZE(CCRCDCIrdaDisconnectReply, 0x1);
181 
183 {
185  uint8_t magic;
187  uint8_t sessionId;
188  uint8_t unk : 1;
190  uint8_t isLarge : 1;
192  uint8_t dataSize : 6;
194  uint16_t receiveSize;
195 };
196 WUT_CHECK_OFFSET(CCRCDCIrdaSmallPacketHeader, 0x0, magic);
197 WUT_CHECK_OFFSET(CCRCDCIrdaSmallPacketHeader, 0x1, sessionId);
198 WUT_CHECK_OFFSET(CCRCDCIrdaSmallPacketHeader, 0x3, receiveSize);
199 WUT_CHECK_SIZE(CCRCDCIrdaSmallPacketHeader, 0x5);
200 
202 {
204  uint8_t magic;
206  uint8_t sessionId;
207  uint8_t unk : 1;
209  uint8_t isLarge : 1;
211  uint16_t dataSize : 14;
213  uint16_t receiveSize;
214 };
215 WUT_CHECK_OFFSET(CCRCDCIrdaLargePacketHeader, 0x0, magic);
216 WUT_CHECK_OFFSET(CCRCDCIrdaLargePacketHeader, 0x1, sessionId);
217 WUT_CHECK_OFFSET(CCRCDCIrdaLargePacketHeader, 0x4, receiveSize);
218 WUT_CHECK_SIZE(CCRCDCIrdaLargePacketHeader, 0x6);
219 
243 int32_t
245  void *request,
246  uint32_t requestSize,
247  void *response,
248  uint32_t responseSize);
249 
250 #ifdef __cplusplus
251 }
252 #endif
253 
uint8_t sessionId
ID of the session (gets filled out by the DRC before transmitting the packet)
Definition: irda.h:187
uint8_t magic
Magic value (needs to be set to 0xa5)
Definition: irda.h:185
uint16_t receiveSize
Amount of data which should be received from the other device.
Definition: irda.h:100
CCRCDCIrdaConnectionType type
The type of the connect request.
Definition: irda.h:104
CCRCDCIrdaCommand command
CCR_IRDA_COMMAND_CONNECT.
Definition: irda.h:94
uint8_t result
0 on success
Definition: irda.h:117
CCRCDCIrdaBitrate bitrate
Bitrate of the connection.
Definition: irda.h:98
uint16_t timeout
Timeout of the connection in ms.
Definition: irda.h:96
uint8_t targetId
The ID of the target device.
Definition: irda.h:102
uint8_t isLarge
0 for small packets
Definition: irda.h:190
uint16_t size
The size of this request.
Definition: irda.h:127
uint8_t dataSize
Size of the actual data.
Definition: irda.h:192
uint16_t dataSize
Size of the actual data.
Definition: irda.h:211
uint8_t CCRCDCIrdaConnectionType
Definition: irda.h:18
CCRCDCIrdaBitrateEnum
Definition: irda.h:46
int32_t CCRCDCPerIrdaControl(CCRCDCDestination dest, void *request, uint32_t requestSize, void *response, uint32_t responseSize)
Controls IR of the GamePad.
uint8_t CCRCDCIrdaCommand
Definition: irda.h:16
uint8_t CCRCDCIrdaBitrate
Definition: irda.h:17
CCRCDCIrdaCommandEnum
Definition: irda.h:34
CCRCDCIrdaConnectionTypeEnum
Definition: irda.h:82
@ CCR_IRDA_BITRATE_72000
72000 bits-per-second
Definition: irda.h:52
@ CCR_IRDA_BITRATE_7200
7200 bits-per-second
Definition: irda.h:72
@ CCR_IRDA_BITRATE_57600
57600 bits-per-second
Definition: irda.h:54
@ CCR_IRDA_BITRATE_4800
4800 bits-per-second
Definition: irda.h:76
@ CCR_IRDA_BITRATE_12000
12000 bits-per-second
Definition: irda.h:68
@ CCR_IRDA_BITRATE_18000
18000 bits-per-second
Definition: irda.h:66
@ CCR_IRDA_BITRATE_9600
9600 bits-per-second
Definition: irda.h:70
@ CCR_IRDA_BITRATE_3000
3000 bits-per-second
Definition: irda.h:78
@ CCR_IRDA_BITRATE_38400
38400 bits-per-second
Definition: irda.h:58
@ CCR_IRDA_BITRATE_19200
19200 bits-per-second
Definition: irda.h:64
@ CCR_IRDA_BITRATE_6000
6000 bits-per-second
Definition: irda.h:74
@ CCR_IRDA_BITRATE_36000
36000 bits-per-second
Definition: irda.h:60
@ CCR_IRDA_BITRATE_48000
48000 bits-per-second
Definition: irda.h:56
@ CCR_IRDA_BITRATE_115200
115200 bits-per-second
Definition: irda.h:48
@ CCR_IRDA_BITRATE_24000
24000 bits-per-second
Definition: irda.h:62
@ CCR_IRDA_BITRATE_96000
96000 bits-per-second
Definition: irda.h:50
@ CCR_IRDA_COMMAND_RECEIVE
Receive data.
Definition: irda.h:40
@ CCR_IRDA_COMMAND_CONNECT
Initiate a new connection.
Definition: irda.h:36
@ CCR_IRDA_COMMAND_SEND
Send data.
Definition: irda.h:38
@ CCR_IRDA_COMMAND_DISCONNECT
Disconnect.
Definition: irda.h:42
@ CCR_IRDA_CONNECTION_REQUIRE
Initiate a new connection.
Definition: irda.h:86
@ CCR_IRDA_CONNECTION_ANY
Don't require a connection.
Definition: irda.h:88
@ CCR_IRDA_CONNECTION_WAIT
Wait for another device to start a connection.
Definition: irda.h:84
uint8_t CCRCDCDestination
Definition: cdc.h:28