vitasdk
Documentation of the vitasdk
udcd.h File Reference
#include <vitasdk/build_utils.h>
#include <psp2kern/types.h>
#include <psp2common/udcd.h>

Go to the source code of this file.

Data Structures

struct  SceUdcdStringDescriptor
 USB string descriptor. More...
 
struct  SceUdcdConfigDescriptor
 USB configuration descriptor. More...
 
struct  SceUdcdInterfaceSettings
 USB driver interfaces structure. More...
 
struct  SceUdcdInterfaceDescriptor
 USB Interface descriptor. More...
 
struct  SceUdcdEndpointDescriptor
 USB endpoint descriptor. More...
 
struct  SceUdcdInterface
 USB driver interface. More...
 
struct  SceUdcdEndpoint
 USB driver endpoint. More...
 
struct  SceUdcdConfiguration
 USB driver configuration. More...
 
struct  SceUdcdEP0DeviceRequest
 USB EP0 Device Request. More...
 
struct  SceUdcdDriver
 USB driver structure. More...
 
struct  SceUdcdDeviceRequest
 USB device request. More...
 

Macros

#define USB_DT_DEVICE_SIZE   18
 Descriptor sizes per descriptor type. More...
 
#define USB_DT_CONFIG_SIZE   9
 
#define USB_DT_INTERFACE_SIZE   9
 
#define USB_DT_ENDPOINT_SIZE   7
 
#define USB_DT_ENDPOINT_AUDIO_SIZE   9
 Audio extension. More...
 
#define USB_DT_HUB_NONVAR_SIZE   7
 
#define USB_CTRLTYPE_DIR_MASK   0x80
 Control message request type bitmask. More...
 
#define USB_CTRLTYPE_DIR_HOST2DEVICE   (0 << 7)
 
#define USB_CTRLTYPE_DIR_DEVICE2HOST   (1 << 7)
 
#define USB_CTRLTYPE_TYPE_MASK   0x60
 
#define USB_CTRLTYPE_TYPE_STANDARD   (0 << 5)
 
#define USB_CTRLTYPE_TYPE_CLASS   (1 << 5)
 
#define USB_CTRLTYPE_TYPE_VENDOR   (2 << 5)
 
#define USB_CTRLTYPE_TYPE_RESERVED   (3 << 5)
 
#define USB_CTRLTYPE_REC_MASK   0x1f
 
#define USB_CTRLTYPE_REC_DEVICE   0
 
#define USB_CTRLTYPE_REC_INTERFACE   1
 
#define USB_CTRLTYPE_REC_ENDPOINT   2
 
#define USB_CTRLTYPE_REC_OTHER   3
 
#define USB_ENDPOINT_ADDRESS_MASK   0x0f /* in bEndpointAddress */
 Endpoint types and masks. More...
 
#define USB_ENDPOINT_DIR_MASK   0x80
 
#define USB_FEATURE_ENDPOINT_HALT   0
 
#define USB_ENDPOINT_IN   0x80
 
#define USB_ENDPOINT_OUT   0x00
 
#define USB_ENDPOINT_TYPE_MASK   0x03 /* in bmAttributes */
 
#define USB_ENDPOINT_TYPE_CONTROL   0
 
#define USB_ENDPOINT_TYPE_ISOCHRONOUS   1
 
#define USB_ENDPOINT_TYPE_BULK   2
 
#define USB_ENDPOINT_TYPE_INTERRUPT   3
 
#define HID_INTF   0x03
 HID Interface Class Code. More...
 
#define BOOT_INTF_SUBCLASS   0x01
 HID Interface Class SubClass Codes. More...
 
#define SCE_UDCD_MAX_INTERFACES   8
 USB limits. More...
 
#define SCE_UDCD_MAX_ENDPOINTS   9
 
#define SCE_UDCD_MAX_ALTERNATE   2
 

Enumerations

enum  SceUdcdUsbClass {
  USB_CLASS_PER_INTERFACE = 0x00 , USB_CLASS_AUDIO = 0x01 , USB_CLASS_COMM = 0x02 , USB_CLASS_HID = 0x03 ,
  USB_CLASS_PTP = 0x06 , USB_CLASS_PRINTER = 0x07 , USB_CLASS_MASS_STORAGE = 0x08 , USB_CLASS_HUB = 0x09 ,
  USB_CLASS_DATA = 0x0A , USB_CLASS_VIDEO = 0x0E , USB_CLASS_VENDOR_SPEC = 0xFF
}
 Enumeration for Device and/or Interface Class codes. More...
 
enum  SceUdcdUsbDt {
  USB_DT_DEVICE = 0x01 , USB_DT_CONFIG = 0x02 , USB_DT_STRING = 0x03 , USB_DT_INTERFACE = 0x04 ,
  USB_DT_ENDPOINT = 0x05
}
 Enumeration for descriptor types. More...
 
enum  SceUdcdUsbReq {
  USB_REQ_GET_STATUS = 0x00 , USB_REQ_CLEAR_FEATURE = 0x01 , USB_REQ_SET_FEATURE = 0x03 , USB_REQ_SET_ADDRESS = 0x05 ,
  USB_REQ_GET_DESCRIPTOR = 0x06 , USB_REQ_SET_DESCRIPTOR = 0x07 , USB_REQ_GET_CONFIG = 0x08 , USB_REQ_SET_CONFIG = 0x09 ,
  USB_REQ_GET_INTERFACE = 0x0A , USB_REQ_SET_INTERFACE = 0x0B , USB_REQ_SYNC_FRAME = 0x0C
}
 Enumeration for standard requests. More...
 
enum  SceUdcdHidRequest {
  HID_REQUEST_GET_REPORT = 0x01 , HID_REQUEST_GET_IDLE = 0x02 , HID_REQUEST_GET_PROTOCOL = 0x03 , HID_REQUEST_SET_REPORT = 0x09 ,
  HID_REQUEST_SET_IDLE = 0x0A , HID_REQUEST_SET_PROTOCOL = 0x0B
}
 Class-Specific Requests. More...
 
enum  SceUdcdHidDescriptor { HID_DESCRIPTOR_HID = 0x21 , HID_DESCRIPTOR_REPORT = 0x22 , HID_DESRIPTOR_PHY = 0x23 }
 Class Descriptor Types. More...
 
enum  SceUdcdProtocol { BOOT_PROTOCOL = 0x00 , RPT_PROTOCOL = 0x01 }
 Protocol Selection. More...
 
enum  SceUdcdHidProtocol { HID_PROTOCOL_NONE = 0x00 , HID_PROTOCOL_KEYBOARD = 0x01 , HID_PROTOCOL_MOUSE = 0x02 }
 HID Interface Class Protocol Codes. More...
 
enum  SceUdcdRetcode {
  SCE_UDCD_RETCODE_CANCEL = -1 , SCE_UDCD_RETCODE_CANCEL_ALL = -2 , SCE_UDCD_RETCODE_CANCEL_TRANSMISSION = -3 , SCE_UDCD_RETCODE_SUCCESS = 0 ,
  SCE_UDCD_RETCODE_SEND = 1 , SCE_UDCD_RETCODE_RECV = 2
}
 
enum  SceUdcdErrorCode {
  SCE_UDCD_ERROR_ILLEGAL_CONTEXT = 0x80000030 , SCE_UDCD_ERROR_INVALID_POINTER = 0x80000103 , SCE_UDCD_ERROR_INVALID_FLAG = 0x80000105 , SCE_UDCD_ERROR_INVALID_VALUE = 0x800001FE ,
  SCE_UDCD_ERROR_ALREADY_DONE = 0x80243001 , SCE_UDCD_ERROR_INVALID_ARGUMENT = 0x80243002 , SCE_UDCD_ERROR_ARGUMENT_EXCEEDED_LIMIT = 0x80243003 , SCE_UDCD_ERROR_MEMORY_EXHAUSTED = 0x80243004 ,
  SCE_UDCD_ERROR_DRIVER_NOT_FOUND = 0x80243005 , SCE_UDCD_ERROR_DRIVER_IN_PROGRESS = 0x80243006 , SCE_UDCD_ERROR_BUS_DRIVER_NOT_STARTED = 0x80243007 , SCE_UDCD_ERROR_WAIT_TIMEOUT = 0x80243008 ,
  SCE_UDCD_ERROR_WAIT_CANCEL = 0x80243009 , SCE_UDCD_ERROR_USBDRIVER_INVALID_DRIVER = 0x80243200 , SCE_UDCD_ERROR_USBDRIVER_INVALID_NAME = 0x80243201 , SCE_UDCD_ERROR_USBDRIVER_INVALID_FUNCS = 0x80243202
}
 Error codes. More...
 
enum  SceUdcdDeviceRequestAttr { SCE_UDCD_DEVICE_REQUEST_ATTR_PHYCONT = 0x00000001 }
 SceUdcdDeviceRequest Flags. More...
 

Functions

 VITASDK_BUILD_ASSERT_EQ (0x40, SceUdcdStringDescriptor)
 
struct SCE_ALIGN (4) SceUdcdDeviceDescriptor
 USB device descriptor. More...
 
 VITASDK_BUILD_ASSERT_EQ (0x14, SceUdcdDeviceDescriptor)
 
 VITASDK_BUILD_ASSERT_EQ (0xC, SceUdcdDeviceQualifierDescriptor)
 
 VITASDK_BUILD_ASSERT_EQ (0x18, SceUdcdConfigDescriptor)
 
 VITASDK_BUILD_ASSERT_EQ (0xC, SceUdcdInterfaceSettings)
 
 VITASDK_BUILD_ASSERT_EQ (0x18, SceUdcdInterfaceDescriptor)
 
 VITASDK_BUILD_ASSERT_EQ (0x10, SceUdcdEndpointDescriptor)
 
 VITASDK_BUILD_ASSERT_EQ (0xC, SceUdcdInterface)
 
 VITASDK_BUILD_ASSERT_EQ (0x10, SceUdcdEndpoint)
 
 VITASDK_BUILD_ASSERT_EQ (0x10, SceUdcdConfiguration)
 
 VITASDK_BUILD_ASSERT_EQ (8, SceUdcdEP0DeviceRequest)
 
 VITASDK_BUILD_ASSERT_EQ (0x54, SceUdcdDriver)
 
 VITASDK_BUILD_ASSERT_EQ (0x2C, SceUdcdDeviceRequest)
 
struct SCE_ALIGN (16) SceUdcdDriverName
 USB driver name. More...
 
 VITASDK_BUILD_ASSERT_EQ (((0x28+(0x10 - 1)) &~(0x10 - 1)), SceUdcdDriverName)
 
int ksceUdcdWaitBusInitialized (unsigned int timeout, int bus)
 Waits until an UDCD bus is initialized. More...
 
int ksceUdcdStart (const char *driverName, int size, void *args)
 Start a USB driver. More...
 
int ksceUdcdStartInternal (const char *driverName, int size, void *args, int bus)
 Start a USB driver for an UDCD bus. More...
 
int ksceUdcdStartCurrentInternal (int unused, int bus)
 Starts the current USB driver for an UDCD bus. More...
 
int ksceUdcdStop (const char *driverName, int size, void *args)
 Stop a USB driver. More...
 
int ksceUdcdStopInternal (const char *driverName, int size, void *args, int bus)
 Stop a USB driver for an UDCD bus. More...
 
int ksceUdcdStopCurrentInternal (int bus)
 Stops the current USB driver for an UDCD bus. More...
 
int ksceUdcdActivate (unsigned int productId)
 Activate a USB driver. More...
 
int ksceUdcdActivateInternal (unsigned int productId, unsigned int bus_powered, int bus)
 Activate a USB driver for an UDCD bus. More...
 
int ksceUdcdDeactivate (void)
 Deactivate USB driver. More...
 
int ksceUdcdDeactivateInternal (int bus)
 Deactivate USB driver for an UDCD bus. More...
 
int ksceUdcdGetDeviceState (void)
 Get USB state. More...
 
int ksceUdcdGetDeviceStateInternal (int bus)
 Get USB state for an UDCD bus. More...
 
int ksceUdcdGetDeviceInfo (SceUdcdDeviceInfo *devInfo)
 Get device information. More...
 
int ksceUdcdGetDeviceInfoInternal (SceUdcdDeviceInfo *devInfo, int bus)
 Get device information for an UDCD bus. More...
 
int ksceUdcdGetDrvState (const char *driverName)
 Get state of a specific USB driver. More...
 
int ksceUdcdGetDrvStateInternal (const char *driverName, int bus)
 Get state of a specific USB driver for an UDCD bus. More...
 
int ksceUdcdWaitState (SceUdcdWaitParam *waitParam, unsigned int timeout)
 Wait for state. More...
 
int ksceUdcdWaitStateInternal (SceUdcdWaitParam *waitParam, unsigned int timeout, int bus)
 Wait for state for an UDCD bus. More...
 
int ksceUdcdRegister (SceUdcdDriver *drv)
 Register a USB driver. More...
 
int ksceUdcdRegisterInternal (SceUdcdDriver *drv, int bus)
 Register a USB driver to a specific USB bus. More...
 
int ksceUdcdUnregister (SceUdcdDriver *drv)
 Unregister a USB driver. More...
 
int ksceUdcdUnregisterInternal (SceUdcdDriver *drv, int bus)
 Unregister a USB driver for an UDCD bus. More...
 
int ksceUdcdClearFIFO (SceUdcdEndpoint *endp)
 Clear the FIFO on an endpoint. More...
 
int ksceUdcdClearFIFOInternal (SceUdcdEndpoint *endp, int bus)
 Clear the FIFO on an endpoint for an UDCD bus. More...
 
int ksceUdcdReqCancelAll (SceUdcdEndpoint *endp)
 Cancel any pending requests on an endpoint. More...
 
int ksceUdcdStall (SceUdcdEndpoint *endp)
 Stall an endpoint. More...
 
int ksceUdcdStallInternal (SceUdcdEndpoint *endp, int bus)
 Stall an endpoint for an UDCD bus. More...
 
int ksceUdcdReqSend (SceUdcdDeviceRequest *req)
 Queue a send request (IN from host pov) More...
 
int ksceUdcdReqSendInternal (SceUdcdDeviceRequest *req, int bus)
 Queue a send request (IN from host pov) for an UDCD bus. More...
 
int ksceUdcdReqRecv (SceUdcdDeviceRequest *req)
 Queue a receive request (OUT from host pov) More...
 
int ksceUdcdReqRecvInternal (SceUdcdDeviceRequest *req, int bus)
 Queue a receive request (OUT from host pov) for an UDCD bus. More...
 

Variables

 SceUdcdDeviceDescriptor
 
 SceUdcdDeviceQualifierDescriptor
 
 SceUdcdDriverName