diff options
Diffstat (limited to '')
-rw-r--r-- | include/kernel/udcd.h | 164 |
1 files changed, 152 insertions, 12 deletions
diff --git a/include/kernel/udcd.h b/include/kernel/udcd.h index 4490559..25d1e2a 100644 --- a/include/kernel/udcd.h +++ b/include/kernel/udcd.h @@ -2,6 +2,7 @@ #define _PSP2_KERNEL_UDCD_H_ #include <psp2kern/types.h> +#include <dolcesdk/align.h> #ifdef __cplusplus extern "C" { @@ -19,6 +20,7 @@ typedef enum SceUdcdUsbClass { USB_CLASS_MASS_STORAGE = 0x08, USB_CLASS_HUB = 0x09, USB_CLASS_DATA = 0x0A, + USB_CLASS_VIDEO = 0x0E, USB_CLASS_VENDOR_SPEC = 0xFF } SceUdcdUsbClass; @@ -193,6 +195,12 @@ typedef enum SceUdcdErrorCode { SCE_UDCD_ERROR_USBDRIVER_INVALID_FUNCS = 0x80243202 } SceUdcdErrorCode; +/** SceUdcdDeviceRequest Flags + */ +typedef enum SceUdcdDeviceRequestAttr { + SCE_UDCD_DEVICE_REQUEST_ATTR_PHYCONT = 0x00000001 +} SceUdcdDeviceRequestAttr; + /** USB string descriptor */ typedef struct SceUdcdStringDescriptor { @@ -203,7 +211,7 @@ typedef struct SceUdcdStringDescriptor { /** USB device descriptor */ -typedef struct SceUdcdDeviceDescriptor { +typedef struct SCE_ALIGN(4) SceUdcdDeviceDescriptor { unsigned char bLength; unsigned char bDescriptorType; unsigned short bcdUSB; @@ -218,11 +226,11 @@ typedef struct SceUdcdDeviceDescriptor { unsigned char iProduct; unsigned char iSerialNumber; unsigned char bNumConfigurations; -} __attribute__ ((aligned(4))) SceUdcdDeviceDescriptor; +} SceUdcdDeviceDescriptor; /** USB device qualifier descriptor */ -typedef struct SceUdcdDeviceQualifierDescriptor { +typedef struct SCE_ALIGN(4) SceUdcdDeviceQualifierDescriptor { unsigned char bLength; unsigned char bDescriptorType; unsigned short bcdUSB; @@ -232,7 +240,7 @@ typedef struct SceUdcdDeviceQualifierDescriptor { unsigned char bMaxPacketSize0; unsigned char bNumConfigurations; unsigned char bReserved; -} __attribute__ ((aligned(4))) SceUdcdDeviceQualifierDescriptor; +} SceUdcdDeviceQualifierDescriptor; /** USB configuration descriptor */ @@ -355,7 +363,7 @@ typedef struct SceUdcdDriver { typedef struct SceUdcdDeviceRequest { 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 + unsigned int attributes; //!< Request attributes (See ::SceUdcdDeviceRequestAttr) 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 @@ -368,11 +376,11 @@ typedef struct SceUdcdDeviceRequest { /** USB driver name */ -typedef struct SceUdcdDriverName { +typedef struct SCE_ALIGN(16) SceUdcdDriverName { int size; char name[32]; int flags; -} __attribute__ ((aligned(16))) SceUdcdDriverName; +} SceUdcdDriverName; /** USB device information */ @@ -380,9 +388,9 @@ typedef struct SceUdcdDeviceInfo { unsigned char info[64]; } SceUdcdDeviceInfo; -typedef struct { +typedef struct SceUdcdWaitParam { int unk_00; - int unk_04; + int status; int unk_08; int unk_0C; int unk_10; @@ -411,6 +419,28 @@ int sceUdcdWaitBusInitialized(unsigned int timeout, int bus); int sceUdcdStart(const char *driverName, int size, void *args); /** + * Start a USB driver for an UDCD bus. + * + * @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 + * @param[in] bus - UDCD bus (default is 2) + * + * @return 0 on success, < 0 on error. + */ +int sceUdcdStartInternal(const char *driverName, int size, void *args, int bus); + +/** + * Starts the current USB driver for an UDCD bus. + * + * @param[in] unused - Unused + * @param[in] bus - UDCD bus (default is 2) + * + * @return 0 on success, < 0 on error. + */ +int sceUdcdStartCurrentInternal(int unused, int bus); + +/** * Stop a USB driver. * * @param driverName - Name of the USB driver to stop @@ -422,6 +452,27 @@ int sceUdcdStart(const char *driverName, int size, void *args); int sceUdcdStop(const char *driverName, int size, void *args); /** + * Stop a USB driver for an UDCD bus. + * + * @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 + * @param[in] bus - UDCD bus (default is 2) + * + * @return 0 on success, < 0 on error. + */ +int sceUdcdStopInternal(const char *driverName, int size, void *args, int bus); + +/** + * Stops the current USB driver for an UDCD bus. + * + * @param[in] bus - UDCD bus (default is 2) + * + * @return 0 on success, < 0 on error. + */ +int sceUdcdStopCurrentInternal(int bus); + +/** * Activate a USB driver. * * @param pid - Product ID for the default USB Driver @@ -431,6 +482,17 @@ int sceUdcdStop(const char *driverName, int size, void *args); int sceUdcdActivate(unsigned int productId); /** + * Activate a USB driver for an UDCD bus. + * + * @param pid - Product ID for the default USB Driver + * @param[in] bus_powered - Enable USB bus power + * @param[in] bus - UDCD bus (default is 2) + * + * @return 0 on success, < 0 on error. + */ +int sceUdcdActivateInternal(unsigned int productId, unsigned int bus_powered, int bus); + +/** * Deactivate USB driver. * * @return 0 on success, < 0 on error. @@ -438,6 +500,15 @@ int sceUdcdActivate(unsigned int productId); int sceUdcdDeactivate(void); /** + * Deactivate USB driver for an UDCD bus. + * + * @param[in] bus - UDCD bus (default is 2) + * + * @return 0 on success, < 0 on error. + */ +int sceUdcdDeactivateInternal(int bus); + +/** * Get USB state * * @return One or more ::SceUdcdStatus. @@ -445,6 +516,15 @@ int sceUdcdDeactivate(void); int sceUdcdGetDeviceState(void); /** + * Get USB state for an UDCD bus + * + * @param[in] bus - UDCD bus (default is 2) + * + * @return One or more ::SceUdcdStatus. + */ +int sceUdcdGetDeviceStateInternal(int bus); + +/** * Get device information * * @param[out] devInfo - Device information @@ -454,6 +534,16 @@ int sceUdcdGetDeviceState(void); int sceUdcdGetDeviceInfo(SceUdcdDeviceInfo *devInfo); /** + * Get device information for an UDCD bus + * + * @param[out] devInfo - Device information + * @param[in] bus - UDCD bus (default is 2) + * + * @return 0 on success, < 0 on error. +*/ +int sceUdcdGetDeviceInfoInternal(SceUdcdDeviceInfo *devInfo, int bus); + +/** * Get state of a specific USB driver * * @param driverName - name of USB driver to get status from @@ -510,7 +600,7 @@ int sceUdcdRegister(SceUdcdDriver *drv); * * @return 0 on success, < 0 on error */ -int sceUdcdRegisterToBus(SceUdcdDriver *drv, int bus); +int sceUdcdRegisterInternal(SceUdcdDriver *drv, int bus); /** * Unregister a USB driver @@ -522,6 +612,16 @@ int sceUdcdRegisterToBus(SceUdcdDriver *drv, int bus); int sceUdcdUnregister(SceUdcdDriver *drv); /** + * Unregister a USB driver for an UDCD bus + * + * @param drv - Pointer to a filled out USB driver + * @param[in] bus - UDCD bus (default is 2) + * + * @return 0 on success, < 0 on error + */ +int sceUdcdUnregisterInternal(SceUdcdDriver *drv, int bus); + +/** * Clear the FIFO on an endpoint * * @param endp - The endpoint to clear @@ -531,6 +631,16 @@ int sceUdcdUnregister(SceUdcdDriver *drv); int sceUdcdClearFIFO(SceUdcdEndpoint *endp); /** + * Clear the FIFO on an endpoint for an UDCD bus + * + * @param endp - The endpoint to clear + * @param[in] bus - UDCD bus (default is 2) + * + * @return 0 on success, < 0 on error + */ +int sceUdcdClearFIFOInternal(SceUdcdEndpoint *endp, int bus); + +/** * Cancel any pending requests on an endpoint. * * @param endp - The endpoint to cancel @@ -549,7 +659,17 @@ int sceUdcdReqCancelAll(SceUdcdEndpoint *endp); int sceUdcdStall(SceUdcdEndpoint *endp); /** - * Queue a send request(IN from host pov) + * Stall an endpoint for an UDCD bus + * + * @param endp - The endpoint to stall + * @param[in] bus - UDCD bus (default is 2) + * + * @return 0 on success, < 0 on error + */ +int sceUdcdStallInternal(SceUdcdEndpoint *endp, int bus); + +/** + * Queue a send request (IN from host pov) * * @param req - Pointer to a filled out ::SceUdcdDeviceRequest structure. * @@ -558,7 +678,17 @@ int sceUdcdStall(SceUdcdEndpoint *endp); int sceUdcdReqSend(SceUdcdDeviceRequest *req); /** - * Queue a receive request(OUT from host pov) + * Queue a send request (IN from host pov) for an UDCD bus + * + * @param req - Pointer to a filled out ::SceUdcdDeviceRequest structure. + * @param[in] bus - UDCD bus (default is 2) + * + * @return 0 on success, < 0 on error + */ +int sceUdcdReqSendInternal(SceUdcdDeviceRequest *req, int bus); + +/** + * Queue a receive request (OUT from host pov) * * @param req - Pointer to a filled out ::SceUdcdDeviceRequest structure * @@ -566,6 +696,16 @@ int sceUdcdReqSend(SceUdcdDeviceRequest *req); */ int sceUdcdReqRecv(SceUdcdDeviceRequest *req); +/** + * Queue a receive request (OUT from host pov) for an UDCD bus + * + * @param req - Pointer to a filled out ::SceUdcdDeviceRequest structure + * @param[in] bus - UDCD bus (default is 2) + * + * @return 0 on success, < 0 on error + */ +int sceUdcdReqRecvInternal(SceUdcdDeviceRequest *req, int bus); + #ifdef __cplusplus } #endif |