summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/arm/tms570/startup/bspreset.c
diff options
context:
space:
mode:
Diffstat (limited to 'c/src/lib/libbsp/arm/tms570/startup/bspreset.c')
-rw-r--r--c/src/lib/libbsp/arm/tms570/startup/bspreset.c37
1 files changed, 23 insertions, 14 deletions
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;
}