summaryrefslogtreecommitdiff
path: root/tinyusb/hal
diff options
context:
space:
mode:
authorhathach <[email protected]>2013-05-25 16:03:40 +0700
committerhathach <[email protected]>2013-05-25 16:03:40 +0700
commitae02263d817a7b2f37c7e9c5026fd067b9d75fcc (patch)
tree6d3f39a6f2ecffbf955acc022785b099a0bbe6cf /tinyusb/hal
parent9b7f24bef27833d753217dcb76464aec7d15391e (diff)
add stub function to able to build device with EA4357
- dcd_controller_reset - dcd_controller_connect
Diffstat (limited to 'tinyusb/hal')
-rw-r--r--tinyusb/hal/hal.h4
-rw-r--r--tinyusb/hal/hal_lpc43xx.c19
2 files changed, 15 insertions, 8 deletions
diff --git a/tinyusb/hal/hal.h b/tinyusb/hal/hal.h
index 2e7cc55ea..d97f5463f 100644
--- a/tinyusb/hal/hal.h
+++ b/tinyusb/hal/hal.h
@@ -58,13 +58,15 @@
#include "common/compiler/compiler.h"
#if MCU == 0
- #error MCU is not defined or supported
+ #error MCU is not defined or supported yet
#elif MCU == MCU_LPC11UXX
#include "hal_lpc11uxx.h"
#elif MCU == MCU_LPC13UXX
#include "hal_lpc13uxx.h"
#elif MCU == MCU_LPC43XX
#include "hal_lpc43xx.h"
+#else
+ #error MCU is not defined or supported yet
#endif
#ifdef __cplusplus
diff --git a/tinyusb/hal/hal_lpc43xx.c b/tinyusb/hal/hal_lpc43xx.c
index 320be6fd7..2863aba0a 100644
--- a/tinyusb/hal/hal_lpc43xx.c
+++ b/tinyusb/hal/hal_lpc43xx.c
@@ -66,10 +66,12 @@ tusb_error_t hal_init(void)
// reset controller & set role
#if TUSB_CFG_CONTROLLER0_MODE & TUSB_MODE_HOST
- hcd_controller_reset(0); // TODO where to place prototype
- LPC_USB0->USBMODE_H = LPC43XX_USBMODE_HOST | (LPC43XX_USBMODE_VBUS_HIGH << 5);
+ hcd_controller_reset(0); // TODO where to place prototype
+ LPC_USB0->USBMODE_H = LPC43XX_USBMODE_HOST | (LPC43XX_USBMODE_VBUS_HIGH << 5);
#else // TODO OTG
- #error device mode is not supported
+ dcd_controller_reset(0);
+ LPC_USB0->USBMODE_D = LPC43XX_USBMODE_DEVICE;
+ dcd_controller_connect(0);
#endif
hal_interrupt_enable(0);
@@ -77,6 +79,7 @@ tusb_error_t hal_init(void)
//------------- USB1 Clock, only use on-chip FS PHY -------------//
#if TUSB_CFG_CONTROLLER1_MODE
+ // TODO confirm whether device mode require P2_5 or not
scu_pinmux(0x2, 5, MD_PLN | MD_EZI | MD_ZI, FUNC2); // USB1_VBUS monitor presence, must be high for bus reset occur
/* connect CLK_USB1 to 60 MHz clock */
@@ -85,10 +88,12 @@ tusb_error_t hal_init(void)
LPC_SCU->SFSUSB = (TUSB_CFG_CONTROLLER1_MODE & TUSB_MODE_HOST) ? 0x16 : 0x12; // enable USB1 with on-chip FS PHY
#if TUSB_CFG_CONTROLLER1_MODE & TUSB_MODE_HOST
- hcd_controller_reset(1); // TODO where to place prototype
- LPC_USB1->USBMODE_H = LPC43XX_USBMODE_HOST | (LPC43XX_USBMODE_VBUS_HIGH << 5);
- #else
-
+ hcd_controller_reset(1); // TODO where to place prototype
+ LPC_USB1->USBMODE_H = LPC43XX_USBMODE_HOST | (LPC43XX_USBMODE_VBUS_HIGH << 5);
+ #else // TODO OTG
+ dcd_controller_reset(1);
+ LPC_USB0->USBMODE_D = LPC43XX_USBMODE_DEVICE;
+ dcd_controller_connect(1);
#endif
LPC_USB1->PORTSC1_D |= (1<<24); // TODO abtract, force port to fullspeed