From ef850984dae94b424959ebba5563aedeeeb3f52b Mon Sep 17 00:00:00 2001 From: hathach Date: Mon, 8 Apr 2013 03:45:31 +0700 Subject: [PATCH] move MCU define to tusb_option.h, fix the ATTR with USB RAM hack: add delay before the very first xfer when enumerating (finalize later after reading USB 2.0 specs) --- demos/host/.project | 1 - demos/host/keyboard_app.c | 4 +--- demos/host/mouse_app.c | 4 +--- tinyusb/host/usbh.c | 7 +++++++ tinyusb/mcu_capacity.h | 7 ------- tinyusb/tusb_option.h | 9 ++++++++- 6 files changed, 17 insertions(+), 15 deletions(-) diff --git a/demos/host/.project b/demos/host/.project index c8e578a8a..8b3bceca8 100644 --- a/demos/host/.project +++ b/demos/host/.project @@ -3,7 +3,6 @@ host - tinyusb diff --git a/demos/host/keyboard_app.c b/demos/host/keyboard_app.c index 32827b987..25bf67e1a 100644 --- a/demos/host/keyboard_app.c +++ b/demos/host/keyboard_app.c @@ -46,9 +46,7 @@ //--------------------------------------------------------------------+ // INTERNAL OBJECT & FUNCTION DECLARATION //--------------------------------------------------------------------+ -//TUSB_CFG_ATTR_USBRAM -__attribute__ ((section(".data.$RAM3"))) // TODO hack for USB RAM -tusb_keyboard_report_t keyboard_report; +tusb_keyboard_report_t keyboard_report TUSB_CFG_ATTR_USBRAM; //--------------------------------------------------------------------+ // IMPLEMENTATION diff --git a/demos/host/mouse_app.c b/demos/host/mouse_app.c index c7d845b2d..b3df965bc 100644 --- a/demos/host/mouse_app.c +++ b/demos/host/mouse_app.c @@ -46,9 +46,7 @@ //--------------------------------------------------------------------+ // INTERNAL OBJECT & FUNCTION DECLARATION //--------------------------------------------------------------------+ -//TUSB_CFG_ATTR_USBRAM -__attribute__ ((section(".data.$RAM3"))) // TODO hack for USB RAM -tusb_mouse_report_t mouse_report; +tusb_mouse_report_t mouse_report TUSB_CFG_ATTR_USBRAM; //--------------------------------------------------------------------+ // IMPLEMENTATION diff --git a/tinyusb/host/usbh.c b/tinyusb/host/usbh.c index 8c3b20703..0902c8ed9 100644 --- a/tinyusb/host/usbh.c +++ b/tinyusb/host/usbh.c @@ -273,6 +273,13 @@ OSAL_TASK_DECLARE(usbh_enumeration_task) TASK_ASSERT_STATUS( usbh_pipe_control_open(0, 8) ); usbh_devices[0].state = TUSB_DEVICE_STATE_ADDRESSED; +#ifndef _TEST_ + // TODO finalize delay after reset, hack delay 100 ms, otherwise speed is detected as LOW in most cases + volatile uint32_t delay_us = 10000; + delay_us *= (SystemCoreClock / 1000000) / 3; + while(delay_us--); +#endif + //------------- Get first 8 bytes of device descriptor to get Control Endpoint Size -------------// OSAL_SUBTASK_INVOKED_AND_WAIT( usbh_control_xfer_subtask( diff --git a/tinyusb/mcu_capacity.h b/tinyusb/mcu_capacity.h index 574921330..2fbcbfdee 100644 --- a/tinyusb/mcu_capacity.h +++ b/tinyusb/mcu_capacity.h @@ -51,13 +51,6 @@ #ifndef _TUSB_MCU_CAPACITY_H_ #define _TUSB_MCU_CAPACITY_H_ -#define MCU_LPC13UXX 1 -#define MCU_LPC11UXX 2 -#define MCU_LPC43XX 3 -#define MCU_LPC18XX 4 -#define MCU_LPC175X_6X 5 -#define MCU_LPC177X_8X 6 - #ifdef __cplusplus extern "C" { #endif diff --git a/tinyusb/tusb_option.h b/tinyusb/tusb_option.h index 789e88028..4d20b3049 100644 --- a/tinyusb/tusb_option.h +++ b/tinyusb/tusb_option.h @@ -59,9 +59,16 @@ #define TUSB_VERSION_NAME "alpha" #define TUSB_VERSION XSTRING_(TUSB_VERSION_YEAR) "." XSTRING_(TUSB_VERSION_MONTH) +#define MCU_LPC13UXX 1 +#define MCU_LPC11UXX 2 +#define MCU_LPC43XX 3 +#define MCU_LPC18XX 4 +#define MCU_LPC175X_6X 5 +#define MCU_LPC177X_8X 6 + /// define this symbol will make tinyusb look for external configure file -#include "tusb_config.h" #include "mcu_capacity.h" +#include "tusb_config.h" //--------------------------------------------------------------------+ // CONTROLLER