summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Galvan <martin.galvan@tallertechnologies.com>2015-03-26 17:16:38 -0300
committerSebastian Huber <sebastian.huber@embedded-brains.de>2015-03-31 07:57:04 +0200
commitec8f3cbd6f602b479eaa102dc98c248fd530770e (patch)
treed7120d0a6d9a0515a375241b2320feb86e7d036b
parentTMS570: Enable FPU in makefile. (diff)
downloadrtems-ec8f3cbd6f602b479eaa102dc98c248fd530770e.tar.bz2
TMS570: Add board reset code to bsp_reset
-rw-r--r--c/src/lib/libbsp/arm/tms570/include/tms570.h19
-rw-r--r--c/src/lib/libbsp/arm/tms570/startup/bspreset.c37
2 files changed, 34 insertions, 22 deletions
diff --git a/c/src/lib/libbsp/arm/tms570/include/tms570.h b/c/src/lib/libbsp/arm/tms570/include/tms570.h
index 2023a29040..50f1315fd4 100644
--- a/c/src/lib/libbsp/arm/tms570/include/tms570.h
+++ b/c/src/lib/libbsp/arm/tms570/include/tms570.h
@@ -7,15 +7,9 @@
*/
/*
- * Copyright (c) 2014 Premysl Houdek <kom541000@gmail.com>
+ * Copyright (c) 2015 Taller Technologies.
*
- * Google Summer of Code 2014 at
- * Czech Technical University in Prague
- * Zikova 1903/4
- * 166 36 Praha 6
- * Czech Republic
- *
- * Based on LPC24xx and LPC1768 BSP
+ * @author Martin Galvan <martin.galvan@tallertechnologies.com>
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
@@ -25,4 +19,13 @@
#ifndef LIBBSP_ARM_TMS570_H
#define LIBBSP_ARM_TMS570_H
+#define SYSECR (*(uint32_t *)0xFFFFFFE0u) /* System Exception Control Register */
+#define ESMIOFFHR (*(uint32_t *)0xFFFFF528) /* ESM Interrupt Offset High Register */
+#define ESMSR1 (*(uint32_t *)0xFFFFF518u) /* ESM Status Register 1 */
+#define ESMSR2 (*(uint32_t *)0xFFFFF51Cu) /* ESM Status Register 2 */
+#define ESMSR3 (*(uint32_t *)0xFFFFF520u) /* ESM Status Register 3 */
+#define ESMSR4 (*(uint32_t *)0xFFFFF558u) /* ESM Status Register 4 */
+
+#define SYSECR_RESET 0x80000u
+
#endif /* LIBBSP_ARM_TMS570_H */
diff --git a/c/src/lib/libbsp/arm/tms570/startup/bspreset.c b/c/src/lib/libbsp/arm/tms570/startup/bspreset.c
index d47920c485..a4b6647674 100644
--- a/c/src/lib/libbsp/arm/tms570/startup/bspreset.c
+++ b/c/src/lib/libbsp/arm/tms570/startup/bspreset.c
@@ -7,30 +7,39 @@
*/
/*
- * Copyright (c) 2014 Premysl Houdek <kom541000@gmail.com>
+ * Copyright (c) 2015 Taller Technologies.
*
- * Google Summer of Code 2014 at
- * Czech Technical University in Prague
- * Zikova 1903/4
- * 166 36 Praha 6
- * Czech Republic
- *
- * Based on LPC24xx and LPC1768 BSP
+ * @author Martin Galvan <martin.galvan@tallertechnologies.com>
*
* 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/bootcard.h>
+#include <bsp.h>
#include <bsp/tms570.h>
#include <bsp/start.h>
-BSP_START_TEXT_SECTION __attribute__( ( flatten ) ) void bsp_reset( void )
+static void handle_esm_errors(uint32_t esm_irq_channel)
+{
+ /* ESMR3 errors don't generate interrupts. */
+ if (esm_irq_channel < 0x20u) {
+ ESMSR1 = 1 << esm_irq_channel;
+ } else if (esm_irq_channel < 0x40u) {
+ ESMSR2 = 1 << (esm_irq_channel - 32u);
+ } else if (esm_irq_channel < 0x60u) {
+ ESMSR4 = 1 << (esm_irq_channel - 64u);
+ }
+}
+
+void bsp_reset(void)
{
- while ( true ) {
- /* Do nothing */
+ uint32_t esm_irq_channel = ESMIOFFHR - 1;
+
+ if (esm_irq_channel) {
+ handle_esm_errors(esm_irq_channel);
}
+
+ /* Reset the board */
+ SYSECR = SYSECR_RESET;
}