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

4.115
Last change on this file since c6af4585 was c6af4585, checked in by Chirayu Desai <cdesai@…>, on 12/06/13 at 16:17:52

powerpc/ss555: move startup/start.S to start/start.S

  • Property mode set to 100644
File size: 3.2 KB
Line 
1/*  bspstart.c
2 *
3 *  This set of routines starts the application.  It includes application,
4 *  board, and monitor specific initialization and configuration.
5 *  The generic CPU dependent initialization has been performed
6 *  before this routine is invoked.
7 *
8 *  COPYRIGHT (c) 1989-2007.
9 *  On-Line Applications Research Corporation (OAR).
10 *
11 *  The license and distribution terms for this file may be
12 *  found in the file LICENSE in this distribution or at
13 *  http://www.rtems.com/license/LICENSE.
14 *
15 *  SS555 port sponsored by Defence Research and Development Canada - Suffield
16 *  Copyright (C) 2004, Real-Time Systems Inc. (querbach@realtime.bc.ca)
17 *
18 *  Derived from c/src/lib/libbsp/powerpc/mbx8xx/startup/bspstart.c:
19 *
20 *  Modifications for MBX860:
21 *  Copyright (c) 1999, National Research Council of Canada
22 */
23
24#warning The interrupt disable mask is now stored in SPRG0, please verify that this is compatible to this BSP (see also bootcard.c).
25
26#include <rtems/bspIo.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
112  /*
113   * Initalize RTEMS IRQ system
114   */
115  BSP_rtems_irq_mng_init(0);
116}
Note: See TracBrowser for help on using the repository browser.