sdk-core
v2026.11.05
PS2 SDK - core tier (build-critical EE/IOP modules)
Toggle main menu visibility
Loading...
Searching...
No Matches
usbd_macro.h
Go to the documentation of this file.
1
/*
2
# _____ ___ ____ ___ ____
3
# ____| | ____| | | |____|
4
# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5
#-----------------------------------------------------------------------
6
# Copyright 2001-2004, ps2dev - http://www.ps2dev.org
7
# Licenced under Academic Free License version 2.0
8
# Review ps2sdk README & LICENSE files for further details.
9
*/
10
16
17
#ifndef __USBD_MACRO_H__
18
#define __USBD_MACRO_H__
19
20
#include <
usbd.h
>
21
22
static
int
sceUsbdControlTransfer(
int
epID,
int
reqtyp,
int
req,
int
val,
int
index,
int
leng,
void
*dataptr,
void
*doneCB,
void
*arg)
23
{
24
UsbDeviceRequest
devreq;
25
devreq.requesttype = reqtyp;
26
devreq.request = req;
27
devreq.value = val;
28
devreq.index = index;
29
devreq.length = leng;
30
31
return
sceUsbdTransferPipe(epID, dataptr, devreq.length, &devreq, doneCB, arg);
32
}
33
34
#define sceUsbdIsochronousTransfer(epID, dataptr, len, delta, doneCB, arg) \
35
sceUsbdTransferPipe((epID), (dataptr), (len), (void *)(delta), (doneCB), (arg))
36
37
#define sceUsbdBulkTransfer(epID, dataptr, len, doneCB, arg) \
38
sceUsbdTransferPipe((epID), (dataptr), (len), NULL, (doneCB), (arg))
39
40
#define sceUsbdInterruptTransfer(epID, dataptr, len, doneCB, arg) \
41
sceUsbdTransferPipe((epID), (dataptr), (len), NULL, (doneCB), (arg))
42
43
/* standard control transfers */
44
45
#define sceUsbdClearDeviceFeature(epID, feature, doneCB, arg) \
46
sceUsbdControlTransfer((epID), USB_DIR_OUT | USB_RECIP_DEVICE, USB_REQ_CLEAR_FEATURE, \
47
(feature), 0, 0, NULL, (doneCB), (arg))
48
49
#define sceUsbdSetDeviceFeature(epID, feature, doneCB, arg) \
50
sceUsbdControlTransfer((epID), USB_DIR_OUT | USB_RECIP_DEVICE, USB_REQ_SET_FEATURE, \
51
(feature), 0, 0, NULL, (doneCB), (arg))
52
53
#define sceUsbdGetConfiguration(epID, dataptr, doneCB, arg) \
54
sceUsbdControlTransfer((epID), USB_DIR_IN | USB_RECIP_DEVICE, USB_REQ_GET_CONFIGURATION, \
55
0, 0, 1, (dataptr), (doneCB), (arg))
56
57
#define sceUsbdSetConfiguration(epID, config, doneCB, arg) \
58
sceUsbdControlTransfer((epID), USB_DIR_OUT | USB_RECIP_DEVICE, USB_REQ_SET_CONFIGURATION, (config), 0, 0, NULL, (doneCB), (arg))
59
60
#define sceUsbdGetDescriptor(epID, type, index, language, dataptr, len, doneCB, arg) \
61
sceUsbdControlTransfer((epID), USB_DIR_IN | USB_RECIP_DEVICE, USB_REQ_GET_DESCRIPTOR, \
62
((type) << 8) | (index), (language), (len), (dataptr), (doneCB), (arg))
63
64
#define sceUsbdSetDeviceDescriptor(epID, type, index, language, dataptr, len, doneCB, arg) \
65
sceUsbdControlTransfer((epID), USB_DIR_OUT | USB_RECIP_DEVICE, USB_REQ_SET_DESCRIPTOR, \
66
((type) << 8) | (index), (language), (len), (dataptr), (doneCB), (arg))
67
68
#define sceUsbdGetDeviceStatus(epID, dataptr, doneCB, arg) \
69
sceUsbdControlTransfer((epID), USB_DIR_IN | USB_RECIP_DEVICE, USB_REQ_GET_STATUS, \
70
0, 0, 2, (dataptr), (doneCB), (arg))
71
72
#define sceUsbdSetAddress(epID, address, doneCB, arg) \
73
sceUsbdControlTransfer((epID), USB_DIR_OUT | USB_RECIP_DEVICE, USB_REQ_SET_ADDRESS, \
74
(address), 0, 0, NULL, (doneCB), (arg))
75
76
#define sceUsbdClearInterfaceFeature(epID, feature, interface, doneCB, arg) \
77
sceUsbdControlTransfer((epID), USB_DIR_OUT | USB_RECIP_INTERFACE, USB_REQ_CLEAR_FEATURE, \
78
(feature), (interface), 0, NULL, (doneCB), (arg))
79
80
#define sceUsbdSetInterfaceFeature(epID, feature, interface, doneCB, arg) \
81
sceUsbdControlTransfer((epID), USB_DIR_OUT | USB_RECIP_INTERFACE, USB_REQ_SET_FEATURE, \
82
(feature), (interface), 0, NULL, (doneCB), (arg))
83
84
#define sceUsbdGetInterface(epID, interface, dataptr, doneCB, arg) \
85
sceUsbdControlTransfer((epID), USB_DIR_IN | USB_RECIP_INTERFACE, USB_REQ_GET_INTERFACE, \
86
0, (interface), 1, (dataptr), (doneCB), (arg))
87
88
#define sceUsbdSetInterface(epID, interface, alt_setting, doneCB, arg) \
89
sceUsbdControlTransfer((epID), USB_DIR_OUT | USB_RECIP_INTERFACE, USB_REQ_SET_INTERFACE, \
90
(alt_setting), (interface), 0, NULL, (doneCB), (arg))
91
92
#define sceUsbdGetInterfaceDescriptor(epID, type, index, language, dataptr, len, doneCB, arg) \
93
sceUsbdControlTransfer((epID), USB_DIR_IN | USB_RECIP_INTERFACE, USB_REQ_GET_DESCRIPTOR, \
94
((type) << 8) | (index), (language), (len), (dataptr), (doneCB), (arg))
95
96
#define sceUsbdSetInterfaceDescriptor(epID, type, index, language, dataptr, len, doneCB, arg) \
97
sceUsbdControlTransfer((epID), USB_DIR_OUT | USB_RECIP_INTERFACE, USB_REQ_SET_DESCRIPTOR, \
98
((type) << 8) | (index), (language), (len), (dataptr), (doneCB), (arg))
99
100
#define sceUsbdGetInterfaceStatus(epID, interface, dataptr, doneCB, arg) \
101
sceUsbdControlTransfer((epID), USB_DIR_IN | USB_RECIP_INTERFACE, USB_REQ_GET_STATUS, \
102
0, (interface), 2, (dataptr), (doneCB), (arg))
103
104
#define sceUsbdClearEndpointFeature(epID, feature, endpoint, doneCB, arg) \
105
sceUsbdControlTransfer((epID), USB_DIR_OUT | USB_RECIP_ENDPOINT, USB_REQ_CLEAR_FEATURE, \
106
(feature), (endpoint), 0, NULL, (doneCB), (arg))
107
108
#define sceUsbdSetEndpointFeature(epID, feature, endpoint, doneCB, arg) \
109
sceUsbdControlTransfer((epID), USB_DIR_OUT | USB_RECIP_ENDPOINT, USB_REQ_SET_FEATURE, \
110
(feature), (endpoint), 0, NULL, (doneCB), (arg))
111
112
#define sceUsbdGetEndpointStatus(epID, endpoint, dataptr, doneCB, arg) \
113
sceUsbdControlTransfer((epID), USB_DIR_IN | USB_RECIP_ENDPOINT, USB_REQ_GET_STATUS, \
114
0, (endpoint), 2, (dataptr), (doneCB), (arg))
115
116
#define sceUsbdGetEndpointDescriptor(epID, type, index, language, dataptr, len, doneCB, arg) \
117
sceUsbdControlTransfer((epID), USB_DIR_IN | USB_RECIP_ENDPOINT, USB_REQ_GET_DESCRIPTOR, \
118
((type) << 8) | (index), (language), (len), (dataptr), (doneCB), (arg))
119
120
#define sceUsbdSetEndpointDescriptor(epID, type, index, language, dataptr, len, doneCB, arg) \
121
sceUsbdControlTransfer((epID), USB_DIR_OUT | USB_RECIP_ENDPOINT, USB_REQ_SET_DESCRIPTOR, \
122
((type) << 8) | (index), (language), (len), (dataptr), (doneCB), (arg))
123
124
#define sceUsbdSynchFrame(epID, endpoint, pfn, doneCB, arg) \
125
sceUsbdControlTransfer((epID), USB_DIR_IN | USB_RECIP_ENDPOINT, USB_REQ_SYNCH_FRAME, \
126
0, (endpoint), 2, (pfn), (doneCB), (arg))
127
128
// For backwards compatibility:
129
#define UsbControlTransfer sceUsbdControlTransfer
130
#define UsbIsochronousTransfer sceUsbdIsochronousTransfer
131
#define UsbBulkTransfer sceUsbdBulkTransfer
132
#define UsbInterruptTransfer sceUsbdInterruptTransfer
133
#define UsbClearDeviceFeature sceUsbdClearDeviceFeature
134
#define UsbSetDeviceFeature sceUsbdSetDeviceFeature
135
#define UsbGetDeviceConfiguration sceUsbdGetConfiguration
136
#define UsbSetDeviceConfiguration sceUsbdSetConfiguration
137
#define UsbGetDeviceDescriptor sceUsbdGetDescriptor
138
#define UsbSetDeviceDescriptor sceUsbdSetDeviceDescriptor
139
#define UsbGetDeviceStatus sceUsbdGetDeviceStatus
140
#define UsbSetDeviceAddress sceUsbdSetAddress
141
#define UsbClearInterfaceFeature sceUsbdClearInterfaceFeature
142
#define UsbSetInterfaceFeature sceUsbdSetInterfaceFeature
143
#define UsbGetInterface sceUsbdGetInterface
144
#define UsbSetInterface sceUsbdSetInterface
145
#define UsbGetInterfaceDescriptor sceUsbdGetInterfaceDescriptor
146
#define UsbSetInterfaceDescriptor sceUsbdSetInterfaceDescriptor
147
#define UsbGetInterfaceStatus sceUsbdGetInterfaceStatus
148
#define UsbClearEndpointFeature sceUsbdClearEndpointFeature
149
#define UsbSetEndpointFeature sceUsbdSetEndpointFeature
150
#define UsbGetEndpointStatus sceUsbdGetEndpointStatus
151
#define UsbGetEndpointDescriptor sceUsbdGetEndpointDescriptor
152
#define UsbSetEndpointDescriptor sceUsbdSetEndpointDescriptor
153
#define UsbSynchEndpointFrame sceUsbdSynchFrame
154
155
#endif
/* __USBD_MACRO_H__ */
UsbDeviceRequest
Definition
usbd.h:24
usbd.h
core
usbd
include
usbd_macro.h
Generated by
1.18.0