source: rtems/c/src/lib/libbsp/arm/tms570/startup/bspreset.c @ bd7f099

5
Last change on this file since bd7f099 was 069560a, checked in by Premysl Houdek <kom541000@…>, on 07/16/15 at 12:14:32

bsp/tms570: source changes reflecting new headers.

Signed-off-by: Premysl Houdek <kom541000@…>

  • Property mode set to 100644
File size: 1.1 KB
Line 
1/**
2 * @file bspreset.c
3 *
4 * @ingroup tms570
5 *
6 * @brief Reset code.
7 */
8
9/*
10 * Copyright (c) 2015 Taller Technologies.
11 *
12 * @author Martin Galvan <martin.galvan@tallertechnologies.com>
13 *
14 * The license and distribution terms for this file may be
15 * found in the file LICENSE in this distribution or at
16 * http://www.rtems.org/license/LICENSE.
17 */
18
19#include <bsp.h>
20#include <bsp/bootcard.h>
21#include <bsp/tms570.h>
22#include <bsp/start.h>
23
24static void handle_esm_errors(uint32_t esm_irq_channel)
25{
26   /* ESMR3 errors don't generate interrupts. */
27   if (esm_irq_channel < 0x20u) {
28     TMS570_ESM.SR[0] = 1 << esm_irq_channel;
29   } else if (esm_irq_channel < 0x40u) {
30     TMS570_ESM.SR[1] = 1 << (esm_irq_channel - 32u);
31   } else if (esm_irq_channel < 0x60u) {
32     TMS570_ESM.SR4 = 1 << (esm_irq_channel - 64u);
33   }
34}
35
36void bsp_reset(void)
37{
38   uint32_t esm_irq_channel = TMS570_ESM.IOFFHR - 1;
39
40   if (esm_irq_channel) {
41     handle_esm_errors(esm_irq_channel);
42   }
43
44   /* Reset the board */
45   /* write of value other than 1 cause system reset */
46   TMS570_SYS1.SYSECR = TMS570_SYS1_SYSECR_RESET(2);
47}
Note: See TracBrowser for help on using the repository browser.