00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef __PSPUSBBUS_H__
00013 #define __PSPUSBBUS_H__
00014
00015 #ifdef __cplusplus
00016 extern "C" {
00017 #endif
00018
00020 struct UsbInterface
00021 {
00023 int expect_interface;
00025 int unk8;
00027 int num_interface;
00028 };
00029
00031 struct UsbEndpoint
00032 {
00034 int endpnum;
00036 int unk2;
00038 int unk3;
00039 };
00040
00042 struct StringDescriptor
00043 {
00044 unsigned char bLength;
00045 unsigned char bDescriptorType;
00046 short bString[32];
00047 } __attribute__((packed));
00048
00050 struct DeviceDescriptor
00051 {
00052 unsigned char bLength;
00053 unsigned char bDescriptorType;
00054 unsigned short bcdUSB;
00055 unsigned char bDeviceClass;
00056 unsigned char bDeviceSubClass;
00057 unsigned char bDeviceProtocol;
00058 unsigned char bMaxPacketSize;
00059 unsigned short idVendor;
00060 unsigned short idProduct;
00061 unsigned short bcdDevice;
00062 unsigned char iManufacturer;
00063 unsigned char iProduct;
00064 unsigned char iSerialNumber;
00065 unsigned char bNumConfigurations;
00066 } __attribute__((packed));
00067
00069 struct ConfigDescriptor
00070 {
00071 unsigned char bLength;
00072 unsigned char bDescriptorType;
00073 unsigned short wTotalLength;
00074 unsigned char bNumInterfaces;
00075 unsigned char bConfigurationValue;
00076 unsigned char iConfiguration;
00077 unsigned char bmAttributes;
00078 unsigned char bMaxPower;
00079 } __attribute__((packed));
00080
00082 struct InterfaceDescriptor
00083 {
00084 unsigned char bLength;
00085 unsigned char bDescriptorType;
00086 unsigned char bInterfaceNumber;
00087 unsigned char bAlternateSetting;
00088 unsigned char bNumEndpoints;
00089 unsigned char bInterfaceClass;
00090 unsigned char bInterfaceSubClass;
00091 unsigned char bInterfaceProtocol;
00092 unsigned char iInterface;
00093 } __attribute__((packed));
00094
00096 struct EndpointDescriptor
00097 {
00098 unsigned char bLength;
00099 unsigned char bDescriptorType;
00100 unsigned char bEndpointAddress;
00101 unsigned char bmAttributes;
00102 unsigned short wMaxPacketSize;
00103 unsigned char bInterval;
00104 } __attribute__((packed));
00105
00107 struct UsbInterfaces
00108 {
00110 struct InterfaceDescriptor *infp[2];
00112 unsigned int num;
00113 };
00114
00116 struct UsbConfiguration
00117 {
00119 struct ConfigDescriptor *confp;
00121 struct UsbInterfaces *infs;
00123 struct InterfaceDescriptor *infp;
00125 struct EndpointDescriptor *endp;
00126 };
00127
00129 struct UsbData
00130 {
00131 unsigned char devdesc[20];
00132
00133 struct Config
00134 {
00135 void *pconfdesc;
00136 void *pinterfaces;
00137 void *pinterdesc;
00138 void *pendp;
00139 } config;
00140
00141 struct ConfDesc
00142 {
00143 unsigned char desc[12];
00144 void *pinterfaces;
00145 } confdesc;
00146
00147 unsigned char pad1[8];
00148 struct Interfaces
00149 {
00150 void *pinterdesc[2];
00151 unsigned int intcount;
00152 } interfaces;
00153
00154 struct InterDesc
00155 {
00156 unsigned char desc[12];
00157 void *pendp;
00158 unsigned char pad[32];
00159 } interdesc;
00160
00161 struct Endp
00162 {
00163 unsigned char desc[16];
00164 } endp[4];
00165 } __attribute__((packed));
00166
00168 struct DeviceRequest
00169 {
00170 unsigned char bmRequestType;
00171 unsigned char bRequest;
00172 unsigned short wValue;
00173 unsigned short wIndex;
00174 unsigned short wLength;
00175 } __attribute__((packed));
00176
00178 struct UsbDriver
00179 {
00181 const char *name;
00183 int endpoints;
00185 struct UsbEndpoint *endp;
00187 struct UsbInterface *intp;
00189 void *devp_hi;
00191 void *confp_hi;
00193 void *devp;
00195 void *confp;
00197 struct StringDescriptor *str;
00199 int (*recvctl)(int arg1, int arg2, struct DeviceRequest *req);
00201 int (*func28)(int arg1, int arg2, int arg3);
00203 int (*attach)(int speed, void *arg2, void *arg3);
00205 int (*detach)(int arg1, int arg2, int arg3);
00207 int unk34;
00209 int (*start_func)(int size, void *args);
00211 int (*stop_func)(int size, void *args);
00213 struct UsbDriver *link;
00214 };
00215
00217 struct UsbdDeviceReq
00218 {
00220 struct UsbEndpoint *endp;
00222 void *data;
00224 int size;
00226 int unkc;
00228 void *func;
00230 int recvsize;
00232 int retcode;
00234 int unk1c;
00236 void *arg;
00238 void *link;
00239 };
00240
00248 int sceUsbbdRegister(struct UsbDriver *drv);
00249
00257 int sceUsbbdUnregister(struct UsbDriver *drv);
00258
00266 int sceUsbbdClearFIFO(struct UsbEndpoint *endp);
00267
00275 int sceUsbbdReqCancelAll(struct UsbEndpoint *endp);
00276
00284 int sceUsbbdStall(struct UsbEndpoint *endp);
00285
00293 int sceUsbbdReqSend(struct UsbdDeviceReq *req);
00294
00302 int sceUsbbdReqRecv(struct UsbdDeviceReq *req);
00303
00304 #ifdef __cplusplus
00305 }
00306 #endif
00307
00308 #endif