|
@@ -59,10 +59,19 @@
|
|
|
#define usbd_lane_dcp 4 /**<\brief Lanes connected to dedicated charging port.*/
|
|
#define usbd_lane_dcp 4 /**<\brief Lanes connected to dedicated charging port.*/
|
|
|
/** @} */
|
|
/** @} */
|
|
|
|
|
|
|
|
-/** \name USB HW capabilities
|
|
|
|
|
|
|
+/**\anchor USBD_HW_CAPS
|
|
|
|
|
+ * \name USB HW capabilities and status
|
|
|
* @{ */
|
|
* @{ */
|
|
|
#define USBD_HW_ADDRFST (1 << 0) /**<\brief Set address before STATUS_OUT.*/
|
|
#define USBD_HW_ADDRFST (1 << 0) /**<\brief Set address before STATUS_OUT.*/
|
|
|
#define USBD_HW_BC (1 << 1) /**<\brief Battery charging detection supported.*/
|
|
#define USBD_HW_BC (1 << 1) /**<\brief Battery charging detection supported.*/
|
|
|
|
|
+#define USND_HW_HS (1 << 2) /**<\brief High speed supported.*/
|
|
|
|
|
+#define USBD_HW_ENABLED (1 << 3) /**<\brief USB device emabled. */
|
|
|
|
|
+#define USBD_HW_ENUMSPEED (2 << 4) /**<\brief USB device enumerated speed*/
|
|
|
|
|
+#define USBD_HW_SPEED_NC (0 << 4) /**<\brief Not connected */
|
|
|
|
|
+#define USBD_HW_SPEED_LS (1 << 4) /**<\brief Low speed */
|
|
|
|
|
+#define USBD_HW_SPEED_FS (2 << 4) /**<\brief Full speed */
|
|
|
|
|
+#define USBD_HW_SPEED_HS (3 << 4) /**<\brief High speed */
|
|
|
|
|
+
|
|
|
/** @} */
|
|
/** @} */
|
|
|
/** @} */
|
|
/** @} */
|
|
|
|
|
|
|
@@ -212,6 +221,10 @@ typedef usbd_respond (*usbd_cfg_callback)(usbd_device *dev, uint8_t cfg);
|
|
|
|
|
|
|
|
/**\addtogroup USBD_HW
|
|
/**\addtogroup USBD_HW
|
|
|
* @{ */
|
|
* @{ */
|
|
|
|
|
+/**\brief Get USB device status and capabilities.
|
|
|
|
|
+ * \return Hardware status and capabilities \ref USBD_HW_CAPS */
|
|
|
|
|
+
|
|
|
|
|
+typedef uint32_t (*usbd_hw_getinfo)(void);
|
|
|
|
|
|
|
|
/**\brief Enables or disables USB hardware
|
|
/**\brief Enables or disables USB hardware
|
|
|
* \param enable Enables USB when TRUE disables otherwise.
|
|
* \param enable Enables USB when TRUE disables otherwise.
|
|
@@ -291,7 +304,7 @@ typedef uint16_t (*usbd_hw_get_serialno)(void *buffer);
|
|
|
|
|
|
|
|
/**\brief Represents a hardware USB driver call table.*/
|
|
/**\brief Represents a hardware USB driver call table.*/
|
|
|
struct usbd_driver {
|
|
struct usbd_driver {
|
|
|
- uint32_t caps; /**<\brief HW capabilities */
|
|
|
|
|
|
|
+ usbd_hw_getinfo getinfo; /**<\copybrief usbd_hw_getinfo */
|
|
|
usbd_hw_enable enable; /**<\copybrief usbd_hw_enable */
|
|
usbd_hw_enable enable; /**<\copybrief usbd_hw_enable */
|
|
|
usbd_hw_connect connect; /**<\copybrief usbd_hw_connect */
|
|
usbd_hw_connect connect; /**<\copybrief usbd_hw_connect */
|
|
|
usbd_hw_setaddr setaddr; /**<\copybrief usbd_hw_setaddr */
|
|
usbd_hw_setaddr setaddr; /**<\copybrief usbd_hw_setaddr */
|
|
@@ -452,6 +465,12 @@ inline static uint8_t usbd_connect(usbd_device *dev, bool connect) {
|
|
|
return dev->driver->connect(connect);
|
|
return dev->driver->connect(connect);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+/**<\brief Retrieves status and capabilities.
|
|
|
|
|
+ * \return current HW status, enumeration speed and capabilities /ref USBD_HW_CAPS */
|
|
|
|
|
+inline static uint32_t usbd_getinfo(usbd_device *dev) {
|
|
|
|
|
+ return dev->driver->getinfo();
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
#endif //(__ASSEMBLER__)
|
|
#endif //(__ASSEMBLER__)
|
|
|
/** @} */
|
|
/** @} */
|
|
|
/** @} */
|
|
/** @} */
|