diff options
-rw-r--r-- | include/kernel/udcd.h | 122 | ||||
-rw-r--r-- | include/user/udcd.h | 20 | ||||
-rw-r--r-- | nids/360/SceUdcd.yml | 3 |
3 files changed, 98 insertions, 47 deletions
diff --git a/include/kernel/udcd.h b/include/kernel/udcd.h index c79f356..1551433 100644 --- a/include/kernel/udcd.h +++ b/include/kernel/udcd.h @@ -308,10 +308,10 @@ typedef struct SceUdcdEndpoint { /** USB driver configuration */ typedef struct SceUdcdConfiguration { - SceUdcdConfigDescriptor *configDescriptors; //!< Pointer to the configuration descriptors - SceUdcdInterfaceSettings *settings; //!< USB driver interface settings + 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 + SceUdcdEndpointDescriptor *endpointDescriptors; //!< Pointer to the first endpoint descriptor } SceUdcdConfiguration; /** USB EP0 Device Request @@ -381,48 +381,58 @@ typedef struct SceUdcdDeviceInfo { } SceUdcdDeviceInfo; /** - * Start a USB driver. - * - * @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, < 0 on error. - */ + * Waits until an UDCD bus is initialized + * + * @param[in] timeout - Timeout + * @param[in] bus - UDCD bus (default is 2) + * + * @return 0 on success, < 0 on error. + */ +int sceUdcdWaitBusInitialized(unsigned int timeout, int bus); + +/** + * Start a USB driver. + * + * @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, < 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 size - Size of arguments to pass to USB driver start - * @param args - Arguments to pass to USB driver start - * - * @return 0 on success, < 0 on error. - */ + * Stop a USB driver. + * + * @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, < 0 on error. + */ int sceUdcdStop(const char *driverName, int size, void *args); /** - * Activate a USB driver. - * - * @param pid - Product ID for the default USB Driver - * - * @return 0 on success, < 0 on error. - */ + * Activate a USB driver. + * + * @param pid - Product ID for the default USB Driver + * + * @return 0 on success, < 0 on error. + */ int sceUdcdActivate(unsigned int productId); /** - * Deactivate USB driver. - * - * @return 0 on success, < 0 on error. - */ + * Deactivate USB driver. + * + * @return 0 on success, < 0 on error. + */ int sceUdcdDeactivate(void); /** - * Get USB state - * - * @return One or more ::SceUdcdStatus. - */ + * Get USB state + * + * @return One or more ::SceUdcdStatus. + */ int sceUdcdGetDeviceState(void); /** @@ -435,22 +445,44 @@ int sceUdcdGetDeviceState(void); int sceUdcdGetDeviceInfo(SceUdcdDeviceInfo *devInfo); /** - * Get state of a specific USB driver - * - * @param driverName - name of USB driver to get status from - * - * @return SCE_UDCD_STATUS_DRIVER_STARTED if the driver has been started, SCE_UDCD_STATUS_DRIVER_REGISTERED if it is stopped - */ + * Get state of a specific USB driver + * + * @param driverName - name of USB driver to get status from + * + * @return SCE_UDCD_STATUS_DRIVER_STARTED if the driver has been started, SCE_UDCD_STATUS_DRIVER_REGISTERED if it is stopped + */ int sceUdcdGetDrvState(const char *driverName); /** - * Wait for USB state - * @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 + * Get state of a specific USB driver for an UDCD bus + * + * @param driverName - name of USB driver to get status from + * @param[in] bus - UDCD bus (default is 2) + * + * @return SCE_UDCD_STATUS_DRIVER_STARTED if the driver has been started, SCE_UDCD_STATUS_DRIVER_REGISTERED if it is stopped */ -int sceUdcdWaitState(unsigned int state, unsigned int waitMode, SceUInt *timeout); +int sceUdcdGetDrvStateInternal(const char *driverName, int bus); + +/** + * Wait for state + * + * @param[in] waitParam - Wait parameter + * @param[in] timeout - Timeout + * + * @return 0 on success, < 0 on error. +*/ +int sceUdcdWaitState(SceUdcdWaitParam *waitParam, unsigned int timeout); + +/** + * Wait for state for an UDCD bus + * + * @param[in] waitParam - Wait parameter + * @param[in] timeout - Timeout + * @param[in] bus - UDCD bus (default is 2) + * + * @return 0 on success, < 0 on error. +*/ +int sceUdcdWaitStateInternal(SceUdcdWaitParam *waitParam, unsigned int timeout, int bus); /** * Register a USB driver. diff --git a/include/user/udcd.h b/include/user/udcd.h index 2915312..fefb048 100644 --- a/include/user/udcd.h +++ b/include/user/udcd.h @@ -20,6 +20,13 @@ typedef enum SceUdcdStatus { SCE_UDCD_STATUS_UNKNOWN_2000 = 0x2000 } SceUdcdStatus; +/** USB Driver status + */ +typedef enum SceUdcdStatusDriver { + SCE_UDCD_STATUS_DRIVER_STARTED = 0x01, + SCE_UDCD_STATUS_DRIVER_REGISTERED = 0x02 +} SceUdcdStatusDriver; + typedef struct { uint8_t info[64]; } SceUdcdDeviceInfo; @@ -61,6 +68,15 @@ int sceUdcdGetDeviceState(SceUdcdDeviceState *state); int sceUdcdGetDeviceInfo(SceUdcdDeviceInfo *devInfo); /** + * Get state of a specific USB driver + * + * @param driverName - name of USB driver to get status from + * + * @return SCE_UDCD_STATUS_DRIVER_STARTED if the driver has been started, SCE_UDCD_STATUS_DRIVER_REGISTERED if it is stopped + */ +int sceUdcdGetDrvState(const char *driverName); + +/** * Register callback * * @param[in] cbid - Callback UID @@ -83,11 +99,11 @@ int sceUdcdUnregisterCallback(SceUID cbid); * Wait for state * * @param[in] waitParam - Wait parameter - * @param[in] state - State + * @param[in] timeout - Timeout * * @return 0 on success, < 0 on error. */ -int sceUdcdWaitState(SceUdcdWaitParam *waitParam, int state); +int sceUdcdWaitState(SceUdcdWaitParam *waitParam, unsigned int timeout); #ifdef __cplusplus } diff --git a/nids/360/SceUdcd.yml b/nids/360/SceUdcd.yml index a537b22..36cc553 100644 --- a/nids/360/SceUdcd.yml +++ b/nids/360/SceUdcd.yml @@ -20,6 +20,7 @@ modules: sceUdcdGetDeviceInfo: 0xFBEA3703 sceUdcdGetDeviceState: 0xE054B5E4 sceUdcdGetDrvState: 0xC0CA5DDB + sceUdcdGetDrvStateInternal: 0x512F77BC sceUdcdRegister: 0x4E55244D sceUdcdRegisterToBus: 0x64675918 sceUdcdReqCancelAll: 0x38787672 @@ -29,4 +30,6 @@ modules: sceUdcdStart: 0x9FD733EA sceUdcdStop: 0x1494293B sceUdcdUnregister: 0x0DECE532 + sceUdcdWaitBusInitialized: 0x1C684884 sceUdcdWaitState: 0xD03017C0 + sceUdcdWaitStateInternal: 0x7AD0C8D1 |