source: rtems/bsps/lm32/milkymist/start/bspclean.c @ 511dc4b

5
Last change on this file since 511dc4b was 9964895, checked in by Sebastian Huber <sebastian.huber@…>, on 04/20/18 at 08:35:35

bsps: Move startup files to bsps

Adjust build support files to new directory layout.

This patch is a part of the BSP source reorganization.

Update #3285.

  • Property mode set to 100644
File size: 1.5 KB
Line 
1/*
2 *  Milkymist shutdown routine
3 */
4
5/*
6 *  COPYRIGHT (c) 2010 Sebastien Bourdeauducq
7 *
8 *  The license and distribution terms for this file may be
9 *  found in the file LICENSE in this distribution or at
10 *  http://www.rtems.org/license/LICENSE.
11 */
12
13#include <bsp.h>
14#include <bsp/bootcard.h>
15#include "../include/system_conf.h"
16
17static void reboot(void)
18{
19  /* Writing to CSR_SYSTEM_ID causes a system reset */
20  MM_WRITE(MM_SYSTEM_ID, 1);
21}
22
23static void icap_write(int val, unsigned int w)
24{
25  while (!(MM_READ(MM_ICAP) & ICAP_READY));
26  if (!val)
27    w |= ICAP_CE|ICAP_WRITE;
28  MM_WRITE(MM_ICAP, w);
29}
30
31static void reconf(void)
32{
33  icap_write(0, 0xffff); /* dummy word */
34  icap_write(0, 0xffff); /* dummy word */
35  icap_write(0, 0xffff); /* dummy word */
36  icap_write(0, 0xffff); /* dummy word */
37  icap_write(1, 0xaa99); /* sync word part 1 */
38  icap_write(1, 0x5566); /* sync word part 2 */
39  icap_write(1, 0x30a1); /* write to command register */
40  icap_write(1, 0x0000); /* null command */
41  icap_write(1, 0x30a1); /* write to command register */
42  icap_write(1, 0x000e); /* reboot command */
43  icap_write(1, 0x2000); /* NOP */
44  icap_write(1, 0x2000); /* NOP */
45  icap_write(1, 0x2000); /* NOP */
46  icap_write(1, 0x2000); /* NOP */
47  icap_write(0, 0x1111); /* NULL */
48  icap_write(0, 0xffff); /* dummy word */
49}
50
51void bsp_fatal_extension(
52  rtems_fatal_source source,
53  bool always_set_to_false,
54  rtems_fatal_code error
55)
56{
57  if (source == RTEMS_FATAL_SOURCE_EXIT && error)
58    reconf();
59  else
60    reboot();
61}
Note: See TracBrowser for help on using the repository browser.