summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/arm/rtl22xx/startup/bspreset.c
blob: 195dc088cad142208daeffeaba53d23a1efdb9a2 (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
/*
 *  Copyright (c) 2007 by Ray Xu <rayx.cn@gmail.com>
 *
 *  The license and distribution terms for this file may be
 *  found in the file LICENSE in this distribution or at
 *  http://www.rtems.com/license/LICENSE.
 */

#include <bsp.h>
#include <lpc22xx.h>

void bsp_reset(void)
{
#if ON_SKYEYE == 1
  #define SKYEYE_MAGIC_ADDRESS (*(volatile unsigned int *)(0xb0000000))

  SKYEYE_MAGIC_ADDRESS = 0xff;
#else
    rtems_interrupt_level level;

    rtems_interrupt_disable(level);

  #ifdef __thumb__
    int tmp;
    __asm__ volatile (" .code 16            \n" \
                  "ldr %[tmp], =_start  \n" \
                  "bx  %[tmp]           \n" \
                  "nop                  \n" \
                  : [tmp]"=&r" (tmp) );
  #else
    __asm__ volatile ("b _start");
  #endif
  while(1);
#endif
}