From 4ec23ea786117b338dd8c070df1da15b27e98f3c Mon Sep 17 00:00:00 2001 From: hathach Date: Mon, 10 Dec 2012 15:59:10 +0700 Subject: add build and project settings for lpc43xx --- demos/bsp/boards/board.h | 4 +- demos/bsp/boards/board_ngx4330.c | 95 +++++++++++++++++++++ demos/bsp/boards/board_ngx43xx.c | 95 --------------------- demos/device/keyboard/.cproject | 4 +- tinyusb/.cproject | 180 ++++++++++++++++++++++++++++++++++++++- tinyusb/hal/hal.h | 3 +- tinyusb/hal/hal_lpc11uxx.h | 3 - tinyusb/hal/hal_lpc13uxx.h | 3 - tinyusb/tusb_cfg.h | 4 +- 9 files changed, 282 insertions(+), 109 deletions(-) create mode 100644 demos/bsp/boards/board_ngx4330.c delete mode 100644 demos/bsp/boards/board_ngx43xx.c diff --git a/demos/bsp/boards/board.h b/demos/bsp/boards/board.h index 74030f2f0..80051e14c 100644 --- a/demos/bsp/boards/board.h +++ b/demos/bsp/boards/board.h @@ -64,11 +64,11 @@ #define BIT_(n) (1 << (n)) #endif -#define BOARD_NGX43XX 1 +#define BOARD_NGX4330 1 #define BOARD_LPCXPRESSO1347 2 #define BOARD_AT86RF2XX 3 -#if BOARD == BOARD_NGX43XX +#if BOARD == BOARD_NGX4330 #elif BOARD == BOARD_LPCXPRESSO1347 diff --git a/demos/bsp/boards/board_ngx4330.c b/demos/bsp/boards/board_ngx4330.c new file mode 100644 index 000000000..d9ffc5cbf --- /dev/null +++ b/demos/bsp/boards/board_ngx4330.c @@ -0,0 +1,95 @@ +/* + * board_ngx4330.c + * + * Created on: Dec 4, 2012 + * 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_NGX4330 + +#include "lpc43xx_uart.h" +#include "lpc43xx_scu.h" +#include "lpc43xx_cgu.h" +#include "lpc43xx_gpio.h" +#include "lpc43xx_timer.h" +#include "lpc43xx_i2c.h" +#include "lpc43xx_gpdma.h" +#include "lpc43xx_i2s.h" +#include "lpc43xx_emc.h" + +#define BOARD_MAX_LEDS 2 +const static struct { + uint8_t port; + uint8_t pin; +}leds[BOARD_MAX_LEDS] = { {1, 11}, {1,12} }; + +void board_init(void) +{ + CGU_Init(); + SysTick_Config( CGU_GetPCLKFrequency(CGU_PERIPHERAL_M4CORE)/1000 ); /* 1 ms Timer */ + + /* Turn on 5V USB VBUS TODO Should be Host-only */ + scu_pinmux(0x2, 6, MD_PUP | MD_EZI, FUNC4); // P2_6 USB1_PWR_EN, USB1 VBus function + scu_pinmux(0x2, 5, MD_PLN | MD_EZI | MD_ZI, FUNC2); // P2_5 USB1_VBUS, MUST CONFIGURE THIS SIGNAL FOR USB1 NORMAL OPERATION + + /* Turn on 5V USB VBUS TODO Should be Host-only */ +#if 1 //(BOARD == BOARD_XPLORER) + scu_pinmux(0x1, 7, MD_PUP | MD_EZI, FUNC4); // P1_7 USB0_PWR_EN, USB0 VBus function Xplorer +#else + scu_pinmux(0x2, 3, MD_PUP | MD_EZI, FUNC7); // P2_3 USB0_PWR_EN, USB0 VBus function Farnell +#endif + + // Leds Init + uint8_t i; + for (i=0; i - + @@ -728,7 +728,7 @@ - + diff --git a/tinyusb/.cproject b/tinyusb/.cproject index 4a33ccbad..06a0c2b48 100644 --- a/tinyusb/.cproject +++ b/tinyusb/.cproject @@ -202,7 +202,7 @@ - + @@ -357,6 +357,184 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tinyusb/hal/hal.h b/tinyusb/hal/hal.h index 10fcc6155..467f75f37 100644 --- a/tinyusb/hal/hal.h +++ b/tinyusb/hal/hal.h @@ -82,8 +82,9 @@ static inline void hal_interrupt_disable() ATTR_ALWAYS_INLINE; #elif MCU == MCU_LPC13UXX #include "hal_lpc13uxx.h" #elif MCU == MCU_LPC43XX - + #include "hal_lpc43xx.h" #endif + #ifdef __cplusplus } #endif diff --git a/tinyusb/hal/hal_lpc11uxx.h b/tinyusb/hal/hal_lpc11uxx.h index f65f95ad0..1f1d6779e 100644 --- a/tinyusb/hal/hal_lpc11uxx.h +++ b/tinyusb/hal/hal_lpc11uxx.h @@ -63,9 +63,6 @@ static inline void hal_interrupt_enable() NVIC_EnableIRQ(USB_IRQn); } -/** - * Disable USB Interrupt - */ static inline void hal_interrupt_disable() { NVIC_DisableIRQ(USB_IRQn); diff --git a/tinyusb/hal/hal_lpc13uxx.h b/tinyusb/hal/hal_lpc13uxx.h index 795782fc3..f29bab7b9 100644 --- a/tinyusb/hal/hal_lpc13uxx.h +++ b/tinyusb/hal/hal_lpc13uxx.h @@ -62,9 +62,6 @@ static inline void hal_interrupt_enable() NVIC_EnableIRQ(USB_IRQ_IRQn); } -/** - * Disable USB Interrupt - */ static inline void hal_interrupt_disable() { NVIC_DisableIRQ(USB_IRQ_IRQn); diff --git a/tinyusb/tusb_cfg.h b/tinyusb/tusb_cfg.h index efb236cef..6cda15830 100644 --- a/tinyusb/tusb_cfg.h +++ b/tinyusb/tusb_cfg.h @@ -57,10 +57,10 @@ #define CFG_TUSB_DEBUG_LEVEL 3 /// Enable Host Support -//#define CFG_TUSB_HOST +#define CFG_TUSB_HOST /// Enable Device Support -#define CFG_TUSB_DEVICE +//#define CFG_TUSB_DEVICE /// Enable CDC Support #define CFG_CLASS_CDC -- cgit v1.3.1