Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define VITA_PID 0x04E4
- #define USB_DRIVERNAME "VITA_MTP"
- /* Endpoint blocks */
- static
- struct SceUdcdEndpoint endpoints[4] = {
- {
- 0, /* Control endpoint */
- 0,
- 0,
- 0
- },
- {
- 0x80, /* In */
- 1,
- 0,
- 0
- },
- {
- 0, /* Out */
- 2,
- 0,
- 0
- },
- {
- 0x80, /* In */
- 3,
- 0,
- 0
- }
- };
- /* Interfaces */
- static
- struct SceUdcdInterface interfaces[1] = {
- { -1, 0, 1 }
- };
- /* String descriptor */
- static
- struct SceUdcdStringDescriptor string_descriptors[2] = {
- {
- 18,
- USB_DT_STRING,
- { 'V', 'i', 't', 'a', ' ', 'M', 'T', 'P' }
- },
- {
- 0,
- USB_DT_STRING
- }
- };
- /* HI-Speed device descriptor */
- static
- struct SceUdcdDeviceDescriptor devdesc_hi =
- {
- USB_DT_DEVICE_SIZE,
- USB_DT_DEVICE,
- 0x200, /* bcdUSB */
- USB_CLASS_PER_INTERFACE, /* bDeviceClass */
- 0, /* bDeviceSubClass */
- 0, /* bDeviceProtocol */
- 64, /* bMaxPacketSize0 */
- 0, /* idProduct */
- 0, /* idVendor */
- 0x100, /* bcdDevice */
- 0, /* iManufacturer */
- 0, /* iProduct */
- 0, /* iSerialNumber */
- 1 /* bNumConfigurations */
- };
- /* Hi-Speed endpoint descriptors */
- static
- struct SceUdcdEndpointDescriptor endpdesc_hi[4] =
- {
- {
- USB_DT_ENDPOINT_SIZE ,
- USB_DT_ENDPOINT,
- 0x81, /* bEndpointAddress */
- USB_ENDPOINT_TYPE_BULK, /* bmAttributes */
- 0x0200, /* wMaxPacketSize */
- 0 /* bInterval */
- },
- {
- USB_DT_ENDPOINT_SIZE ,
- USB_DT_ENDPOINT,
- 0x01, /* bEndpointAddress */
- USB_ENDPOINT_TYPE_BULK, /* bmAttributes */
- 0x0200, /* wMaxPacketSize */
- 0 /* bInterval */
- },
- {
- USB_DT_ENDPOINT_SIZE ,
- USB_DT_ENDPOINT,
- 0x82, /* bEndpointAddress */
- USB_ENDPOINT_TYPE_INTERRUPT, /* bmAttributes */
- 0x001c, /* wMaxPacketSize */
- 0x06 /* bInterval */
- },
- {
- 0
- }
- };
- /* Hi-Speed interface descriptor */
- static
- struct SceUdcdInterfaceDescriptor interdesc_hi[2] =
- {
- {
- USB_DT_INTERFACE_SIZE,
- USB_DT_INTERFACE,
- 0, /* bInterfaceNumber */
- 0, /* bAlternateSetting */
- 3, /* bNumEndpoints */
- USB_CLASS_VENDOR_SPEC , /* bInterfaceClass */
- 0xFF, /* bInterfaceSubClass */
- 0x00, /* bInterfaceProtocol */
- 1, /* iInterface */
- &endpdesc_hi[0], /* endpoints */
- NULL,
- 0
- },
- {
- 0
- }
- };
- /* Hi-Speed settings */
- static
- struct SceUdcdInterfaceSettings settings_hi[1] =
- {
- {
- &interdesc_hi[0],
- 0,
- 1
- }
- };
- /* Hi-Speed configuration descriptor */
- static
- struct SceUdcdConfigDescriptor confdesc_hi =
- {
- USB_DT_CONFIG_SIZE,
- USB_DT_CONFIG,
- (USB_DT_INTERFACE_SIZE + USB_DT_CONFIG_SIZE + 3 * USB_DT_ENDPOINT_SIZE), /* wTotalLength */
- 1, /* bNumInterfaces */
- 1, /* bConfigurationValue */
- 0, /* iConfiguration */
- 0xC0, /* bmAttributes */
- 0, /* bMaxPower */
- &settings_hi[0]
- };
- /* Hi-Speed configuration */
- static
- struct SceUdcdConfiguration config_hi =
- {
- &confdesc_hi,
- &settings_hi[0],
- &interdesc_hi[0],
- &endpdesc_hi[0]
- };
- /* Full-Speed device descriptor */
- static
- struct SceUdcdDeviceDescriptor devdesc_full =
- {
- USB_DT_DEVICE_SIZE,
- USB_DT_DEVICE,
- 0x200, /* bcdUSB (should be 0x110 but Vita freezes otherwise) */
- USB_CLASS_PER_INTERFACE, /* bDeviceClass */
- 0, /* bDeviceSubClass */
- 0, /* bDeviceProtocol */
- 8, /* bMaxPacketSize0 */
- 0, /* idProduct */
- 0, /* idVendor */
- 0x200, /* bcdDevice */
- 0, /* iManufacturer */
- 0, /* iProduct */
- 0, /* iSerialNumber */
- 1 /* bNumConfigurations */
- };
- /* Full-Speed endpoint descriptors */
- static
- struct SceUdcdEndpointDescriptor endpdesc_full[4] =
- {
- {
- USB_DT_ENDPOINT_SIZE ,
- USB_DT_ENDPOINT,
- 0x81, /* bEndpointAddress */
- USB_ENDPOINT_TYPE_BULK, /* bmAttributes */
- 0x40, /* wMaxPacketSize */
- 0 /* bInterval */
- },
- {
- USB_DT_ENDPOINT_SIZE ,
- USB_DT_ENDPOINT,
- 0x01, /* bEndpointAddress */
- USB_ENDPOINT_TYPE_BULK, /* bmAttributes */
- 0x40, /* wMaxPacketSize */
- 0 /* bInterval */
- },
- {
- USB_DT_ENDPOINT_SIZE ,
- USB_DT_ENDPOINT,
- 0x82, /* bEndpointAddress */
- USB_ENDPOINT_TYPE_INTERRUPT, /* bmAttributes */
- 0x001c, /* wMaxPacketSize */
- 0x06 /* bInterval */
- },
- {
- 0
- }
- };
- /* Full-Speed interface descriptor */
- static
- struct SceUdcdInterfaceDescriptor interdesc_full[2] =
- {
- {
- USB_DT_INTERFACE_SIZE,
- USB_DT_INTERFACE,
- 0, /* bInterfaceNumber */
- 0, /* bAlternateSetting */
- 3, /* bNumEndpoints */
- USB_CLASS_VENDOR_SPEC , /* bInterfaceClass */
- 0xFF, /* bInterfaceSubClass */
- 0x00, /* bInterfaceProtocol */
- 1, /* iInterface */
- &endpdesc_full[0], /* endpoints */
- NULL,
- 0
- },
- {
- 0
- }
- };
- /* Full-Speed settings */
- static
- struct SceUdcdInterfaceSettings settings_full[1] =
- {
- {
- &interdesc_full[0],
- 0,
- 1
- }
- };
- /* Full-Speed configuration descriptor */
- static
- struct SceUdcdConfigDescriptor confdesc_full =
- {
- USB_DT_CONFIG_SIZE,
- USB_DT_CONFIG,
- (USB_DT_INTERFACE_SIZE + USB_DT_CONFIG_SIZE + 3 * USB_DT_ENDPOINT_SIZE), /* wTotalLength */
- 1, /* bNumInterfaces */
- 1, /* bConfigurationValue */
- 0, /* iConfiguration */
- 0xC0, /* bmAttributes */
- 0, /* bMaxPower */
- &settings_full[0]
- };
- /* Full-Speed configuration */
- static
- struct SceUdcdConfiguration config_full =
- {
- &confdesc_full,
- &settings_full[0],
- &interdesc_full[0],
- &endpdesc_full[0]
- };
- static struct SceUdcdDriver usb_driver = {
- .driverName = USB_DRIVERNAME,
- .numEndpoints = 4,
- .endpoints = endpoints,
- .interface = interfaces,
- .descriptor_hi = &devdesc_hi,
- .configuration_hi = &config_hi,
- .descriptor = &devdesc_full,
- .configuration = &config_full,
- .stringDescriptorsUnk0 = string_descriptors,
- .stringDescriptorsUnk1 = string_descriptors,
- .stringDescriptorsUnk2 = string_descriptors,
- .processRequest = usb_driver_process_request,
- .changeSetting = usb_driver_change_setting,
- .attach = usb_driver_attach,
- .detach = usb_driver_detach,
- .configure = usb_driver_configure,
- .start = usb_driver_start,
- .stop = usb_driver_stop,
- .unk1 = 0,
- .unk2 = 0,
- .link = NULL
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement