summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--demos/bsp/boards/board_ea4357.c76
-rw-r--r--demos/bsp/boards/board_ea4357.h11
-rw-r--r--demos/device/keyboard/.cproject18
-rw-r--r--demos/device/keyboard/descriptors.h2
-rw-r--r--demos/device/keyboard/main.c6
-rw-r--r--tinyusb/class/cdc.c5
-rw-r--r--tinyusb/device/dcd.c2
-rw-r--r--tinyusb/hal/hal_lpc11uxx.h1
-rw-r--r--tinyusb/hal/hal_lpc13uxx.h2
-rw-r--r--tinyusb/hal/hal_lpc43xx.c2
-rw-r--r--tinyusb/hal/hal_lpc43xx.h1
-rw-r--r--tinyusb/tusb.h4
12 files changed, 88 insertions, 42 deletions
diff --git a/demos/bsp/boards/board_ea4357.c b/demos/bsp/boards/board_ea4357.c
index 90ac83aff..70b9fb7e2 100644
--- a/demos/bsp/boards/board_ea4357.c
+++ b/demos/bsp/boards/board_ea4357.c
@@ -39,35 +39,69 @@
#if BOARD == BOARD_EA4357
+#define UART_PORT LPC_USART0
+
+#if 0
+static const struct {
+ uint8_t port;
+ uint8_t pin;
+}leds[CFG_LED_NUMBER] = { {0, 8} };
+#endif
+
void board_init(void)
{
-// SystemInit();
-// SysTick_Config(SystemCoreClock / CFG_TICKS_PER_SECOND); // 1 msec tick timer
-// GPIOInit();
-//
-// // Leds Init
-// GPIOSetDir(CFG_LED_PORT, CFG_LED_PIN, 1);
-// LPC_GPIO->CLR[CFG_LED_PORT] = (1 << CFG_LED_PIN);
-//
-//#if CFG_UART_ENABLE
-// UARTInit(CFG_UART_BAUDRATE);
-//#endif
-//
-//#if CFG_PRINTF_TARGET == PRINTF_TARGET_SWO
+ SystemInit();
+ CGU_Init();
+
+ SysTick_Config(CGU_GetPCLKFrequency(CGU_PERIPHERAL_M4CORE) / CFG_TICKS_PER_SECOND); // 1 msec tick timer
+
+#if 0
+ // Leds Init
+ uint8_t i;
+ for (i=0; i<CFG_LED_NUMBER; i++)
+ {
+ scu_pinmux(leds[i].port, leds[i].pin, MD_PUP|MD_EZI|MD_ZI, 0); // MD_PDN
+ GPIO_SetDir(leds[i].port, BIT_(leds[i].pin), 1); // output
+ }
+#endif
+
+#if CFG_UART_ENABLE
+ // pinsel for UART
+ scu_pinmux(0xF ,10 , MD_PDN, FUNC1); // PF.10 : UART0_TXD
+ scu_pinmux(0xF ,11 , MD_PLN|MD_EZI|MD_ZI, FUNC1); // PF.11 : UART0_RXD
+
+ UART_CFG_Type UARTConfigStruct;
+ UART_ConfigStructInit(&UARTConfigStruct);
+ UARTConfigStruct.Baud_rate = CFG_UART_BAUDRATE;
+ UARTConfigStruct.Clock_Speed = 0;
+
+ UART_Init(UART_PORT, &UARTConfigStruct);
+ UART_TxCmd(UART_PORT, ENABLE); // Enable UART Transmit
+#endif
+
+#if CFG_PRINTF_TARGET == PRINTF_TARGET_SWO
+ tttt
// LPC_IOCON->PIO0_9 &= ~0x07; /* UART I/O config */
// LPC_IOCON->PIO0_9 |= 0x03; /* UART RXD */
-//#endif
+#endif
}
//--------------------------------------------------------------------+
// LEDS
//--------------------------------------------------------------------+
+void board_leds(uint32_t mask, uint32_t state) __attribute__ ((deprecated("not supported yet")));
void board_leds(uint32_t mask, uint32_t state)
{
-// if (mask)
-// {
-// GPIOSetBitValue(CFG_LED_PORT, CFG_LED_PIN, mask & state ? CFG_LED_ON : CFG_LED_OFF);
-// }
+#if 0
+ uint8_t i;
+ for(i=0; i<CFG_LED_NUMBER; i++)
+ {
+ if ( mask & BIT_(i) )
+ {
+ (mask & state) ? GPIO_SetValue(leds[i].port, BIT_(leds[i].pin)) : GPIO_ClearValue(leds[i].port, BIT_(leds[i].pin)) ;
+ }
+ }
+#endif
}
//--------------------------------------------------------------------+
@@ -76,14 +110,12 @@ void board_leds(uint32_t mask, uint32_t state)
#if CFG_UART_ENABLE
uint32_t board_uart_send(uint8_t *buffer, uint32_t length)
{
- UARTSend(buffer, length);
- return length;
+ return UART_Send(UART_PORT, buffer, length, BLOCKING);
}
uint32_t board_uart_recv(uint8_t *buffer, uint32_t length)
{
- *buffer = get_key();
- return 1;
+ return UART_Receive(UART_PORT, buffer, length, BLOCKING);
}
#endif
diff --git a/demos/bsp/boards/board_ea4357.h b/demos/bsp/boards/board_ea4357.h
index c38327af1..faab1f4e1 100644
--- a/demos/bsp/boards/board_ea4357.h
+++ b/demos/bsp/boards/board_ea4357.h
@@ -55,12 +55,17 @@
extern "C" {
#endif
-#define CFG_LED_PORT (0)
-#define CFG_LED_PIN (8)
+#include "LPC43xx.h"
+#include "lpc43xx_scu.h"
+#include "lpc43xx_cgu.h"
+#include "lpc43xx_gpio.h"
+#include "lpc43xx_uart.h"
+
+#define CFG_LED_NUMBER 0
#define CFG_LED_ON (1)
#define CFG_LED_OFF (0)
-#define CFG_PRINTF_TARGET PRINTF_TARGET_DEBUG_CONSOLE
+#define CFG_PRINTF_TARGET PRINTF_TARGET_UART
#ifdef __cplusplus
}
diff --git a/demos/device/keyboard/.cproject b/demos/device/keyboard/.cproject
index 7a1c5769e..be3fa9e00 100644
--- a/demos/device/keyboard/.cproject
+++ b/demos/device/keyboard/.cproject
@@ -30,7 +30,7 @@
<builder buildPath="${workspace_loc:/device_keyboard/Debug}" enableAutoBuild="false" enabledIncrementalBuild="true" errorParsers="org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.CWDLocator" id="com.crt.advproject.builder.exe.debug.1029932398" incrementalBuildTarget="all" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.debug"/>
<tool id="com.crt.advproject.cpp.exe.debug.1119457813" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.debug"/>
<tool command="arm-none-eabi-gcc" commandLinePattern="${COMMAND} ${FLAGS} ${CFLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" errorParsers="org.eclipse.cdt.core.GCCErrorParser" id="com.crt.advproject.gcc.exe.debug.2040685134" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.debug">
- <option id="com.crt.advproject.gcc.arch.658802474" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.arch.658802474" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm4" valueType="enumerated"/>
<option id="com.crt.advproject.gcc.thumb.697143257" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
<option id="gnu.c.compiler.option.preprocessor.def.symbols.371325215" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
<listOptionValue builtIn="false" value="__REDLIB__"/>
@@ -53,14 +53,14 @@
<inputType id="com.crt.advproject.compiler.input.932601394" superClass="com.crt.advproject.compiler.input"/>
</tool>
<tool command="arm-none-eabi-gcc" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" errorParsers="org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.gas.exe.debug.1050918013" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.debug">
- <option id="com.crt.advproject.gas.arch.1370417737" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.arch.1370417737" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm4" valueType="enumerated"/>
<option id="com.crt.advproject.gas.thumb.631765837" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
<option id="gnu.both.asm.option.flags.crt.1931019746" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED" valueType="string"/>
<inputType id="com.crt.advproject.assembler.input.1898367800" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
</tool>
<tool id="com.crt.advproject.link.cpp.exe.debug.290831412" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.debug"/>
<tool command="arm-none-eabi-gcc" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" errorParsers="org.eclipse.cdt.core.GLDErrorParser" id="com.crt.advproject.link.exe.debug.1506176667" name="MCU Linker" superClass="com.crt.advproject.link.exe.debug">
- <option id="com.crt.advproject.link.arch.1411471839" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.arch.1411471839" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm4" valueType="enumerated"/>
<option id="com.crt.advproject.link.thumb.897273840" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
<option id="com.crt.advproject.link.script.935550147" name="Linker script" superClass="com.crt.advproject.link.script" value="&quot;device_keyboard_Board_LPCXpresso1347.ld&quot;" valueType="string"/>
<option id="com.crt.advproject.link.manage.1693118885" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
@@ -685,7 +685,7 @@
<builder buildPath="${workspace_loc:/device_keyboard/Debug}" errorParsers="org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.CWDLocator" id="com.crt.advproject.builder.exe.debug.1603637140" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.debug"/>
<tool id="com.crt.advproject.cpp.exe.debug.1912680765" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.debug"/>
<tool command="arm-none-eabi-gcc" commandLinePattern="${COMMAND} ${FLAGS} ${CFLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" errorParsers="org.eclipse.cdt.core.GCCErrorParser" id="com.crt.advproject.gcc.exe.debug.901878888" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.debug">
- <option id="com.crt.advproject.gcc.arch.227583493" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm0" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.arch.227583493" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm4" valueType="enumerated"/>
<option id="com.crt.advproject.gcc.thumb.1429919562" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
<option id="gnu.c.compiler.option.preprocessor.def.symbols.690334585" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
<listOptionValue builtIn="false" value="__REDLIB__"/>
@@ -708,14 +708,14 @@
<inputType id="com.crt.advproject.compiler.input.1660235734" superClass="com.crt.advproject.compiler.input"/>
</tool>
<tool command="arm-none-eabi-gcc" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" errorParsers="org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.gas.exe.debug.1919954827" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.debug">
- <option id="com.crt.advproject.gas.arch.62277376" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm0" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.arch.62277376" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm4" valueType="enumerated"/>
<option id="com.crt.advproject.gas.thumb.567012827" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
<option id="gnu.both.asm.option.flags.crt.1544048579" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED" valueType="string"/>
<inputType id="com.crt.advproject.assembler.input.2112542401" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
</tool>
<tool id="com.crt.advproject.link.cpp.exe.debug.438186138" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.debug"/>
<tool command="arm-none-eabi-gcc" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" errorParsers="org.eclipse.cdt.core.GLDErrorParser" id="com.crt.advproject.link.exe.debug.332994381" name="MCU Linker" superClass="com.crt.advproject.link.exe.debug">
- <option id="com.crt.advproject.link.arch.5439507" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm0" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.arch.5439507" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm4" valueType="enumerated"/>
<option id="com.crt.advproject.link.thumb.1052282054" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
<option id="com.crt.advproject.link.script.1723865493" name="Linker script" superClass="com.crt.advproject.link.script" value="&quot;device_keyboard_Board_at86rf2xx.ld&quot;" valueType="string"/>
<option id="com.crt.advproject.link.manage.314167409" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
@@ -1344,7 +1344,8 @@
<option id="com.crt.advproject.gcc.thumb.1993301691" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
<option id="gnu.c.compiler.option.preprocessor.def.symbols.211439980" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
<listOptionValue builtIn="false" value="__REDLIB__"/>
- <listOptionValue builtIn="false" value="CORE_M0"/>
+ <listOptionValue builtIn="false" value="__USE_CMSIS=CMSISv2p10_LPC43xx_DriverLib"/>
+ <listOptionValue builtIn="false" value="CORE_M4"/>
<listOptionValue builtIn="false" value="MCU=MCU_LPC43XX"/>
<listOptionValue builtIn="false" value="BOARD=BOARD_EA4357"/>
<listOptionValue builtIn="false" value="DEBUG"/>
@@ -1353,7 +1354,6 @@
<option id="gnu.c.compiler.option.misc.other.2122594924" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
<option id="gnu.c.compiler.option.include.paths.1913705177" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/CMSISv2p10_LPC43xx_DriverLib/inc}&quot;"/>
- <listOptionValue builtIn="false" value="&quot;${workspace_loc:/CMSISv2p10_LPC43xx_DriverLib-M0/inc}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/bsp}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/tinyusb}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}&quot;"/>
@@ -1396,7 +1396,7 @@
</toolChain>
</folderInfo>
<sourceEntries>
- <entry excluding="bsp/lpc13uxx|bsp/lpc43xx|bsp/lpc11uxx" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
+ <entry excluding="bsp/lpc13uxx|bsp/lpc11uxx" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
</sourceEntries>
</configuration>
</storageModule>
diff --git a/demos/device/keyboard/descriptors.h b/demos/device/keyboard/descriptors.h
index 0fa68af10..528b0334e 100644
--- a/demos/device/keyboard/descriptors.h
+++ b/demos/device/keyboard/descriptors.h
@@ -45,7 +45,7 @@
#define USB_STRING_LEN(n) (2 + ((n)<<1))
-typedef PRE_PACK struct POST_PACK _USB_STR_DESCRIPTOR
+typedef ATTR_PREPACKED struct ATTR_PACKED _USB_STR_DESCRIPTOR
{
USB_COMMON_DESCRIPTOR LangID;
uint16_t strLangID[1];
diff --git a/demos/device/keyboard/main.c b/demos/device/keyboard/main.c
index b031312e4..19f2da104 100644
--- a/demos/device/keyboard/main.c
+++ b/demos/device/keyboard/main.c
@@ -26,9 +26,9 @@ int main(void)
current_tick += 1000;
board_leds(0x01, (current_tick/1000)%2); /* Toggle LED once per second */
- printf("hello world\n");
+ printf("tinyusb: " __DATE__ "\t" __TIME__ "\n");
- #ifndef TUSB_CFG_DEVICE_CDC
+ #if !(defined TUSB_CFG_DEVICE_CDC) && 0
if (usb_isConfigured())
{
#ifdef TUSB_CFG_DEVICE_HID_KEYBOARD
@@ -43,7 +43,7 @@ int main(void)
#endif
}
- #ifdef TUSB_CFG_DEVICE_CDC
+ #if defined TUSB_CFG_DEVICE_CDC && 0
if (usb_isConfigured())
{
uint8_t cdc_char;
diff --git a/tinyusb/class/cdc.c b/tinyusb/class/cdc.c
index 51dcc8bfb..5fc1cd5fd 100644
--- a/tinyusb/class/cdc.c
+++ b/tinyusb/class/cdc.c
@@ -316,8 +316,11 @@ TUSB_Error_t tusb_cdc_configured(USBD_HANDLE_T hUsb)
#elif MCU == MCU_LPC13UXX
fifo_init (&ffTX, qBuffer[0], CDC_BUFFER_SIZE, false, USB_IRQ_IRQn); // TX is non-overwritable
fifo_init (&ffRX, qBuffer[1], CDC_BUFFER_SIZE, true, USB_IRQ_IRQn); // RX is overwritable
+ #elif MCU == MCU_LPC43XX
+ fifo_init (&ffTX, qBuffer[0], CDC_BUFFER_SIZE, false, USB0_IRQn); // TODO USB1 TX is non-overwritable
+ fifo_init (&ffRX, qBuffer[1], CDC_BUFFER_SIZE, true, USB0_IRQn); // RX is overwritable
#else
- #error "usb_cdc.c: No MCU defined"
+ #error No MCU defined" // TODO asbtract MCU
#endif
return tERROR_NONE;
diff --git a/tinyusb/device/dcd.c b/tinyusb/device/dcd.c
index 8df95e131..de9e4f07d 100644
--- a/tinyusb/device/dcd.c
+++ b/tinyusb/device/dcd.c
@@ -93,7 +93,7 @@ TUSB_Error_t dcd_init(uint8_t coreid)
USBD_API_INIT_PARAM_T usb_param =
{
- .usb_reg_base = LPC_USB_BASE,
+ .usb_reg_base = DEVICE_ROM_REG_BASE,
.max_num_ep = USB_MAX_EP_NUM,
.mem_base = membase,
.mem_size = memsize,
diff --git a/tinyusb/hal/hal_lpc11uxx.h b/tinyusb/hal/hal_lpc11uxx.h
index b984afbc1..3d44d8742 100644
--- a/tinyusb/hal/hal_lpc11uxx.h
+++ b/tinyusb/hal/hal_lpc11uxx.h
@@ -54,6 +54,7 @@
#include "LPC11Uxx.h"
#define DEVICE_ROMDRIVER
+#define DEVICE_ROM_REG_BASE LPC_USB_BASE
#ifdef __cplusplus
extern "C" {
diff --git a/tinyusb/hal/hal_lpc13uxx.h b/tinyusb/hal/hal_lpc13uxx.h
index c360f2909..b24d774b6 100644
--- a/tinyusb/hal/hal_lpc13uxx.h
+++ b/tinyusb/hal/hal_lpc13uxx.h
@@ -54,7 +54,7 @@
#include "LPC13Uxx.h"
#define DEVICE_ROMDRIVER
-
+#define DEVICE_ROM_REG_BASE LPC_USB_BASE
#ifdef __cplusplus
extern "C" {
diff --git a/tinyusb/hal/hal_lpc43xx.c b/tinyusb/hal/hal_lpc43xx.c
index 2fcd885f5..2b60d29c3 100644
--- a/tinyusb/hal/hal_lpc43xx.c
+++ b/tinyusb/hal/hal_lpc43xx.c
@@ -43,7 +43,7 @@ TUSB_Error_t hal_init()
{
/* Set up USB0 clock */
CGU_EnableEntity(CGU_CLKSRC_PLL0, DISABLE); /* Disable PLL first */
- ASSERT_MESSAGE( CGU_SetPLL0() == CGU_ERROR_SUCCESS, tERROR_FAILED, "set PLL failed"); /* the usb core require output clock = 480MHz */
+ ASSERT_INT( CGU_ERROR_SUCCESS, CGU_SetPLL0(), tERROR_FAILED); /* the usb core require output clock = 480MHz */
CGU_EntityConnect(CGU_CLKSRC_XTAL_OSC, CGU_CLKSRC_PLL0);
CGU_EnableEntity(CGU_CLKSRC_PLL0, ENABLE); /* Enable PLL after all setting is done */
LPC_CREG->CREG0 &= ~(1<<5); /* Turn on the phy */
diff --git a/tinyusb/hal/hal_lpc43xx.h b/tinyusb/hal/hal_lpc43xx.h
index 2efd6da81..6fba59dfb 100644
--- a/tinyusb/hal/hal_lpc43xx.h
+++ b/tinyusb/hal/hal_lpc43xx.h
@@ -59,6 +59,7 @@
#endif
#define DEVICE_ROMDRIVER
+#define DEVICE_ROM_REG_BASE LPC_USB0_BASE // TODO USB1
static inline void hal_interrupt_enable()
{
diff --git a/tinyusb/tusb.h b/tinyusb/tusb.h
index 9eb153371..8d1fd66bc 100644
--- a/tinyusb/tusb.h
+++ b/tinyusb/tusb.h
@@ -58,6 +58,10 @@
#include "device/dcd.h"
#endif
+#if !(defined TUSB_CFG_HOST) && !(defined TUSB_CFG_DEVICE)
+ #error please enable either TUSB_CFG_HOST or TUSB_CFG_DEVICE
+#endif
+
#if DEVICE_CLASS_HID
#include "class/hid.h"
#endif