vitasdk
Documentation of the vitasdk
usbd.h
Go to the documentation of this file.
1 
7 #ifndef _PSP2_USBD_H_
8 #define _PSP2_USBD_H_
9 
10 #include <vitasdk/build_utils.h>
11 #include <psp2/types.h>
12 #include <psp2common/usbd.h>
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
18 typedef struct SceUsbdDeviceInfo {
19  unsigned int port;
20  unsigned int device_num;
21  unsigned int unk3; // handled? 0, 1, 2
24 
25 typedef struct SceUsbdTransferData {
26  unsigned int pipe; // 0x00
27  const void *data; // 0x04
28  unsigned int data_size; // 0x08
29  void *transferred; // // 0x0C // ptr to 8 bytes?
30  unsigned int timeout; // 0x10 // size of above ptr? only 8 allowed?
33 
34 typedef struct SceUsbdReceiveEvent {
35  unsigned int unk0; // 0
36  unsigned int unk1; // next ptr?
37  unsigned int unk2; // != 8, set to 1, 2, 4? // transfer flags? type?
38  unsigned int unk3;
39  unsigned int unk4;
40  unsigned int unk5;
41  unsigned int transfer_id;
44 
45 #define USB_DESCRIPTOR_DEVICE 0x01 // bDescriptorType for a Device Descriptor.
46 #define USB_DESCRIPTOR_CONFIGURATION 0x02 // bDescriptorType for a Configuration Descriptor.
47 #define USB_DESCRIPTOR_STRING 0x03 // bDescriptorType for a String Descriptor.
48 #define USB_DESCRIPTOR_INTERFACE 0x04 // bDescriptorType for an Interface Descriptor.
49 #define USB_DESCRIPTOR_ENDPOINT 0x05 // bDescriptorType for an Endpoint Descriptor.
50 
51 #define USB_DESCRIPTOR_DEVICE_QUALIFIER 0x06 // bDescriptorType for a Device Qualifier.
52 #define USB_DESCRIPTOR_OTHER_SPEED 0x07 // bDescriptorType for a Other Speed Configuration.
53 #define USB_DESCRIPTOR_INTERFACE_POWER 0x08 // bDescriptorType for Interface Power.
54 #define USB_DESCRIPTOR_OTG 0x09 // bDescriptorType for an OTG Descriptor.
55 
64 int sceUsbdInit(SceUID *uid);
65 
74 int sceUsbdEnd(SceUID uid);
75 
86 int sceUsbdGetDeviceList(SceUID uid, SceSize num, SceUsbdDeviceInfo *info); // 8 devices max
87 
88 
98 int sceUsbdGetDescriptorSize(SceUID uid, unsigned int device_id);
99 
111 int sceUsbdGetDescriptor(SceUID uid, SceUID device_id, unsigned char *descriptor, SceSize size);
112 
113 
124 int sceUsbdGetDeviceSpeed(SceUID uid, SceUID device_id, unsigned int *speed);
125 #define SCE_USBD_DEVICE_SPEED_LS (0)
126 #define SCE_USBD_DEVICE_SPEED_FS (1)
127 #define SCE_USBD_DEVICE_SPEED_HS (2)
128 
141 int sceUsbdRegisterCallback(SceUID cbid, int flag);
142 
154 
164 int sceUsbdResetDevice(SceUID uid, SceUID device_id);
165 
178 int sceUsbdAttach(SceUID uid, SceUID driver_id, SceUInt bus, SceUInt device);
179 
192 
193 typedef struct SceUsbdTransferStatus {
194  uint32_t unk0; // < 0x40 - transfer id (result of sceUsbdTransferData)
195  uint32_t unk1; // unused
196  uint32_t unk2; // ret 4. ptr? // status?
197  uint32_t unk3; // ret 4. ptr? // transferred?
200 
202  uint32_t unk0; // < 0x40 - size? pipe? transfer id?
203  uint32_t unk1; // unused
204  uintptr_t* unk2; // ret up to 0x28 buff. 10 * 4 bytes. or 8*5 bytes
205  uint32_t unk3; // ret 4. ptr?
208 
220 
232 
233 typedef struct SceUsbdDevicePipe {
234  unsigned int device_id;
235  unsigned int unk1;
236  unsigned int unk2;
237  unsigned int unk3;
238  unsigned int unk4;
239  unsigned int unk5;
242 
253 
264 
274 int sceUsbdClosePipe(SceUID uid, SceUID pipe_id);
275 
286 
287 typedef struct SceUsbdIsochTransfer {
288  unsigned int unk0; // array of num_packets? ptrs to 4
289  unsigned int unk1; // num packets?
290  unsigned int unk2;
291  unsigned int unk3;
292 
293  unsigned int unk4;
294  unsigned int unk5;
295  unsigned int unk6;
296  unsigned int unk7;
297 
298  unsigned int unk8;
299  unsigned int unk9;
302 
314 
325 
336 
347 
357 int sceUsbdUnregisterLdd(SceUID uid, char* name);
358 
360  uint32_t driver_id;
361  uint32_t bus;
362  uint32_t device;
363  uint32_t unk3; // num devices?
364  uint32_t unk4;
367 
378 
379 #ifdef __cplusplus
380 }
381 #endif
382 
383 #endif /* _PSP2_USBD_H_ */
SceSize size
struct size(variable size)
Definition: debug.h:0
unsigned int SceSize
Definition: types.h:56
uint32_t SceUInt
Definition: types.h:48
int SceUID
UIDs are used to describe many different kernel objects.
Definition: types.h:90
Definition: usbd.h:162
unsigned int unk1
Definition: usbd.h:36
unsigned int unk2
Definition: usbd.h:290
uint32_t unk0
Definition: usbd.h:202
uint32_t unk1
Definition: usbd.h:203
int sceUsbdInit(SceUID *uid)
Init usb subsystem.
int sceUsbdIsochTransferData(SceUID uid, SceUID pipe_id, SceUsbdIsochTransfer *transfer)
Transfer data to/from endpoint isochronously.
int sceUsbdGetDescriptor(SceUID uid, SceUID device_id, unsigned char *descriptor, SceSize size)
Get usb device descriptors (all)
int sceUsbdGetIsochTransferStatus(SceUID transfer_id, SceUsbdIsochTransferStatus *status)
Get isochronous transfer status.
unsigned int unk6
Definition: usbd.h:295
uintptr_t * unk2
Definition: usbd.h:204
unsigned int unk3
Definition: usbd.h:38
uint32_t device
Definition: usbd.h:362
SceUID sceUsbdOpenDefaultPipe(SceUID uid, SceUID device_id)
Open endpoint communication pipe for default config endpoint.
uint32_t driver_id
Definition: usbd.h:360
int sceUsbdEnd(SceUID uid)
Stop usb subsystem.
unsigned int unk3
Definition: usbd.h:291
unsigned int unk5
Definition: usbd.h:40
unsigned int unk7
Definition: usbd.h:296
SceUID sceUsbdOpenPipe(SceUID uid, SceUsbdDevicePipe *pipe)
Open endpoint communication pipe.
unsigned int pipe
Definition: usbd.h:26
unsigned int unk9
Definition: usbd.h:299
int sceUsbdAttachCompositeLdd(SceUID uid, SceUsbdAttachCompositeParam *param)
Attach composite driver to device.
SceUID sceUsbdRegisterLdd(SceUID uid, char *name)
Register logical device driver.
unsigned int timeout
Definition: usbd.h:30
int sceUsbdGetDeviceAddress(SceUID uid, SceUID device_id, SceUsbdDeviceAddress *addr)
Get device address.
uint32_t unk0
Definition: usbd.h:194
uint32_t unk3
Definition: usbd.h:197
int sceUsbdUnregisterLdd(SceUID uid, char *name)
De-register logical device driver.
unsigned int unk0
Definition: usbd.h:35
unsigned int port
Definition: usbd.h:19
unsigned int unk3
Definition: usbd.h:237
int sceUsbdUnregisterCallback(SceUID cbid)
Remove callback to usb event.
uint32_t unk4
Definition: usbd.h:364
int sceUsbdGetDescriptorSize(SceUID uid, unsigned int device_id)
Get usb device descriptors data size.
void * transferred
Definition: usbd.h:29
uint32_t bus
Definition: usbd.h:361
int sceUsbdGetDeviceSpeed(SceUID uid, SceUID device_id, unsigned int *speed)
Get usb device speed.
unsigned int unk5
Definition: usbd.h:294
unsigned int unk4
Definition: usbd.h:293
int sceUsbdResetDevice(SceUID uid, SceUID device_id)
Reset usb device.
unsigned int unk4
Definition: usbd.h:238
unsigned int data_size
Definition: usbd.h:28
unsigned int unk3
Definition: usbd.h:21
int sceUsbdReceiveEvent(SceUID uid, SceUsbdReceiveEvent *event)
Receive usb event.
int sceUsbdRegisterCallback(SceUID cbid, int flag)
Register callback to usb event.
int sceUsbdGetTransferStatus(SceUID transfer_id, SceUsbdTransferStatus *status)
Get transfer status.
unsigned int unk5
Definition: usbd.h:239
unsigned int transfer_id
Definition: usbd.h:41
unsigned int unk0
Definition: usbd.h:288
VITASDK_BUILD_ASSERT_EQ(0xC, SceUsbdDeviceInfo)
unsigned int device_id
Definition: usbd.h:234
int sceUsbdAttach(SceUID uid, SceUID driver_id, SceUInt bus, SceUInt device)
Attach specified driver to device.
int sceUsbdClosePipe(SceUID uid, SceUID pipe_id)
Close endpoint communication pipe.
uint32_t unk3
Definition: usbd.h:363
unsigned int unk4
Definition: usbd.h:39
SceUID sceUsbdRegisterCompositeLdd(SceUID uid, char *name)
Register logical device driver for composite devices.
unsigned int unk2
Definition: usbd.h:37
uint32_t unk3
Definition: usbd.h:205
unsigned int unk8
Definition: usbd.h:298
uint32_t unk1
Definition: usbd.h:195
int sceUsbdGetDeviceList(SceUID uid, SceSize num, SceUsbdDeviceInfo *info)
Get usb devices list.
unsigned int unk2
Definition: usbd.h:236
const void * data
Definition: usbd.h:27
unsigned int device_num
Definition: usbd.h:20
SceUID sceUsbdTransferData(SceUID uid, SceUsbdTransferData *data)
Transfer data to/from endpoint.
uint32_t unk2
Definition: usbd.h:196
unsigned int unk1
Definition: usbd.h:289
unsigned int unk1
Definition: usbd.h:235
Definition: usbd.h:359
Definition: usbd.h:18
Definition: usbd.h:233
Definition: usbd.h:287
Definition: usbd.h:201
Definition: usbd.h:34
Definition: usbd.h:25
Definition: usbd.h:193