summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/arm/gba/startup/exit.c
blob: d5fa3789aee925ce890ad3cce52dd14369d9ce18 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/**
 *  @file exit.c
 *
 *  Routines to shutdown and reboot the BSP.
 */
/*
 *  RTEMS GBA BSP
 *
 *  Copyright (c) 2004 Markku Puro <markku.puro@kopteri.net>
 *
 *  The license and distribution terms for this file may be
 *  found in found in the file LICENSE in this distribution or at
 *  http://www.rtems.com/license/LICENSE.
 *
 *  $Id$
 */

#include <stdio.h>
#include <bsp.h>
#include <rtems/bspIo.h>
#include <rtems/libio.h>
#include <gba.h>


/**
 *  @brief rtemsReboot BSP routine reboot rtems
 *
 *  Input parameters:  None
 *
 *  Output parameters: None
 */
void rtemsReboot (void)
{
   asm volatile ("ldr  r0, =_gba_reset");
   asm volatile ("bx   r0");
}

/**
 *  @brief bsp_cleanup BSP routine wait input from user for rebooting
 *
 *  Normally at this point, the console driver is disconnected => we must
 *  use polled output/input. This is exactly what printk does.
 *
 *  @param  None
 *  @return None
 */
void bsp_cleanup(void)
{
  static const char line[]="\nEXECUTIVE SHUTDOWN! Press button to reboot...";
  printk("\n");
  printk("%s",line);
  while ( !GBA_ANY_KEY(GBA_KEY_ALL) );
  rtemsReboot();
}