From c4edff3a593198d8dab935f371e2a6a30d5d22c4 Mon Sep 17 00:00:00 2001 From: Francisco Molina Date: Sun, 25 Oct 2020 15:55:54 +0100 Subject: [PATCH] boards cpu: move OpenWSN defintions to openwsn_defs.h --- boards/common/iotlab/include/board_common.h | 17 -------- boards/common/iotlab/include/openwsn_defs.h | 48 +++++++++++++++++++++ boards/openmote-b/include/board.h | 3 ++ boards/samr21-xpro/include/board.h | 16 ------- boards/samr21-xpro/include/openwsn_defs.h | 48 +++++++++++++++++++++ cpu/cc2538/include/cpu_conf.h | 14 ------ cpu/cc2538/include/openwsn_defs.h | 43 ++++++++++++++++++ cpu/nrf52/include/openwsn_defs.h | 48 +++++++++++++++++++++ pkg/openwsn/include/board_info.h | 6 +++ 9 files changed, 196 insertions(+), 47 deletions(-) create mode 100644 boards/common/iotlab/include/openwsn_defs.h create mode 100644 boards/samr21-xpro/include/openwsn_defs.h create mode 100644 cpu/cc2538/include/openwsn_defs.h create mode 100644 cpu/nrf52/include/openwsn_defs.h diff --git a/boards/common/iotlab/include/board_common.h b/boards/common/iotlab/include/board_common.h index ed573fd156..e2b86e4db0 100644 --- a/boards/common/iotlab/include/board_common.h +++ b/boards/common/iotlab/include/board_common.h @@ -61,23 +61,6 @@ extern "C" { #define CONFIG_ZTIMER_USEC_MIN (2) /** @} */ -/** - * @name OpenWSN timing constants - * - * @{ - */ -/* Measured 440us + ~10% */ -#define PORT_maxTxDataPrepare (500/PORT_US_PER_TICK) -/* Measured 200us + ~10% */ -#define PORT_maxRxAckPrepare (300/PORT_US_PER_TICK) -/* Measured 300us + ~10% */ -#define PORT_maxRxDataPrepare (350/PORT_US_PER_TICK) -/* Measured 316us + ~10% */ -#define PORT_maxTxAckPrepare (350/PORT_US_PER_TICK) -/* Measured 360us with openwsn_sctimer_rtt */ -#define PORT_delayTx (360/PORT_US_PER_TICK) -/** @} */ - /** * @name Define the interface to the AT86RF231 radio * diff --git a/boards/common/iotlab/include/openwsn_defs.h b/boards/common/iotlab/include/openwsn_defs.h new file mode 100644 index 0000000000..cb8469fd98 --- /dev/null +++ b/boards/common/iotlab/include/openwsn_defs.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2020 Inria + * + * 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 + * @{ + * + * @file + * @brief Board specific definitions for pkg/openwsn + * + * @author Francisco Molina + */ + +#ifndef OPENWSN_DEFS_H +#define OPENWSN_DEFS_H + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @name OpenWSN timing constants + * + * @{ + */ +/* Measured 440us + ~10% */ +#define PORT_maxTxDataPrepare (500/PORT_US_PER_TICK) +/* Measured 200us + ~10% */ +#define PORT_maxRxAckPrepare (300/PORT_US_PER_TICK) +/* Measured 300us + ~10% */ +#define PORT_maxRxDataPrepare (350/PORT_US_PER_TICK) +/* Measured 316us + ~10% */ +#define PORT_maxTxAckPrepare (350/PORT_US_PER_TICK) +/* Measured 360us with openwsn_sctimer_rtt */ +#define PORT_delayTx (360/PORT_US_PER_TICK) +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* OPENWSN_DEFS_H */ +/** @} */ diff --git a/boards/openmote-b/include/board.h b/boards/openmote-b/include/board.h index 1863d83b25..fe55deddd2 100644 --- a/boards/openmote-b/include/board.h +++ b/boards/openmote-b/include/board.h @@ -88,6 +88,9 @@ /** * @name OpenWSN leds configuration + * + * @note This configuration mimics the one done in OpenWSN-fw for the + * same platform * @{ */ #define OPENWSN_LEDPIN_ERROR LED0_PIN diff --git a/boards/samr21-xpro/include/board.h b/boards/samr21-xpro/include/board.h index 929c7e31b8..daba7670a4 100644 --- a/boards/samr21-xpro/include/board.h +++ b/boards/samr21-xpro/include/board.h @@ -82,22 +82,6 @@ static inline int _edbg_get_eui64(const void *arg, eui64_t *addr) #define EUI64_PROVIDER_INDEX 0 /** @} */ -/** - * @name OpenWSN timing constants - * - * @{ - */ -/* Measured 800us + ~10% */ -#define PORT_maxTxDataPrepare (900/PORT_US_PER_TICK) -/* Measured 450us + ~10% */ -#define PORT_maxRxAckPrepare (500/PORT_US_PER_TICK) -/* Measured 500us + ~10% */ -#define PORT_maxRxDataPrepare (550/PORT_US_PER_TICK) -/* Measured 660us + ~10% */ -#define PORT_maxTxAckPrepare (750/PORT_US_PER_TICK) -/* Measured 650us with openwsn_sctimer_rtt */ -#define PORT_delayTx (650/PORT_US_PER_TICK) -/** @} */ /** * @name LED pin definitions and handlers diff --git a/boards/samr21-xpro/include/openwsn_defs.h b/boards/samr21-xpro/include/openwsn_defs.h new file mode 100644 index 0000000000..84450e2d5c --- /dev/null +++ b/boards/samr21-xpro/include/openwsn_defs.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2020 Inria + * + * 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_samr21-xpro + * @{ + * + * @file + * @brief Board specific definitions for pkg/openwsn + * + * @author Francisco Molina + */ + +#ifndef OPENWSN_DEFS_H +#define OPENWSN_DEFS_H + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @name OpenWSN timing constants + * + * @{ + */ +/* Measured 800us + ~10% */ +#define PORT_maxTxDataPrepare (900/PORT_US_PER_TICK) +/* Measured 450us + ~10% */ +#define PORT_maxRxAckPrepare (500/PORT_US_PER_TICK) +/* Measured 500us + ~10% */ +#define PORT_maxRxDataPrepare (550/PORT_US_PER_TICK) +/* Measured 660us + ~10% */ +#define PORT_maxTxAckPrepare (750/PORT_US_PER_TICK) +/* Measured 650us with openwsn_sctimer_rtt */ +#define PORT_delayTx (650/PORT_US_PER_TICK) +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* OPENWSN_DEFS_H */ +/** @} */ diff --git a/cpu/cc2538/include/cpu_conf.h b/cpu/cc2538/include/cpu_conf.h index 48af9a8b97..aa37cd6108 100644 --- a/cpu/cc2538/include/cpu_conf.h +++ b/cpu/cc2538/include/cpu_conf.h @@ -43,7 +43,6 @@ extern "C" { #define CPU_HAS_BITBAND (1) /** @} */ - /** * @brief Flash page configuration * @{ @@ -71,19 +70,6 @@ extern "C" { #define FLASHPAGE_RAW_ALIGNMENT (4U) /** @} */ -/** - * @name OpenWSN timing constants - * - * @{ - */ -/* Taken from openwsn-fw */ -#define PORT_maxTxDataPrepare (460/PORT_US_PER_TICK) -#define PORT_maxRxAckPrepare (300/PORT_US_PER_TICK) -#define PORT_maxRxDataPrepare (300/PORT_US_PER_TICK) -#define PORT_maxTxAckPrepare (460/PORT_US_PER_TICK) -#define PORT_delayTx (400/PORT_US_PER_TICK) -/** @} */ - #ifdef __cplusplus } /* end extern "C" */ #endif diff --git a/cpu/cc2538/include/openwsn_defs.h b/cpu/cc2538/include/openwsn_defs.h new file mode 100644 index 0000000000..4004234d19 --- /dev/null +++ b/cpu/cc2538/include/openwsn_defs.h @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2020 Inria + * + * 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 cpu + * @{ + * + * @file + * @brief cc2538 specific definitions for pkg/openwsn + * + * @author Francisco Molina + */ + +#ifndef OPENWSN_DEFS_H +#define OPENWSN_DEFS_H + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @name OpenWSN timing constants + * + * @{ + */ +/* Taken from openwsn-fw */ +#define PORT_maxTxDataPrepare (460/PORT_US_PER_TICK) +#define PORT_maxRxAckPrepare (300/PORT_US_PER_TICK) +#define PORT_maxRxDataPrepare (300/PORT_US_PER_TICK) +#define PORT_maxTxAckPrepare (460/PORT_US_PER_TICK) +#define PORT_delayTx (400/PORT_US_PER_TICK) +/** @} */ +#ifdef __cplusplus +} +#endif + +#endif /* OPENWSN_DEFS_H */ +/** @} */ diff --git a/cpu/nrf52/include/openwsn_defs.h b/cpu/nrf52/include/openwsn_defs.h new file mode 100644 index 0000000000..dbf55b99ba --- /dev/null +++ b/cpu/nrf52/include/openwsn_defs.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2020 Inria + * + * 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 cpu + * @{ + * + * @file + * @brief nrf52 specific definitions for pkg/openwsn + * + * @author Francisco Molina + */ + +#ifndef OPENWSN_DEFS_H +#define OPENWSN_DEFS_H + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef CPU_MODEL_NRF52840XXAA +/** + * @name OpenWSN timing constants + * + * @{ + */ +/* Taken from OpenWSN @32.768Hz */ +#define PORT_maxTxDataPrepare (400/PORT_US_PER_TICK) +#define PORT_maxRxAckPrepare (400/PORT_US_PER_TICK) +#define PORT_maxRxDataPrepare (400/PORT_US_PER_TICK) +#define PORT_maxTxAckPrepare (400/PORT_US_PER_TICK) +/* Measured 220us */ +#define PORT_delayTx (300/PORT_US_PER_TICK) +#define PORT_delayRx (150/PORT_US_PER_TICK) +/** @} */ +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* OPENWSN_DEFS_H */ +/** @} */ diff --git a/pkg/openwsn/include/board_info.h b/pkg/openwsn/include/board_info.h index 03a43f0db8..d4f5a9145a 100644 --- a/pkg/openwsn/include/board_info.h +++ b/pkg/openwsn/include/board_info.h @@ -31,6 +31,12 @@ #include "periph_conf.h" #include "timex.h" +#if defined __has_include +# if __has_include ("openwsn_defs.h") +# include "openwsn_defs.h" +# endif +#endif + #ifdef __cplusplus extern "C" { #endif