diff --git a/tests/test/host/ehci/test_ehci_init.c b/tests/test/host/ehci/test_ehci_init.c index 5d691b600..f83d5f979 100644 --- a/tests/test/host/ehci/test_ehci_init.c +++ b/tests/test/host/ehci/test_ehci_init.c @@ -83,7 +83,7 @@ void test_hcd_init_usbint(void) for(uint32_t i=0; iusb_int_enable_bit.usb_error); @@ -188,5 +188,9 @@ void test_hcd_init_usbcmd(void) TEST_ASSERT_BITS(BIN8(11), EHCI_CFG_FRAMELIST_SIZE_BITS, regs->usb_cmd_bit.framelist_size); TEST_ASSERT_EQUAL(EHCI_CFG_FRAMELIST_SIZE_BITS >> 2, regs->usb_cmd_bit.nxp_framelist_size_msb); } - +} + +void test_hcd_init_portsc(void) +{ + TEST_IGNORE_MESSAGE("more advance stuff need manipulate this register"); } diff --git a/tinyusb/common/assertion.h b/tinyusb/common/assertion.h index dba812959..4082f4b59 100644 --- a/tinyusb/common/assertion.h +++ b/tinyusb/common/assertion.h @@ -61,13 +61,17 @@ extern "C" //--------------------------------------------------------------------+ // Compile-time Assert //--------------------------------------------------------------------+ -#if defined __COUNTER__ && __COUNTER__ != __COUNTER__ - #define _ASSERT_COUNTER __COUNTER__ +#ifdef __ICCARM__ + #define STATIC_ASSERT static_assert #else - #define _ASSERT_COUNTER __LINE__ -#endif + #if defined __COUNTER__ && __COUNTER__ != __COUNTER__ + #define _ASSERT_COUNTER __COUNTER__ + #else + #define _ASSERT_COUNTER __LINE__ + #endif -#define STATIC_ASSSERT(const_expr) enum { XSTRING_CONCAT(static_assert_, _ASSERT_COUNTER) = 1/(!!(const_expr)) } + #define STATIC_ASSERT(const_expr, message) enum { XSTRING_CONCAT_(static_assert_, _ASSERT_COUNTER) = 1/(!!(const_expr)) } +#endif //#if ( defined CFG_PRINTF_UART || defined CFG_PRINTF_USBCDC || defined CFG_PRINTF_DEBUG ) #if TUSB_CFG_DEBUG == 3 diff --git a/tinyusb/common/compiler/compiler_gcc.h b/tinyusb/common/compiler/compiler_gcc.h index b778f6b92..ac0238a8e 100644 --- a/tinyusb/common/compiler/compiler_gcc.h +++ b/tinyusb/common/compiler/compiler_gcc.h @@ -51,6 +51,8 @@ extern "C" { #endif +#define ALIGN_OF(x) __alignof__(x) + /// Normally, the compiler places the objects it generates in sections like data or bss & function in text. Sometimes, however, you need additional sections, or you need certain particular variables to appear in special sections, for example to map to special hardware. The section attribute specifies that a variable (or function) lives in a particular section #define ATTR_SECTION(section) __attribute__ ((#section)) diff --git a/tinyusb/common/compiler/compiler_iar.h b/tinyusb/common/compiler/compiler_iar.h index 85f98deed..99a9005d8 100644 --- a/tinyusb/common/compiler/compiler_iar.h +++ b/tinyusb/common/compiler/compiler_iar.h @@ -51,6 +51,8 @@ extern "C" { #endif +#define ALIGN_OF(x) __ALIGNOF__(x) + #define ATTR_PREPACKED __packed #define ATTR_PACKED diff --git a/tinyusb/hal/hal_lpc43xx.h b/tinyusb/hal/hal_lpc43xx.h index 63da8a37c..0d9e4c8be 100644 --- a/tinyusb/hal/hal_lpc43xx.h +++ b/tinyusb/hal/hal_lpc43xx.h @@ -61,6 +61,9 @@ #define DEVICE_ROM_REG_BASE LPC_USB0_BASE // TODO USB1 #define DEVICE_ROM_DRIVER_ADDR 0x1040011C +#define tusb_1st_isr USB0_IRQHandler +#define tusb_2nd_isr + static inline void hal_interrupt_enable() { NVIC_EnableIRQ(USB0_IRQn); // TODO USB1 diff --git a/tinyusb/host/ehci/ehci.c b/tinyusb/host/ehci/ehci.c index 64c56f341..961dc6517 100644 --- a/tinyusb/host/ehci/ehci.c +++ b/tinyusb/host/ehci/ehci.c @@ -59,6 +59,12 @@ STATIC_ ehci_link_t period_frame_list0[EHCI_FRAMELIST_SIZE] ATTR_ALIGNED(4096) T STATIC_ ehci_link_t period_frame_list1[EHCI_FRAMELIST_SIZE] ATTR_ALIGNED(4096) TUSB_CFG_ATTR_USBRAM; #endif +//------------- Validation -------------// +STATIC_ASSERT( ALIGN_OF(period_frame_list0) == 4096, "Period Framelist must be 4k alginment"); +#if TUSB_CFG_HOST_CONTROLLER_NUM > 1 +STATIC_ASSERT( ALIGN_OF(period_frame_list1) == 4096, "Period Framelist must be 4k alginment"); +#endif + //--------------------------------------------------------------------+ // IMPLEMENTATION //--------------------------------------------------------------------+ diff --git a/tinyusb/host/ehci/ehci.h b/tinyusb/host/ehci/ehci.h index a0b1e635b..7f528eb06 100644 --- a/tinyusb/host/ehci/ehci.h +++ b/tinyusb/host/ehci/ehci.h @@ -91,6 +91,11 @@ #error EHCI_CFG_FRAMELIST_SIZE_BITS must be from 0-7 #endif +//--------------------------------------------------------------------+ +// USBH-HCD API +//--------------------------------------------------------------------+ +void hcd_isr(uint8_t hostid); + //--------------------------------------------------------------------+ // EHCI Data Structure //--------------------------------------------------------------------+ diff --git a/tinyusb/tusb.c b/tinyusb/tusb.c index 6fbcd98f4..b45c7b601 100644 --- a/tinyusb/tusb.c +++ b/tinyusb/tusb.c @@ -41,15 +41,16 @@ tusb_error_t tusb_init(void) { - ASSERT_STATUS( hal_init() ) ; /* HARDWARE INIT */ + ASSERT_STATUS( hal_init() ) ; // hardware init #ifdef TUSB_CFG_HOST - ASSERT_STATUS( usbh_init() ); + ASSERT_STATUS( usbh_init() ); // host stack init #endif #ifdef TUSB_CFG_DEVICE - ASSERT_STATUS( dcd_init(0) ); + ASSERT_STATUS( dcd_init(0) ); // device stack init #endif return TUSB_ERROR_NONE; } +