support for osmocom USB E1 board by vogelchr

This adds "core" support for the board found at
https://github.com/vogelchr/e1_sam4_usb

The sam_e1 application has not yet been ported over.
This commit is contained in:
Harald Welte 2019-12-22 10:48:45 +01:00
parent c65e90d63d
commit f3734e752f
14 changed files with 1041 additions and 0 deletions

View File

@ -164,6 +164,7 @@ extern "C" {
#define AVR_SIMULATOR_UC3 98 //!< Simulator for the AVR UC3 device family.
#define USER_BOARD 99 //!< User-reserved board (if any).
#define DUMMY_BOARD 100 //!< Dummy board to support board-independent applications (e.g. bootloader).
#define OSMOCOM_E1_USB 255 //!< SAM4S based Osmocom E1 USB board.
//! @}
/*! \name Extension Boards
@ -387,6 +388,9 @@ extern "C" {
# include "user_board.h"
#elif BOARD == DUMMY_BOARD
# include "dummy/dummy_board.h"
#elif BOARD == OSMOCOM_E1_USB
# include "osmocom_e1_usb/osmocom_e1_usb.h"
#elif BOARD == USER_BOARD
#else
# error No known Atmel board defined
#endif

View File

@ -129,7 +129,13 @@ static void reconfigure_console(uint32_t ul_mck, uint32_t ul_baudrate)
bool microvty_cb_uart_rx_not_empty(void)
{
#if CONSOLE_UART_ID == ID_UART1
return usart_serial_is_rx_ready(UART1);
#elif CONSOLE_UART_ID == ID_UART0
return usart_serial_is_rx_ready(UART0);
#else
#error "Unsuppoerted CONSOLE_UART_ID"
#endif
}
/**

View File

@ -0,0 +1,56 @@
/**
* \file
*
* \brief Board configuration.
*
* Copyright (c) 2014-2015 Atmel Corporation. All rights reserved.
*
* \asf_license_start
*
* \page License
*
* 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 Atmel may not be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* 4. This software may only be redistributed and used in connection with an
* Atmel microcontroller product.
*
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
*
* \asf_license_stop
*
*/
/*
* Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
*/
#ifndef CONF_BOARD_H_INCLUDED
#define CONF_BOARD_H_INCLUDED
/** Usart Hw ID used by the console (UART1). */
#define CONSOLE_UART_ID ID_UART0
/* Configure UART0 pins */
#define CONF_BOARD_UART_CONSOLE
#endif /* CONF_BOARD_H_INCLUDED */

View File

@ -0,0 +1,103 @@
/**
* \file
*
* \brief SAM4S clock configuration.
*
* Copyright (c) 2014-2015 Atmel Corporation. All rights reserved.
*
* \asf_license_start
*
* \page License
*
* 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 Atmel may not be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* 4. This software may only be redistributed and used in connection with an
* Atmel microcontroller product.
*
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
*
* \asf_license_stop
*
*/
/*
* Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
*/
#ifndef CONF_CLOCK_H_INCLUDED
#define CONF_CLOCK_H_INCLUDED
// ===== System Clock (MCK) Source Options
//#define CONFIG_SYSCLK_SOURCE SYSCLK_SRC_SLCK_RC
//#define CONFIG_SYSCLK_SOURCE SYSCLK_SRC_SLCK_XTAL
//#define CONFIG_SYSCLK_SOURCE SYSCLK_SRC_SLCK_BYPASS
//#define CONFIG_SYSCLK_SOURCE SYSCLK_SRC_MAINCK_4M_RC
//#define CONFIG_SYSCLK_SOURCE SYSCLK_SRC_MAINCK_8M_RC
//#define CONFIG_SYSCLK_SOURCE SYSCLK_SRC_MAINCK_12M_RC
//#define CONFIG_SYSCLK_SOURCE SYSCLK_SRC_MAINCK_XTAL
//#define CONFIG_SYSCLK_SOURCE SYSCLK_SRC_MAINCK_BYPASS
#define CONFIG_SYSCLK_SOURCE SYSCLK_SRC_PLLACK
//#define CONFIG_SYSCLK_SOURCE SYSCLK_SRC_PLLBCK
// ===== System Clock (MCK) Prescaler Options (Fmck = Fsys / (SYSCLK_PRES))
#define CONFIG_SYSCLK_PRES SYSCLK_PRES_1
//#define CONFIG_SYSCLK_PRES SYSCLK_PRES_2
//#define CONFIG_SYSCLK_PRES SYSCLK_PRES_4
//#define CONFIG_SYSCLK_PRES SYSCLK_PRES_8
//#define CONFIG_SYSCLK_PRES SYSCLK_PRES_16
//#define CONFIG_SYSCLK_PRES SYSCLK_PRES_32
//#define CONFIG_SYSCLK_PRES SYSCLK_PRES_64
//#define CONFIG_SYSCLK_PRES SYSCLK_PRES_3
// ===== PLL0 (A) Options (Fpll = (Fclk * PLL_mul) / PLL_div)
// Use mul and div effective values here.
#define CONFIG_PLL0_SOURCE PLL_SRC_MAINCK_BYPASS
#define CONFIG_PLL0_MUL 18
#define CONFIG_PLL0_DIV 5
// ===== PLL1 (B) Options (Fpll = (Fclk * PLL_mul) / PLL_div)
// Use mul and div effective values here.
#define CONFIG_PLL1_SOURCE PLL_SRC_MAINCK_BYPASS
#define CONFIG_PLL1_MUL 25
#define CONFIG_PLL1_DIV 8
// ===== USB Clock Source Options (Fusb = FpllX / USB_div)
// Use div effective value here.
#define CONFIG_USBCLK_SOURCE USBCLK_SRC_PLL1
#define CONFIG_USBCLK_DIV 2
// ===== Target frequency (System clock)
// - ext. Oscillator frequency: 30.72 MHz
// - System clock source: PLLA
// - System clock prescaler: 2 (divided by 2)
// - PLLA source: XTAL
// - PLLA output: XTAL * 5 / 18 = 30.72M / 5 * 18 = 110.592 MHz
// - System clock: 12 * 20 / 1 / 2 = 120MHz
// ===== Target frequency (USB Clock)
// - USB clock source: PLLB
// - USB clock divider: 2 (divided by 2)
// - PLLB output: XTAL / 8 * 25 = 30.72M / 8 * 25 = 96 MHz
// - USB clock: 12 * 16 / 2 / 2 = 48MHz
#endif /* CONF_CLOCK_H_INCLUDED */

View File

@ -0,0 +1 @@
../sam4sd32c_sam4s_xplained_pro/conf_sleepmgr.h

View File

@ -0,0 +1 @@
../sam4sd32c_sam4s_xplained_pro/conf_spi_master.h

View File

@ -0,0 +1,66 @@
/**
* \file
*
* \brief Serial USART service configuration.
*
* Copyright (c) 2014-2015 Atmel Corporation. All rights reserved.
*
* \asf_license_start
*
* \page License
*
* 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 Atmel may not be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* 4. This software may only be redistributed and used in connection with an
* Atmel microcontroller product.
*
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
*
* \asf_license_stop
*
*/
/*
* Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
*/
#ifndef CONF_USART_SERIAL_H
#define CONF_USART_SERIAL_H
/** UART Interface */
#define CONF_UART CONSOLE_UART
/** Baudrate setting */
#define CONF_UART_BAUDRATE 115200
/** Parity setting */
#define CONF_UART_PARITY US_MR_PAR_NO
/* Configure UART pins PIO */
#define CONF_UART_PIO PINS_UART0_PIO
/* Configure UART pins */
#define CONF_PINS_UART PINS_UART0
/* Configure UART pins flags */
#define CONF_PINS_UART_FLAGS PINS_UART0_FLAGS
#endif/* CONF_USART_SERIAL_H_INCLUDED */

View File

@ -0,0 +1 @@
../sam4sd32c_sam4s_xplained_pro/conf_usb.h

View File

@ -0,0 +1,52 @@
# List of available make goals:
#
# all Default target, builds the project
# clean Clean up the project
# rebuild Rebuild the project
#
#
# doc Build the documentation
# cleandoc Clean up the documentation
# rebuilddoc Rebuild the documentation
#
# Copyright (c) 2011 Atmel Corporation. All rights reserved.
#
# \asf_license_start
#
# \page License
#
# 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 Atmel may not be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# 4. This software may only be redistributed and used in connection with an
# Atmel microcontroller product.
#
# THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
# EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
#
# \asf_license_stop
#
# Include the common Makefile, which will also include the project specific
# config.mk file.
MAKEFILE_PATH = ../../../../../sam/utils/make/Makefile.sam.in
include $(MAKEFILE_PATH)

View File

@ -0,0 +1,124 @@
/**
* \file
*
* \brief Autogenerated API include file for the Atmel Software Framework (ASF)
*
* Copyright (c) 2012 Atmel Corporation. All rights reserved.
*
* \asf_license_start
*
* \page License
*
* 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 Atmel may not be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* 4. This software may only be redistributed and used in connection with an
* Atmel microcontroller product.
*
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
*
* \asf_license_stop
*
*/
#ifndef ASF_H
#define ASF_H
/*
* This file includes all API header files for the selected drivers from ASF.
* Note: There might be duplicate includes required by more than one driver.
*
* The file is automatically generated and will be re-written when
* running the ASF driver selector tool. Any changes will be discarded.
*/
// From module: ADC - Analog-to-digital Converter
#include <adc.h>
// From module: Common SAM compiler driver
#include <compiler.h>
#include <status_codes.h>
// From module: EEFC - Enhanced Embedded Flash Controller
#include <efc.h>
// From module: GPBR - General Purpose Backup Register
#include <gpbr.h>
// From module: GPIO - General purpose Input/Output
#include <gpio.h>
// From module: Generic board support
#include <board.h>
// From module: IOPORT - General purpose I/O service
#include <ioport.h>
// From module: Interrupt management - SAM implementation
#include <interrupt.h>
// From module: PIO - Parallel Input/Output Controller
#include <pio.h>
// From module: PMC - Power Management Controller
#include <pmc.h>
#include <sleep.h>
// From module: Part identification macros
#include <parts.h>
// From module: SAM4S Xplained Pro LED support enabled
#include <led.h>
// From module: SUPC - Supply Controller
#include <supc.h>
// From module: Standard serial I/O (stdio) - SAM implementation
#include <stdio_serial.h>
// From module: System Clock Control - SAM4S implementation
#include <sysclk.h>
// From module: UART - Univ. Async Rec/Trans
#include <uart.h>
// From module: USART - Serial interface - SAM implementation for devices with both UART and USART
#include <serial.h>
// From module: USART - Univ. Syn Async Rec/Trans
#include <usart.h>
// From module: WDT - Watchdog Timer
#include <wdt.h>
// From module: pio_handler support enabled
#include <pio_handler.h>
#include <ssc.h>
#include <tc.h>
#include <pdc.h>
#include <udc.h>
#include <spi.h>
#include <spi_master.h>
#endif // ASF_H

View File

@ -0,0 +1,209 @@
#
# Copyright (c) 2011 Atmel Corporation. All rights reserved.
#
# \asf_license_start
#
# \page License
#
# 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 Atmel may not be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# 4. This software may only be redistributed and used in connection with an
# Atmel microcontroller product.
#
# THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
# EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
#
# \asf_license_stop
#
# Path to top level ASF directory relative to this project directory.
PRJ_PATH = ../../../../..
# Target CPU architecture: cortex-m3, cortex-m4
ARCH = cortex-m4
# Target part: none, sam3n4 or sam4l4aa
PART = sam4sd32c
# Application target name. Given with suffix .a for library and .elf for a
# standalone application.
TARGET_FLASH = sam_e1.elf
TARGET_SRAM = sam_e1.elf
# List of C source files.
CSRCS = \
common/services/clock/sam4s/sysclk.c \
common/services/serial/usart_serial.c \
common/services/sleepmgr/sam/sleepmgr.c \
common/services/spi/sam_spi/spi_master.c \
common/services/usb/udc/udc.c \
common/services/usb/class/cdc/device/udi_cdc.c \
common/services/usb/class/composite/device/udi_composite_desc.c \
common/services/usb/class/vendor/device/udi_vendor.c \
common/utils/interrupt/interrupt_sam_nvic.c \
common/utils/stdio/read.c \
common/utils/stdio/write.c \
sam/applications/sam_e1/main.c \
sam/applications/sam_e1/e1_ssc_tc.c \
sam/applications/sam_e1/idt82v2081.c \
sam/applications/sam_e1/idt82v2081_asf.c \
sam/applications/sam_e1/hardfault.c \
thirdparty/microvty/microvty.c \
sam/boards/osmocom_e1_usb/init.c \
sam/drivers/adc/adc.c \
sam/drivers/adc/adc_sam3u.c \
sam/drivers/efc/efc.c \
sam/drivers/matrix/matrix.c \
sam/drivers/gpbr/gpbr.c \
sam/drivers/pdc/pdc.c \
sam/drivers/pio/pio.c \
sam/drivers/pio/pio_handler.c \
sam/drivers/pmc/pmc.c \
sam/drivers/pmc/sleep.c \
sam/drivers/spi/spi.c \
sam/drivers/ssc/ssc.c \
sam/drivers/supc/supc.c \
sam/drivers/tc/tc.c \
sam/drivers/uart/uart.c \
sam/drivers/udp/udp_device.c \
sam/drivers/usart/usart.c \
sam/drivers/wdt/wdt.c \
sam/utils/cmsis/sam4s/source/templates/gcc/startup_sam4s.c \
sam/utils/cmsis/sam4s/source/templates/system_sam4s.c \
sam/utils/syscalls/gcc/syscalls.c
# List of assembler source files.
ASSRCS =
# List of include paths.
INC_PATH = \
common/boards \
common/services/clock \
common/services/gpio \
common/services/ioport \
common/services/serial \
common/services/serial/sam_uart \
common/services/sleepmgr \
common/services/spi \
common/services/spi/sam_spi \
common/services/usb \
common/services/usb/udc \
common/services/usb/class/cdc \
common/services/usb/class/cdc/device \
common/services/usb/class/composite/device \
common/services/usb/class/vendor \
common/services/usb/class/vendor/device \
common/utils \
common/utils/stdio/stdio_serial \
sam/applications/sam_e1 \
sam/applications/sam_e1/osmocom_e1_usb \
sam/boards \
sam/boards/osmocom_e1_usb \
sam/drivers/adc \
sam/drivers/efc \
sam/drivers/gpbr \
sam/drivers/pdc \
sam/drivers/pio \
sam/drivers/pmc \
sam/drivers/spi \
sam/drivers/ssc \
sam/drivers/supc \
sam/drivers/tc \
sam/drivers/uart \
sam/drivers/udp \
sam/drivers/usart \
sam/drivers/wdt \
sam/utils \
sam/utils/cmsis/sam4s/include \
sam/utils/cmsis/sam4s/source/templates \
sam/utils/header_files \
sam/utils/preprocessor \
thirdparty/CMSIS/Include \
thirdparty/CMSIS/Lib/GCC \
thirdparty/microvty \
sam/applications/sam_e1/osmocom_e1_usb/gcc \
# Additional search paths for libraries.
LIB_PATH = \
thirdparty/CMSIS/Lib/GCC
# List of libraries to use during linking.
LIBS = \
osmocore \
arm_cortexM4l_math \
m
# Path relative to top level directory pointing to a linker script.
LINKER_SCRIPT_FLASH = sam/utils/linker_scripts/sam4s/sam4s8/gcc/flash.ld
LINKER_SCRIPT_SRAM = sam/utils/linker_scripts/sam4s/sam4s8/gcc/sram.ld
# Path relative to top level directory pointing to a linker script.
DEBUG_SCRIPT_FLASH = sam/boards/sam4s_xplained_pro/debug_scripts/gcc/sam4s_xplained_pro_flash.gdb
DEBUG_SCRIPT_SRAM = sam/boards/sam4s_xplained_pro/debug_scripts/gcc/sam4s_xplained_pro_sram.gdb
# Project type parameter: all, sram or flash
PROJECT_TYPE = flash
# Additional options for debugging. By default the common Makefile.in will
# add -g3.
DBGFLAGS =
# Application optimization used during compilation and linking:
# -O0, -O1, -O2, -O3 or -Os
OPTIMIZATION = -O1
# Extra flags to use when archiving.
ARFLAGS =
# Extra flags to use when assembling.
ASFLAGS =
# Extra flags to use when compiling.
CFLAGS = \
-I /usr/local/arm-none-eabi/include
# Extra flags to use when preprocessing.
#
# Preprocessor symbol definitions
# To add a definition use the format "-D name[=definition]".
# To cancel a definition use the format "-U name".
#
# The most relevant symbols to define for the preprocessor are:
# BOARD Target board in use, see boards/board.h for a list.
# EXT_BOARD Optional extension board in use, see boards/board.h for a list.
CPPFLAGS = \
-D ACCESS_USB_ENABLED \
-D ARM_MATH_CM4=true \
-D BOARD=OSMOCOM_E1_USB \
-D UDD_ENABLE \
-D __SAM4SD32C__ \
-D printf=iprintf \
-D scanf=iscanf
# Extra flags to use when linking
LDFLAGS = \
-L /usr/local/arm-none-eabi/lib
# Pre- and post-build commands
PREBUILD_CMD =
POSTBUILD_CMD =

View File

@ -0,0 +1,98 @@
/**
* \file
*
* \brief SAM4S Xplained Pro board initialization
*
* Copyright (C) 2012-2015 Atmel Corporation. All rights reserved.
*
* \asf_license_start
*
* \page License
*
* 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 Atmel may not be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* 4. This software may only be redistributed and used in connection with an
* Atmel microcontroller product.
*
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
*
* \asf_license_stop
*/
/*
* Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
*/
#include <board.h>
#include <gpio.h>
#include <ioport.h>
#include <wdt.h>
/**
* \addtogroup sam4s_xplained_pro_group
* @{
*/
void board_init(void)
{
#ifndef CONF_BOARD_KEEP_WATCHDOG_AT_INIT
wdt_disable(WDT);
#endif
/* GPIO has been deprecated, the old code just keeps it for compatibility.
* In new designs IOPORT is used instead.
* Here IOPORT must be initialized for others to use before setting up IO.
*/
ioport_init();
/* Initialize LED, turned off */
ioport_set_pin_level(LED_0_PIN, !LED_0_ACTIVE);
ioport_set_pin_dir(LED_0_PIN, IOPORT_DIR_OUTPUT);
ioport_set_pin_level(LED_1_PIN, !LED_1_ACTIVE);
ioport_set_pin_dir(LED_1_PIN, IOPORT_DIR_OUTPUT);
ioport_set_pin_level(LED_2_PIN, !LED_2_ACTIVE);
ioport_set_pin_dir(LED_2_PIN, IOPORT_DIR_OUTPUT);
#ifdef CONF_BOARD_UART_CONSOLE
/* Configure UART pins */
gpio_configure_group(PINS_UART0_PIO, PINS_UART0, PINS_UART0_FLAGS);
#endif
#ifdef CONF_BOARD_TWI0
gpio_configure_pin(TWI0_DATA_GPIO, TWI0_DATA_FLAGS);
gpio_configure_pin(TWI0_CLK_GPIO, TWI0_CLK_FLAGS);
#endif
/* Configure SPI pins */
#ifdef CONF_BOARD_SPI
gpio_configure_pin(SPI_MISO_GPIO, SPI_MISO_FLAGS);
gpio_configure_pin(SPI_MOSI_GPIO, SPI_MOSI_FLAGS);
gpio_configure_pin(SPI_SPCK_GPIO, SPI_SPCK_FLAGS);
gpio_configure_pin(SPI_NPCS0_GPIO, SPI_NPCS0_FLAGS);
gpio_configure_pin(SPI_NPCS1_PA31_GPIO, SPI_NPCS1_PA31_FLAGS);
gpio_configure_pin(SPI_NPCS2_PA30_GPIO, SPI_NPCS2_PA30_FLAGS);
#endif
}
/** @} */

View File

@ -0,0 +1,79 @@
/**
* \file
*
* \brief SAM4S Xplained Pro LEDs support package.
*
* Copyright (c) 2014-2015 Atmel Corporation. All rights reserved.
*
* \asf_license_start
*
* \page License
*
* 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 Atmel may not be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* 4. This software may only be redistributed and used in connection with an
* Atmel microcontroller product.
*
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
*
* \asf_license_stop
*
*/
/*
* Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
*/
#ifndef _LED_H_
#define _LED_H_
#include "gpio.h"
/**
* \brief Turns off the specified LEDs.
*
* \param led LED to turn off (LEDx).
*
* \note The pins of the specified LEDs are set to GPIO output mode.
*/
#define LED_Off(led) ioport_set_pin_level(led, IOPORT_PIN_LEVEL_LOW)
/**
* \brief Turns on the specified LEDs.
*
* \param led LED to turn on (LEDx).
*
* \note The pins of the specified LEDs are set to GPIO output mode.
*/
#define LED_On(led) ioport_set_pin_level(led, IOPORT_PIN_LEVEL_HIGH)
/**
* \brief Toggles the specified LEDs.
*
* \param led LED to toggle (LEDx).
*
* \note The pins of the specified LEDs are set to GPIO output mode.
*/
#define LED_Toggle(led) ioport_toggle_pin_level(led)
#endif // _LED_H_

View File

@ -0,0 +1,241 @@
/**
* \file
*
* \brief SAM4S Xplained Pro board definition and driver
*
* Copyright (C) 2012-2016 Atmel Corporation. All rights reserved.
*
* \asf_license_start
*
* \page License
*
* 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 Atmel may not be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* 4. This software may only be redistributed and used in connection with an
* Atmel microcontroller product.
*
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
*
* \asf_license_stop
*/
/*
* Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
*/
#ifndef OSMOCOM_E1_USB_H
#define OSMOCOM_E1_USB_H
#include <conf_board.h>
/**
* \ingroup group_common_boards
* \defgroup sam4s_xplained_pro_group SAM4S Xplained Pro board
* @{
*/
/**
* \defgroup sam4s_xplained_pro_config_group Configuration
*
* Symbols to use for configuring the board and its initialization.
*
* @{
*/
#ifdef __DOXYGEN__
//! \name Initialization
//@{
/**
* \def CONF_BOARD_KEEP_WATCHDOG_AT_INIT
* \brief Let watchdog remain enabled
*
* If this symbol is defined, the watchdog is left running with its current
* configuration. Otherwise, it gets disabled during board initialization.
*/
# ifndef CONF_BOARD_KEEP_WATCHDOG_AT_INIT
# define CONF_BOARD_KEEP_WATCHDOG_AT_INIT
# endif
//@}
#endif // __DOXYGEN__
/** @} */
/**
* \defgroup sam4s_xplained_pro_features_group Features
*
* Symbols that describe features and capabilities of the board.
*
* @{
*/
//! Name string macro
#define BOARD_NAME "OSMOCOM_E1_USB"
//! \name Resonator definitions
//@{
#define BOARD_FREQ_SLCK_XTAL (32768U)
#define BOARD_FREQ_SLCK_BYPASS (32768U)
#define BOARD_FREQ_MAINCK_XTAL (30720000U)
#define BOARD_FREQ_MAINCK_BYPASS (30720000U)
#define BOARD_MCK CHIP_FREQ_CPU_MAX
#define BOARD_OSC_STARTUP_US 15625
//@}
//! \name LED0 definitions
//@{
#define LED0_PIN IOPORT_CREATE_PIN(PIOA, 24)
#define LED0_ACTIVE true
#define LED0_INACTIVE !LED0_ACTIVE
#define LED0 LED0_GPIO
#define LED0_GPIO LED0_PIN
//@}
//! \name LED1 definitions
//@{
#define LED1_PIN IOPORT_CREATE_PIN(PIOA, 25)
#define LED1_ACTIVE true
#define LED1_INACTIVE !LED1_ACTIVE
#define LED1 LED1_GPIO
#define LED1_GPIO LED1_PIN
//@}
//! \name LED2 definitions
//@{
#define LED2_PIN IOPORT_CREATE_PIN(PIOA, 26)
#define LED2_ACTIVE true
#define LED2_INACTIVE !LED2_ACTIVE
#define LED2 LED2_GPIO
#define LED2_GPIO LED2_PIN
//@}
/**
* \name LED #0 definitions
*
* Wrapper macros for LED0, to ensure common naming across all Xplained Pro
* boards.
*/
//@{
#define LED_0_NAME "LED1"
#define LED_0_PIN LED0_PIN
#define LED_0_ACTIVE LED0_ACTIVE
#define LED_0_INACTIVE LED0_INACTIVE
//@}
/**
* \name LED #0 definitions
*
* Wrapper macros for LED0, to ensure common naming across all Xplained Pro
* boards.
*/
//@{
#define LED_1_NAME "LED2"
#define LED_1_PIN LED1_PIN
#define LED_1_ACTIVE LED1_ACTIVE
#define LED_1_INACTIVE LED1_INACTIVE
//@}
/**
* \name LED #2 definitions
*
* Wrapper macros for LED2, to ensure common naming across all Xplained Pro
* boards.
*/
//@{
#define LED_2_NAME "LED3"
#define LED_2_PIN LED2_PIN
#define LED_2_ACTIVE LED2_ACTIVE
#define LED_2_INACTIVE LED2_INACTIVE
//@}
//! Number of on-board LEDs
#define LED_COUNT 3
//! Number of on-board buttons
#define BUTTON_COUNT 0
//! \name Embedded debugger USART interface definitions
//@{
#define EDBG_UART_MODULE UART0
//@}
//! \name Embedded debugger TWI interface definitions
//@{
#define EDBG_TWI_MODULE TWI0
//@}
//! \name Embedded debugger SPI interface definitions
//@{
#define EDBG_SPI_MODULE SPI
//@}
#define CONSOLE_UART UART0
#define CONSOLE_UART_ID ID_UART0
/** UART1 pins (UTXD1 and URXD1) definitions, PB2,PB3. */
#define PINS_UART0 (PIO_PA9A_URXD0 | PIO_PA10A_UTXD0)
#define PINS_UART0_FLAGS (PIO_PERIPH_A | PIO_DEFAULT)
#define PINS_UART0_PIO PIOA
//! \name SPI
//@{
/** SPI MISO pin definition. */
#define SPI_MISO_GPIO (PIO_PA12_IDX)
#define SPI_MISO_FLAGS (PIO_PERIPH_A | PIO_PULLUP)
/** SPI MOSI pin definition. */
#define SPI_MOSI_GPIO (PIO_PA13_IDX)
#define SPI_MOSI_FLAGS (PIO_PERIPH_A | PIO_PULLUP)
/** SPI SPCK pin definition. */
#define SPI_SPCK_GPIO (PIO_PA14_IDX)
#define SPI_SPCK_FLAGS (PIO_PERIPH_A | PIO_PULLUP)
/** SPI chip select 0 pin definition. (Only one configuration is possible) */
#define SPI_NPCS0_GPIO (PIO_PA11_IDX)
#define SPI_NPCS0_FLAGS (PIO_PERIPH_A | PIO_DEFAULT)
/** SPI chip select 1 pin definition. (multiple configurations are possible) */
#define SPI_NPCS1_PA31_GPIO (PIO_PA31_IDX)
#define SPI_NPCS1_PA31_FLAGS (PIO_PERIPH_A | PIO_DEFAULT)
/** SPI chip select 2 pin definition. (multiple configurations are possible) */
#define SPI_NPCS2_PA30_GPIO (PIO_PA30_IDX)
#define SPI_NPCS2_PA30_FLAGS (PIO_PERIPH_B | PIO_DEFAULT)
//@}
//! \name TWI
//@{
/** TWI0 pin definitions */
#define TWI0_DATA_GPIO PIO_PA3_IDX
#define TWI0_DATA_FLAGS (PIO_PERIPH_A | PIO_PULLUP)
#define TWI0_CLK_GPIO PIO_PA4_IDX
#define TWI0_CLK_FLAGS (PIO_PERIPH_A | PIO_PULLUP)
//@}
/** @} */
/** @} */
#endif /* OSMOCOM_E1_USB_H */