1 | /* |
---|
2 | * Copyright (c) 2012 embedded brains GmbH. All rights reserved. |
---|
3 | * |
---|
4 | * embedded brains GmbH |
---|
5 | * Obere Lagerstr. 30 |
---|
6 | * 82178 Puchheim |
---|
7 | * Germany |
---|
8 | * <rtems@embedded-brains.de> |
---|
9 | * |
---|
10 | * The license and distribution terms for this file may be |
---|
11 | * found in the file LICENSE in this distribution or at |
---|
12 | * http://www.rtems.com/license/LICENSE. |
---|
13 | */ |
---|
14 | |
---|
15 | #include <rtems/config.h> |
---|
16 | |
---|
17 | #include <bsp.h> |
---|
18 | #include <bsp/vectors.h> |
---|
19 | #include <bsp/bootcard.h> |
---|
20 | #include <bsp/irq-generic.h> |
---|
21 | #include <bsp/linker-symbols.h> |
---|
22 | |
---|
23 | LINKER_SYMBOL(bsp_exc_vector_base); |
---|
24 | |
---|
25 | /* |
---|
26 | * Configuration parameter for clock driver. The Trace32 PowerPC simulator has |
---|
27 | * an odd decrementer frequency. The time base frequency is one tick per |
---|
28 | * instruction. The decrementer frequency is one tick per ten instructions. |
---|
29 | * The clock driver assumes that the time base and decrementer frequencies are |
---|
30 | * equal. For now we simulate processor that issues 10000000 instructions per |
---|
31 | * second. |
---|
32 | */ |
---|
33 | uint32_t bsp_time_base_frequency = 10000000 / 10; |
---|
34 | |
---|
35 | void BSP_panic(char *s) |
---|
36 | { |
---|
37 | rtems_interrupt_level level; |
---|
38 | |
---|
39 | rtems_interrupt_disable(level); |
---|
40 | |
---|
41 | printk("%s PANIC %s\n", rtems_get_version_string(), s); |
---|
42 | |
---|
43 | while (1) { |
---|
44 | /* Do nothing */ |
---|
45 | } |
---|
46 | } |
---|
47 | |
---|
48 | void _BSP_Fatal_error(unsigned n) |
---|
49 | { |
---|
50 | rtems_interrupt_level level; |
---|
51 | |
---|
52 | rtems_interrupt_disable(level); |
---|
53 | |
---|
54 | printk("%s PANIC ERROR %u\n", rtems_get_version_string(), n); |
---|
55 | |
---|
56 | while (1) { |
---|
57 | /* Do nothing */ |
---|
58 | } |
---|
59 | } |
---|
60 | |
---|
61 | void bsp_start(void) |
---|
62 | { |
---|
63 | rtems_status_code sc; |
---|
64 | |
---|
65 | get_ppc_cpu_type(); |
---|
66 | get_ppc_cpu_revision(); |
---|
67 | |
---|
68 | /* Initialize exception handler */ |
---|
69 | ppc_exc_vector_base = (uint32_t) bsp_exc_vector_base; |
---|
70 | sc = ppc_exc_initialize( |
---|
71 | PPC_INTERRUPT_DISABLE_MASK_DEFAULT, |
---|
72 | (uintptr_t) bsp_section_work_begin, |
---|
73 | rtems_configuration_get_interrupt_stack_size() |
---|
74 | ); |
---|
75 | if (sc != RTEMS_SUCCESSFUL) { |
---|
76 | BSP_panic("cannot initialize exceptions"); |
---|
77 | } |
---|
78 | |
---|
79 | /* Initalize interrupt support */ |
---|
80 | bsp_interrupt_initialize(); |
---|
81 | } |
---|