source: rtems/c/src/lib/libbsp/powerpc/ss555/startup/bspstart.c @ 5eb04f4d

4.115
Last change on this file since 5eb04f4d was 5eb04f4d, checked in by Joel Sherrill <joel.sherrill@…>, on 10/07/14 at 22:39:26

powerpc/ss555/startup/bspstart.c: Add include of <bsp/bootcard.h> to fix warning and clean up

  • Property mode set to 100644
File size: 3.2 KB
Line 
1/*
2 *  This routine does the bulk of the system initialization.
3 */
4
5/*
6 *  COPYRIGHT (c) 1989-2007.
7 *  On-Line Applications Research Corporation (OAR).
8 *
9 *  The license and distribution terms for this file may be
10 *  found in the file LICENSE in this distribution or at
11 *  http://www.rtems.org/license/LICENSE.
12 *
13 *  SS555 port sponsored by Defence Research and Development Canada - Suffield
14 *  Copyright (C) 2004, Real-Time Systems Inc. (querbach@realtime.bc.ca)
15 *
16 *  Derived from c/src/lib/libbsp/powerpc/mbx8xx/startup/bspstart.c:
17 *
18 *  Modifications for MBX860:
19 *  Copyright (c) 1999, National Research Council of Canada
20 */
21
22#warning The interrupt disable mask is now stored in SPRG0, please verify that this is compatible to this BSP (see also bootcard.c).
23
24#include <rtems/bspIo.h>
25#include <rtems/counter.h>
26#include <bsp/bootcard.h>
27#include <rtems/powerpc/powerpc.h>
28
29#include <libcpu/cpuIdent.h>
30#include <libcpu/spr.h>
31
32#include <bsp/irq.h>
33#include <bsp.h>
34
35SPR_RW(SPRG1)
36
37extern unsigned long intrStackPtr;
38
39/*
40 *  Driver configuration parameters
41 */
42uint32_t   bsp_clicks_per_usec;
43uint32_t   bsp_clock_speed;            /* Serial clocks per second */
44uint32_t   bsp_timer_least_valid;
45uint32_t   bsp_timer_average_overhead;
46
47void BSP_panic(char *s)
48{
49  printk("%s PANIC %s\n",_RTEMS_version, s);
50  __asm__ __volatile ("sc");
51}
52
53void _BSP_Fatal_error(unsigned int v)
54{
55  printk("%s PANIC ERROR %x\n",_RTEMS_version, v);
56  __asm__ __volatile ("sc");
57}
58
59/*
60 *  bsp_start()
61 *
62 *  Board-specific initialization code. Called from the generic boot_card()
63 *  function defined in rtems/c/src/lib/libbsp/shared/main.c. That function
64 *  does some of the board independent initialization. It is called from the
65 *  SS555 entry point _start() defined in
66 *  rtems/c/src/lib/libbsp/powerpc/ss555/start/start.S
67 *
68 *  _start() has set up a stack, has zeroed the .bss section, has set up the
69 *  .data section from contents stored in ROM, has turned off interrupts,
70 *  and placed the processor in the supervisor mode.  boot_card() has left
71 *  the processor in that state when bsp_start() was called.
72 *
73 *  Input parameters: NONE
74 *
75 *  Output parameters: NONE
76 *
77 *  Return values: NONE
78 */
79void bsp_start(void)
80{
81  ppc_cpu_id_t myCpu;
82  ppc_cpu_revision_t myCpuRevision;
83  register unsigned char* intrStack;
84
85  /*
86   * Get CPU identification dynamically.  Note that the get_ppc_cpu_type()
87   * function stores the result in global variables so that it can be used
88   * later.
89   */
90  myCpu         = get_ppc_cpu_type();
91  myCpuRevision = get_ppc_cpu_revision();
92
93  /*
94   * Initialize some SPRG registers related to irq handling
95   */
96  intrStack = (((unsigned char*)&intrStackPtr) - PPC_MINIMUM_STACK_FRAME_SIZE);
97  _write_SPRG1((unsigned int)intrStack);
98
99  /*
100   * Install our own set of exception vectors
101   */
102  initialize_exceptions();
103
104  /*
105   *  initialize the device driver parameters
106   */
107  bsp_clicks_per_usec = BSP_CRYSTAL_HZ / 4 / 1000000;
108  bsp_clock_speed     = BSP_CLOCK_HZ;   /* for SCI baud rate generator */
109  bsp_timer_least_valid      = 0;
110  bsp_timer_average_overhead = 0;
111  rtems_counter_initialize_converter(BSP_CRYSTAL_HZ / 4);
112
113  /*
114   * Initalize RTEMS IRQ system
115   */
116  BSP_rtems_irq_mng_init(0);
117}
Note: See TracBrowser for help on using the repository browser.