diff --git a/demos/bsp/boards/board.h b/demos/bsp/boards/board.h index da6be30c..237c346d 100644 --- a/demos/bsp/boards/board.h +++ b/demos/bsp/boards/board.h @@ -58,20 +58,25 @@ #include #include "common/binary.h" // This file is too good to not use -#define BOARD_AT86RF2XX 0 -#define BOARD_LPCXPRESSO1347 1 -#define BOARD_NGX4330 2 +#define BOARD_AT86RF2XX 1 +#define BOARD_LPCXPRESSO1347 2 +#define BOARD_NGX4330 3 +#define BOARD_EA4357 4 #define PRINTF_TARGET_DEBUG_CONSOLE 0 // IDE semihosting console #define PRINTF_TARGET_UART 1 #define PRINTF_TARGET_SWO 2 // aka SWV, ITM -#if BOARD == BOARD_NGX4330 +#if BOARD == 0 + #error BOARD is not defined or supported yet +#elif BOARD == BOARD_NGX4330 #include "board_ngx4330.h" #elif BOARD == BOARD_LPCXPRESSO1347 #include "board_lpcxpresso1347.h" #elif BOARD == BOARD_AT86RF2XX #include "board_at86rf2xx.h" +#elif BOARD == BOARD_EA4357 + #include "board_ea4357.h" #else #error BOARD is not defined or supported yet #endif diff --git a/demos/bsp/boards/board_ea4357.c b/demos/bsp/boards/board_ea4357.c new file mode 100644 index 00000000..90ac83af --- /dev/null +++ b/demos/bsp/boards/board_ea4357.c @@ -0,0 +1,90 @@ +/* + * board_ea4357.c + * + * Created on: Jan 17, 2013 + * Author: hathach + */ + +/* + * Software License Agreement (BSD License) + * Copyright (c) 2012, hathach (tinyusb.net) + * 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. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 tiny usb stack. + */ + +#include "board.h" + +#if BOARD == BOARD_EA4357 + +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 +// LPC_IOCON->PIO0_9 &= ~0x07; /* UART I/O config */ +// LPC_IOCON->PIO0_9 |= 0x03; /* UART RXD */ +//#endif +} + +//--------------------------------------------------------------------+ +// LEDS +//--------------------------------------------------------------------+ +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); +// } +} + +//--------------------------------------------------------------------+ +// UART +//--------------------------------------------------------------------+ +#if CFG_UART_ENABLE +uint32_t board_uart_send(uint8_t *buffer, uint32_t length) +{ + UARTSend(buffer, length); + return length; +} + +uint32_t board_uart_recv(uint8_t *buffer, uint32_t length) +{ + *buffer = get_key(); + return 1; +} +#endif + +#endif diff --git a/demos/bsp/boards/board_ea4357.h b/demos/bsp/boards/board_ea4357.h new file mode 100644 index 00000000..c38327af --- /dev/null +++ b/demos/bsp/boards/board_ea4357.h @@ -0,0 +1,71 @@ +/* + * board_ea4357.h + * + * Created on: Jan 17, 2013 + * Author: hathach + */ + +/* + * Software License Agreement (BSD License) + * Copyright (c) 2012, hathach (tinyusb.net) + * 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. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 tiny usb stack. + */ + +/** \file + * \brief TBD + * + * \note TBD + */ + +/** \ingroup TBD + * \defgroup TBD + * \brief TBD + * + * @{ + */ + +#ifndef _TUSB_BOARD_EA4357_H_ +#define _TUSB_BOARD_EA4357_H_ + +#ifdef __cplusplus + extern "C" { +#endif + +#define CFG_LED_PORT (0) +#define CFG_LED_PIN (8) +#define CFG_LED_ON (1) +#define CFG_LED_OFF (0) + +#define CFG_PRINTF_TARGET PRINTF_TARGET_DEBUG_CONSOLE + +#ifdef __cplusplus + } +#endif + +#endif /* _TUSB_BOARD_EA4357_H_ */ + +/** @} */ diff --git a/demos/device/keyboard/.cproject b/demos/device/keyboard/.cproject index b8689bdc..7a1c5769 100644 --- a/demos/device/keyboard/.cproject +++ b/demos/device/keyboard/.cproject @@ -1313,6 +1313,663 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1320,49 +1977,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/tinyusb/hal/hal.h b/tinyusb/hal/hal.h index 36fe9c5a..4c317302 100644 --- a/tinyusb/hal/hal.h +++ b/tinyusb/hal/hal.h @@ -58,9 +58,9 @@ #include "common/compiler/compiler.h" #include "common/errors.h" -#define MCU_LPC13UXX 0 -#define MCU_LPC11UXX 1 -#define MCU_LPC43XX 2 +#define MCU_LPC13UXX 1 +#define MCU_LPC11UXX 2 +#define MCU_LPC43XX 3 /** \brief USB hardware init * @@ -81,7 +81,9 @@ static inline void hal_interrupt_enable() ATTR_ALWAYS_INLINE; */ static inline void hal_interrupt_disable() ATTR_ALWAYS_INLINE; -#if MCU == MCU_LPC11UXX +#if MCU == 0 + #error MCU is not defined or supported +#elif MCU == MCU_LPC11UXX #include "hal_lpc11uxx.h" #elif MCU == MCU_LPC13UXX #include "hal_lpc13uxx.h" diff --git a/tinyusb/hal/hal_lpc43xx.h b/tinyusb/hal/hal_lpc43xx.h index d00d9fa4..2efd6da8 100644 --- a/tinyusb/hal/hal_lpc43xx.h +++ b/tinyusb/hal/hal_lpc43xx.h @@ -58,6 +58,8 @@ extern "C" { #endif +#define DEVICE_ROMDRIVER + static inline void hal_interrupt_enable() { // TODO support multiple controller later