aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/include/hal_usbh.h
diff options
context:
space:
mode:
Diffstat (limited to 'os/hal/include/hal_usbh.h')
-rw-r--r--os/hal/include/hal_usbh.h26
1 files changed, 16 insertions, 10 deletions
diff --git a/os/hal/include/hal_usbh.h b/os/hal/include/hal_usbh.h
index 63be93e..5dcd01a 100644
--- a/os/hal/include/hal_usbh.h
+++ b/os/hal/include/hal_usbh.h
@@ -20,6 +20,9 @@
#include "hal.h"
+#ifndef HAL_USE_USBH
+#define HAL_USE_USBH FALSE
+#endif
#ifndef HAL_USBH_USE_FTDI
#define HAL_USBH_USE_FTDI FALSE
@@ -37,6 +40,8 @@
#define HAL_USBH_USE_UVC FALSE
#endif
+#define HAL_USBH_USE_IAD HAL_USBH_USE_UVC
+
#if (HAL_USE_USBH == TRUE) || defined(__DOXYGEN__)
#include "osal.h"
@@ -104,13 +109,11 @@ enum usbh_urbstatus {
USBH_URBSTATUS_UNINITIALIZED = 0,
USBH_URBSTATUS_INITIALIZED,
USBH_URBSTATUS_PENDING,
-// USBH_URBSTATUS_QUEUED,
USBH_URBSTATUS_ERROR,
USBH_URBSTATUS_TIMEOUT,
USBH_URBSTATUS_CANCELLED,
USBH_URBSTATUS_STALL,
USBH_URBSTATUS_DISCONNECTED,
-// USBH_URBSTATUS_EPCLOSED,
USBH_URBSTATUS_OK,
};
@@ -145,7 +148,8 @@ typedef void (*usbh_completion_cb)(usbh_urb_t *);
/* include the low level driver; the required definitions are above */
#include "hal_usbh_lld.h"
-#define USBH_DEFINE_BUFFER(type, name) USBH_LLD_DEFINE_BUFFER(type, name)
+#define USBH_DEFINE_BUFFER(var) USBH_LLD_DEFINE_BUFFER(var)
+#define USBH_DECLARE_STRUCT_MEMBER(member) USBH_LLD_DECLARE_STRUCT_MEMBER(member)
struct usbh_urb {
usbh_ep_t *ep;
@@ -198,9 +202,8 @@ struct usbh_device {
usbh_devstatus_t status;
usbh_devspeed_t speed;
- USBH_DEFINE_BUFFER(usbh_device_descriptor_t, devDesc);
- unsigned char align_bytes[2];
- USBH_DEFINE_BUFFER(usbh_config_descriptor_t, basicConfigDesc);
+ USBH_DECLARE_STRUCT_MEMBER(usbh_device_descriptor_t devDesc);
+ USBH_DECLARE_STRUCT_MEMBER(usbh_config_descriptor_t basicConfigDesc);
uint8_t *fullConfigurationDescriptor;
uint8_t keepFullCfgDesc;
@@ -362,10 +365,13 @@ extern "C" {
usbhEPCloseS(ep);
osalSysUnlock();
}
- static inline void usbhEPResetI(usbh_ep_t *ep) {
- osalDbgCheckClassI();
- osalDbgCheck(ep != NULL);
- usbh_lld_epreset(ep);
+ bool usbhEPResetS(usbh_ep_t *ep);
+ static inline bool usbhEPReset(usbh_ep_t *ep) {
+ bool ret;
+ osalSysLock();
+ ret = usbhEPResetS(ep);
+ osalSysUnlock();
+ return ret;
}
static inline bool usbhEPIsPeriodic(usbh_ep_t *ep) {
osalDbgCheck(ep != NULL);