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

4.115
Last change on this file since ec8f3cb was ec8f3cb, checked in by Martin Galvan <martin.galvan@…>, on 03/26/15 at 20:16:38

TMS570: Add board reset code to bsp_reset

  • Property mode set to 100644
File size: 954 bytes
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/tms570.h>
21#include <bsp/start.h>
22
23static void handle_esm_errors(uint32_t esm_irq_channel)
24{
25  /* ESMR3 errors don't generate interrupts. */
26  if (esm_irq_channel < 0x20u) {
27    ESMSR1 = 1 << esm_irq_channel;
28  } else if (esm_irq_channel < 0x40u) {
29    ESMSR2 = 1 << (esm_irq_channel - 32u);
30  } else if (esm_irq_channel < 0x60u) {
31    ESMSR4 = 1 << (esm_irq_channel - 64u);
32  }
33}
34
35void bsp_reset(void)
36{
37  uint32_t esm_irq_channel = ESMIOFFHR - 1;
38
39  if (esm_irq_channel) {
40    handle_esm_errors(esm_irq_channel);
41  }
42
43  /* Reset the board */
44  SYSECR = SYSECR_RESET;
45}
Note: See TracBrowser for help on using the repository browser.