summaryrefslogtreecommitdiff
path: root/tinyusb/device
diff options
context:
space:
mode:
authorhathach <[email protected]>2013-10-30 12:20:00 +0700
committerhathach <[email protected]>2013-10-30 12:20:00 +0700
commitd67a7b7959342e93c6ae63d5dac5149dec76d0e6 (patch)
tree2c98b03f52b1b0654d758201958f3af30fa3c84f /tinyusb/device
parentd9ce879df84f6098e431736a297d4239d6f8eb2a (diff)
fix dcd_data declared with TUSB_CFG_ATTR_USBRAM
fix lpc43xx UM: non-control unused endpoint type should be set to different than control in ENDPTCTRL add hid mouse device fix mouse descriptor with vertical wheel support
Diffstat (limited to 'tinyusb/device')
-rw-r--r--tinyusb/device/dcd_lpc43xx.c17
-rw-r--r--tinyusb/device/usbd.c1
-rw-r--r--tinyusb/device/usbd.h6
3 files changed, 16 insertions, 8 deletions
diff --git a/tinyusb/device/dcd_lpc43xx.c b/tinyusb/device/dcd_lpc43xx.c
index f10383d9c..213de5a6c 100644
--- a/tinyusb/device/dcd_lpc43xx.c
+++ b/tinyusb/device/dcd_lpc43xx.c
@@ -122,7 +122,7 @@ typedef struct {
}dcd_data_t;
-ATTR_ALIGNED(2048) dcd_data_t dcd_data;
+ATTR_ALIGNED(2048) dcd_data_t dcd_data TUSB_CFG_ATTR_USBRAM;
//--------------------------------------------------------------------+
// INTERNAL OBJECT & FUNCTION DECLARATION
@@ -200,6 +200,14 @@ void bus_reset(uint8_t coreid)
{
// TODO mutliple core id support
+ // The reset value for all endpoint types is the control endpoint. If one endpoint
+ //direction is enabled and the paired endpoint of opposite direction is disabled, then the
+ //endpoint type of the unused direction must bechanged from the control type to any other
+ //type (e.g. bulk). Leaving an unconfigured endpoint control will cause undefined behavior
+ //for the data PID tracking on the active endpoint.
+ LPC_USB0->ENDPTCTRL1 = LPC_USB0->ENDPTCTRL2 = LPC_USB0->ENDPTCTRL3 = LPC_USB0->ENDPTCTRL4 = LPC_USB0->ENDPTCTRL5 =
+ (TUSB_XFER_BULK << 2) | (TUSB_XFER_BULK << 18);
+
//------------- Clear All Registers -------------//
LPC_USB0->ENDPTNAK = LPC_USB0->ENDPTNAK;
LPC_USB0->ENDPTNAKEN = 0;
@@ -327,7 +335,7 @@ endpoint_handle_t dcd_pipe_open(uint8_t coreid, tusb_descriptor_endpoint_t const
//------------- Endpoint Control Register -------------//
volatile uint32_t * reg_control = (&LPC_USB0->ENDPTCTRL0) + (p_endpoint_desc->bEndpointAddress & 0x0f);
- (*reg_control) = ((p_endpoint_desc->bmAttributes.xfer << 2) | ENDPTCTRL_MASK_ENABLE | ENDPTCTRL_MASK_TOGGLE_RESET) << ((p_endpoint_desc->bEndpointAddress & TUSB_DIR_DEV_TO_HOST_MASK) ? 16 : 0);
+ (*reg_control) |= ((p_endpoint_desc->bmAttributes.xfer << 2) | ENDPTCTRL_MASK_ENABLE | ENDPTCTRL_MASK_TOGGLE_RESET) << ((p_endpoint_desc->bEndpointAddress & TUSB_DIR_DEV_TO_HOST_MASK) ? 16 : 0);
return (endpoint_handle_t) { .coreid = coreid, .xfer_type = p_endpoint_desc->bmAttributes.xfer, .index = ep_idx };
}
@@ -383,7 +391,7 @@ void dcd_isr(uint8_t coreid)
if (int_status & INT_MASK_USB)
{
if (LPC_USB0->ENDPTSETUPSTAT)
- {
+ { // 23.10.10.2 Operational model for setup transfers
tusb_control_request_t control_request = dcd_data.qhd[0].setup_request;
LPC_USB0->ENDPTSETUPSTAT = LPC_USB0->ENDPTSETUPSTAT;
@@ -392,7 +400,8 @@ void dcd_isr(uint8_t coreid)
if (LPC_USB0->ENDPTCOMPLETE)
{
-// TransferCompleteISR(DeviceID);
+// hal_debugger_breakpoint();
+ LPC_USB0->ENDPTCOMPLETE = LPC_USB0->ENDPTCOMPLETE;
}
}
diff --git a/tinyusb/device/usbd.c b/tinyusb/device/usbd.c
index bf202f6d8..521e1f6b4 100644
--- a/tinyusb/device/usbd.c
+++ b/tinyusb/device/usbd.c
@@ -146,6 +146,7 @@ tusb_error_t usbh_set_configure_received(uint8_t coreid, uint8_t config_number)
}
#endif
+ return TUSB_ERROR_NONE;
}
void usbd_setup_received_isr(uint8_t coreid, tusb_control_request_t * p_request)
diff --git a/tinyusb/device/usbd.h b/tinyusb/device/usbd.h
index 39bbceee0..be389f182 100644
--- a/tinyusb/device/usbd.h
+++ b/tinyusb/device/usbd.h
@@ -50,11 +50,9 @@
// INCLUDE
//--------------------------------------------------------------------+
#include "common/common.h"
-#include "osal/osal.h" // TODO refractor move to common.h ?
+#include "osal/osal.h"
+#include "dcd.h"
-#ifdef _TINY_USB_SOURCE_FILE_
-#include "dcd.h" // TODO hide from application include
-#endif
//#include "tusb_descriptors.h"
#ifdef __cplusplus