summaryrefslogtreecommitdiff
path: root/tinyusb
diff options
context:
space:
mode:
authorhathach <[email protected]>2013-03-29 00:20:27 +0700
committerhathach <[email protected]>2013-03-29 00:20:27 +0700
commite658e67ebefb94ee001dc491ea01c607300490b7 (patch)
treebf657aaead73a8b5f03335044315b8b08653e152 /tinyusb
parentd95c6cf2e016257aaa74e372fca350ce96f6a90b (diff)
fix the damn bug within 10 line of code in keyboard_app.c
Diffstat (limited to 'tinyusb')
-rw-r--r--tinyusb/hal/hal_lpc43xx.c2
-rw-r--r--tinyusb/host/usbh.c32
2 files changed, 18 insertions, 16 deletions
diff --git a/tinyusb/hal/hal_lpc43xx.c b/tinyusb/hal/hal_lpc43xx.c
index 8cee945fc..7c5678671 100644
--- a/tinyusb/hal/hal_lpc43xx.c
+++ b/tinyusb/hal/hal_lpc43xx.c
@@ -41,6 +41,7 @@
#if MCU == MCU_LPC43XX
#include "lpc43xx_cgu.h"
+#include "lpc43xx_scu.h"
enum {
LPC43XX_USBMODE_DEVICE = 2,
@@ -63,6 +64,7 @@ tusb_error_t hal_init(void)
//------------- reset controller & set role -------------//
hcd_controller_reset(0); // TODO where to place prototype, USB1
+
LPC_USB0->USBMODE_H = LPC43XX_USBMODE_HOST | (LPC43XX_USBMODE_VBUS_HIGH << 5);
hal_interrupt_enable(0); // TODO USB1
diff --git a/tinyusb/host/usbh.c b/tinyusb/host/usbh.c
index 08ab56880..3cf80f6c5 100644
--- a/tinyusb/host/usbh.c
+++ b/tinyusb/host/usbh.c
@@ -290,6 +290,8 @@ OSAL_TASK_DECLARE(usbh_enumeration_task)
)
);
+ hcd_port_reset( usbh_devices[0].core_id ); // reset port after 8 byte descriptor
+
//------------- Set new address -------------//
new_addr = get_new_address();
TASK_ASSERT(new_addr <= TUSB_CFG_HOST_DEVICE_MAX);
@@ -317,8 +319,6 @@ OSAL_TASK_DECLARE(usbh_enumeration_task)
usbh_pipe_control_close(0);
usbh_devices[0].state = TUSB_DEVICE_STATE_UNPLUG;
-// hcd_port_reset( usbh_device_info_pool[new_addr].core_id ); TODO may need to reset device after set address
-
// open control pipe for new address
TASK_ASSERT_STATUS ( usbh_pipe_control_open(new_addr, ((tusb_descriptor_device_t*) enum_data_buffer)->bMaxPacketSize0 ) );
@@ -380,6 +380,20 @@ OSAL_TASK_DECLARE(usbh_enumeration_task)
// update configuration info
usbh_devices[new_addr].interface_count = ((tusb_descriptor_configuration_t*) enum_data_buffer)->bNumInterfaces;
+ //------------- Set Configure -------------//
+ OSAL_SUBTASK_INVOKED_AND_WAIT (
+ usbh_control_xfer_subtask(
+ new_addr,
+ &(tusb_std_request_t)
+ {
+ .bmRequestType = { .direction = TUSB_DIR_HOST_TO_DEV, .type = TUSB_REQUEST_TYPE_STANDARD, .recipient = TUSB_REQUEST_RECIPIENT_DEVICE },
+ .bRequest = TUSB_REQUEST_SET_CONFIGURATION,
+ .wValue = configure_selected
+ },
+ NULL
+ )
+ );
+
//------------- parse configuration & install drivers -------------//
p_desc = enum_data_buffer + sizeof(tusb_descriptor_configuration_t);
@@ -422,20 +436,6 @@ OSAL_TASK_DECLARE(usbh_enumeration_task)
}
}
- //------------- Set Configure -------------//
- OSAL_SUBTASK_INVOKED_AND_WAIT (
- usbh_control_xfer_subtask(
- new_addr,
- &(tusb_std_request_t)
- {
- .bmRequestType = { .direction = TUSB_DIR_HOST_TO_DEV, .type = TUSB_REQUEST_TYPE_STANDARD, .recipient = TUSB_REQUEST_RECIPIENT_DEVICE },
- .bRequest = TUSB_REQUEST_SET_CONFIGURATION,
- .wValue = configure_selected
- },
- NULL
- )
- );
-
usbh_devices[new_addr].state = TUSB_DEVICE_STATE_CONFIGURED;
tusbh_device_mount_succeed_cb(new_addr);