diff options
| author | hathach <[email protected]> | 2018-12-03 23:46:28 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2018-12-03 23:46:28 +0700 |
| commit | 819a03c14d851395dc233559b4859f6964804e45 (patch) | |
| tree | 2d3e51353bdaf9fa2f269abb4c8141d24d98bd0d | |
| parent | 3a573fdd892a58b1bf1dfc685a92e2f2ac57bf36 (diff) | |
clean up
| -rw-r--r-- | hw/bsp/keil/board_mcb4300.c | 154 | ||||
| -rw-r--r-- | hw/bsp/keil/board_mcb4300.h | 59 | ||||
| -rw-r--r-- | hw/bsp/lpcxpresso/board_lpclink2.c | 126 | ||||
| -rw-r--r-- | hw/bsp/lpcxpresso/board_lpclink2.h | 59 | ||||
| -rw-r--r-- | hw/bsp/lpcxpresso/board_lpcxpresso11u14.c | 131 | ||||
| -rw-r--r-- | hw/bsp/lpcxpresso/board_lpcxpresso11u14.h | 54 | ||||
| -rw-r--r-- | hw/bsp/ngx/board_ngx4330.c | 158 | ||||
| -rw-r--r-- | hw/bsp/ngx/board_ngx4330.h | 59 | ||||
| -rw-r--r-- | hw/bsp/readme.md | 5 |
9 files changed, 2 insertions, 803 deletions
diff --git a/hw/bsp/keil/board_mcb4300.c b/hw/bsp/keil/board_mcb4300.c deleted file mode 100644 index 1cd8b070e..000000000 --- a/hw/bsp/keil/board_mcb4300.c +++ /dev/null @@ -1,154 +0,0 @@ -/**************************************************************************/ -/*! - @file board_mcb4300.c - @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. -*/ -/**************************************************************************/ - -#include "../board.h" - -#ifdef BOARD_MCB4300 - -//--------------------------------------------------------------------+ -// INCLUDE -//--------------------------------------------------------------------+ -#define BOARD_MAX_LEDS 8 - -#define BOARD_UART_PORT LPC_USART0 -#define BOARD_UART_PIN_PORT 2 -#define BOARD_UART_PIN_TX 0 -#define BOARD_UART_PIN_RX 1 - -//--------------------------------------------------------------------+ -// MACRO CONSTANT TYPEDEF -//--------------------------------------------------------------------+ -static const uint8_t ledports[] = {6, 6, 6, 6, 6, 4, 4, 4}; -static const uint8_t ledbits[] = {24, 25, 26, 27, 28, 12, 13, 14}; - -const static struct { - uint8_t port; - uint8_t pin; -}leds[BOARD_MAX_LEDS] = { - {6, 24}, {6, 25}, {6, 26}, {6, 27}, - {4, 28}, {4, 12}, {4, 13}, {4, 14}}; - -//--------------------------------------------------------------------+ -// INTERNAL OBJECT & FUNCTION DECLARATION -//--------------------------------------------------------------------+ - -//--------------------------------------------------------------------+ -// IMPLEMENTATION -//--------------------------------------------------------------------+ -void board_init(void) -{ - CGU_Init(); - -#if CFG_TUSB_OS == OPT_OS_NONE // TODO may move to main.c - SysTick_Config(CGU_GetPCLKFrequency(CGU_PERIPHERAL_M4CORE) / BOARD_TICKS_HZ); // 1 msec tick timer -#endif - - //------------- USB Bus power HOST ONLY-------------// - // Keil VBUS0 is P6_3 - scu_pinmux(0x6, 3, MD_PUP | MD_EZI, FUNC1); // P6_3 USB0_PWR_EN, USB0 VBus function - - // Keil VBUS1 is P9_5 - scu_pinmux(0x9, 5, MD_PUP | MD_EZI, FUNC2); // P9_5 USB1_PWR_EN, USB1 VBus function - - //------------- LEDs init, J21 must be installed -------------// - LPC_SCU->SFSPD_10 = 4; // GPIO6[24] - LPC_SCU->SFSPD_11 = 4; // GPIO6[25] - LPC_SCU->SFSPD_12 = 4; // GPIO6[26] - LPC_SCU->SFSPD_13 = 4; // GPIO6[27] - LPC_SCU->SFSPD_14 = 4; // GPIO6[28] - LPC_SCU->SFSP9_0 = 0; // GPIO4[12] - LPC_SCU->SFSP9_1 = 0; // GPIO4[13] - LPC_SCU->SFSP9_2 = 0; // GPIO4[14] - - for(uint32_t i=0; i<BOARD_MAX_LEDS; i++) - { - GPIO_SetDir(leds[i].port, BIT_(leds[i].pin), 1); // output - } - - //------------- UART -------------// - scu_pinmux(BOARD_UART_PIN_PORT, BOARD_UART_PIN_TX, MD_PDN , FUNC1); - scu_pinmux(BOARD_UART_PIN_PORT, BOARD_UART_PIN_RX, MD_PLN|MD_EZI|MD_ZI, FUNC1); - - UART_CFG_Type UARTConfigStruct; - UART_ConfigStructInit(&UARTConfigStruct); - UARTConfigStruct.Baud_rate = CFG_UART_BAUDRATE; - UARTConfigStruct.Clock_Speed = 0; - - UART_Init(BOARD_UART_PORT, &UARTConfigStruct); - UART_TxCmd(BOARD_UART_PORT, ENABLE); // Enable UART Transmit -} - -//--------------------------------------------------------------------+ -// LEDS -//--------------------------------------------------------------------+ -void board_leds(uint32_t on_mask, uint32_t off_mask) -{ - for (uint32_t i=0; i<BOARD_MAX_LEDS; i++) - { - if ( on_mask & BIT_(i)) - { - GPIO_SetValue(leds[i].port, BIT_(leds[i].pin)); - }else if ( off_mask & BIT_(i)) // on_mask take precedence over off_mask - { - GPIO_ClearValue(leds[i].port, BIT_(leds[i].pin)); - } - } -} - -//--------------------------------------------------------------------+ -// BUTTONS -//--------------------------------------------------------------------+ -uint32_t board_buttons(void) -{ - return 0; // TODO buttons for mcb4300 -} - -//--------------------------------------------------------------------+ -// UART -//--------------------------------------------------------------------+ -uint8_t board_uart_getchar(void) -{ - return UART_ReceiveByte(BOARD_UART_PORT); -} - -void board_uart_putchar(uint8_t c) -{ - UART_Send(BOARD_UART_PORT, &c, 1, BLOCKING); -} - -#endif diff --git a/hw/bsp/keil/board_mcb4300.h b/hw/bsp/keil/board_mcb4300.h deleted file mode 100644 index b414e142a..000000000 --- a/hw/bsp/keil/board_mcb4300.h +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************/ -/*! - @file board_mcb4300.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. -*/ -/**************************************************************************/ - -#ifndef _TUSB_BOARD_MCB4300_H_ -#define _TUSB_BOARD_MCB4300_H_ - -#include "LPC43xx.h" -#include "lpc43xx_scu.h" -#include "lpc43xx_cgu.h" -#include "lpc43xx_gpio.h" -#include "lpc43xx_uart.h" - -#ifdef __cplusplus - extern "C" { -#endif - -#define CFG_PRINTF_TARGET PRINTF_TARGET_UART - - -#ifdef __cplusplus - } -#endif - -#endif /* _TUSB_BOARD_MCB4300_H_ */ diff --git a/hw/bsp/lpcxpresso/board_lpclink2.c b/hw/bsp/lpcxpresso/board_lpclink2.c deleted file mode 100644 index ea2610f55..000000000 --- a/hw/bsp/lpcxpresso/board_lpclink2.c +++ /dev/null @@ -1,126 +0,0 @@ -/**************************************************************************/ -/*! - @file board_lpclink2.c - @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. -*/ -/**************************************************************************/ - -#include "../board.h" - -#if BOARD == BOARD_LPCLINK2 - -#define BOARD_UART_PORT LPC_USART0 -#define BOARD_UART_PIN_PORT 0x0f -#define BOARD_UART_PIN_TX 10 // PF.10 : UART0_TXD -#define BOARD_UART_PIN_RX 11 // PF.11 : UART0_RXD - -#define BOARD_MAX_LEDS 1 - -const static struct { - uint8_t port; - uint8_t pin; -}leds[BOARD_MAX_LEDS] = { {0, 8} }; - -void board_init(void) -{ - CGU_Init(); - -#if CFG_TUSB_OS == OPT_OS_NONE // TODO may move to main.c - SysTick_Config(CGU_GetPCLKFrequency(CGU_PERIPHERAL_M4CORE) / BOARD_TICKS_HZ); // 1 msec tick timer -#endif - - //------------- USB -------------// - - - //------------- LED -------------// - for (uint8_t i=0; i<BOARD_MAX_LEDS; i++) - { - scu_pinmux(leds[i].port, leds[i].pin, MD_PUP|MD_EZI|MD_ZI, FUNC0); - GPIO_SetDir(leds[i].port, BIT_(leds[i].pin), 1); // output - } - - -#if CFG_UART_ENABLE - //------------- UART -------------// - scu_pinmux(BOARD_UART_PIN_PORT, BOARD_UART_PIN_TX, MD_PDN, FUNC1); - scu_pinmux(BOARD_UART_PIN_PORT, BOARD_UART_PIN_RX, MD_PLN | MD_EZI | MD_ZI, FUNC1); - - UART_CFG_Type UARTConfigStruct; - UART_ConfigStructInit(&UARTConfigStruct); - UARTConfigStruct.Baud_rate = CFG_UART_BAUDRATE; - UARTConfigStruct.Clock_Speed = 0; - - UART_Init(BOARD_UART_PORT, &UARTConfigStruct); - UART_TxCmd(BOARD_UART_PORT, ENABLE); // Enable UART Transmit -#endif -} - -//--------------------------------------------------------------------+ -// LEDS -//--------------------------------------------------------------------+ -void board_leds(uint32_t on_mask, uint32_t off_mask) -{ - for (uint32_t i=0; i<BOARD_MAX_LEDS; i++) - { - if ( on_mask & BIT_(i)) - { - GPIO_SetValue(leds[i].port, BIT_(leds[i].pin)); - }else if ( off_mask & BIT_(i)) // on_mask take precedence over off_mask - { - GPIO_ClearValue(leds[i].port, BIT_(leds[i].pin)); - } - } -} - -//--------------------------------------------------------------------+ -// UART -//--------------------------------------------------------------------+ -#if CFG_UART_ENABLE -uint32_t board_uart_send(uint8_t *buffer, uint32_t length) -{ - return UART_Send(BOARD_UART_PORT, buffer, length, BLOCKING); -} - -uint32_t board_uart_recv(uint8_t *buffer, uint32_t length) -{ - return UART_Receive(BOARD_UART_PORT, buffer, length, BLOCKING); -} - -uint8_t board_uart_getchar(void) -{ - return UART_ReceiveByte(BOARD_UART_PORT); -} -#endif - -#endif diff --git a/hw/bsp/lpcxpresso/board_lpclink2.h b/hw/bsp/lpcxpresso/board_lpclink2.h deleted file mode 100644 index ddb2f80ec..000000000 --- a/hw/bsp/lpcxpresso/board_lpclink2.h +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************/ -/*! - @file board_lpclink2.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. -*/ -/**************************************************************************/ - -#ifndef _TUSB_BOARD_LPCLINK2_H_ -#define _TUSB_BOARD_LPCLINK2_H_ - -#ifdef __cplusplus - extern "C" { -#endif - -#include "LPC43xx.h" -#include "lpc43xx_scu.h" -#include "lpc43xx_cgu.h"a -#include "lpc43xx_gpio.h" -#include "lpc43xx_uart.h" -#include "lpc43xx_i2c.h" - -#define CFG_PRINTF_TARGET PRINTF_TARGET_UART - -#ifdef __cplusplus - } -#endif - -#endif /* _TUSB_BOARD_LPCLINK2_H_ */ diff --git a/hw/bsp/lpcxpresso/board_lpcxpresso11u14.c b/hw/bsp/lpcxpresso/board_lpcxpresso11u14.c deleted file mode 100644 index 7b9705436..000000000 --- a/hw/bsp/lpcxpresso/board_lpcxpresso11u14.c +++ /dev/null @@ -1,131 +0,0 @@ -/**************************************************************************/ -/*! - @file board_lpcxpresso11u14.c - @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. -*/ -/**************************************************************************/ - -#include "../board.h" - -#ifdef BOARD_LPCXPRESSO11U14 - -#define LED_PORT (0) -#define LED_PIN (7) -#define LED_ON (1) - -const static struct { - uint8_t port; - uint8_t pin; -} buttons[] = -{ - {1, 22 }, // Joystick up - {1, 20 }, // Joystick down - {1, 23 }, // Joystick left - {1, 21 }, // Joystick right - {1, 19 }, // Joystick press - {0, 1 }, // SW3 -// {1, 4 }, // SW4 (require to remove J28) -}; - - -enum { - BOARD_BUTTON_COUNT = sizeof(buttons) / sizeof(buttons[0]) -}; - -void board_init(void) -{ - SystemInit(); - -#if CFG_TUSB_OS == OPT_OS_NONE // TODO may move to main.c - SysTick_Config(SystemCoreClock / BOARD_TICKS_HZ); // 1 msec tick timer -#endif - - GPIOInit(); - - //------------- LED -------------// - GPIOSetDir(LED_PORT, LED_PIN, 1); - - //------------- BUTTON -------------// - for(uint8_t i=0; i<BOARD_BUTTON_COUNT; i++) GPIOSetDir(buttons[i].port, buttons[i].pin, 0); - - //------------- UART -------------// - UARTInit(CFG_UART_BAUDRATE); -} - -//--------------------------------------------------------------------+ -// LEDS -//--------------------------------------------------------------------+ -void board_leds(uint32_t on_mask, uint32_t off_mask) -{ - if (on_mask & BIT_(0)) - { - GPIOSetBitValue(LED_PORT, LED_PIN, LED_ON); - }else if (off_mask & BIT_(0)) - { - GPIOSetBitValue(LED_PORT, LED_PIN, 1 - LED_ON); - } -} - -//--------------------------------------------------------------------+ -// Buttons -//--------------------------------------------------------------------+ -static bool button_read(uint8_t id) -{ - return !GPIOGetPinValue(buttons[id].port, buttons[id].pin); // button is active low -} - -uint32_t board_buttons(void) -{ - uint32_t result = 0; - - for(uint8_t i=0; i<BOARD_BUTTON_COUNT; i++) result |= (button_read(i) ? BIT_(i) : 0); - - return result; -} - -//--------------------------------------------------------------------+ -// UART -//--------------------------------------------------------------------+ -void board_uart_putchar(uint8_t c) -{ - UARTSend(&c, 1); -} - -uint8_t board_uart_getchar(void) -{ -// *buffer = get_key(); TODO cannot find available code for uart getchar - return 0; -} - -#endif diff --git a/hw/bsp/lpcxpresso/board_lpcxpresso11u14.h b/hw/bsp/lpcxpresso/board_lpcxpresso11u14.h deleted file mode 100644 index ce46cb939..000000000 --- a/hw/bsp/lpcxpresso/board_lpcxpresso11u14.h +++ /dev/null @@ -1,54 +0,0 @@ -/**************************************************************************/ -/*! - @file board_lpcxpresso11u14.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. -*/ -/**************************************************************************/ - -#ifndef _TUSB_BOARD_LPCXPRESSO11U14_H_ -#define _TUSB_BOARD_LPCXPRESSO11U14_H_ - -#ifdef __cplusplus - extern "C" { -#endif - -#include "LPC11Uxx.h" -#include "lpc11uxx_gpio.h" -#include "lpc11uxx_uart.h" - -#ifdef __cplusplus - } -#endif - -#endif /* _TUSB_BOARD_LPCXPRESSO11U14_H_ */ diff --git a/hw/bsp/ngx/board_ngx4330.c b/hw/bsp/ngx/board_ngx4330.c deleted file mode 100644 index d82decbea..000000000 --- a/hw/bsp/ngx/board_ngx4330.c +++ /dev/null @@ -1,158 +0,0 @@ -/**************************************************************************/ -/*! - @file board_ngx4330.c - @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. -*/ -/**************************************************************************/ - -#include "../board.h" - -#ifdef BOARD_NGX4330 - -#define BOARD_UART_PORT LPC_USART0 - -const static struct { - uint8_t mux_port; - uint8_t mux_pin; - - uint8_t gpio_port; - uint8_t gpio_pin; -}leds[] = { {2, 11, 1, 11}, {2, 12, 1,12} }; - -enum { - BOARD_MAX_LEDS = sizeof(leds) / sizeof(leds[0]) -}; - -const static struct { - uint8_t mux_port; - uint8_t mux_pin; - - uint8_t gpio_port; - uint8_t gpio_pin; -}buttons[] = { {0x02, 7, 0, 7 } }; - -enum { - BOARD_BUTTON_COUNT = sizeof(buttons) / sizeof(buttons[0]) -}; - -void board_init(void) -{ - CGU_Init(); - -#if CFG_TUSB_OS == OPT_OS_NONE // TODO may move to main.c - SysTick_Config( CGU_GetPCLKFrequency(CGU_PERIPHERAL_M4CORE)/BOARD_TICKS_HZ ); /* 1 ms Timer */ -#endif - - //------------- USB Bus power HOST ONLY-------------// - scu_pinmux(0x1, 7, MD_PUP | MD_EZI, FUNC4); // P1_7 USB0_PWR_EN, USB0 VBus function Xplorer - - scu_pinmux(0x2, 6, MD_PUP | MD_EZI, FUNC4); // P2_6 is configured as GPIO5[6] for USB1_PWR_EN - GPIO_SetDir (5, BIT_(6), 1); // GPIO5[6] is output - GPIO_SetValue (5, BIT_(6)); // GPIO5[6] output high - - //------------- LED -------------// - for (uint8_t i=0; i<BOARD_MAX_LEDS; i++) - { - scu_pinmux(leds[i].mux_port, leds[i].mux_pin, MD_PUP|MD_EZI|MD_ZI, FUNC0); - GPIO_SetDir(leds[i].gpio_port, BIT_(leds[i].gpio_pin), 1); // output - } - - //------------- BUTTONS -------------// - for(uint8_t i=0; i<BOARD_BUTTON_COUNT; i++) - { - scu_pinmux(buttons[i].mux_port, buttons[i].mux_pin, GPIO_NOPULL, FUNC0); - GPIO_SetDir(buttons[i].gpio_port, BIT_(buttons[i].gpio_pin), 0); - } - - //------------- UART init -------------// - scu_pinmux(0x6 ,4, MD_PDN | MD_EZI, FUNC2); // UART0_TXD - scu_pinmux(0x6 ,5, MD_PDN | MD_EZI, FUNC2); // UART0_RXD - - UART_CFG_Type UARTConfigStruct; - UART_ConfigStructInit(&UARTConfigStruct); // default: baud = 9600, 8 bit data, 1 stop bit, no parity - UARTConfigStruct.Baud_rate = CFG_UART_BAUDRATE; // Re-configure baudrate - UARTConfigStruct.Clock_Speed = 0; - - UART_Init(BOARD_UART_PORT, &UARTConfigStruct); - UART_TxCmd(BOARD_UART_PORT, ENABLE); // Enable UART -} - -//--------------------------------------------------------------------+ -// LEDS -//--------------------------------------------------------------------+ -void board_leds(uint32_t on_mask, uint32_t off_mask) -{ - for (uint32_t i=0; i<BOARD_MAX_LEDS; i++) - { - if ( on_mask & BIT_(i)) - { - GPIO_SetValue(leds[i].gpio_port, BIT_(leds[i].gpio_pin)); - }else if ( off_mask & BIT_(i)) // on_mask take precedence over off_mask - { - GPIO_ClearValue(leds[i].gpio_port, BIT_(leds[i].gpio_pin)); - } - } -} - -//--------------------------------------------------------------------+ -// BUTTONS -//--------------------------------------------------------------------+ -static bool button_read(uint8_t id) -{ - return !BIT_TEST_( GPIO_ReadValue(buttons[id].gpio_port), buttons[id].gpio_pin ); // button is active low -} - -uint32_t board_buttons(void) -{ - uint32_t result = 0; - - for(uint8_t i=0; i<BOARD_BUTTON_COUNT; i++) result |= (button_read(i) ? BIT_(i) : 0); - - return result; -} - -//--------------------------------------------------------------------+ -// UART -//--------------------------------------------------------------------+ -uint8_t board_uart_getchar(void) -{ - return UART_ReceiveByte(BOARD_UART_PORT); -} - -void board_uart_putchar(uint8_t c) -{ - UART_Send(BOARD_UART_PORT, &c, 1, BLOCKING); -} - -#endif diff --git a/hw/bsp/ngx/board_ngx4330.h b/hw/bsp/ngx/board_ngx4330.h deleted file mode 100644 index c5e2d0e26..000000000 --- a/hw/bsp/ngx/board_ngx4330.h +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************/ -/*! - @file board_ngx4330.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. -*/ -/**************************************************************************/ - -#ifndef _TUSB_BOARD_NGX4330_H_ -#define _TUSB_BOARD_NGX4330_H_ - -#include "LPC43xx.h" -#include "lpc43xx_scu.h" -#include "lpc43xx_cgu.h" -#include "lpc43xx_gpio.h" -#include "lpc43xx_uart.h" - -#ifdef __cplusplus - extern "C" { -#endif - -#define CFG_PRINTF_TARGET PRINTF_TARGET_UART -//#define CFG_PRINTF_TARGET PRINTF_TARGET_SWO - -#ifdef __cplusplus - } -#endif - -#endif /* _TUSB_BOARD_NGX4330_H_ */ diff --git a/hw/bsp/readme.md b/hw/bsp/readme.md index 3b244c3ac..3f6f7eb8a 100644 --- a/hw/bsp/readme.md +++ b/hw/bsp/readme.md @@ -6,12 +6,11 @@ This code base already had supported for a handful of boards. However due to my ### NXP MCU ### -- [LPCXpresso 11u14](http://www.embeddedartists.com/products/lpcxpresso/lpc11U14_xpr.php) with base board (for some peripherals to work) +- LPCXpresso 11U68 - [**LPCXpresso 1347**](http://www.embeddedartists.com/products/lpcxpresso/lpc1347_xpr.php) with base board (for some peripherals to work) - [**LPCXpresso 1769**](http://www.embeddedartists.com/products/lpcxpresso/lpc1347_xpr.php) with base board (for some peripherals to work) +- [Keil MCB1800 Evaluation Board](http://www.keil.com/mcb1800) - [**Embedded Artists LPC4357 OEM & Base board**](http://www.embeddedartists.com/products/kits/lpc4357_kit.php) -- [**NGX LPC4330 Explorer**](http://shop.ngxtechnologies.com/product_info.php?products_id=104) -- [Keil MCB4357 Evaluation Board](http://www.keil.com/mcb4300) ### MicroChip SAMD ### |
