summaryrefslogtreecommitdiffstats
path: root/bsps/arm/lpc24xx/start/restart.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2018-04-25 10:40:40 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2018-04-25 14:31:24 +0200
commit74df15caecf05c9c2007e71b5a185d3c289a6152 (patch)
tree812803bda0c1607a12d851ec8528baa29502222e /bsps/arm/lpc24xx/start/restart.c
parentbsp/lpc32xx: Move source files to bsps (diff)
downloadrtems-74df15caecf05c9c2007e71b5a185d3c289a6152.tar.bz2
bsp/lpc24xx: Move source files to bsps
This patch is a part of the BSP source reorganization. Update #3285.
Diffstat (limited to 'bsps/arm/lpc24xx/start/restart.c')
-rw-r--r--bsps/arm/lpc24xx/start/restart.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/bsps/arm/lpc24xx/start/restart.c b/bsps/arm/lpc24xx/start/restart.c
new file mode 100644
index 0000000000..627f79d19d
--- /dev/null
+++ b/bsps/arm/lpc24xx/start/restart.c
@@ -0,0 +1,52 @@
+/**
+ * @file
+ *
+ * @ingroup lpc24xx
+ *
+ * @brief Restart implementation.
+ */
+
+/*
+ * Copyright (c) 2011-2014 embedded brains GmbH. All rights reserved.
+ *
+ * embedded brains GmbH
+ * Dornierstr. 4
+ * 82178 Puchheim
+ * Germany
+ * <rtems@embedded-brains.de>
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#include <rtems.h>
+
+#include <bsp.h>
+
+void bsp_restart(void *addr)
+{
+ #ifdef ARM_MULTILIB_ARCH_V4
+ ARM_SWITCH_REGISTERS;
+ rtems_interrupt_level level;
+
+ rtems_interrupt_disable(level);
+ (void) level;
+
+ asm volatile (
+ ARM_SWITCH_TO_ARM
+ "mov pc, %[addr]\n"
+ ARM_SWITCH_BACK
+ : ARM_SWITCH_OUTPUT
+ : [addr] "r" (addr)
+ );
+ #else
+ rtems_interrupt_level level;
+ void (*start)(void) = addr;
+
+ rtems_interrupt_disable(level);
+ (void) level;
+
+ (*start)();
+ #endif
+}