From 4b1f4c7b6f01a4a0a2da6218958f381674e7f52c Mon Sep 17 00:00:00 2001 From: hathach Date: Wed, 14 Nov 2018 00:22:49 +0700 Subject: [PATCH] add Adafruit samd-peripherals as submodule. clean up board --- .gitmodules | 5 +- .../ses/ses_nrf5x/nrf5x.emProject | 4 +- hw/bsp/board.h | 2 - hw/bsp/ea4357/board_ea4357.c | 2 +- hw/bsp/hitex/board_hitex4350.c | 109 ------------------ hw/bsp/hitex/board_hitex4350.h | 58 ---------- hw/bsp/keil/board_mcb4300.c | 2 +- hw/bsp/lpcxpresso/board_lpcxpresso11u14.c | 2 +- .../lpcxpresso11u68/board_lpcxpresso11u68.c | 2 +- hw/bsp/lpcxpresso1347/board_lpcxpresso1347.c | 2 +- hw/bsp/lpcxpresso1769/board_lpcxpresso1769.c | 2 +- hw/bsp/ngx/board_ngx4330.c | 2 +- hw/bsp/pca10056/board_pca10056.c | 3 + hw/mcu/microchip/samd/samd-peripherals | 1 + 14 files changed, 17 insertions(+), 179 deletions(-) delete mode 100644 hw/bsp/hitex/board_hitex4350.c delete mode 100644 hw/bsp/hitex/board_hitex4350.h create mode 160000 hw/mcu/microchip/samd/samd-peripherals diff --git a/.gitmodules b/.gitmodules index e569dc9c..30abb53e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -3,4 +3,7 @@ url = https://github.com/NordicSemiconductor/nrfx.git [submodule "hw/mcu/microchip/samd/asf4"] path = hw/mcu/microchip/samd/asf4 - url = git@github.com:adafruit/asf4.git + url = https://github.com/adafruit/asf4.git +[submodule "hw/mcu/microchip/samd/samd-peripherals"] + path = hw/mcu/microchip/samd/samd-peripherals + url = https://github.com/adafruit/samd-peripherals.git diff --git a/examples/device/device_composite/ses/ses_nrf5x/nrf5x.emProject b/examples/device/device_composite/ses/ses_nrf5x/nrf5x.emProject index bb25b9fd..377ae434 100644 --- a/examples/device/device_composite/ses/ses_nrf5x/nrf5x.emProject +++ b/examples/device/device_composite/ses/ses_nrf5x/nrf5x.emProject @@ -20,13 +20,13 @@ arm_target_interface_type="SWD" build_treat_warnings_as_errors="Yes" c_preprocessor_definitions="NRF52840_XXAA;__nRF_FAMILY;ARM_MATH_CM4;FLASH_PLACEMENT=1;BOARD_PCA10056" - c_user_include_directories="../../src;$(tusbDir)/hw/cmsis/Include;$(tusbDir)/hw;$(tusbDir)/src;$(nrfxDir)/..;$(nrfxDir);$(nrfxDir)/mdk;$(nrfxDir)/hal;$(nrfxDir)/drivers/include" + c_user_include_directories="../../src;$(rootDir)/hw/cmsis/Include;$(rootDir)/hw;$(rootDir)/src;$(nrfxDir)/..;$(nrfxDir);$(nrfxDir)/mdk;$(nrfxDir)/hal;$(nrfxDir)/drivers/include" debug_register_definition_file="$(ProjectDir)/nrf52840_Registers.xml" debug_target_connection="J-Link" gcc_entry_point="Reset_Handler" linker_memory_map_file="$(ProjectDir)/nRF52840_xxAA_MemoryMap.xml" linker_section_placement_file="$(ProjectDir)/flash_placement.xml" - macros="DeviceHeaderFile=$(PackagesDir)/nRF/CMSIS/Device/Include/nrf.h;DeviceLibraryIdentifier=M4lf;DeviceSystemFile=$(PackagesDir)/nRF/CMSIS/Device/Source/system_nrf52840.c;DeviceVectorsFile=$(PackagesDir)/nRF/Source/ses_nrf52840_Vectors.s;DeviceFamily=nRF;Target=nRF52840_xxAA;Placement=Flash;tusbDir=../../../../..;nrfxDir=../../../../../hw/mcu/nordic/nrfx" + macros="DeviceHeaderFile=$(PackagesDir)/nRF/CMSIS/Device/Include/nrf.h;DeviceLibraryIdentifier=M4lf;DeviceSystemFile=$(PackagesDir)/nRF/CMSIS/Device/Source/system_nrf52840.c;DeviceVectorsFile=$(PackagesDir)/nRF/Source/ses_nrf52840_Vectors.s;DeviceFamily=nRF;Target=nRF52840_xxAA;Placement=Flash;rootDir=../../../../..;nrfxDir=../../../../../hw/mcu/nordic/nrfx" project_directory="" project_type="Executable" target_reset_script="Reset();" diff --git a/hw/bsp/board.h b/hw/bsp/board.h index b4a677be..fc835d31 100644 --- a/hw/bsp/board.h +++ b/hw/bsp/board.h @@ -80,8 +80,6 @@ #include "ea4357/board_ea4357.h" #elif defined BOARD_MCB4300 #include "keil/board_mcb4300.h" -#elif defined BOARD_HITEX4350 - #include "hitex/board_hitex4350.h" #elif defined BOARD_LPCLINK2 #include "lpcxpresso/board_lpclink2.h" #elif defined BOARD_PCA10056 diff --git a/hw/bsp/ea4357/board_ea4357.c b/hw/bsp/ea4357/board_ea4357.c index 105f32d1..e4b9a0dc 100644 --- a/hw/bsp/ea4357/board_ea4357.c +++ b/hw/bsp/ea4357/board_ea4357.c @@ -38,7 +38,7 @@ #include "../board.h" -#if BOARD == BOARD_EA4357 +#ifdef BOARD_EA4357 #define BOARD_UART_PORT LPC_USART0 #define BOARD_UART_PIN_PORT 0x0f diff --git a/hw/bsp/hitex/board_hitex4350.c b/hw/bsp/hitex/board_hitex4350.c deleted file mode 100644 index 23e070a9..00000000 --- a/hw/bsp/hitex/board_hitex4350.c +++ /dev/null @@ -1,109 +0,0 @@ -/**************************************************************************/ -/*! - @file board_hitex4350.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_HITEX4350 - -//--------------------------------------------------------------------+ -// MACRO CONSTANT TYPEDEF -//--------------------------------------------------------------------+ - -//--------------------------------------------------------------------+ -// INTERNAL OBJECT & FUNCTION DECLARATION -//--------------------------------------------------------------------+ - -//--------------------------------------------------------------------+ -// IMPLEMENTATION -//--------------------------------------------------------------------+ -void board_init(void) -{ - CGU_Init(); - SysTick_Config(CGU_GetPCLKFrequency(CGU_PERIPHERAL_M4CORE) / BOARD_TICKS_HZ); // 1 msec tick timer - - //------------- USB Bus power HOST ONLY-------------// - // Hitex VBUS0 is P2_3 - scu_pinmux(0x2, 3, MD_PUP | MD_EZI, FUNC7); // USB0_PWR_EN, USB0 VBus function - scu_pinmux(0x6, 3, MD_PUP | MD_EZI, FUNC1); // P6_3 USB0_PWR_EN, USB0 VBus function - - // Hitex VBUS1 is P9_5 - scu_pinmux(0x9, 5, MD_PUP | MD_EZI, FUNC2); // USB1_PWR_EN, USB1 VBus function - - //------------- LEDs init -------------// - // TODO Leds for hitex - - //------------- UART init -------------// - #if CFG_UART_ENABLE - 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) -{ - // TODO LED for hitex -} - -//--------------------------------------------------------------------+ -// 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); -} -#endif - -#endif diff --git a/hw/bsp/hitex/board_hitex4350.h b/hw/bsp/hitex/board_hitex4350.h deleted file mode 100644 index f52c83fa..00000000 --- a/hw/bsp/hitex/board_hitex4350.h +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************/ -/*! - @file board_hitex4350.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_HITEX4350_H_ -#define _TUSB_BOARD_HITEX4350_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_SEMIHOST - -#ifdef __cplusplus - } -#endif - -#endif /* _TUSB_BOARD_HITEX4350_H_ */ diff --git a/hw/bsp/keil/board_mcb4300.c b/hw/bsp/keil/board_mcb4300.c index 118cef20..1cd8b070 100644 --- a/hw/bsp/keil/board_mcb4300.c +++ b/hw/bsp/keil/board_mcb4300.c @@ -38,7 +38,7 @@ #include "../board.h" -#if BOARD == BOARD_MCB4300 +#ifdef BOARD_MCB4300 //--------------------------------------------------------------------+ // INCLUDE diff --git a/hw/bsp/lpcxpresso/board_lpcxpresso11u14.c b/hw/bsp/lpcxpresso/board_lpcxpresso11u14.c index 20b3c73c..7b970543 100644 --- a/hw/bsp/lpcxpresso/board_lpcxpresso11u14.c +++ b/hw/bsp/lpcxpresso/board_lpcxpresso11u14.c @@ -38,7 +38,7 @@ #include "../board.h" -#if BOARD == BOARD_LPCXPRESSO11U14 +#ifdef BOARD_LPCXPRESSO11U14 #define LED_PORT (0) #define LED_PIN (7) diff --git a/hw/bsp/lpcxpresso11u68/board_lpcxpresso11u68.c b/hw/bsp/lpcxpresso11u68/board_lpcxpresso11u68.c index ebf30d48..854d8cda 100644 --- a/hw/bsp/lpcxpresso11u68/board_lpcxpresso11u68.c +++ b/hw/bsp/lpcxpresso11u68/board_lpcxpresso11u68.c @@ -38,7 +38,7 @@ #include "../board.h" -#if BOARD == BOARD_LPCXPRESSO11U68 +#ifdef BOARD_LPCXPRESSO11U68 #define LED_PORT (1) #define LED_PIN (31) diff --git a/hw/bsp/lpcxpresso1347/board_lpcxpresso1347.c b/hw/bsp/lpcxpresso1347/board_lpcxpresso1347.c index 3649b3a7..d72402d6 100644 --- a/hw/bsp/lpcxpresso1347/board_lpcxpresso1347.c +++ b/hw/bsp/lpcxpresso1347/board_lpcxpresso1347.c @@ -38,7 +38,7 @@ #include "../board.h" -#if BOARD == BOARD_LPCXPRESSO1347 +#ifdef BOARD_LPCXPRESSO1347 #define LED_PORT (0) #define LED_PIN (7) diff --git a/hw/bsp/lpcxpresso1769/board_lpcxpresso1769.c b/hw/bsp/lpcxpresso1769/board_lpcxpresso1769.c index 196199d6..4321a3f3 100644 --- a/hw/bsp/lpcxpresso1769/board_lpcxpresso1769.c +++ b/hw/bsp/lpcxpresso1769/board_lpcxpresso1769.c @@ -38,7 +38,7 @@ #include "../board.h" -#if BOARD == BOARD_LPCXPRESSO1769 +#ifdef BOARD_LPCXPRESSO1769 #define BOARD_LED_PORT (0) #define BOARD_LED_PIN (22) diff --git a/hw/bsp/ngx/board_ngx4330.c b/hw/bsp/ngx/board_ngx4330.c index 01f5f614..d82decbe 100644 --- a/hw/bsp/ngx/board_ngx4330.c +++ b/hw/bsp/ngx/board_ngx4330.c @@ -38,7 +38,7 @@ #include "../board.h" -#if BOARD == BOARD_NGX4330 +#ifdef BOARD_NGX4330 #define BOARD_UART_PORT LPC_USART0 diff --git a/hw/bsp/pca10056/board_pca10056.c b/hw/bsp/pca10056/board_pca10056.c index 54b1488a..cef27244 100644 --- a/hw/bsp/pca10056/board_pca10056.c +++ b/hw/bsp/pca10056/board_pca10056.c @@ -35,6 +35,7 @@ This file is part of the tinyusb stack. */ /**************************************************************************/ +#ifdef BOARD_PCA10056 #include "bsp/board.h" #include "nrfx/hal/nrf_gpio.h" @@ -251,3 +252,5 @@ void board_uart_putchar(uint8_t c) { } + +#endif diff --git a/hw/mcu/microchip/samd/samd-peripherals b/hw/mcu/microchip/samd/samd-peripherals new file mode 160000 index 00000000..f20fcf64 --- /dev/null +++ b/hw/mcu/microchip/samd/samd-peripherals @@ -0,0 +1 @@ +Subproject commit f20fcf642b5654ee68d7d551ea7db39716ef83bf