From 01bfac6dbc567562120fecb5ea8671f277e92ee5 Mon Sep 17 00:00:00 2001
From: Hauke Petersen <hauke.petersen@fu-berlin.de>
Date: Tue, 21 Nov 2017 13:25:28 +0100
Subject: [PATCH] boards/common: add Arduino Due common files

---
 boards/common/arduino-due/Makefile            |   3 +
 boards/common/arduino-due/Makefile.dep        |   3 +
 boards/common/arduino-due/Makefile.features   |  16 ++
 boards/common/arduino-due/Makefile.include    |  18 +++
 boards/common/arduino-due/board.c             |  31 ++++
 .../arduino-due/include/arduino_board.h       | 141 ++++++++++++++++
 .../arduino-due/include/arduino_pinmap.h      | 148 +++++++++++++++++
 boards/common/arduino-due/include/board.h     |  52 ++++++
 .../common/arduino-due/include/gpio_params.h  |  46 ++++++
 .../common/arduino-due/include/periph_conf.h  | 151 ++++++++++++++++++
 .../arduino-due/include/sdcard_spi_params.h   |  78 +++++++++
 .../common/arduino-due/include/w5100_params.h |  63 ++++++++
 12 files changed, 750 insertions(+)
 create mode 100644 boards/common/arduino-due/Makefile
 create mode 100644 boards/common/arduino-due/Makefile.dep
 create mode 100644 boards/common/arduino-due/Makefile.features
 create mode 100644 boards/common/arduino-due/Makefile.include
 create mode 100644 boards/common/arduino-due/board.c
 create mode 100644 boards/common/arduino-due/include/arduino_board.h
 create mode 100644 boards/common/arduino-due/include/arduino_pinmap.h
 create mode 100644 boards/common/arduino-due/include/board.h
 create mode 100644 boards/common/arduino-due/include/gpio_params.h
 create mode 100644 boards/common/arduino-due/include/periph_conf.h
 create mode 100644 boards/common/arduino-due/include/sdcard_spi_params.h
 create mode 100644 boards/common/arduino-due/include/w5100_params.h

diff --git a/boards/common/arduino-due/Makefile b/boards/common/arduino-due/Makefile
new file mode 100644
index 0000000000..f4c41bf9a0
--- /dev/null
+++ b/boards/common/arduino-due/Makefile
@@ -0,0 +1,3 @@
+MODULE = boards_common_arduino_due
+
+include $(RIOTBASE)/Makefile.base
diff --git a/boards/common/arduino-due/Makefile.dep b/boards/common/arduino-due/Makefile.dep
new file mode 100644
index 0000000000..5472bf8b8d
--- /dev/null
+++ b/boards/common/arduino-due/Makefile.dep
@@ -0,0 +1,3 @@
+ifneq (,$(filter saul_default,$(USEMODULE)))
+  USEMODULE += saul_gpio
+endif
diff --git a/boards/common/arduino-due/Makefile.features b/boards/common/arduino-due/Makefile.features
new file mode 100644
index 0000000000..16dda01475
--- /dev/null
+++ b/boards/common/arduino-due/Makefile.features
@@ -0,0 +1,16 @@
+# Put defined MCU peripherals here (in alphabetical order)
+FEATURES_PROVIDED += periph_adc
+FEATURES_PROVIDED += periph_dac
+FEATURES_PROVIDED += periph_gpio
+FEATURES_PROVIDED += periph_pwm
+FEATURES_PROVIDED += periph_spi
+FEATURES_PROVIDED += periph_timer
+FEATURES_PROVIDED += periph_uart
+
+# Various other features (if any)
+FEATURES_PROVIDED += arduino
+
+# The board MPU family (used for grouping by the CI system)
+FEATURES_MCU_GROUP = cortex_m3_1
+
+-include $(RIOTCPU)/sam3/Makefile.features
diff --git a/boards/common/arduino-due/Makefile.include b/boards/common/arduino-due/Makefile.include
new file mode 100644
index 0000000000..bdd1e97809
--- /dev/null
+++ b/boards/common/arduino-due/Makefile.include
@@ -0,0 +1,18 @@
+# define the cpu used by the arduino due based boards
+export CPU = sam3
+export CPU_MODEL = sam3x8e
+
+# export this module and its includes
+USEMODULE += boards_common_arduino_due
+INCLUDES  += -I$(RIOTBOARD)/common/arduino-due/include
+
+# define the default port depending on the host OS
+PORT_LINUX ?= /dev/ttyACM0
+PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))
+
+# setup serial terminal
+include $(RIOTMAKE)/tools/serial.inc.mk
+
+# setup flasher (using BOSSA)
+export BOSSA_ARDUINO_PREFLASH = yes
+include $(RIOTMAKE)/tools/bossa.inc.mk
diff --git a/boards/common/arduino-due/board.c b/boards/common/arduino-due/board.c
new file mode 100644
index 0000000000..86b5d19c65
--- /dev/null
+++ b/boards/common/arduino-due/board.c
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2014-2017 Freie Universität Berlin
+ *
+ * This file is subject to the terms and conditions of the GNU Lesser
+ * General Public License v2.1. See the file LICENSE in the top level
+ * directory for more details.
+ */
+
+/**
+ * @ingroup     boards_common_arduino_due
+ * @{
+ *
+ * @file
+ * @brief       Board specific for Arduino-due-based boards
+ *
+ * @author      Hauke Petersen <hauke.petersen@fu-berlin.de>
+ *
+ * @}
+ */
+
+#include "cpu.h"
+#include "board.h"
+#include "periph/gpio.h"
+
+void board_init(void)
+{
+    /* initialize the CPU */
+    cpu_init();
+    /* initialize the on-board Amber "L" LED @ pin PB27 */
+    gpio_init(LED0_PIN, GPIO_OUT);
+}
diff --git a/boards/common/arduino-due/include/arduino_board.h b/boards/common/arduino-due/include/arduino_board.h
new file mode 100644
index 0000000000..c0e434b123
--- /dev/null
+++ b/boards/common/arduino-due/include/arduino_board.h
@@ -0,0 +1,141 @@
+/*
+ * Copyright (C) 2016,2017 Freie Universität Berlin
+ *
+ * This file is subject to the terms and conditions of the GNU Lesser
+ * General Public License v2.1. See the file LICENSE in the top level
+ * directory for more details.
+ */
+
+/**
+ * @ingroup     boards_common_arduino_due
+ * @{
+ *
+ * @file
+ * @brief       Board specific configuration for the Arduino API
+ *
+ * @author      Hauke Petersen  <hauke.petersen@fu-berlin.de>
+ */
+
+#ifndef ARDUINO_BOARD_H
+#define ARDUINO_BOARD_H
+
+#include "arduino_pinmap.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief   The on-board LED is connected to pin 13 on this board
+ */
+#define ARDUINO_LED         (13)
+
+/**
+ * @brief   Look-up table for the Arduino's digital pins
+ */
+static const gpio_t arduino_pinmap[] = {
+    ARDUINO_PIN_0,
+    ARDUINO_PIN_1,
+    ARDUINO_PIN_2,
+    ARDUINO_PIN_3,
+    ARDUINO_PIN_4,
+    ARDUINO_PIN_5,
+    ARDUINO_PIN_6,
+    ARDUINO_PIN_7,
+    ARDUINO_PIN_8,
+    ARDUINO_PIN_9,
+    ARDUINO_PIN_10,
+    ARDUINO_PIN_11,
+    ARDUINO_PIN_12,
+    ARDUINO_PIN_13,
+    ARDUINO_PIN_14,
+    ARDUINO_PIN_15,
+    ARDUINO_PIN_16,
+    ARDUINO_PIN_17,
+    ARDUINO_PIN_18,
+    ARDUINO_PIN_19,
+    ARDUINO_PIN_20,
+    ARDUINO_PIN_21,
+    ARDUINO_PIN_22,
+    ARDUINO_PIN_23,
+    ARDUINO_PIN_24,
+    ARDUINO_PIN_25,
+    ARDUINO_PIN_26,
+    ARDUINO_PIN_27,
+    ARDUINO_PIN_28,
+    ARDUINO_PIN_29,
+    ARDUINO_PIN_30,
+    ARDUINO_PIN_31,
+    ARDUINO_PIN_32,
+    ARDUINO_PIN_33,
+    ARDUINO_PIN_34,
+    ARDUINO_PIN_35,
+    ARDUINO_PIN_36,
+    ARDUINO_PIN_37,
+    ARDUINO_PIN_38,
+    ARDUINO_PIN_39,
+    ARDUINO_PIN_40,
+    ARDUINO_PIN_41,
+    ARDUINO_PIN_42,
+    ARDUINO_PIN_43,
+    ARDUINO_PIN_44,
+    ARDUINO_PIN_45,
+    ARDUINO_PIN_46,
+    ARDUINO_PIN_47,
+    ARDUINO_PIN_48,
+    ARDUINO_PIN_49,
+    ARDUINO_PIN_50,
+    ARDUINO_PIN_51,
+    ARDUINO_PIN_52,
+    ARDUINO_PIN_53,
+    ARDUINO_PIN_54,
+    ARDUINO_PIN_55,
+    ARDUINO_PIN_56,
+    ARDUINO_PIN_57,
+    ARDUINO_PIN_58,
+    ARDUINO_PIN_59,
+    ARDUINO_PIN_60,
+    ARDUINO_PIN_61,
+    ARDUINO_PIN_62,
+    ARDUINO_PIN_63,
+    ARDUINO_PIN_64,
+    ARDUINO_PIN_65,
+    ARDUINO_PIN_66,
+    ARDUINO_PIN_67,
+    ARDUINO_PIN_68,
+    ARDUINO_PIN_69,
+    ARDUINO_PIN_70,
+    ARDUINO_PIN_71,
+    ARDUINO_PIN_72,
+    ARDUINO_PIN_73,
+    ARDUINO_PIN_74,
+    ARDUINO_PIN_75,
+    ARDUINO_PIN_76,
+    ARDUINO_PIN_77,
+    ARDUINO_PIN_78,
+};
+
+/**
+ * @brief   Look-up table for the Arduino's analog pins
+ */
+static const adc_t arduino_analog_map[] = {
+    ARDUINO_A0,
+    ARDUINO_A1,
+    ARDUINO_A2,
+    ARDUINO_A3,
+    ARDUINO_A4,
+    ARDUINO_A5,
+    ARDUINO_A6,
+    ARDUINO_A7,
+    ARDUINO_A8,
+    ARDUINO_A9,
+    ARDUINO_A10,
+    ARDUINO_A11,
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ARDUINO_BOARD_H */
+/** @} */
diff --git a/boards/common/arduino-due/include/arduino_pinmap.h b/boards/common/arduino-due/include/arduino_pinmap.h
new file mode 100644
index 0000000000..7d03b50545
--- /dev/null
+++ b/boards/common/arduino-due/include/arduino_pinmap.h
@@ -0,0 +1,148 @@
+/*
+ * Copyright (C) 2015,2017 Freie Universität Berlin
+ *
+ * This file is subject to the terms and conditions of the GNU Lesser
+ * General Public License v2.1. See the file LICENSE in the top level
+ * directory for more details.
+ */
+
+/**
+ * @ingroup     boards_common_arduino_due
+ * @{
+ *
+ * @file
+ * @brief       Mapping from MCU pins to Arduino pins
+ *
+ * You can use the defines in this file for simplified interaction with the
+ * Arduino specific pin numbers.
+ *
+ * @author      Hauke Petersen <hauke.petersen@fu-berlin.de>
+ */
+
+#ifndef ARDUINO_PINMAP_H
+#define ARDUINO_PINMAP_H
+
+#include "periph/gpio.h"
+#include "periph/adc.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @name    Mapping of MCU pins to Arduino pins
+ * @{
+ */
+#define ARDUINO_PIN_0           GPIO_PIN(PA, 8)
+#define ARDUINO_PIN_1           GPIO_PIN(PA, 9)
+#define ARDUINO_PIN_2           GPIO_PIN(PB, 25)
+#define ARDUINO_PIN_3           GPIO_PIN(PC, 28)
+#define ARDUINO_PIN_4           GPIO_PIN(PA, 29)
+#define ARDUINO_PIN_5           GPIO_PIN(PC, 25)
+#define ARDUINO_PIN_6           GPIO_PIN(PC, 24)
+#define ARDUINO_PIN_7           GPIO_PIN(PC, 23)
+#define ARDUINO_PIN_8           GPIO_PIN(PC, 22)
+#define ARDUINO_PIN_9           GPIO_PIN(PC, 21)
+#define ARDUINO_PIN_10          GPIO_PIN(PC, 29)
+#define ARDUINO_PIN_11          GPIO_PIN(PD, 7)
+#define ARDUINO_PIN_12          GPIO_PIN(PD, 8)
+#define ARDUINO_PIN_13          GPIO_PIN(PB, 27)
+#define ARDUINO_PIN_14          GPIO_PIN(PD, 4)
+#define ARDUINO_PIN_15          GPIO_PIN(PD, 5)
+#define ARDUINO_PIN_16          GPIO_PIN(PA, 13)
+#define ARDUINO_PIN_17          GPIO_PIN(PA, 12)
+#define ARDUINO_PIN_18          GPIO_PIN(PA, 11)
+#define ARDUINO_PIN_19          GPIO_PIN(PA, 10)
+#define ARDUINO_PIN_20          GPIO_PIN(PB, 12)
+#define ARDUINO_PIN_21          GPIO_PIN(PB, 13)
+#define ARDUINO_PIN_22          GPIO_PIN(PB, 26)
+#define ARDUINO_PIN_23          GPIO_PIN(PA, 14)
+#define ARDUINO_PIN_24          GPIO_PIN(PA, 15)
+#define ARDUINO_PIN_25          GPIO_PIN(PD, 0)
+#define ARDUINO_PIN_26          GPIO_PIN(PD, 1)
+#define ARDUINO_PIN_27          GPIO_PIN(PD, 2)
+#define ARDUINO_PIN_28          GPIO_PIN(PD, 3)
+#define ARDUINO_PIN_29          GPIO_PIN(PD, 6)
+#define ARDUINO_PIN_30          GPIO_PIN(PD, 9)
+#define ARDUINO_PIN_31          GPIO_PIN(PA, 7)
+#define ARDUINO_PIN_32          GPIO_PIN(PD, 10)
+#define ARDUINO_PIN_33          GPIO_PIN(PC, 1)
+#define ARDUINO_PIN_34          GPIO_PIN(PC, 2)
+#define ARDUINO_PIN_35          GPIO_PIN(PC, 3)
+#define ARDUINO_PIN_36          GPIO_PIN(PC, 4)
+#define ARDUINO_PIN_37          GPIO_PIN(PC, 5)
+#define ARDUINO_PIN_38          GPIO_PIN(PC, 6)
+#define ARDUINO_PIN_39          GPIO_PIN(PC, 7)
+#define ARDUINO_PIN_40          GPIO_PIN(PC, 8)
+#define ARDUINO_PIN_41          GPIO_PIN(PC, 9)
+#define ARDUINO_PIN_42          GPIO_PIN(PA, 19)
+#define ARDUINO_PIN_43          GPIO_PIN(PA, 20)
+#define ARDUINO_PIN_44          GPIO_PIN(PC, 19)
+#define ARDUINO_PIN_45          GPIO_PIN(PC, 18)
+#define ARDUINO_PIN_46          GPIO_PIN(PC, 17)
+#define ARDUINO_PIN_47          GPIO_PIN(PC, 16)
+#define ARDUINO_PIN_48          GPIO_PIN(PC, 15)
+#define ARDUINO_PIN_49          GPIO_PIN(PC, 14)
+#define ARDUINO_PIN_50          GPIO_PIN(PC, 13)
+#define ARDUINO_PIN_51          GPIO_PIN(PC, 12)
+#define ARDUINO_PIN_52          GPIO_PIN(PB, 21)
+#define ARDUINO_PIN_53          GPIO_PIN(PB, 14)
+#define ARDUINO_PIN_54          GPIO_PIN(PA, 16)
+#define ARDUINO_PIN_55          GPIO_PIN(PA, 24)
+#define ARDUINO_PIN_56          GPIO_PIN(PA, 23)
+#define ARDUINO_PIN_57          GPIO_PIN(PA, 22)
+#define ARDUINO_PIN_58          GPIO_PIN(PA, 6)
+#define ARDUINO_PIN_59          GPIO_PIN(PA, 4)
+#define ARDUINO_PIN_60          GPIO_PIN(PA, 3)
+#define ARDUINO_PIN_61          GPIO_PIN(PA, 2)
+#define ARDUINO_PIN_62          GPIO_PIN(PB, 17)
+#define ARDUINO_PIN_63          GPIO_PIN(PB, 18)
+#define ARDUINO_PIN_64          GPIO_PIN(PB, 19)
+#define ARDUINO_PIN_65          GPIO_PIN(PB, 20)
+#define ARDUINO_PIN_66          GPIO_PIN(PB, 15)
+#define ARDUINO_PIN_67          GPIO_PIN(PB, 16)
+#define ARDUINO_PIN_68          GPIO_PIN(PA, 1)
+#define ARDUINO_PIN_69          GPIO_PIN(PA, 0)
+#define ARDUINO_PIN_70          GPIO_PIN(PA, 17)
+#define ARDUINO_PIN_71          GPIO_PIN(PA, 18)
+#define ARDUINO_PIN_72          GPIO_PIN(PC, 30)
+#define ARDUINO_PIN_73          GPIO_PIN(PA, 21)
+#define ARDUINO_PIN_74          GPIO_PIN(PA, 25)
+#define ARDUINO_PIN_75          GPIO_PIN(PA, 26)
+#define ARDUINO_PIN_76          GPIO_PIN(PA, 27)
+#define ARDUINO_PIN_77          GPIO_PIN(PA, 28)
+#define ARDUINO_PIN_78          GPIO_PIN(PB, 23)
+/** @ */
+
+/**
+ * @name    Mapping of Ardunino analog pins to RIOT ADC lines
+ * @{
+ */
+#define ARDUINO_A0              ADC_LINE(7)
+#define ARDUINO_A1              ADC_LINE(6)
+#define ARDUINO_A2              ADC_LINE(5)
+#define ARDUINO_A3              ADC_LINE(4)
+#define ARDUINO_A4              ADC_LINE(3)
+#define ARDUINO_A5              ADC_LINE(2)
+#define ARDUINO_A6              ADC_LINE(1)
+#define ARDUINO_A7              ADC_LINE(0)
+#define ARDUINO_A8              ADC_LINE(10)
+#define ARDUINO_A9              ADC_LINE(11)
+#define ARDUINO_A10             ADC_LINE(12)
+#define ARDUINO_A11             ADC_LINE(13)
+/** @} */
+
+/**
+ * @name    Mapping of Arduino DAC pins to RIOT DAC lines
+ * @{
+ */
+#define ARDUINO_DAC0            DAC_LINE(0)
+#define ARDUINO_DAC1            DAC_LINE(1)
+/** @} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ARDUINO_PINMAP_H */
+/** @} */
diff --git a/boards/common/arduino-due/include/board.h b/boards/common/arduino-due/include/board.h
new file mode 100644
index 0000000000..a5e86a5ab4
--- /dev/null
+++ b/boards/common/arduino-due/include/board.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2014,2017 Freie Universität Berlin
+ *
+ * This file is subject to the terms and conditions of the GNU Lesser
+ * General Public License v2.1. See the file LICENSE in the top level
+ * directory for more details.
+ */
+
+/**
+ * @defgroup    boards_common_arduino_due Shared Arduino Due Code
+ * @ingroup     boards
+ * @brief       Shared code for Arduino Due based boards
+ * @{
+ *
+ * @file
+ * @brief       Board specific definitions for the Arduino Due based boards
+ *
+ * @author      Hauke Petersen <hauke.petersen@fu-berlin.de>
+ */
+
+#ifndef BOARD_H
+#define BOARD_H
+
+#include "cpu.h"
+#include "arduino_pinmap.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @name LED pin definitions
+ * @{
+ */
+#define LED0_PIN            GPIO_PIN(PB, 27)
+
+#define LED0_ON             (PIOB->PIO_SODR  = PIO_PB27)
+#define LED0_OFF            (PIOB->PIO_CODR  = PIO_PB27)
+#define LED0_TOGGLE         ((PIOB->PIO_ODSR & PIO_PB27) ? LED0_OFF : LED0_ON)
+/** @} */
+
+/**
+ * @brief Initialize board specific hardware, including clock, LEDs and std-IO
+ */
+void board_init(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BOARD_H */
+/** @} */
diff --git a/boards/common/arduino-due/include/gpio_params.h b/boards/common/arduino-due/include/gpio_params.h
new file mode 100644
index 0000000000..f3c7d9d165
--- /dev/null
+++ b/boards/common/arduino-due/include/gpio_params.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2016-2017 Freie Universität Berlin
+ *
+ * This file is subject to the terms and conditions of the GNU Lesser
+ * General Public License v2.1. See the file LICENSE in the top level
+ * directory for more details.
+ */
+
+/**
+ * @ingroup   boards_common_arduino_due
+ * @{
+ *
+ * @file
+ * @brief     Board specific configuration of direct mapped GPIOs
+ *
+ * @author    Hauke Petersen <hauke.petersen@fu-berlin.de>
+ */
+
+#ifndef GPIO_PARAMS_H
+#define GPIO_PARAMS_H
+
+#include "board.h"
+#include "saul/periph.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief   LED configuration
+ */
+static const  saul_gpio_params_t saul_gpio_params[] =
+{
+    {
+        .name = "LED",
+        .pin = LED0_PIN,
+        .mode = GPIO_OUT
+    }
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GPIO_PARAMS_H */
+/** @} */
diff --git a/boards/common/arduino-due/include/periph_conf.h b/boards/common/arduino-due/include/periph_conf.h
new file mode 100644
index 0000000000..2c94b12a31
--- /dev/null
+++ b/boards/common/arduino-due/include/periph_conf.h
@@ -0,0 +1,151 @@
+ /*
+ * Copyright (C) 2014-2015,2017 Freie Universität Berlin
+ *
+ * This file is subject to the terms and conditions of the GNU Lesser
+ * General Public License v2.1. See the file LICENSE in the top level
+ * directory for more details.
+ */
+
+/**
+ * @ingroup     boards_common_arduino_due
+ * @{
+ *
+ * @file
+ * @brief       Peripheral MCU configuration for Arduino Due based boards
+ *
+ * @author      Hauke Petersen <hauke.petersen@fu-berlin.de>
+ * @author      Peter Kietzmann <peter.kietzmann@haw-hamburg.de>
+ * @author      Andreas "Paul" Pauli <andreas.pauli@haw-hamburg.de>
+ */
+
+#ifndef PERIPH_CONF_H
+#define PERIPH_CONF_H
+
+#include "periph_cpu.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @name    Clock configuration
+ * @{
+ */
+/* targeted system core clock */
+#define CLOCK_CORECLOCK     (84000000UL)
+/* external oscillator clock */
+#define CLOCK_EXT_OSC       (12000000UL)
+/* define PLL configuration
+ *
+ * The values must fulfill this equation:
+ * CORECLOCK = (EXT_OCS / PLL_DIV) * (PLL_MUL + 1)
+ */
+#define CLOCK_PLL_MUL       (83)
+#define CLOCK_PLL_DIV       (12)
+
+/* number of wait states before flash read and write operations */
+#define CLOCK_FWS           (4)         /* 4 is save for 84MHz */
+/** @} */
+
+/**
+ * @name    Timer peripheral configuration
+ * @{
+ */
+static const timer_conf_t timer_config[] = {
+    { .dev = TC0, .id_ch0 = ID_TC0 },
+    { .dev = TC1, .id_ch0 = ID_TC3 }
+};
+
+#define TIMER_0_ISR         isr_tc0
+#define TIMER_1_ISR         isr_tc3
+
+#define TIMER_NUMOF         (sizeof(timer_config) / sizeof(timer_config[0]))
+/** @} */
+
+/**
+ * @name    UART configuration
+ * @{
+ */
+static const uart_conf_t uart_config[] = {
+    {
+        .dev    = (Uart *)UART,
+        .rx_pin = GPIO_PIN(PA, 8),
+        .tx_pin = GPIO_PIN(PA, 9),
+        .mux    = GPIO_MUX_A,
+        .pmc_id = ID_UART,
+        .irqn   = UART_IRQn
+    },
+    {
+        .dev    = (Uart *)USART0,
+        .rx_pin = GPIO_PIN(PA, 10),
+        .tx_pin = GPIO_PIN(PA, 11),
+        .mux    = GPIO_MUX_A,
+        .pmc_id = ID_USART0,
+        .irqn   = USART0_IRQn
+    },
+    {
+        .dev    = (Uart *)USART1,
+        .rx_pin = GPIO_PIN(PA, 12),
+        .tx_pin = GPIO_PIN(PA, 13),
+        .mux    = GPIO_MUX_A,
+        .pmc_id = ID_USART1,
+        .irqn   = USART1_IRQn
+    },
+    {
+        .dev    = (Uart *)USART3,
+        .rx_pin = GPIO_PIN(PD, 5),
+        .tx_pin = GPIO_PIN(PD, 4),
+        .mux    = GPIO_MUX_B,
+        .pmc_id = ID_USART3,
+        .irqn   = USART3_IRQn
+    }
+};
+
+/* define interrupt vectors */
+#define UART_0_ISR          isr_uart
+#define UART_1_ISR          isr_usart0
+#define UART_2_ISR          isr_usart1
+#define UART_3_ISR          isr_usart3
+
+#define UART_NUMOF          (sizeof(uart_config) / sizeof(uart_config[0]))
+/** @} */
+
+/**
+* @name     SPI configuration
+* @{
+*/
+static const spi_conf_t spi_config[] = {
+    {
+        .dev   = SPI0,
+        .id    = ID_SPI0,
+        .clk   = GPIO_PIN(PA, 27),
+        .mosi  = GPIO_PIN(PA, 26),
+        .miso  = GPIO_PIN(PA, 25),
+        .mux   = GPIO_MUX_A
+    }
+};
+
+#define SPI_NUMOF           (sizeof(spi_config) / sizeof(spi_config[0]))
+/** @} */
+
+/**
+ * @name    PWM configuration
+ * @{
+ */
+static const pwm_chan_conf_t pwm_chan[] = {
+    { .pin = GPIO_PIN(PC, 21), .hwchan = 4 },
+    { .pin = GPIO_PIN(PC, 22), .hwchan = 5 },
+    { .pin = GPIO_PIN(PC, 23), .hwchan = 6 },
+    { .pin = GPIO_PIN(PC, 24), .hwchan = 7 }
+};
+
+#define PWM_NUMOF           (1U)
+#define PWM_CHAN_NUMOF      (sizeof(pwm_chan) / sizeof(pwm_chan[0]))
+/** @} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* PERIPH_CONF_H */
+/** @} */
diff --git a/boards/common/arduino-due/include/sdcard_spi_params.h b/boards/common/arduino-due/include/sdcard_spi_params.h
new file mode 100644
index 0000000000..608a4726dc
--- /dev/null
+++ b/boards/common/arduino-due/include/sdcard_spi_params.h
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2017 Michel Rottleuthner <michel.rottleuthner@haw-hamburg.de>
+ *               2017 Freie Universität Berlin
+ *
+ * This file is subject to the terms and conditions of the GNU Lesser
+ * General Public License v2.1. See the file LICENSE in the top level
+ * directory for more details.
+ */
+
+/**
+ * @ingroup     boards_common_arduino_due
+ * @{
+ *
+ * @file
+ * @brief       SD card configuration for the Arduino SD card shields
+ *
+ * @author      Michel Rottleuthner <michel.rottleuthner@haw-hamburg.de>
+ * @author      Hauke Petersen <hauke.petersen@fu-berlin.de>
+ */
+
+#ifndef SDCARD_SPI_PARAMS_H
+#define SDCARD_SPI_PARAMS_H
+
+#include "arduino_pinmap.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @name    Default configuration for the sdcard_spi driver
+ * @{
+ */
+#ifndef SDCARD_SPI_PARAM_SPI
+#define SDCARD_SPI_PARAM_SPI         (SPI_DEV(0))
+#endif
+#ifndef SDCARD_SPI_PARAM_CS
+#define SDCARD_SPI_PARAM_CS          (ARDUINO_PIN_4)
+#endif
+#ifndef SDCARD_SPI_PARAM_CLK
+#define SDCARD_SPI_PARAM_CLK         (ARDUINO_PIN_76)
+#endif
+#ifndef SDCARD_SPI_PARAM_MOSI
+#define SDCARD_SPI_PARAM_MOSI        (ARDUINO_PIN_75)
+#endif
+#ifndef SDCARD_SPI_PARAM_MISO
+#define SDCARD_SPI_PARAM_MISO        (ARDUINO_PIN_74)
+#endif
+#ifndef SDCARD_SPI_PARAM_POWER
+#define SDCARD_SPI_PARAM_POWER       (GPIO_UNDEF)
+#endif
+#ifndef SDCARD_SPI_PARAM_POWER_AH
+/** treated as 'don't care' if SDCARD_SPI_PARAM_POWER is GPIO_UNDEF */
+#define SDCARD_SPI_PARAM_POWER_AH    (true)
+#endif
+/** @} */
+
+/**
+ * @brief   sdcard_spi configuration
+ */
+static const  sdcard_spi_params_t sdcard_spi_params[] = {
+    {
+        .spi_dev        = SDCARD_SPI_PARAM_SPI,
+        .cs             = SDCARD_SPI_PARAM_CS,
+        .clk            = SDCARD_SPI_PARAM_CLK,
+        .mosi           = SDCARD_SPI_PARAM_MOSI,
+        .miso           = SDCARD_SPI_PARAM_MISO,
+        .power          = SDCARD_SPI_PARAM_POWER,
+        .power_act_high = SDCARD_SPI_PARAM_POWER_AH
+    },
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* SDCARD_SPI_PARAMS_H */
+/** @} */
diff --git a/boards/common/arduino-due/include/w5100_params.h b/boards/common/arduino-due/include/w5100_params.h
new file mode 100644
index 0000000000..032291900f
--- /dev/null
+++ b/boards/common/arduino-due/include/w5100_params.h
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2016-2017 Freie Universität Berlin
+ *
+ * This file is subject to the terms and conditions of the GNU Lesser
+ * General Public License v2.1. See the file LICENSE in the top level
+ * directory for more details.
+ */
+
+/**
+ * @ingroup     boards_common_arduino_due
+ * @{
+ *
+ * @file
+ * @brief       Parameters for W5100 Arduino Ehternet Shields (v4 and v5)
+ *
+ * @author      Hauke Petersen <hauke.petersen@fu-berlin.de>
+ */
+
+#ifndef W5100_PARAMS_H
+#define W5100_PARAMS_H
+
+#include "arduino_pinmap.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @name    Configuration parameters for the W5100 driver
+ * @{
+ */
+#ifndef W5100_PARAM_SPI
+#define W5100_PARAM_SPI         (SPI_DEV(0))
+#endif
+#ifndef W5100_PARAM_SPI_CLK
+#define W5100_PARAM_SPI_CLK     (SPI_CLK_5MHZ)
+#endif
+#ifndef W5100_PARAM_CS
+#define W5100_PARAM_CS          (ARDUINO_PIN_10)
+#endif
+#ifndef W5100_PARAM_EVT
+#define W5100_PARAM_EVT         (ARDUINO_PIN_2)
+#endif
+/** @} */
+
+/**
+ * @brief   W5100 configuration instance
+ */
+static const  w5100_params_t w5100_params[] = {
+    {
+        .spi = W5100_PARAM_SPI,
+        .clk = W5100_PARAM_SPI_CLK,
+        .cs  = W5100_PARAM_CS,
+        .evt = W5100_PARAM_EVT
+    },
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* W5100_PARAMS_H */
+/** @} */
-- 
GitLab