source: rtems/c/src/lib/libbsp/powerpc/qemuppc/startup/bspstart.c @ b9bc399

4.115
Last change on this file since b9bc399 was 9b4422a2, checked in by Joel Sherrill <joel.sherrill@…>, on 05/03/12 at 15:09:24

Remove All CVS Id Strings Possible Using a Script

Script does what is expected and tries to do it as
smartly as possible.

+ remove occurrences of two blank comment lines

next to each other after Id string line removed.

+ remove entire comment blocks which only exited to

contain CVS Ids

+ If the processing left a blank line at the top of

a file, it was removed.

  • Property mode set to 100644
File size: 3.1 KB
Line 
1/*
2 *  This set of routines starts the application.  It includes application,
3 *  board, and monitor specific initialization and configuration.
4 *  The generic CPU dependent initialization has been performed
5 *  before any of these are invoked.
6 *
7 *  COPYRIGHT (c) 1989-2008.
8 *  On-Line Applications Research Corporation (OAR).
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 <string.h>
16#include <fcntl.h>
17
18#include <libcpu/bat.h>
19#include <libcpu/spr.h>
20#include <libcpu/powerpc-utility.h>
21
22#include <bsp.h>
23#include <bsp/irq.h>
24#include <bsp/vectors.h>
25#include <bsp/bootcard.h>
26#include <bsp/irq-generic.h>
27
28/*
29 * CPU Bus Frequency
30 */
31unsigned int BSP_bus_frequency;
32
33/* Configuration parameter for clock driver */
34uint32_t bsp_time_base_frequency;
35
36/* Legacy */
37uint32_t bsp_clicks_per_usec;
38
39/*
40 * Memory on this board.
41 */
42extern char RamSize[];
43extern char bsp_interrupt_stack_start[];
44extern char bsp_interrupt_stack_end[];
45extern char bsp_interrupt_stack_size[];
46uint32_t BSP_mem_size = (uint32_t)RamSize;
47
48/* Default decrementer exception handler */
49static int default_decrementer_exception_handler( BSP_Exception_frame *frame, unsigned number)
50{
51  ppc_set_decrementer_register(UINT32_MAX);
52
53  return 0;
54}
55
56/*
57 *  bsp_start
58 *
59 *  This routine does the bulk of the system initialization.
60 */
61
62void bsp_start( void )
63{
64  rtems_status_code sc = RTEMS_SUCCESSFUL;
65  uintptr_t intrStackStart;
66  uintptr_t intrStackSize;
67
68  /*
69   * Note we can not get CPU identification dynamically, so
70   * force current_ppc_cpu.
71   */
72  current_ppc_cpu = PPC_PSIM;
73
74  /*
75   *  initialize the device driver parameters
76   * assume we are running with 20MHz bus
77   * this should speed up some tests :-)
78   */
79  BSP_bus_frequency        = 20;
80  bsp_time_base_frequency  = 20000000;
81  bsp_clicks_per_usec      = BSP_bus_frequency;
82
83  /*
84   * Initialize the interrupt related settings.
85   */
86  intrStackStart = (uintptr_t) bsp_interrupt_stack_start;
87  intrStackSize =  (uintptr_t) bsp_interrupt_stack_size;
88
89  BSP_mem_size = (uint32_t )RamSize;
90
91  /*
92   * Initialize default raw exception handlers.
93   */
94  sc = ppc_exc_initialize(
95    PPC_INTERRUPT_DISABLE_MASK_DEFAULT,
96    intrStackStart,
97    intrStackSize
98  );
99  if (sc != RTEMS_SUCCESSFUL) {
100    BSP_panic("cannot initialize exceptions");
101  }
102
103  /* Install default handler for the decrementer exception */
104  sc = ppc_exc_set_handler( ASM_DEC_VECTOR, default_decrementer_exception_handler);
105  if (sc != RTEMS_SUCCESSFUL) {
106    BSP_panic("cannot install decrementer exception handler");
107  }
108
109  /* Initalize interrupt support */
110  sc = bsp_interrupt_initialize();
111  if (sc != RTEMS_SUCCESSFUL) {
112    BSP_panic("cannot intitialize interrupts");
113  }
114
115#if 0
116  /*
117   * Setup BATs and enable MMU
118   */
119  /* Memory */
120  setdbat(0, 0x0<<24, 0x0<<24, 2<<24, _PAGE_RW);
121  setibat(0, 0x0<<24, 0x0<<24, 2<<24,        0);
122  /* PCI    */
123  setdbat(1, 0x8<<24, 0x8<<24, 1<<24,  IO_PAGE);
124  setdbat(2, 0xc<<24, 0xc<<24, 1<<24,  IO_PAGE);
125
126  _write_MSR(_read_MSR() | MSR_DR | MSR_IR);
127  __asm__ volatile("sync; isync");
128#endif
129}
Note: See TracBrowser for help on using the repository browser.