diff --git a/demos/device/device_os_none/.cproject b/demos/device/device_os_none/.cproject
index 18b8d5a27..9175e195e 100644
--- a/demos/device/device_os_none/.cproject
+++ b/demos/device/device_os_none/.cproject
@@ -30,7 +30,7 @@
-
+
-
+
@@ -62,7 +62,7 @@
-
+
@@ -119,7 +119,7 @@
-
+
-
+
@@ -151,7 +151,7 @@
-
+
@@ -162,7 +162,7 @@
-
+
@@ -208,7 +208,7 @@
-
+
-
+
@@ -243,7 +243,7 @@
-
+
@@ -302,7 +302,7 @@
-
+
-
+
@@ -334,7 +334,7 @@
-
+
@@ -371,49 +371,45 @@
<?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_3="NXP" property_4="LPC11U37/401" property_count="5" version="1"/>
+<infoList vendor="NXP"><info chip="LPC11U37/401" match_id="0x00017C40" name="LPC11U37/401" stub="crt_emu_lpc11_13_nxp"><chip><name>LPC11U37/401</name>
+<family>LPC11Uxx</family>
<vendor>NXP (formerly Philips)</vendor>
<reset board="None" core="Real" sys="Real"/>
<clock changeable="TRUE" freq="12MHz" 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="Flash" id="MFlash128" location="0x0" size="0x20000"/>
<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"/>
-<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"/>
+<prog_flash blocksz="0x1000" location="0x0" maxprgbuff="0x400" progwithcode="TRUE" size="0x20000"/>
+<peripheralInstance derived_from="CM0_NVIC" id="NVIC" location="0xe000e000"/>
+<peripheralInstance derived_from="LPC11U_GPIO" id="GPIO" location="0x50000000"/>
+<peripheralInstance derived_from="LPC11U_USBDEV" id="USB" location="0x40080000"/>
+<peripheralInstance derived_from="CM0_DCR" id="DCR" location="0xe000edf0"/>
+<peripheralInstance derived_from="LPC11U_GPIO_GROUP_INT" id="GPIOGROUP0INT" location="0x40060000"/>
+<peripheralInstance derived_from="LPC11U_GPIO_GROUP_INT" id="GPIOGROUP1INT" location="0x4005c000"/>
+<peripheralInstance derived_from="LPC11U_GPIO_INT" id="GPIOINT" location="0x4004c000"/>
+<peripheralInstance derived_from="LPC11_13_SSP" id="SSP1" location="0x40058000"/>
+<peripheralInstance derived_from="LPC11U_FMC" id="FMC" location="0x4003c000"/>
+<peripheralInstance derived_from="LPC11U_SYSCTL" id="SYSCTL" location="0x40048000"/>
+<peripheralInstance derived_from="LPC11U_IOCON" id="IOCON" location="0x40044000"/>
+<peripheralInstance derived_from="LPC11_13_SSP" id="SSP0" location="0x40040000"/>
+<peripheralInstance derived_from="LPC11_13_PMU" id="PMU" location="0x40038000"/>
+<peripheralInstance derived_from="LPC11_13_ADC" id="ADC" location="0x4001c000"/>
+<peripheralInstance derived_from="LPC11_13_TIMER32" id="TIMER1" location="0x40018000"/>
+<peripheralInstance derived_from="LPC11_13_TIMER32" id="TIMER0" location="0x40014000"/>
+<peripheralInstance derived_from="LPC11_13_TIMER16" id="TMR161" location="0x40010000"/>
+<peripheralInstance derived_from="LPC11_13_TIMER16" id="TMR160" location="0x4000c000"/>
+<peripheralInstance derived_from="LPC1xxx_UART_MODEM" id="UART0" location="0x40008000"/>
+<peripheralInstance derived_from="LPC11_13_WDT" id="WDT" location="0x40004000"/>
+<peripheralInstance derived_from="LPC11_13_I2C" id="I2C0" location="0x40000000"/>
</chip>
-<processor><name gcc_name="cortex-m3">Cortex-M3</name>
+<processor><name gcc_name="cortex-m0">Cortex-M0</name>
<family>Cortex-M</family>
</processor>
-<link href="nxp_lpc13Uxx_peripheral.xme" show="embed" type="simple"/>
+<link href="nxp_lpc11_13_peripheral.xme" show="embed" type="simple"/>
</info>
</infoList>
</TargetConfig>
diff --git a/demos/device/device_os_none/tusb_config.h b/demos/device/device_os_none/tusb_config.h
index 35ea5ee72..d2c46b447 100644
--- a/demos/device/device_os_none/tusb_config.h
+++ b/demos/device/device_os_none/tusb_config.h
@@ -89,11 +89,11 @@
#define TUSB_CFG_DEVICE_CONTROL_ENDOINT_SIZE 64
//------------- CLASS -------------//
-#define TUSB_CFG_DEVICE_HID_KEYBOARD 1
-#define TUSB_CFG_DEVICE_HID_MOUSE 1
+#define TUSB_CFG_DEVICE_HID_KEYBOARD 0
+#define TUSB_CFG_DEVICE_HID_MOUSE 0
#define TUSB_CFG_DEVICE_HID_GENERIC 0
#define TUSB_CFG_DEVICE_MSC 0
-#define TUSB_CFG_DEVICE_CDC 0
+#define TUSB_CFG_DEVICE_CDC 1
//--------------------------------------------------------------------+
// COMMON CONFIGURATION
@@ -106,16 +106,14 @@
#define TUSB_CFG_OS_TICKS_PER_SECOND 1000
#ifdef __CODE_RED // make use of code red's support for ram region macros
- #if (MCU == MCU_LPC11UXX)
- #error
- #elif (MCU == MCU_LPC13UXX)
+ #if (MCU == MCU_LPC11UXX) || (MCU == MCU_LPC13UXX)
#define TUSB_RAM_SECTION ".data.$RAM2"
#elif (MCU == MCU_LPC43XX)
#define TUSB_RAM_SECTION ".data.$RAM3"
#elif (MCU == MCU_LPC175X_6X)
#define TUSB_RAM_SECTION ".data.$RAM2"
#else
- forgot something thach ?
+ #error Please define USB RAM section
#endif
#define TUSB_CFG_ATTR_USBRAM __attribute__ ((section(TUSB_RAM_SECTION)))
diff --git a/tinyusb/class/hid_device.c b/tinyusb/class/hid_device.c
index ec77ccc74..40a46cd03 100644
--- a/tinyusb/class/hid_device.c
+++ b/tinyusb/class/hid_device.c
@@ -121,12 +121,12 @@ tusb_error_t tusbd_hid_mouse_send(uint8_t coreid, hid_mouse_report_t const *p_re
//--------------------------------------------------------------------+
void hidd_init(void)
{
-
+ // TODO not implemented yet
}
void hidd_bus_reset(uint8_t coreid)
{
-
+ // TODO not implemented yet
}
tusb_error_t hidd_control_request(uint8_t coreid, tusb_control_request_t const * p_request)
diff --git a/tinyusb/class/msc_device.c b/tinyusb/class/msc_device.c
index 6e537810e..cd9e8eb68 100644
--- a/tinyusb/class/msc_device.c
+++ b/tinyusb/class/msc_device.c
@@ -56,9 +56,10 @@ typedef struct {
endpoint_handle_t edpt_in, edpt_out;
// must be in USB ram
- uint8_t max_lun;
- msc_cmd_block_wrapper_t cbw;
- msc_cmd_status_wrapper_t csw;
+ ATTR_USB_MIN_ALIGNMENT uint8_t max_lun;
+
+ ATTR_USB_MIN_ALIGNMENT msc_cmd_block_wrapper_t cbw;
+ ATTR_USB_MIN_ALIGNMENT msc_cmd_status_wrapper_t csw;
}mscd_interface_t;
STATIC_VAR mscd_interface_t mscd_data TUSB_CFG_ATTR_USBRAM;
@@ -69,6 +70,16 @@ STATIC_VAR mscd_interface_t mscd_data TUSB_CFG_ATTR_USBRAM;
//--------------------------------------------------------------------+
// USBD-CLASS API
//--------------------------------------------------------------------+
+void mscd_init(void)
+{
+ // TODO not implemented
+}
+
+void mscd_bus_reset(uint8_t coreid)
+{
+ // TODO not implemented yet
+}
+
tusb_error_t mscd_open(uint8_t coreid, tusb_descriptor_interface_t const * p_interface_desc, uint16_t *p_length)
{
ASSERT( ( MSC_SUBCLASS_SCSI == p_interface_desc->bInterfaceSubClass &&
diff --git a/tinyusb/class/msc_device.h b/tinyusb/class/msc_device.h
index a2d73945e..fd117da95 100644
--- a/tinyusb/class/msc_device.h
+++ b/tinyusb/class/msc_device.h
@@ -58,6 +58,8 @@ msc_csw_status_t tusbd_msc_scsi_received_isr (uint8_t coreid, uint8_t lun, uint8
//--------------------------------------------------------------------+
#ifdef _TINY_USB_SOURCE_FILE_
+void mscd_init(void);
+void mscd_bus_reset(uint8_t coreid);
tusb_error_t mscd_open(uint8_t coreid, tusb_descriptor_interface_t const * p_interface_desc, uint16_t *p_length);
tusb_error_t mscd_control_request(uint8_t coreid, tusb_control_request_t const * p_request);
void mscd_isr(endpoint_handle_t edpt_hdl, tusb_event_t event, uint32_t xferred_bytes);
diff --git a/tinyusb/device/dcd_lpc13uxx.c b/tinyusb/device/dcd_lpc_11uxx_13uxx.c
similarity index 93%
rename from tinyusb/device/dcd_lpc13uxx.c
rename to tinyusb/device/dcd_lpc_11uxx_13uxx.c
index 25739d31f..73d2f759a 100644
--- a/tinyusb/device/dcd_lpc13uxx.c
+++ b/tinyusb/device/dcd_lpc_11uxx_13uxx.c
@@ -1,6 +1,6 @@
/**************************************************************************/
/*!
- @file dcd_lpc13xx_12adc.c
+ @file dcd_lpc_11uxx_13uxx.c
@author hathach (tinyusb.org)
@section LICENSE
@@ -38,7 +38,7 @@
#include "tusb_option.h"
-#if MODE_DEVICE_SUPPORTED && MCU == MCU_LPC13UXX
+#if MODE_DEVICE_SUPPORTED && (MCU == MCU_LPC11UXX || MCU == MCU_LPC13UXX)
#define _TINY_USB_SOURCE_FILE_
//--------------------------------------------------------------------+
@@ -51,7 +51,7 @@
#include "dcd.h"
#include "usbd_dcd.h"
-#include "dcd_lpc13uxx.h"
+#include "dcd_lpc_11uxx_13uxx.h"
//--------------------------------------------------------------------+
// MACRO CONSTANT TYPEDEF
@@ -164,7 +164,6 @@ void dcd_controller_set_address(uint8_t coreid, uint8_t dev_addr)
LPC_USB->DEVCMDSTAT |= dev_addr;
}
-
tusb_error_t dcd_init(void)
{
LPC_USB->EPLISTSTART = (uint32_t) dcd_data.qhd;
@@ -226,7 +225,8 @@ void dcd_isr(uint8_t coreid)
}
- LPC_USB->DEVCMDSTAT |= CMDSTAT_MASK_RESET_CHANGE | CMDSTAT_MASK_SUSPEND_CHANGE | CMDSTAT_MASK_CONNECT_CHANGE;
+ LPC_USB->DEVCMDSTAT |= CMDSTAT_MASK_RESET_CHANGE | CMDSTAT_MASK_CONNECT_CHANGE
+ /* CMDSTAT_MASK_SUSPEND_CHANGE | */;
}
//------------- Control Endpoint -------------//
@@ -325,8 +325,22 @@ static inline uint8_t edpt_phy2log(uint8_t physical_endpoint)
//--------------------------------------------------------------------+
// BULK/INTERRUPT/ISOCHRONOUS PIPE API
//--------------------------------------------------------------------+
+tusb_error_t dcd_pipe_stall(endpoint_handle_t edpt_hdl)
+{
+ ASSERT( !dcd_pipe_is_busy(edpt_hdl), TUSB_ERROR_INTERFACE_IS_BUSY); // endpoint must not in transferring
+
+ dcd_data.qhd[edpt_hdl.index][0].stall = 1;
+
+ return TUSB_ERROR_NONE;
+}
+
tusb_error_t dcd_pipe_clear_stall(uint8_t coreid, uint8_t edpt_addr)
{
+ uint8_t ep_id = edpt_addr2phy(edpt_addr);
+
+ dcd_data.qhd[ep_id][0].stall = 0;
+ dcd_data.qhd[ep_id][0].toggle_reset = 1;
+
return TUSB_ERROR_NONE;
}
@@ -371,10 +385,10 @@ bool dcd_pipe_is_busy(endpoint_handle_t edpt_hdl)
// return TUSB_ERROR_NONE;
//}
-tusb_error_t dcd_pipe_queue_xfer(endpoint_handle_t edpt_hdl, void * buffer, uint16_t total_bytes)
-{
-
-}
+//tusb_error_t dcd_pipe_queue_xfer(endpoint_handle_t edpt_hdl, void * buffer, uint16_t total_bytes)
+//{
+//
+//}
tusb_error_t dcd_pipe_xfer(endpoint_handle_t edpt_hdl, void* buffer, uint16_t total_bytes, bool int_on_complete)
{
diff --git a/tinyusb/device/dcd_lpc13uxx.h b/tinyusb/device/dcd_lpc_11uxx_13uxx.h
similarity index 100%
rename from tinyusb/device/dcd_lpc13uxx.h
rename to tinyusb/device/dcd_lpc_11uxx_13uxx.h
diff --git a/tinyusb/device/usbd.c b/tinyusb/device/usbd.c
index 4f0b42a1b..d3480b370 100644
--- a/tinyusb/device/usbd.c
+++ b/tinyusb/device/usbd.c
@@ -124,6 +124,14 @@ tusb_error_t usbd_init (void)
{
ASSERT_STATUS ( dcd_init() );
+#if (TUSB_CFG_CONTROLLER_0_MODE & TUSB_MODE_DEVICE)
+ dcd_controller_connect(0);
+#endif
+
+#if (TUSB_CFG_CONTROLLER_1_MODE & TUSB_MODE_DEVICE)
+ dcd_controller_connect(1);
+#endif
+
for (tusb_std_class_code_t class_code = TUSB_CLASS_AUDIO; class_code <= TUSB_CLASS_AUDIO_VIDEO; class_code++)
{
if ( usbd_class_drivers[class_code].init )
diff --git a/tinyusb/hal/hal_lpc11uxx.c b/tinyusb/hal/hal_lpc11uxx.c
index 4395a705c..9cb188e9c 100644
--- a/tinyusb/hal/hal_lpc11uxx.c
+++ b/tinyusb/hal/hal_lpc11uxx.c
@@ -51,6 +51,7 @@ tusb_error_t hal_init(void)
address the wrong status in VBUSDebouncing bit in CmdStatus register. */
LPC_IOCON->PIO0_3 &= ~0x1F;
LPC_IOCON->PIO0_3 |= (0x01<<0); /* Secondary function VBUS */
+
LPC_IOCON->PIO0_6 &= ~0x07;
LPC_IOCON->PIO0_6 |= (0x01<<0); /* Secondary function SoftConn */
diff --git a/tinyusb/hal/hal_lpc11uxx.h b/tinyusb/hal/hal_lpc11uxx.h
index 65e75d46f..b9764ce65 100644
--- a/tinyusb/hal/hal_lpc11uxx.h
+++ b/tinyusb/hal/hal_lpc11uxx.h
@@ -36,12 +36,6 @@
*/
/**************************************************************************/
-/** \file
- * \brief TBD
- *
- * \note TBD
- */
-
/** \ingroup TBD
* \defgroup TBD
* \brief TBD
@@ -58,15 +52,15 @@
extern "C" {
#endif
-static inline void hal_interrupt_enable(uint8_t controller_id)
+static inline void hal_interrupt_enable(uint8_t coreid)
{
- (void) controller_id; // discard compiler's warning
+ (void) coreid; // discard compiler's warning
NVIC_EnableIRQ(USB_IRQn);
}
-static inline void hal_interrupt_disable(uint8_t controller_id)
+static inline void hal_interrupt_disable(uint8_t coreid)
{
- (void) controller_id; // discard compiler's warning
+ (void) coreid; // discard compiler's warning
NVIC_DisableIRQ(USB_IRQn);
}
diff --git a/tinyusb/hal/hal_lpc13uxx.c b/tinyusb/hal/hal_lpc13uxx.c
index fad4ea888..d4e3fa984 100644
--- a/tinyusb/hal/hal_lpc13uxx.c
+++ b/tinyusb/hal/hal_lpc13uxx.c
@@ -57,9 +57,6 @@ tusb_error_t hal_init(void)
LPC_IOCON->PIO0_6 &= ~0x07;
LPC_IOCON->PIO0_6 |= (0x01<<0); /* Secondary function SoftConn */
- dcd_controller_connect(0);
- hal_interrupt_enable(0);
-
return TUSB_ERROR_NONE;
}
diff --git a/tinyusb/hal/hal_lpc43xx.c b/tinyusb/hal/hal_lpc43xx.c
index fc7b78904..9cb07deff 100644
--- a/tinyusb/hal/hal_lpc43xx.c
+++ b/tinyusb/hal/hal_lpc43xx.c
@@ -81,7 +81,6 @@ tusb_error_t hal_init(void)
CGU_EntityConnect(CGU_CLKSRC_XTAL_OSC, CGU_CLKSRC_PLL0);
CGU_EnableEntity(CGU_CLKSRC_PLL0, ENABLE); /* Enable PLL after all setting is done */
-
// reset controller & set role
ASSERT_STATUS( hal_controller_reset(0) );
@@ -93,10 +92,7 @@ tusb_error_t hal_init(void)
#if TUSB_CFG_DEVICE_FULLSPEED // TODO for easy testing
LPC_USB0->PORTSC1_D |= (1<<24); // force full speed
#endif
- dcd_controller_connect(0);
#endif
-
- hal_interrupt_enable(0);
#endif
//------------- USB1 -------------//
@@ -114,11 +110,9 @@ tusb_error_t hal_init(void)
LPC_USB1->USBMODE_H = LPC43XX_USBMODE_HOST | (LPC43XX_USBMODE_VBUS_HIGH << 5);
#else // TODO OTG
LPC_USB1->USBMODE_D = LPC43XX_USBMODE_DEVICE;
- dcd_controller_connect(1);
#endif
LPC_USB1->PORTSC1_D |= (1<<24); // TODO abtract, force port to fullspeed
- hal_interrupt_enable(1);
#endif
return TUSB_ERROR_NONE;
diff --git a/tinyusb/mcu_capacity.h b/tinyusb/mcu_capacity.h
index 958a71f01..b5944ebed 100644
--- a/tinyusb/mcu_capacity.h
+++ b/tinyusb/mcu_capacity.h
@@ -78,10 +78,6 @@
#define CAP_MODE_HOST
#endif
-#if MCU == MCU_LPC43XX || MCU == MCU_LPC18XX || MCU == MCU_LPC11UXX || MCU == MCU_LPC13UXX
- #define CAP_DEVICE_ROMDRIVER
-#endif
-
//--------------------------------------------------------------------+
// Validation
//--------------------------------------------------------------------+
diff --git a/tinyusb/tusb.c b/tinyusb/tusb.c
index 695cc1d3d..800fa0a2d 100644
--- a/tinyusb/tusb.c
+++ b/tinyusb/tusb.c
@@ -52,6 +52,14 @@ tusb_error_t tusb_init(void)
ASSERT_STATUS ( usbd_init() ); // device stack init
#endif
+#if (TUSB_CFG_CONTROLLER_0_MODE)
+ hal_interrupt_enable(0);
+#endif
+
+#if (TUSB_CFG_CONTROLLER_1_MODE)
+ hal_interrupt_enable(1);
+#endif
+
return TUSB_ERROR_NONE;
}
diff --git a/tinyusb/tusb_option.h b/tinyusb/tusb_option.h
index 0280f026c..b356047ed 100644
--- a/tinyusb/tusb_option.h
+++ b/tinyusb/tusb_option.h
@@ -51,8 +51,8 @@
/** \defgroup MCU_ MCU Selection
* \brief TUSB_CFG_MCU must be defined to one of these
* @{ */
-#define MCU_LPC13UXX 1 ///< NXP LPC13xx 12 bit ADC family with USB on-chip Rom Driver (not supported yet)
-#define MCU_LPC13XX_10ADC 2 ///< NXP LPC13xx 10 bit ADC family (not supported yet)
+#define MCU_LPC13UXX 1 ///< NXP LPC13xx 12 bit ADC family with USB on-chip Rom Driver (not supported yet)
+#define MCU_LPC13XX 2 ///< NXP LPC13xx 10 bit ADC family (not supported yet)
#define MCU_LPC11UXX 3 ///< NXP LPC11Uxx family (not supported yet)
#define MCU_LPC43XX 4 ///< NXP LPC43xx family
#define MCU_LPC18XX 5 ///< NXP LPC18xx family (not supported yet)