From 62b6522e012d27a3a1972dc4387fb5b85c5fcbb4 Mon Sep 17 00:00:00 2001 From: Hauke Petersen Date: Thu, 20 Nov 2014 13:34:00 +0100 Subject: [PATCH 1/3] cpu: moved reboot_arch for cortex cpus --- .../reboot_arch.c | 4 +-- .../reboot_arch.c | 4 +-- .../reboot_arch.c | 6 ++-- cpu/nrf51822/reboot_arch.c | 34 ------------------- cpu/stm32f0/reboot_arch.c | 34 ------------------- cpu/stm32f1/reboot_arch.c | 34 ------------------- cpu/stm32f3/reboot_arch.c | 34 ------------------- cpu/stm32f4/reboot_arch.c | 34 ------------------- 8 files changed, 7 insertions(+), 177 deletions(-) rename cpu/{cc2538 => cortex-m0_common}/reboot_arch.c (90%) rename cpu/{sam3x8e => cortex-m3_common}/reboot_arch.c (90%) rename cpu/{samd21 => cortex-m4_common}/reboot_arch.c (80%) delete mode 100644 cpu/nrf51822/reboot_arch.c delete mode 100644 cpu/stm32f0/reboot_arch.c delete mode 100644 cpu/stm32f1/reboot_arch.c delete mode 100644 cpu/stm32f3/reboot_arch.c delete mode 100644 cpu/stm32f4/reboot_arch.c diff --git a/cpu/cc2538/reboot_arch.c b/cpu/cortex-m0_common/reboot_arch.c similarity index 90% rename from cpu/cc2538/reboot_arch.c rename to cpu/cortex-m0_common/reboot_arch.c index cb22deeec8..dbb6940d1a 100644 --- a/cpu/cc2538/reboot_arch.c +++ b/cpu/cortex-m0_common/reboot_arch.c @@ -7,10 +7,10 @@ */ /** - * @ingroup cpu_cc2538 + * @ingroup cpu_cortexm0_common * @{ * - * @file reboot_arch.c + * @file * @brief Implementation of the kernels reboot interface * * @author Hauke Petersen diff --git a/cpu/sam3x8e/reboot_arch.c b/cpu/cortex-m3_common/reboot_arch.c similarity index 90% rename from cpu/sam3x8e/reboot_arch.c rename to cpu/cortex-m3_common/reboot_arch.c index 6d61335b51..ccb3ef14b1 100644 --- a/cpu/sam3x8e/reboot_arch.c +++ b/cpu/cortex-m3_common/reboot_arch.c @@ -7,10 +7,10 @@ */ /** - * @ingroup cpu_sam3x8e + * @ingroup cpu_cortexm3_common * @{ * - * @file reboot_arch.c + * @file * @brief Implementation of the kernels reboot interface * * @author Hauke Petersen diff --git a/cpu/samd21/reboot_arch.c b/cpu/cortex-m4_common/reboot_arch.c similarity index 80% rename from cpu/samd21/reboot_arch.c rename to cpu/cortex-m4_common/reboot_arch.c index a6fc0c9589..78ade0b876 100644 --- a/cpu/samd21/reboot_arch.c +++ b/cpu/cortex-m4_common/reboot_arch.c @@ -7,13 +7,13 @@ */ /** - * @ingroup cpu_samd21 + * @ingroup cpu_cortexm4_common * @{ * - * @file reboot_arch.c + * @file * @brief Implementation of the kernels reboot interface * - * @author Thomas Eichinger + * @author Hauke Petersen * * @} */ diff --git a/cpu/nrf51822/reboot_arch.c b/cpu/nrf51822/reboot_arch.c deleted file mode 100644 index 08bbdfd85c..0000000000 --- a/cpu/nrf51822/reboot_arch.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (C) 2014 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 cpu_nrf51822 - * @{ - * - * @file - * @brief Implementation of the kernels reboot interface - * - * @author Hauke Petersen - * - * @} - */ - -#include - -#include "arch/reboot_arch.h" -#include "cpu.h" - - -int reboot_arch(int mode) -{ - printf("Going into reboot, mode %i\n", mode); - - NVIC_SystemReset(); - - return 0; -} diff --git a/cpu/stm32f0/reboot_arch.c b/cpu/stm32f0/reboot_arch.c deleted file mode 100644 index 2b249606a7..0000000000 --- a/cpu/stm32f0/reboot_arch.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (C) 2014 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 cpu_stm32f0 - * @{ - * - * @file - * @brief Implementation of the kernels reboot interface - * - * @author Hauke Petersen - * - * @} - */ - -#include - -#include "arch/reboot_arch.h" -#include "cpu.h" - - -int reboot_arch(int mode) -{ - printf("Going into reboot, mode %i\n", mode); - - NVIC_SystemReset(); - - return 0; -} diff --git a/cpu/stm32f1/reboot_arch.c b/cpu/stm32f1/reboot_arch.c deleted file mode 100644 index a294513d9c..0000000000 --- a/cpu/stm32f1/reboot_arch.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (C) 2014 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 cpu_stm32f1 - * @{ - * - * @file reboot_arch.c - * @brief Implementation of the kernels reboot interface - * - * @author Hauke Petersen - * - * @} - */ - -#include - -#include "arch/reboot_arch.h" -#include "cpu.h" - - -int reboot_arch(int mode) -{ - printf("Going into reboot, mode %i\n", mode); - - NVIC_SystemReset(); - - return 0; -} diff --git a/cpu/stm32f3/reboot_arch.c b/cpu/stm32f3/reboot_arch.c deleted file mode 100644 index 7d994496b1..0000000000 --- a/cpu/stm32f3/reboot_arch.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (C) 2014 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 cpu_stm32f3 - * @{ - * - * @file - * @brief Implementation of the kernels reboot interface - * - * @author Hauke Petersen - * - * @} - */ - -#include - -#include "arch/reboot_arch.h" -#include "cpu.h" - - -int reboot_arch(int mode) -{ - printf("Going into reboot, mode %i\n", mode); - - NVIC_SystemReset(); - - return 0; -} diff --git a/cpu/stm32f4/reboot_arch.c b/cpu/stm32f4/reboot_arch.c deleted file mode 100644 index 4ce60cb5cd..0000000000 --- a/cpu/stm32f4/reboot_arch.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (C) 2014 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 cpu_stm32f4 - * @{ - * - * @file - * @brief Implementation of the kernels reboot interface - * - * @author Hauke Petersen - * - * @} - */ - -#include - -#include "arch/reboot_arch.h" -#include "cpu.h" - - -int reboot_arch(int mode) -{ - printf("Going into reboot, mode %i\n", mode); - - NVIC_SystemReset(); - - return 0; -} From 5600d862539f28df673a23376e8dc2129b6993cf Mon Sep 17 00:00:00 2001 From: Hauke Petersen Date: Thu, 20 Nov 2014 13:36:00 +0100 Subject: [PATCH 2/3] cpu/cortex-mX_common: fixed reboot_arch return val --- cpu/cortex-m0_common/reboot_arch.c | 2 +- cpu/cortex-m3_common/reboot_arch.c | 2 +- cpu/cortex-m4_common/reboot_arch.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cpu/cortex-m0_common/reboot_arch.c b/cpu/cortex-m0_common/reboot_arch.c index dbb6940d1a..8702ed9250 100644 --- a/cpu/cortex-m0_common/reboot_arch.c +++ b/cpu/cortex-m0_common/reboot_arch.c @@ -30,5 +30,5 @@ int reboot_arch(int mode) NVIC_SystemReset(); - return 0; + return -1; } diff --git a/cpu/cortex-m3_common/reboot_arch.c b/cpu/cortex-m3_common/reboot_arch.c index ccb3ef14b1..d4456efaa4 100644 --- a/cpu/cortex-m3_common/reboot_arch.c +++ b/cpu/cortex-m3_common/reboot_arch.c @@ -30,5 +30,5 @@ int reboot_arch(int mode) NVIC_SystemReset(); - return 0; + return -1; } diff --git a/cpu/cortex-m4_common/reboot_arch.c b/cpu/cortex-m4_common/reboot_arch.c index 78ade0b876..6e8efdbd30 100644 --- a/cpu/cortex-m4_common/reboot_arch.c +++ b/cpu/cortex-m4_common/reboot_arch.c @@ -30,5 +30,5 @@ int reboot_arch(int mode) NVIC_SystemReset(); - return 0; + return -1; } From 1e863a322dc1d88e285e9c5877ee38679738c66d Mon Sep 17 00:00:00 2001 From: Hauke Petersen Date: Thu, 20 Nov 2014 13:37:36 +0100 Subject: [PATCH 3/3] cpu/cortex-mX_common: added delay to reboot_arch --- cpu/cortex-m0_common/reboot_arch.c | 6 +++--- cpu/cortex-m3_common/reboot_arch.c | 6 +++--- cpu/cortex-m4_common/reboot_arch.c | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/cpu/cortex-m0_common/reboot_arch.c b/cpu/cortex-m0_common/reboot_arch.c index 8702ed9250..4774572398 100644 --- a/cpu/cortex-m0_common/reboot_arch.c +++ b/cpu/cortex-m0_common/reboot_arch.c @@ -22,13 +22,13 @@ #include "arch/reboot_arch.h" #include "cpu.h" - +#include "hwtimer.h" int reboot_arch(int mode) { printf("Going into reboot, mode %i\n", mode); - + /* wait 1 ms to make sure the printf is finished */ + hwtimer_wait(HWTIMER_TICKS(1000)); NVIC_SystemReset(); - return -1; } diff --git a/cpu/cortex-m3_common/reboot_arch.c b/cpu/cortex-m3_common/reboot_arch.c index d4456efaa4..fc6046c855 100644 --- a/cpu/cortex-m3_common/reboot_arch.c +++ b/cpu/cortex-m3_common/reboot_arch.c @@ -22,13 +22,13 @@ #include "arch/reboot_arch.h" #include "cpu.h" - +#include "hwtimer.h" int reboot_arch(int mode) { printf("Going into reboot, mode %i\n", mode); - + /* wait 1 ms to make sure the printf is finished */ + hwtimer_wait(HWTIMER_TICKS(1000)); NVIC_SystemReset(); - return -1; } diff --git a/cpu/cortex-m4_common/reboot_arch.c b/cpu/cortex-m4_common/reboot_arch.c index 6e8efdbd30..174a6a5cce 100644 --- a/cpu/cortex-m4_common/reboot_arch.c +++ b/cpu/cortex-m4_common/reboot_arch.c @@ -22,13 +22,13 @@ #include "arch/reboot_arch.h" #include "cpu.h" - +#include "hwtimer.h" int reboot_arch(int mode) { printf("Going into reboot, mode %i\n", mode); - + /* wait 1 ms to make sure the printf is finished */ + hwtimer_wait(HWTIMER_TICKS(1000)); NVIC_SystemReset(); - return -1; }