summaryrefslogtreecommitdiff
path: root/include/kernel/udcd.h
diff options
context:
space:
mode:
authorSunguk Lee2017-10-09 03:44:44 +0900
committerGitHub2017-10-09 03:44:44 +0900
commit4d2d1798f6a34cd39005f7c618f2c98ff8d85d5a (patch)
treee94dce054ed67645818961568940c625b50a4f08 /include/kernel/udcd.h
parentMerge pull request #230 from d3m3vilurr/rename-sceCompatGetDevInf-2 (diff)
parentHexa -> uppercase (diff)
downloadvds-libraries-4d2d1798f6a34cd39005f7c618f2c98ff8d85d5a.tar.gz
Merge pull request #227 from Rinnegatamante/kern_anon
Named anonymous enums in psp2kern
Diffstat (limited to 'include/kernel/udcd.h')
-rw-r--r--include/kernel/udcd.h469
1 files changed, 204 insertions, 265 deletions
diff --git a/include/kernel/udcd.h b/include/kernel/udcd.h
index 899a6e6..46eb51f 100644
--- a/include/kernel/udcd.h
+++ b/include/kernel/udcd.h
@@ -7,56 +7,58 @@
extern "C" {
#endif
-/*
- * Device and/or Interface Class codes
- */
-#define USB_CLASS_PER_INTERFACE 0 /* for DeviceClass */
-#define USB_CLASS_AUDIO 1
-#define USB_CLASS_COMM 2
-#define USB_CLASS_HID 3
-#define USB_CLASS_PRINTER 7
-#define USB_CLASS_PTP 6
-#define USB_CLASS_MASS_STORAGE 8
-#define USB_CLASS_HUB 9
-#define USB_CLASS_DATA 10
-#define USB_CLASS_VENDOR_SPEC 0xff
-
-/*
- * Descriptor types
- */
-#define USB_DT_DEVICE 0x01
-#define USB_DT_CONFIG 0x02
-#define USB_DT_STRING 0x03
-#define USB_DT_INTERFACE 0x04
-#define USB_DT_ENDPOINT 0x05
-
-/*
- * Standard requests
- */
-#define USB_REQ_GET_STATUS 0x00
-#define USB_REQ_CLEAR_FEATURE 0x01
-#define USB_REQ_SET_FEATURE 0x03
-#define USB_REQ_SET_ADDRESS 0x05
-#define USB_REQ_GET_DESCRIPTOR 0x06
-#define USB_REQ_SET_DESCRIPTOR 0x07
-#define USB_REQ_GET_CONFIG 0x08
-#define USB_REQ_SET_CONFIG 0x09
-#define USB_REQ_GET_INTERFACE 0x0a
-#define USB_REQ_SET_INTERFACE 0x0b
-#define USB_REQ_SYNC_FRAME 0x0c
-
-/*
+/** Enumeration for Device and/or Interface Class codes
+ */
+typedef enum SceUdcdUsbClass {
+ USB_CLASS_PER_INTERFACE 0x00, //!< for DeviceClass
+ 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_VENDOR_SPEC 0xFF
+} SceUdcdUsbClass;
+
+/** Enumeration for descriptor types
+ */
+typedef enum SceUdcdUsbDt {
+ USB_DT_DEVICE = 0x01,
+ USB_DT_CONFIG = 0x02,
+ USB_DT_STRING = 0x03,
+ USB_DT_INTERFACE = 0x04,
+ USB_DT_ENDPOINT = 0x05
+} SceUdcdUsbDt;
+
+/** Enumeration for standard requests
+ */
+typedef 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
+} SceUdcdUsbReq;
+
+/**
* Descriptor sizes per descriptor type
*/
#define USB_DT_DEVICE_SIZE 18
#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 */
+#define USB_DT_ENDPOINT_AUDIO_SIZE 9 //!< Audio extension
#define USB_DT_HUB_NONVAR_SIZE 7
-/*
- * Control message request type bitmask
+/** Control message request type bitmask
*/
#define USB_CTRLTYPE_DIR_MASK 0x80
#define USB_CTRLTYPE_DIR_HOST2DEVICE (0 << 7)
@@ -72,8 +74,7 @@ extern "C" {
#define USB_CTRLTYPE_REC_ENDPOINT 2
#define USB_CTRLTYPE_REC_OTHER 3
-/*
- * Endpoint types and masks
+/** Endpoint types and masks
*/
#define USB_ENDPOINT_ADDRESS_MASK 0x0f /* in bEndpointAddress */
#define USB_ENDPOINT_DIR_MASK 0x80
@@ -91,114 +92,116 @@ extern "C" {
/* HID constants. Not part of chapter 9 */
-/*
- * Class-Specific Requests
+/** Class-Specific Requests
*/
-#define HID_REQUEST_GET_REPORT 0x01
-#define HID_REQUEST_GET_IDLE 0x02
-#define HID_REQUEST_GET_PROTOCOL 0x03
-#define HID_REQUEST_SET_REPORT 0x09
-#define HID_REQUEST_SET_IDLE 0x0A
-#define HID_REQUEST_SET_PROTOCOL 0x0B
+typedef 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
+} SceUdcdHidRequest;
-/*
- * Class Descriptor Types
+/** Class Descriptor Types
*/
-#define HID_DESCRIPTOR_HID 0x21
-#define HID_DESCRIPTOR_REPORT 0x22
-#define HID_DESRIPTOR_PHY 0x23
+typedef enum SceUdcdHidDescriptor {
+ HID_DESCRIPTOR_HID = 0x21,
+ HID_DESCRIPTOR_REPORT = 0x22,
+ HID_DESRIPTOR_PHY = 0x23
+} SceUdcdHidDescriptor;
-/*
- * Protocol Selection
+/** Protocol Selection
*/
-#define BOOT_PROTOCOL 0x00
-#define RPT_PROTOCOL 0x01
+typedef enum SceUdcdProtocol {
+ BOOT_PROTOCOL = 0x00,
+ RPT_PROTOCOL = 0x01
+} SceUdcdProtocol;
-/*
- * HID Interface Class Code
+/** HID Interface Class Code
*/
#define HID_INTF 0x03
-/*
- * HID Interface Class SubClass Codes
+/** HID Interface Class SubClass Codes
*/
#define BOOT_INTF_SUBCLASS 0x01
-/*
- * HID Interface Class Protocol Codes
+/** HID Interface Class Protocol Codes
*/
-#define HID_PROTOCOL_NONE 0x00
-#define HID_PROTOCOL_KEYBOARD 0x01
-#define HID_PROTOCOL_MOUSE 0x02
-
+typedef enum SceUdcdHidProtocol {
+ HID_PROTOCOL_NONE = 0x00,
+ HID_PROTOCOL_KEYBOARD = 0x01,
+ HID_PROTOCOL_MOUSE = 0x02
+} SceUdcdHidProtocol;
-/*
- * USB Status
+/** USB Status
*/
-#define SCE_UDCD_STATUS_CONNECTION_NEW 0x0001
-#define SCE_UDCD_STATUS_CONNECTION_ESTABLISHED 0x0002
-#define SCE_UDCD_STATUS_CONNECTION_SUSPENDED 0x0004
-#define SCE_UDCD_STATUS_CABLE_DISCONNECTED 0x0010
-#define SCE_UDCD_STATUS_CABLE_CONNECTED 0x0020
-#define SCE_UDCD_STATUS_DEACTIVATED 0x0100
-#define SCE_UDCD_STATUS_ACTIVATED 0x0200
-#define SCE_UDCD_STATUS_IS_CHARGING 0x0400
-#define SCE_UDCD_STATUS_USE_USB_CHARGING 0x0800
-#define SCE_UDCD_STATUS_UNKNOWN_1000 0x1000
-#define SCE_UDCD_STATUS_UNKNOWN_2000 0x2000
+typedef enum SceUdcdStatus {
+ SCE_UDCD_STATUS_CONNECTION_NEW = 0x0001,
+ SCE_UDCD_STATUS_CONNECTION_ESTABLISHED = 0x0002,
+ SCE_UDCD_STATUS_CONNECTION_SUSPENDED = 0x0004,
+ SCE_UDCD_STATUS_CABLE_DISCONNECTED = 0x0010,
+ SCE_UDCD_STATUS_CABLE_CONNECTED = 0x0020,
+ SCE_UDCD_STATUS_DEACTIVATED = 0x0100,
+ SCE_UDCD_STATUS_ACTIVATED = 0x0200,
+ SCE_UDCD_STATUS_IS_CHARGING = 0x0400,
+ SCE_UDCD_STATUS_USE_USB_CHARGING = 0x0800,
+ SCE_UDCD_STATUS_UNKNOWN_1000 = 0x1000,
+ SCE_UDCD_STATUS_UNKNOWN_2000 = 0x2000
+} SceUdcdStatus;
-/*
- * USB Driver status
+/** USB Driver status
*/
-#define SCE_UDCD_STATUS_DRIVER_STARTED 0x01
-#define SCE_UDCD_STATUS_DRIVER_REGISTERED 0x02
+typedef enum SceUdcdStatusDriver {
+ SCE_UDCD_STATUS_DRIVER_STARTED = 0x01,
+ SCE_UDCD_STATUS_DRIVER_REGISTERED = 0x02
+} SceUdcdStatusDriver;
-/*
- * USB limits
+/** USB limits
*/
#define SCE_UDCD_MAX_INTERFACES 8
#define SCE_UDCD_MAX_ENDPOINTS 9
#define SCE_UDCD_MAX_ALTERNATE 2
-#define SCE_UDCD_RETCODE_CANCEL -1
-#define SCE_UDCD_RETCODE_CANCEL_ALL -2
-#define SCE_UDCD_RETCODE_CANCELTRANSMISSION -3
-#define SCE_UDCD_RETCODE_SUCCESS 0
-#define SCE_UDCD_RETCODE_SEND 1
-#define SCE_UDCD_RETCODE_RECV 2
-
-/*
- * Error codes
- */
-#define SCE_UDCD_ERROR_ALREADY_DONE 0x80243001
-#define SCE_UDCD_ERROR_INVALID_ARGUMENT 0x80243002
-#define SCE_UDCD_ERROR_ARGUMENT_EXCEEDED_LIMIT 0x80243003
-#define SCE_UDCD_ERROR_MEMORY_EXHAUSTED 0x80243004
-#define SCE_UDCD_ERROR_DRIVER_NOT_FOUND 0x80243005
-#define SCE_UDCD_ERROR_DRIVER_IN_PROGRESS 0x80243006
-#define SCE_UDCD_ERROR_BUS_DRIVER_NOT_STARTED 0x80243007
-#define SCE_UDCD_ERROR_WAIT_TIMEOUT 0x80243008
-#define SCE_UDCD_ERROR_WAIT_CANCEL 0x80243009
-#define SCE_UDCD_ERROR_INVALID_POINTER 0x80000103
-#define SCE_UDCD_ERROR_INVALID_FLAG 0x80000105
-#define SCE_UDCD_ERROR_INVALID_VALUE 0x800001FE
-#define SCE_UDCD_ERROR_ILLEGAL_CONTEXT 0x80000030
-#define SCE_UDCD_ERROR_USBDRIVER_INVALID_DRIVER 0x80243200
-#define SCE_UDCD_ERROR_USBDRIVER_INVALID_NAME 0x80243201
-#define SCE_UDCD_ERROR_USBDRIVER_INVALID_FUNCS 0x80243202
-
-
-/*
- * USB string descriptor
+typedef 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
+} SceUdcdRetcode;
+
+/** Error codes
+ */
+typedef 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
+} SceUdcdErrorCode;
+
+/** USB string descriptor
*/
typedef struct SceUdcdStringDescriptor {
unsigned char bLength;
unsigned char bDescriptorType;
short bString[31];
-} SceUdcdStringDescriptor; /* Size 64 */
+} SceUdcdStringDescriptor;
-/*
- * USB device descriptor
+/** USB device descriptor
*/
typedef struct SceUdcdDeviceDescriptor {
unsigned char bLength;
@@ -215,10 +218,9 @@ typedef struct SceUdcdDeviceDescriptor {
unsigned char iProduct;
unsigned char iSerialNumber;
unsigned char bNumConfigurations;
-} __attribute__ ((aligned(4))) SceUdcdDeviceDescriptor; /* size 20 */
+} __attribute__ ((aligned(4))) SceUdcdDeviceDescriptor;
-/*
- * USB device qualifier descriptor
+/** USB device qualifier descriptor
*/
typedef struct SceUdcdDeviceQualifierDescriptor {
unsigned char bLength;
@@ -230,10 +232,9 @@ typedef struct SceUdcdDeviceQualifierDescriptor {
unsigned char bMaxPacketSize0;
unsigned char bNumConfigurations;
unsigned char bReserved;
-} __attribute__ ((aligned(4))) SceUdcdDeviceQualifierDescriptor; /* size 12 */
+} __attribute__ ((aligned(4))) SceUdcdDeviceQualifierDescriptor;
-/*
- * USB configuration descriptor
+/** USB configuration descriptor
*/
typedef struct SceUdcdConfigDescriptor {
unsigned char bLength;
@@ -244,28 +245,20 @@ typedef struct SceUdcdConfigDescriptor {
unsigned char iConfiguration;
unsigned char bmAttributes;
unsigned char bMaxPower;
-
struct SceUdcdInterfaceSettings *settings;
-
- unsigned char *extra; /* Extra descriptors */
+ unsigned char *extra; //!< Extra descriptors
int extraLength;
-} SceUdcdConfigDescriptor; /* size 24 */
+} SceUdcdConfigDescriptor;
-/*
- * USB driver interfaces structure
+/** USB driver interfaces structure
*/
typedef struct SceUdcdInterfaceSettings {
- /* Pointers to the individual interface descriptors */
- struct SceUdcdInterfaceDescriptor *descriptors;
-
+ struct SceUdcdInterfaceDescriptor *descriptors; //!< Pointers to the individual interface descriptors
unsigned int alternateSetting;
-
- /* Number of interface descriptors */
- unsigned int numDescriptors;
+ unsigned int numDescriptors; //!< Number of interface descriptors
} SceUdcdInterfaceSettings;
-/*
- * USB Interface descriptor
+/** USB Interface descriptor
*/
typedef struct SceUdcdInterfaceDescriptor {
unsigned char bLength;
@@ -277,15 +270,12 @@ typedef struct SceUdcdInterfaceDescriptor {
unsigned char bInterfaceSubClass;
unsigned char bInterfaceProtocol;
unsigned char iInterface;
-
struct SceUdcdEndpointDescriptor *endpoints;
-
- unsigned char *extra; /* Extra descriptors */
+ unsigned char *extra; //!< Extra descriptors
int extraLength;
-} SceUdcdInterfaceDescriptor; /* size 24 */
+} SceUdcdInterfaceDescriptor;
-/*
- * USB endpoint descriptor
+/** USB endpoint descriptor
*/
typedef struct SceUdcdEndpointDescriptor {
unsigned char bLength;
@@ -294,53 +284,37 @@ typedef struct SceUdcdEndpointDescriptor {
unsigned char bmAttributes;
unsigned short wMaxPacketSize;
unsigned char bInterval;
-
- unsigned char *extra; /* Extra descriptors */
+ unsigned char *extra; //!< Extra descriptors
int extraLength;
-} SceUdcdEndpointDescriptor; /* size 16 */
+} SceUdcdEndpointDescriptor;
-/*
- * USB driver interface
+/** USB driver interface
*/
typedef struct SceUdcdInterface {
- /* Expectant interface number (interface number or -1) */
- int expectNumber;
- /* End interface */
- int interfaceNumber;
- /* Number of interfaces */
- int numInterfaces;
+ int expectNumber; //!< Expectant interface number (interface number or -1)
+ int interfaceNumber; //!< End interface
+ int numInterfaces; //!< Number of interfaces
} SceUdcdInterface;
-/*
- * USB driver endpoint
+/** USB driver endpoint
*/
typedef struct SceUdcdEndpoint {
- /* 0x80 = in, 0x00 = out */
- int direction;
- /* Driver Endpoint number (must be filled in sequentially) */
- int driverEndpointNumber;
- /* Endpoint number (Filled in by the bus driver) */
- int endpointNumber;
- /* Number of transmitted bytes */
- int transmittedBytes;
+ int direction; //!< USB_ENDPOINT_IN / USB_ENDPOINT_OUT
+ int driverEndpointNumber; //!< Driver Endpoint number (must be filled in sequentially)
+ int endpointNumber; //!< Endpoint number (Filled in by the bus driver)
+ int transmittedBytes; //!< Number of transmitted bytes
} SceUdcdEndpoint;
-/*
- * USB driver configuration
+/** USB driver configuration
*/
typedef struct SceUdcdConfiguration {
- /* Pointer to the configuration descriptors */
- SceUdcdConfigDescriptor *configDescriptors;
- /* USB driver interface settings */
- SceUdcdInterfaceSettings *settings;
- /* Pointer to the first interface descriptor */
- SceUdcdInterfaceDescriptor *interfaceDescriptors;
- /* Pointer to the first endpoint descriptor */
- SceUdcdEndpointDescriptor *endpointDescriptors;
+ SceUdcdConfigDescriptor *configDescriptors; //!< Pointer to the configuration descriptors
+ SceUdcdInterfaceSettings *settings; //!< USB driver interface settings
+ SceUdcdInterfaceDescriptor *interfaceDescriptors; //!< Pointer to the first interface descriptor
+ SceUdcdEndpointDescriptor *endpointDescriptors; //!< Pointer to the first endpoint descriptor
} SceUdcdConfiguration;
-/*
- * USB EP0 Device Request
+/** USB EP0 Device Request
*/
typedef struct SceUdcdEP0DeviceRequest {
unsigned char bmRequestType;
@@ -350,92 +324,57 @@ typedef struct SceUdcdEP0DeviceRequest {
unsigned short wLength;
} SceUdcdEP0DeviceRequest;
-/*
- * USB driver structure
+/** USB driver structure
*/
typedef struct SceUdcdDriver {
- /* Name of the USB driver */
- const char *driverName;
- /* Number of endpoints in this driver (including default control) */
- int numEndpoints;
- /* List of endpoint structures (used when calling other functions) */
- SceUdcdEndpoint *endpoints;
- /* Interface list */
- SceUdcdInterface *interface;
- /* Pointer to hi-speed device descriptor */
- SceUdcdDeviceDescriptor *descriptor_hi;
- /* Pointer to hi-speed device configuration */
- SceUdcdConfiguration *configuration_hi;
- /* Pointer to full-speed device descriptor */
- SceUdcdDeviceDescriptor *descriptor;
- /* Pointer to full-speed device configuration */
- SceUdcdConfiguration *configuration;
- /* Unk0 */
- SceUdcdStringDescriptor *stringDescriptorsUnk0;
- /* Default String descriptor */
- SceUdcdStringDescriptor *stringDescriptorsUnk1;
- /* String descriptors (unknown) */
- SceUdcdStringDescriptor *stringDescriptorsUnk2;
- /* Received a control request */
- int (*processRequest) (int recipient, int arg /* endpoint number or interface number */, SceUdcdEP0DeviceRequest *req);
- /* Change alternate setting */
- int (*changeSetting) (int interfaceNumber, int alternateSetting);
- /* Configuration set (attach) function */
- int (*attach) (int usb_version);
- /* Configuration unset (detach) function */
- void (*detach) (void);
- /* Configure the device */
- void (*configure) (int usb_version, int desc_count, SceUdcdInterfaceSettings *settings);
- /* Function called when the driver is started */
- int (*start) (int size, void *args);
- /* Function called when the driver is stopped */
- int (*stop) (int size, void *args);
- /* Unk */
- unsigned int unk1;
- unsigned int unk2;
- /* Link to next USB driver in the chain, set to NULL */
- struct SceUdcdDriver *link;
+ const char *driverName; //!< Name of the USB driver
+ int numEndpoints; //!< Number of endpoints in this driver (including default control)
+ SceUdcdEndpoint *endpoints; //!< List of endpoint structures (used when calling other functions)
+ SceUdcdInterface *interface; //!< Interface list
+ SceUdcdDeviceDescriptor *descriptor_hi; //!< Pointer to hi-speed device descriptor
+ SceUdcdConfiguration *configuration_hi; //!< Pointer to hi-speed device configuration
+ SceUdcdDeviceDescriptor *descriptor; //!< Pointer to full-speed device descriptor
+ SceUdcdConfiguration *configuration; //!< Pointer to full-speed device configuration
+ SceUdcdStringDescriptor *stringDescriptorsUnk0; //!< Unknown string descriptors
+ SceUdcdStringDescriptor *stringDescriptorsUnk1; //!< Default String descriptor
+ SceUdcdStringDescriptor *stringDescriptorsUnk2; //!< String descriptors (unknown)
+ int (*processRequest) (int recipient, int arg /* endpoint number or interface number */, SceUdcdEP0DeviceRequest *req); //!< Received a control request
+ int (*changeSetting) (int interfaceNumber, int alternateSetting); //!< Change alternate setting
+ int (*attach) (int usb_version); //!< Configuration set (attach) function
+ void (*detach) (void); //!< Configuration unset (detach) function
+ void (*configure) (int usb_version, int desc_count, SceUdcdInterfaceSettings *settings); //!< Configure the device
+ int (*start) (int size, void *args); //!< Function called when the driver is started
+ int (*stop) (int size, void *args); //!< Function called when the driver is stopped
+ unsigned int unk1; //!< Unknown data
+ unsigned int unk2; //!< Unknown data
+ struct SceUdcdDriver *link; //!< Link to next USB driver in the chain, set to NULL
} SceUdcdDriver;
-/*
- * USB device request
+/** USB device request
*/
typedef struct SceUdcdDeviceRequest {
- /* Pointer to the endpoint to queue request on */
- SceUdcdEndpoint *endpoint;
- /* Pointer to the data buffer to use in the request */
- void *data;
- /* Unknown */
- unsigned int unk;
- /* Size of the data buffer */
- int size;
- /* Is a control request? */
- int isControlRequest;
- /* Pointer to the function to call on completion */
- void (*onComplete)(struct SceUdcdDeviceRequest *req);
- /* Number of transmitted bytes */
- int transmitted;
- /* Return code of the request, 0 == success, -3 == canceled */
- int returnCode;
- /* Link pointer to next request used by the driver, set it to NULL */
- struct SceUdcdDeviceRequest *next;
- /* An unused value (maybe an argument) */
- void *unused;
- /* Physical address */
- void *physicalAddress;
+ SceUdcdEndpoint *endpoint; //!< Pointer to the endpoint to queue request on
+ void *data; //!< Pointer to the data buffer to use in the request
+ unsigned int unk; //!< Unknown data
+ int size; //!< Size of the data buffer
+ int isControlRequest; //!< Is a control request?
+ void (*onComplete)(struct SceUdcdDeviceRequest *req); //!< Pointer to the function to call on completion
+ int transmitted; //!< Number of transmitted bytes
+ int returnCode; //!< Return code of the request (See ::SceUdcdRetcode)
+ struct SceUdcdDeviceRequest *next; //!< Link pointer to next request used by the driver, set it to NULL
+ void *unused; //!< An unused value (maybe an argument)
+ void *physicalAddress; //!< Physical address
} SceUdcdDeviceRequest;
-/*
- * USB driver name
+/** USB driver name
*/
typedef struct SceUdcdDriverName {
int size;
char name[32];
int flags;
-} __attribute__ ((aligned(16))) SceUdcdDriverName; /* size 48 */
+} __attribute__ ((aligned(16))) SceUdcdDriverName;
-/*
- * USB device information
+/** USB device information
*/
typedef struct SceUdcdDeviceInfo {
unsigned char info[64];
@@ -444,22 +383,22 @@ typedef struct SceUdcdDeviceInfo {
/**
* Start a USB driver.
*
- * @param driverName - name of the USB driver to start
+ * @param driverName - Name of the USB driver to start
* @param size - Size of arguments to pass to USB driver start
* @param args - Arguments to pass to USB driver start
*
- * @return 0 on success
+ * @return 0 on success, < 0 on error.
*/
int sceUdcdStart(const char *driverName, int size, void *args);
/**
* Stop a USB driver.
*
- * @param driverName - name of the USB driver to stop
+ * @param driverName - Name of the USB driver to stop
* @param size - Size of arguments to pass to USB driver start
* @param args - Arguments to pass to USB driver start
*
- * @return 0 on success
+ * @return 0 on success, < 0 on error.
*/
int sceUdcdStop(const char *driverName, int size, void *args);
@@ -468,21 +407,21 @@ int sceUdcdStop(const char *driverName, int size, void *args);
*
* @param pid - Product ID for the default USB Driver
*
- * @return 0 on success
+ * @return 0 on success, < 0 on error.
*/
int sceUdcdActivate(unsigned int productId);
/**
* Deactivate USB driver.
*
- * @return 0 on success
+ * @return 0 on success, < 0 on error.
*/
int sceUdcdDeactivate(void);
/**
* Get USB state
*
- * @return OR'd SCE_UDCD_STATUS_* constants
+ * @return One or more ::SceUdcdStatus.
*/
int sceUdcdGetDeviceState(void);
@@ -506,7 +445,7 @@ int sceUdcdGetDrvState(const char *driverName);
/**
* Get the list of drivers
- * @param flags - combination of SCE_UDCD_STATUS_DRIVER_STARTED or SCE_UDCD_STATUS_DRIVER_REGISTERED
+ * @param flags - One or more ::SceUdcdStatusDriver
* @param list - points to the output list
* @param size - number of entries in the output list
* @return the number of drivers in the output or < 0 in case of error
@@ -515,7 +454,7 @@ int sceUdcdGetDrvList(unsigned int flags, SceUdcdDriverName *list, int size);
/**
* Wait for USB state
- * @param state - combination of states(returned by sceUdcdGetState)
+ * @param state - combination of states (returned by ::sceUdcdGetDeviceState)
* @param waitMode - one of the ::SceEventFlagWaitTypes
* @param timeout - pointer to timeout
* @return the usb state or < 0 in case of error
@@ -576,7 +515,7 @@ int sceUdcdStall(SceUdcdEndpoint *endp);
/**
* Queue a send request(IN from host pov)
*
- * @param req - Pointer to a filled out SceUdcdDeviceRequest structure.
+ * @param req - Pointer to a filled out ::SceUdcdDeviceRequest structure.
*
* @return 0 on success, < 0 on error
*/
@@ -585,7 +524,7 @@ int sceUdcdReqSend(SceUdcdDeviceRequest *req);
/**
* Queue a receive request(OUT from host pov)
*
- * @param req - Pointer to a filled out SceUdcdDeviceRequest structure
+ * @param req - Pointer to a filled out ::SceUdcdDeviceRequest structure
*
* @return 0 on success, < 0 on error
*/