PS2SDK
PS2 Homebrew Libraries
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
#ifndef __USBD_MACRO_H__
17
#define __USBD_MACRO_H__
18
19
#include <
usbd.h
>
20
21
static
int
sceUsbdControlTransfer(
int
epID,
int
reqtyp,
int
req,
int
val,
int
index,
int
leng,
void
*dataptr,
void
*doneCB,
void
*arg)
22
{
23
UsbDeviceRequest
devreq;
24
devreq.requesttype = reqtyp;
25
devreq.request = req;
26
devreq.value = val;
27
devreq.index = index;
28
devreq.length = leng;
29
30
return
sceUsbdTransferPipe(epID, dataptr, devreq.length, &devreq, doneCB, arg);
31
}
32
33
#define sceUsbdIsochronousTransfer(epID, dataptr, len, delta, doneCB, arg) \
34
sceUsbdTransferPipe((epID), (dataptr), (len), (void *)(delta), (doneCB), (arg))
35
36
#define sceUsbdBulkTransfer(epID, dataptr, len, doneCB, arg) \
37
sceUsbdTransferPipe((epID), (dataptr), (len), NULL, (doneCB), (arg))
38
39
#define sceUsbdInterruptTransfer(epID, dataptr, len, doneCB, arg) \
40
sceUsbdTransferPipe((epID), (dataptr), (len), NULL, (doneCB), (arg))
41
42
/* standard control transfers */
43
44
#define sceUsbdClearDeviceFeature(epID, feature, doneCB, arg) \
45
sceUsbdControlTransfer((epID), USB_DIR_OUT | USB_RECIP_DEVICE, USB_REQ_CLEAR_FEATURE, \
46
(feature), 0, 0, NULL, (doneCB), (arg))
47
48
#define sceUsbdSetDeviceFeature(epID, feature, doneCB, arg) \
49
sceUsbdControlTransfer((epID), USB_DIR_OUT | USB_RECIP_DEVICE, USB_REQ_SET_FEATURE, \
50
(feature), 0, 0, NULL, (doneCB), (arg))
51
52
#define sceUsbdGetConfiguration(epID, dataptr, doneCB, arg) \
53
sceUsbdControlTransfer((epID), USB_DIR_IN | USB_RECIP_DEVICE, USB_REQ_GET_CONFIGURATION, \
54
0, 0, 1, (dataptr), (doneCB), (arg))
55
56
#define sceUsbdSetConfiguration(epID, config, doneCB, arg) \
57
sceUsbdControlTransfer((epID), USB_DIR_OUT | USB_RECIP_DEVICE, USB_REQ_SET_CONFIGURATION, (config), 0, 0, NULL, (doneCB), (arg))
58
59
#define sceUsbdGetDescriptor(epID, type, index, language, dataptr, len, doneCB, arg) \
60
sceUsbdControlTransfer((epID), USB_DIR_IN | USB_RECIP_DEVICE, USB_REQ_GET_DESCRIPTOR, \
61
((type) << 8) | (index), (language), (len), (dataptr), (doneCB), (arg))
62
63
#define sceUsbdSetDeviceDescriptor(epID, type, index, language, dataptr, len, doneCB, arg) \
64
sceUsbdControlTransfer((epID), USB_DIR_OUT | USB_RECIP_DEVICE, USB_REQ_SET_DESCRIPTOR, \
65
((type) << 8) | (index), (language), (len), (dataptr), (doneCB), (arg))
66
67
#define sceUsbdGetDeviceStatus(epID, dataptr, doneCB, arg) \
68
sceUsbdControlTransfer((epID), USB_DIR_IN | USB_RECIP_DEVICE, USB_REQ_GET_STATUS, \
69
0, 0, 2, (dataptr), (doneCB), (arg))
70
71
#define sceUsbdSetAddress(epID, address, doneCB, arg) \
72
sceUsbdControlTransfer((epID), USB_DIR_OUT | USB_RECIP_DEVICE, USB_REQ_SET_ADDRESS, \
73
(address), 0, 0, NULL, (doneCB), (arg))
74
75
#define sceUsbdClearInterfaceFeature(epID, feature, interface, doneCB, arg) \
76
sceUsbdControlTransfer((epID), USB_DIR_OUT | USB_RECIP_INTERFACE, USB_REQ_CLEAR_FEATURE, \
77
(feature), (interface), 0, NULL, (doneCB), (arg))
78
79
#define sceUsbdSetInterfaceFeature(epID, feature, interface, doneCB, arg) \
80
sceUsbdControlTransfer((epID), USB_DIR_OUT | USB_RECIP_INTERFACE, USB_REQ_SET_FEATURE, \
81
(feature), (interface), 0, NULL, (doneCB), (arg))
82
83
#define sceUsbdGetInterface(epID, interface, dataptr, doneCB, arg) \
84
sceUsbdControlTransfer((epID), USB_DIR_IN | USB_RECIP_INTERFACE, USB_REQ_GET_INTERFACE, \
85
0, (interface), 1, (dataptr), (doneCB), (arg))
86
87
#define sceUsbdSetInterface(epID, interface, alt_setting, doneCB, arg) \
88
sceUsbdControlTransfer((epID), USB_DIR_OUT | USB_RECIP_INTERFACE, USB_REQ_SET_INTERFACE, \
89
(alt_setting), (interface), 0, NULL, (doneCB), (arg))
90
91
#define sceUsbdGetInterfaceDescriptor(epID, type, index, language, dataptr, len, doneCB, arg) \
92
sceUsbdControlTransfer((epID), USB_DIR_IN | USB_RECIP_INTERFACE, USB_REQ_GET_DESCRIPTOR, \
93
((type) << 8) | (index), (language), (len), (dataptr), (doneCB), (arg))
94
95
#define sceUsbdSetInterfaceDescriptor(epID, type, index, language, dataptr, len, doneCB, arg) \
96
sceUsbdControlTransfer((epID), USB_DIR_OUT | USB_RECIP_INTERFACE, USB_REQ_SET_DESCRIPTOR, \
97
((type) << 8) | (index), (language), (len), (dataptr), (doneCB), (arg))
98
99
#define sceUsbdGetInterfaceStatus(epID, interface, dataptr, doneCB, arg) \
100
sceUsbdControlTransfer((epID), USB_DIR_IN | USB_RECIP_INTERFACE, USB_REQ_GET_STATUS, \
101
0, (interface), 2, (dataptr), (doneCB), (arg))
102
103
#define sceUsbdClearEndpointFeature(epID, feature, endpoint, doneCB, arg) \
104
sceUsbdControlTransfer((epID), USB_DIR_OUT | USB_RECIP_ENDPOINT, USB_REQ_CLEAR_FEATURE, \
105
(feature), (endpoint), 0, NULL, (doneCB), (arg))
106
107
#define sceUsbdSetEndpointFeature(epID, feature, endpoint, doneCB, arg) \
108
sceUsbdControlTransfer((epID), USB_DIR_OUT | USB_RECIP_ENDPOINT, USB_REQ_SET_FEATURE, \
109
(feature), (endpoint), 0, NULL, (doneCB), (arg))
110
111
#define sceUsbdGetEndpointStatus(epID, endpoint, dataptr, doneCB, arg) \
112
sceUsbdControlTransfer((epID), USB_DIR_IN | USB_RECIP_ENDPOINT, USB_REQ_GET_STATUS, \
113
0, (endpoint), 2, (dataptr), (doneCB), (arg))
114
115
#define sceUsbdGetEndpointDescriptor(epID, type, index, language, dataptr, len, doneCB, arg) \
116
sceUsbdControlTransfer((epID), USB_DIR_IN | USB_RECIP_ENDPOINT, USB_REQ_GET_DESCRIPTOR, \
117
((type) << 8) | (index), (language), (len), (dataptr), (doneCB), (arg))
118
119
#define sceUsbdSetEndpointDescriptor(epID, type, index, language, dataptr, len, doneCB, arg) \
120
sceUsbdControlTransfer((epID), USB_DIR_OUT | USB_RECIP_ENDPOINT, USB_REQ_SET_DESCRIPTOR, \
121
((type) << 8) | (index), (language), (len), (dataptr), (doneCB), (arg))
122
123
#define sceUsbdSynchFrame(epID, endpoint, pfn, doneCB, arg) \
124
sceUsbdControlTransfer((epID), USB_DIR_IN | USB_RECIP_ENDPOINT, USB_REQ_SYNCH_FRAME, \
125
0, (endpoint), 2, (pfn), (doneCB), (arg))
126
127
// For backwards compatibility:
128
#define UsbControlTransfer sceUsbdControlTransfer
129
#define UsbIsochronousTransfer sceUsbdIsochronousTransfer
130
#define UsbBulkTransfer sceUsbdBulkTransfer
131
#define UsbInterruptTransfer sceUsbdInterruptTransfer
132
#define UsbClearDeviceFeature sceUsbdClearDeviceFeature
133
#define UsbSetDeviceFeature sceUsbdSetDeviceFeature
134
#define UsbGetDeviceConfiguration sceUsbdGetConfiguration
135
#define UsbSetDeviceConfiguration sceUsbdSetConfiguration
136
#define UsbGetDeviceDescriptor sceUsbdGetDescriptor
137
#define UsbSetDeviceDescriptor sceUsbdSetDeviceDescriptor
138
#define UsbGetDeviceStatus sceUsbdGetDeviceStatus
139
#define UsbSetDeviceAddress sceUsbdSetAddress
140
#define UsbClearInterfaceFeature sceUsbdClearInterfaceFeature
141
#define UsbSetInterfaceFeature sceUsbdSetInterfaceFeature
142
#define UsbGetInterface sceUsbdGetInterface
143
#define UsbSetInterface sceUsbdSetInterface
144
#define UsbGetInterfaceDescriptor sceUsbdGetInterfaceDescriptor
145
#define UsbSetInterfaceDescriptor sceUsbdSetInterfaceDescriptor
146
#define UsbGetInterfaceStatus sceUsbdGetInterfaceStatus
147
#define UsbClearEndpointFeature sceUsbdClearEndpointFeature
148
#define UsbSetEndpointFeature sceUsbdSetEndpointFeature
149
#define UsbGetEndpointStatus sceUsbdGetEndpointStatus
150
#define UsbGetEndpointDescriptor sceUsbdGetEndpointDescriptor
151
#define UsbSetEndpointDescriptor sceUsbdSetEndpointDescriptor
152
#define UsbSynchEndpointFrame sceUsbdSynchFrame
153
154
#endif
/* __USBD_MACRO_H__ */
usbd.h
UsbDeviceRequest
Definition
usbd.h:23
iop
usb
usbd
include
usbd_macro.h
Generated on Thu Nov 14 2024 05:25:29 for PS2SDK by
1.9.8