summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSergi Granell2018-01-15 11:04:19 +0100
committerSergi Granell2018-01-15 11:04:19 +0100
commit1f4d1032e8c93184ed675dd714f175fe7c5de463 (patch)
tree9d1fbb8679b02a988ffe7d25614f5469dc185010 /include
parentMerge pull request #284 from d3m3vilurr/readd-kernel-io (diff)
downloadvds-libraries-1f4d1032e8c93184ed675dd714f175fe7c5de463.tar.gz
UDCD improvements, add NIDS
Diffstat (limited to 'include')
-rw-r--r--include/kernel/udcd.h122
-rw-r--r--include/user/udcd.h20
2 files changed, 95 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
}