summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhathach <[email protected]>2018-12-05 08:47:23 +0700
committerhathach <[email protected]>2018-12-05 08:47:23 +0700
commitdd9c7b4249618cb8113b0a37226bc6947818ecf0 (patch)
treea2f3dcdef1337434a25bf0319e1668da6873a018 /src
parentfe8346e642c369ad0e0b5bbf3a10d8e7d16a10fc (diff)
lpc40xx device work, moving Chip_USB_Init out of tinyusb
Diffstat (limited to 'src')
-rw-r--r--src/portable/nxp/lpc17_40/dcd_lpc17_40.c2
-rw-r--r--src/portable/nxp/lpc17_40/hal_lpc17_40.c24
-rw-r--r--src/tusb_option.h4
3 files changed, 5 insertions, 25 deletions
diff --git a/src/portable/nxp/lpc17_40/dcd_lpc17_40.c b/src/portable/nxp/lpc17_40/dcd_lpc17_40.c
index 6ed1792ce..8504cbf51 100644
--- a/src/portable/nxp/lpc17_40/dcd_lpc17_40.c
+++ b/src/portable/nxp/lpc17_40/dcd_lpc17_40.c
@@ -103,7 +103,7 @@ typedef struct
} dcd_data_t;
-ATTR_ALIGNED(128) static dcd_data_t _dcd;
+CFG_TUSB_MEM_SECTION ATTR_ALIGNED(128) static dcd_data_t _dcd;
//--------------------------------------------------------------------+
diff --git a/src/portable/nxp/lpc17_40/hal_lpc17_40.c b/src/portable/nxp/lpc17_40/hal_lpc17_40.c
index cebddd883..70df70510 100644
--- a/src/portable/nxp/lpc17_40/hal_lpc17_40.c
+++ b/src/portable/nxp/lpc17_40/hal_lpc17_40.c
@@ -59,30 +59,6 @@ void tusb_hal_int_disable(uint8_t rhport)
//--------------------------------------------------------------------+
bool tusb_hal_init(void)
{
- enum {
- USBCLK_DEVCIE = 0x12, // AHB + Device
- USBCLK_HOST = 0x19, // AHB + Host + OTG (!)
- };
-
- Chip_USB_Init();
-
-#if MODE_HOST_SUPPORTED
- // TODO move pin config to BSP
- PINSEL_ConfigPin( &(PINSEL_CFG_Type) { .Portnum = 1, .Pinnum = 22, .Funcnum = 2} ); // P1.22 as USB_PWRD
- PINSEL_ConfigPin( &(PINSEL_CFG_Type) { .Portnum = 1, .Pinnum = 19, .Funcnum = 2} ); // P1.19 as USB_PPWR
-
- // Enable host
- LPC_USB->USBClkCtrl = USBCLK_HOST;
- while ((LPC_USB->USBClkSt & USBCLK_HOST) != USBCLK_HOST);
- LPC_USB->OTGClkSt = 0x3;
-#endif
-
-#if TUSB_OPT_DEVICE_ENABLED
- // Enable Device
- LPC_USB->USBClkCtrl = USBCLK_DEVCIE;
- while ((LPC_USB->USBClkSt & USBCLK_DEVCIE) != USBCLK_DEVCIE);
-#endif
-
return true;
}
diff --git a/src/tusb_option.h b/src/tusb_option.h
index d808a0518..c558b30ff 100644
--- a/src/tusb_option.h
+++ b/src/tusb_option.h
@@ -153,6 +153,10 @@
#define CFG_TUSB_MEM_SECTION
#endif
+#ifndef CFG_TUSB_MEM_ALIGN
+#define CFG_TUSB_MEM_ALIGN ATTR_ALIGNED(4)
+#endif
+
#ifndef CFG_TUSB_OS
#define CFG_TUSB_OS OPT_OS_NONE
#endif