pspsdk-1.0+beta2
pspusbbus.h
Go to the documentation of this file.
1 /*
2  * PSP Software Development Kit - http://www.pspdev.org
3  * -----------------------------------------------------------------------
4  * Licensed under the BSD license, see LICENSE in PSPSDK root for details.
5  *
6  * pspusbbus.h - Prototypes for the sceUsbBus_driver library
7  *
8  * Copyright (c) 2006 James F
9  *
10  * $Id: pspusbbus.h 2219 2007-04-18 19:08:48Z chip $
11  */
12 #ifndef __PSPUSBBUS_H__
13 #define __PSPUSBBUS_H__
14 
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18 
21 {
25  int unk8;
28 };
29 
32 {
34  int endpnum;
36  int unk2;
38  int unk3;
39 };
40 
43 {
44  unsigned char bLength;
45  unsigned char bDescriptorType;
46  short bString[32];
47 } __attribute__((packed));
48 
51 {
52  unsigned char bLength;
53  unsigned char bDescriptorType;
54  unsigned short bcdUSB;
55  unsigned char bDeviceClass;
56  unsigned char bDeviceSubClass;
57  unsigned char bDeviceProtocol;
58  unsigned char bMaxPacketSize;
59  unsigned short idVendor;
60  unsigned short idProduct;
61  unsigned short bcdDevice;
62  unsigned char iManufacturer;
63  unsigned char iProduct;
64  unsigned char iSerialNumber;
65  unsigned char bNumConfigurations;
66 } __attribute__((packed));
67 
70 {
71  unsigned char bLength;
72  unsigned char bDescriptorType;
73  unsigned short wTotalLength;
74  unsigned char bNumInterfaces;
75  unsigned char bConfigurationValue;
76  unsigned char iConfiguration;
77  unsigned char bmAttributes;
78  unsigned char bMaxPower;
79 } __attribute__((packed));
80 
83 {
84  unsigned char bLength;
85  unsigned char bDescriptorType;
86  unsigned char bInterfaceNumber;
87  unsigned char bAlternateSetting;
88  unsigned char bNumEndpoints;
89  unsigned char bInterfaceClass;
90  unsigned char bInterfaceSubClass;
91  unsigned char bInterfaceProtocol;
92  unsigned char iInterface;
93 } __attribute__((packed));
94 
97 {
98  unsigned char bLength;
99  unsigned char bDescriptorType;
100  unsigned char bEndpointAddress;
101  unsigned char bmAttributes;
102  unsigned short wMaxPacketSize;
103  unsigned char bInterval;
104 } __attribute__((packed));
105 
108 {
112  unsigned int num;
113 };
114 
117 {
126 };
127 
129 struct UsbData
130 {
131  unsigned char devdesc[20];
132 
133  struct Config
134  {
135  void *pconfdesc;
136  void *pinterfaces;
137  void *pinterdesc;
138  void *pendp;
139  } config;
140 
141  struct ConfDesc
142  {
143  unsigned char desc[12];
144  void *pinterfaces;
145  } confdesc;
146 
147  unsigned char pad1[8];
148  struct Interfaces
149  {
150  void *pinterdesc[2];
151  unsigned int intcount;
152  } interfaces;
153 
154  struct InterDesc
155  {
156  unsigned char desc[12];
157  void *pendp;
158  unsigned char pad[32];
159  } interdesc;
160 
161  struct Endp
162  {
163  unsigned char desc[16];
164  } endp[4];
165 } __attribute__((packed));
169 {
170  unsigned char bmRequestType;
171  unsigned char bRequest;
172  unsigned short wValue;
173  unsigned short wIndex;
174  unsigned short wLength;
175 } __attribute__((packed));
178 struct UsbDriver
179 {
181  const char *name;
185  struct UsbEndpoint *endp;
187  struct UsbInterface *intp;
189  void *devp_hi;
191  void *confp_hi;
193  void *devp;
195  void *confp;
199  int (*recvctl)(int arg1, int arg2, struct DeviceRequest *req);
201  int (*func28)(int arg1, int arg2, int arg3);
203  int (*attach)(int speed, void *arg2, void *arg3);
205  int (*detach)(int arg1, int arg2, int arg3);
207  int unk34;
209  int (*start_func)(int size, void *args);
211  int (*stop_func)(int size, void *args);
213  struct UsbDriver *link;
214 };
215 
218 {
220  struct UsbEndpoint *endp;
222  void *data;
224  int size;
226  int unkc;
228  void *func;
230  int recvsize;
232  int retcode;
234  int unk1c;
236  void *arg;
238  void *link;
239 };
240 
248 int sceUsbbdRegister(struct UsbDriver *drv);
249 
257 int sceUsbbdUnregister(struct UsbDriver *drv);
258 
266 int sceUsbbdClearFIFO(struct UsbEndpoint *endp);
267 
276 
284 int sceUsbbdStall(struct UsbEndpoint *endp);
285 
293 int sceUsbbdReqSend(struct UsbdDeviceReq *req);
294 
302 int sceUsbbdReqRecv(struct UsbdDeviceReq *req);
303 
304 #ifdef __cplusplus
305 }
306 #endif
307 
308 #endif