diff --git a/demos/device/keyboard/.cproject b/demos/device/keyboard/.cproject
index e06b38e20..43e13515c 100644
--- a/demos/device/keyboard/.cproject
+++ b/demos/device/keyboard/.cproject
@@ -30,7 +30,7 @@
-
+
-
+
@@ -62,7 +62,7 @@
-
+
@@ -119,7 +119,7 @@
-
+
-
+
@@ -150,7 +150,7 @@
-
+
@@ -207,7 +207,7 @@
-
+
-
+
@@ -240,7 +240,7 @@
-
+
@@ -277,49 +277,82 @@
<?xml version="1.0" encoding="UTF-8"?>
<TargetConfig>
-<Properties property_0="" property_3="NXP" property_4="LPC1347" property_count="5" version="1"/>
-<infoList vendor="NXP"><info chip="LPC1347" match_id="0x08020543" name="LPC1347" stub="crt_emu_lpc11_13_nxp"><chip><name>LPC1347</name>
-<family>LPC13xx (12bit ADC)</family>
+<Properties property_0="" property_2="LPC18x7_43x7_2x512_BootA.cfx" property_3="NXP" property_4="LPC4357" property_count="5" version="1"/>
+<infoList vendor="NXP"><info chip="LPC4357" flash_driver="LPC18x7_43x7_2x512_BootA.cfx" match_id="0x0" name="LPC4357" stub="crt_emu_lpc18_43_nxp"><chip><name>LPC4357</name>
+<family>LPC43xx</family>
<vendor>NXP (formerly Philips)</vendor>
<reset board="None" core="Real" sys="Real"/>
-<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/>
+<clock changeable="TRUE" freq="20MHz" is_accurate="TRUE"/>
<memory can_program="true" id="Flash" is_ro="true" type="Flash"/>
<memory id="RAM" type="RAM"/>
<memory id="Periph" is_volatile="true" type="Peripheral"/>
-<memoryInstance derived_from="Flash" id="MFlash64" location="0x0" size="0x10000"/>
-<memoryInstance derived_from="RAM" id="RamLoc8" location="0x10000000" size="0x2000"/>
-<memoryInstance derived_from="RAM" id="RamUsb2" location="0x20004000" size="0x800"/>
-<memoryInstance derived_from="RAM" id="RamPeriph2" location="0x20000000" size="0x800"/>
-<prog_flash blocksz="0x1000" location="0x0" maxprgbuff="0x400" progwithcode="TRUE" size="0x10000"/>
+<memoryInstance derived_from="Flash" id="MFlashA512" location="0x1a000000" size="0x80000"/>
+<memoryInstance derived_from="Flash" id="MFlashB512" location="0x1b000000" size="0x80000"/>
+<memoryInstance derived_from="RAM" id="RamLoc32" location="0x10000000" size="0x8000"/>
+<memoryInstance derived_from="RAM" id="RamLoc40" location="0x10080000" size="0xa000"/>
+<memoryInstance derived_from="RAM" id="RamAHB32" location="0x20000000" size="0x8000"/>
+<memoryInstance derived_from="RAM" id="RamAHB16" location="0x20008000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="RamAHB_ETB16" location="0x2000c000" size="0x4000"/>
+<prog_flash blocksz="0x2000" location="0x1a000000" maxprgbuff="0x400" progwithcode="TRUE" size="0x10000"/>
+<prog_flash blocksz="0x10000" location="0x1a010000" maxprgbuff="0x400" progwithcode="TRUE" size="0x70000"/>
+<prog_flash blocksz="0x2000" location="0x1b000000" maxprgbuff="0x400" progwithcode="TRUE" size="0x10000"/>
+<prog_flash blocksz="0x10000" location="0x1b010000" maxprgbuff="0x400" progwithcode="TRUE" size="0x70000"/>
<peripheralInstance derived_from="V7M_MPU" id="MPU" location="0xe000ed90"/>
<peripheralInstance derived_from="V7M_NVIC" id="NVIC" location="0xe000e000"/>
<peripheralInstance derived_from="V7M_DCR" id="DCR" location="0xe000edf0"/>
<peripheralInstance derived_from="V7M_ITM" id="ITM" location="0xe0000000"/>
-<peripheralInstance derived_from="I2C" id="I2C" location="0x40000000"/>
-<peripheralInstance derived_from="WWDT" id="WWDT" location="0x40004000"/>
-<peripheralInstance derived_from="USART" id="USART" location="0x40008000"/>
-<peripheralInstance derived_from="CT16B0" id="CT16B0" location="0x4000c000"/>
-<peripheralInstance derived_from="CT16B1" id="CT16B1" location="0x40010000"/>
-<peripheralInstance derived_from="CT32B0" id="CT32B0" location="0x40014000"/>
-<peripheralInstance derived_from="CT32B1" id="CT32B1" location="0x40018000"/>
-<peripheralInstance derived_from="ADC" id="ADC" location="0x4001c000"/>
-<peripheralInstance derived_from="PMU" id="PMU" location="0x40038000"/>
-<peripheralInstance derived_from="FLASHCTRL" id="FLASHCTRL" location="0x4003c000"/>
-<peripheralInstance derived_from="SSP0" id="SSP0" location="0x40040000"/>
-<peripheralInstance derived_from="IOCON" id="IOCON" location="0x40044000"/>
-<peripheralInstance derived_from="SYSCON" id="SYSCON" location="0x40048000"/>
-<peripheralInstance derived_from="GPIO-PIN-INT" id="GPIO-PIN-INT" location="0x4004c000"/>
-<peripheralInstance derived_from="SSP1" id="SSP1" location="0x40058000"/>
-<peripheralInstance derived_from="GPIO-GROUP-INT0" id="GPIO-GROUP-INT0" location="0x4005c000"/>
-<peripheralInstance derived_from="GPIO-GROUP-INT1" id="GPIO-GROUP-INT1" location="0x40060000"/>
-<peripheralInstance derived_from="RITIMER" id="RITIMER" location="0x40064000"/>
-<peripheralInstance derived_from="USB" id="USB" location="0x40080000"/>
-<peripheralInstance derived_from="GPIO-PORT" id="GPIO-PORT" location="0x50000000"/>
+<peripheralInstance derived_from="SCT" id="SCT" location="0x40000000"/>
+<peripheralInstance derived_from="GPDMA" id="GPDMA" location="0x40002000"/>
+<peripheralInstance derived_from="SDMMC" id="SDMMC" location="0x40004000"/>
+<peripheralInstance derived_from="EMC" id="EMC" location="0x40005000"/>
+<peripheralInstance derived_from="USB0" id="USB0" location="0x40006000"/>
+<peripheralInstance derived_from="USB1" id="USB1" location="0x40007000"/>
+<peripheralInstance derived_from="LCD" id="LCD" location="0x40008000"/>
+<peripheralInstance derived_from="ETHERNET" id="ETHERNET" location="0x40010000"/>
+<peripheralInstance derived_from="ATIMER" id="ATIMER" location="0x40040000"/>
+<peripheralInstance derived_from="REGFILE" id="REGFILE" location="0x40041000"/>
+<peripheralInstance derived_from="PMC" id="PMC" location="0x40042000"/>
+<peripheralInstance derived_from="CREG" id="CREG" location="0x40043000"/>
+<peripheralInstance derived_from="EVENTROUTER" id="EVENTROUTER" location="0x40044000"/>
+<peripheralInstance derived_from="RTC" id="RTC" location="0x40046000"/>
+<peripheralInstance derived_from="CGU" id="CGU" location="0x40050000"/>
+<peripheralInstance derived_from="CCU1" id="CCU1" location="0x40051000"/>
+<peripheralInstance derived_from="CCU2" id="CCU2" location="0x40052000"/>
+<peripheralInstance derived_from="RGU" id="RGU" location="0x40053000"/>
+<peripheralInstance derived_from="WWDT" id="WWDT" location="0x40080000"/>
+<peripheralInstance derived_from="USART0" id="USART0" location="0x40081000"/>
+<peripheralInstance derived_from="USART2" id="USART2" location="0x400c1000"/>
+<peripheralInstance derived_from="USART3" id="USART3" location="0x400c2000"/>
+<peripheralInstance derived_from="UART1" id="UART1" location="0x40082000"/>
+<peripheralInstance derived_from="SSP0" id="SSP0" location="0x40083000"/>
+<peripheralInstance derived_from="SSP1" id="SSP1" location="0x400c5000"/>
+<peripheralInstance derived_from="TIMER0" id="TIMER0" location="0x40084000"/>
+<peripheralInstance derived_from="TIMER1" id="TIMER1" location="0x40085000"/>
+<peripheralInstance derived_from="TIMER2" id="TIMER2" location="0x400c3000"/>
+<peripheralInstance derived_from="TIMER3" id="TIMER3" location="0x400c4000"/>
+<peripheralInstance derived_from="SCU" id="SCU" location="0x40086000"/>
+<peripheralInstance derived_from="GPIO-PIN-INT" id="GPIO-PIN-INT" location="0x40087000"/>
+<peripheralInstance derived_from="GPIO-GROUP-INT0" id="GPIO-GROUP-INT0" location="0x40088000"/>
+<peripheralInstance derived_from="GPIO-GROUP-INT1" id="GPIO-GROUP-INT1" location="0x40089000"/>
+<peripheralInstance derived_from="MCPWM" id="MCPWM" location="0x400a0000"/>
+<peripheralInstance derived_from="I2C0" id="I2C0" location="0x400a1000"/>
+<peripheralInstance derived_from="I2C1" id="I2C1" location="0x400e0000"/>
+<peripheralInstance derived_from="I2S0" id="I2S0" location="0x400a2000"/>
+<peripheralInstance derived_from="I2S1" id="I2S1" location="0x400a3000"/>
+<peripheralInstance derived_from="C-CAN1" id="C-CAN1" location="0x400a4000"/>
+<peripheralInstance derived_from="RITIMER" id="RITIMER" location="0x400c0000"/>
+<peripheralInstance derived_from="QEI" id="QEI" location="0x400c6000"/>
+<peripheralInstance derived_from="GIMA" id="GIMA" location="0x400c7000"/>
+<peripheralInstance derived_from="DAC" id="DAC" location="0x400e1000"/>
+<peripheralInstance derived_from="C-CAN0" id="C-CAN0" location="0x400e2000"/>
+<peripheralInstance derived_from="ADC0" id="ADC0" location="0x400e3000"/>
+<peripheralInstance derived_from="ADC1" id="ADC1" location="0x400e4000"/>
+<peripheralInstance derived_from="GPIO-PORT" id="GPIO-PORT" location="0x400f4000"/>
</chip>
-<processor><name gcc_name="cortex-m3">Cortex-M3</name>
+<processor><name gcc_name="cortex-m4">Cortex-M4</name>
<family>Cortex-M</family>
</processor>
-<link href="nxp_lpc13Uxx_peripheral.xme" show="embed" type="simple"/>
+<link href="nxp_lpc43xx_peripheral.xme" show="embed" type="simple"/>
</info>
</infoList>
</TargetConfig>
diff --git a/demos/device/keyboard/main.c b/demos/device/keyboard/main.c
index c0f0b2ac0..f8af02c61 100644
--- a/demos/device/keyboard/main.c
+++ b/demos/device/keyboard/main.c
@@ -46,7 +46,7 @@ int main(void)
}
#if TUSB_CFG_DEVICE_CDC && 0
- if (usb_isConfigured())
+ if (tusb_device_is_configured())
{
uint8_t cdc_char;
if( tusb_cdc_getc(&cdc_char) )
@@ -93,7 +93,7 @@ void led_blinking_task(void * p_para)
#if TUSB_CFG_DEVICE_HID_KEYBOARD
void keyboard_device_app_task(void * p_para)
{
- if (usb_isConfigured())
+ if (tusb_device_is_configured())
{
static uint32_t count =0;
if (count < 4)
@@ -112,7 +112,7 @@ void keyboard_device_app_task(void * p_para)
#if TUSB_CFG_DEVICE_HID_MOUSE
void mouse_device_app_task(void * p_para)
{
- if (usb_isConfigured())
+ if (tusb_device_is_configured())
{
static uint32_t count =0;
if (count < 8)
diff --git a/tinyusb/device/dcd_lpc11uxx_lpc13xx.h b/tinyusb/device/dcd_lpc11uxx_lpc13xx.h
deleted file mode 100644
index aac9cf58f..000000000
--- a/tinyusb/device/dcd_lpc11uxx_lpc13xx.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/**************************************************************************/
-/*!
- @file dcd_lpc11uxx_lpc13xx.h
- @author hathach (tinyusb.org)
-
- @section LICENSE
-
- Software License Agreement (BSD License)
-
- Copyright (c) 2013, hathach (tinyusb.org)
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- 3. Neither the name of the copyright holders nor the
- names of its contributors may be used to endorse or promote products
- derived from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
- EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- This file is part of the tinyusb stack.
-*/
-/**************************************************************************/
-
-/** \ingroup TBD
- * \defgroup TBD
- * \brief TBD
- *
- * @{
- */
-
-#ifndef _TUSB_DCD_LPC11UXX_LPC13XX_H_
-#define _TUSB_DCD_LPC11UXX_LPC13XX_H_
-
-#define NXP_ROMDRIVER_REG_BASE LPC_USB_BASE
-#define NXP_ROMDRIVER_FUNCTION_ADDR 0x1FFF1FF8
-
-#ifdef __cplusplus
- extern "C" {
-#endif
-
-
-
-#ifdef __cplusplus
- }
-#endif
-
-#endif /* _TUSB_DCD_LPC11UXX_LPC13XX_H_ */
-
-/** @} */
diff --git a/tinyusb/device/dcd_lpc18xx_lpc43xx.h b/tinyusb/device/dcd_lpc18xx_lpc43xx.h
deleted file mode 100644
index e7bdfad7c..000000000
--- a/tinyusb/device/dcd_lpc18xx_lpc43xx.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/**************************************************************************/
-/*!
- @file dcd_lpc18xx_lpc43xx.h
- @author hathach (tinyusb.org)
-
- @section LICENSE
-
- Software License Agreement (BSD License)
-
- Copyright (c) 2013, hathach (tinyusb.org)
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- 3. Neither the name of the copyright holders nor the
- names of its contributors may be used to endorse or promote products
- derived from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
- EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- This file is part of the tinyusb stack.
-*/
-/**************************************************************************/
-
-/** \ingroup TBD
- * \defgroup TBD
- * \brief TBD
- *
- * @{
- */
-
-#ifndef _TUSB_DCD_LPC18XX_LPC43XX_H_
-#define _TUSB_DCD_LPC18XX_LPC43XX_H_
-
-#ifdef __cplusplus
- extern "C" {
-#endif
-
-#define NXP_ROMDRIVER_REG_BASE LPC_USB0_BASE // TODO USB1
-#define NXP_ROMDRIVER_FUNCTION_ADDR 0x1040011C
-
-#ifdef __cplusplus
- }
-#endif
-
-#endif /* _TUSB_DCD_LPC18XX_LPC43XX_H_ */
-
-/** @} */
diff --git a/tinyusb/device/dcd_nxp_romdriver.c b/tinyusb/device/dcd_nxp_romdriver.c
index fb3084953..c0fcd64c0 100644
--- a/tinyusb/device/dcd_nxp_romdriver.c
+++ b/tinyusb/device/dcd_nxp_romdriver.c
@@ -112,15 +112,12 @@ ErrorCode_t USB_Error_Event (USBD_HANDLE_T hUsb, uint32_t param1)
tusb_error_t dcd_init(void)
{
- uint32_t membase = (uint32_t) usb_RomDriver_buffer;
- uint32_t memsize = USB_ROM_SIZE;
-
USBD_API_INIT_PARAM_T usb_param =
{
.usb_reg_base = NXP_ROMDRIVER_REG_BASE,
.max_num_ep = USB_MAX_EP_NUM,
- .mem_base = membase,
- .mem_size = memsize,
+ .mem_base = (uint32_t) usb_RomDriver_buffer,
+ .mem_size = USB_ROM_SIZE,
.USB_Configure_Event = USB_Configure_Event,
.USB_Reset_Event = USB_Reset_Event,
@@ -141,13 +138,13 @@ tusb_error_t dcd_init(void)
ASSERT_INT(LPC_OK, ROM_API->hw->Init(&romdriver_hdl, &desc_core, &usb_param), TUSB_ERROR_FAILED);
// TODO need to confirm the mem_size is reduced by the number of byte used
- membase += (memsize - usb_param.mem_size);
- memsize = usb_param.mem_size;
+// membase += (memsize - usb_param.mem_size);
+// memsize = usb_param.mem_size;
return TUSB_ERROR_NONE;
}
-bool usb_isConfigured(void)
+bool tusb_device_is_configured(void)
{
return usbd_info.state == TUSB_DEVICE_STATE_CONFIGURED;
}
diff --git a/tinyusb/device/dcd_nxp_romdriver.h b/tinyusb/device/dcd_nxp_romdriver.h
index e33c45186..f6f12686a 100644
--- a/tinyusb/device/dcd_nxp_romdriver.h
+++ b/tinyusb/device/dcd_nxp_romdriver.h
@@ -56,11 +56,9 @@
#define USB_MAX_IF_NUM 8 // maximum interface number supported, should be fixed to 8
#if (MCU == MCU_LPC18XX) || (MCU == MCU_LPC43XX)
- #include "dcd_lpc18xx_lpc43xx.h"
#define ROM_API ( * ((USBD_API_T**) NXP_ROMDRIVER_FUNCTION_ADDR) )
#define USB_MAX_EP_NUM 6
#elif (MCU == MCU_LPC13UXX) || (MCU == MCU_LPC11UXX)
- #include "dcd_lpc11uxx_lpc13xx.h"
#define ROM_API ( * (*((USBD_API_T***) NXP_ROMDRIVER_FUNCTION_ADDR)) )
#define USB_MAX_EP_NUM 5
#else
diff --git a/tinyusb/hal/hal_lpc11uxx.h b/tinyusb/hal/hal_lpc11uxx.h
index 77d03e3fb..e4841af3c 100644
--- a/tinyusb/hal/hal_lpc11uxx.h
+++ b/tinyusb/hal/hal_lpc11uxx.h
@@ -54,6 +54,9 @@
#include "LPC11Uxx.h"
+#define NXP_ROMDRIVER_REG_BASE LPC_USB_BASE
+#define NXP_ROMDRIVER_FUNCTION_ADDR 0x1FFF1FF8
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/tinyusb/hal/hal_lpc13uxx.h b/tinyusb/hal/hal_lpc13uxx.h
index 259f9de11..86d8d87a7 100644
--- a/tinyusb/hal/hal_lpc13uxx.h
+++ b/tinyusb/hal/hal_lpc13uxx.h
@@ -54,6 +54,9 @@
#include "LPC13Uxx.h"
+#define NXP_ROMDRIVER_REG_BASE LPC_USB_BASE
+#define NXP_ROMDRIVER_FUNCTION_ADDR 0x1FFF1FF8
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/tinyusb/hal/hal_lpc43xx.h b/tinyusb/hal/hal_lpc43xx.h
index 77a0332de..5cb2bbbbe 100644
--- a/tinyusb/hal/hal_lpc43xx.h
+++ b/tinyusb/hal/hal_lpc43xx.h
@@ -54,6 +54,9 @@
#include "LPC43xx.h"
+#define NXP_ROMDRIVER_REG_BASE LPC_USB0_BASE // TODO USB1
+#define NXP_ROMDRIVER_FUNCTION_ADDR 0x1040011C
+
#ifdef __cplusplus
extern "C" {
#endif