source: rtems/c/src/lib/libbsp/powerpc/mbx8xx/startup/bspstart.c @ bc98089

4.104.115
Last change on this file since bc98089 was a196084, checked in by Joel Sherrill <joel.sherrill@…>, on 09/16/08 at 19:06:10

2008-09-16 Joel Sherrill <joel.sherrill@…>

  • startup/bspstart.c: Remove unnecessary includes of rtems/libcsupport.h and rtems/libio.h.
  • Property mode set to 100644
File size: 4.9 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 *  Modifications for MBX860:
16 *  Copyright (c) 1999, National Research Council of Canada
17 *
18 *  $Id$
19 */
20
21#warning The interrupt disable mask is now stored in SPRG0, please verify that this is compatible to this BSP (see also bootcard.c).
22
23#include <bsp.h>
24#include <bsp/irq.h>
25#include <rtems/bspIo.h>
26#include <libcpu/cpuIdent.h>
27#include <libcpu/spr.h>
28#include <rtems/powerpc/powerpc.h>
29
30SPR_RW(SPRG1)
31
32extern unsigned long intrStackPtr;
33
34/*
35 *  Driver configuration parameters
36 */
37uint32_t   bsp_clicks_per_usec;
38uint32_t   bsp_clock_speed;
39uint32_t   bsp_serial_per_sec;         /* Serial clocks per second */
40bool       bsp_serial_external_clock;
41bool       bsp_serial_xon_xoff;
42bool       bsp_serial_cts_rts;
43uint32_t   bsp_serial_rate;
44uint32_t   bsp_timer_average_overhead; /* Average overhead of timer in ticks */
45uint32_t   bsp_timer_least_valid;      /* Least valid number from timer      */
46bool       bsp_timer_internal_clock;   /* TRUE, when timer runs with CPU clk */
47
48void BSP_panic(char *s)
49{
50  printk("%s PANIC %s\n",_RTEMS_version, s);
51  __asm__ __volatile ("sc");
52}
53
54void _BSP_Fatal_error(unsigned int v)
55{
56  printk("%s PANIC ERROR %x\n",_RTEMS_version, v);
57  __asm__ __volatile ("sc");
58}
59
60/*
61 *  bsp_start()
62 *
63 *  Board-specific initialization code. Called from the generic boot_card()
64 *  function defined in rtems/c/src/lib/libbsp/shared/main.c. That function
65 *  does some of the board independent initialization. It is called from the
66 *  MBX8xx entry point _start() defined in
67 *  rtems/c/src/lib/libbsp/powerpc/mbx8xx/startup/start.S
68 *
69 *  _start() has set up a stack, has zeroed the .bss section, has turned off
70 *  interrupts, and placed the processor in the supervisor mode. boot_card()
71 *  has left the processor in that state when bsp_start() was called.
72 *
73 *  RUNS WITH ADDRESS TRANSLATION AND CACHING TURNED OFF!
74 *  ASSUMES THAT THE VIRTUAL ADDRESSES WILL BE IDENTICAL TO THE PHYSICAL
75 *  ADDRESSES. Software-controlled address translation would be required
76 *  otherwise.
77 *
78 *  Input parameters: NONE
79 *
80 *  Output parameters: NONE
81 *
82 *  Return values: NONE
83 */
84void bsp_start(void)
85{
86  ppc_cpu_id_t myCpu;
87  ppc_cpu_revision_t myCpuRevision;
88  register unsigned char* intrStack;
89
90  /*
91   * Get CPU identification dynamically. Note that the get_ppc_cpu_type() function
92   * store the result in global variables so that it can be used latter...
93   */
94  myCpu         = get_ppc_cpu_type();
95  myCpuRevision = get_ppc_cpu_revision();
96
97  mmu_init();
98
99  /*
100   * Enable instruction and data caches. Do not force writethrough mode.
101   */
102#if NVRAM_CONFIGURE == 1
103  if ( nvram->cache_mode & 0x02 )
104    rtems_cache_enable_instruction();
105  if ( nvram->cache_mode & 0x01 )
106    rtems_cache_enable_data();
107#else
108#ifdef INSTRUCTION_CACHE_ENABLE
109  rtems_cache_enable_instruction();
110#endif
111#ifdef DATA_CACHE_ENABLE
112  rtems_cache_enable_data();
113#endif
114#endif
115  /*
116   * Initialize some SPRG registers related to irq handling
117   */
118
119  intrStack = (((unsigned char*)&intrStackPtr) - PPC_MINIMUM_STACK_FRAME_SIZE);
120  _write_SPRG1((unsigned int)intrStack);
121
122  /*
123   * Install our own set of exception vectors
124   */
125  initialize_exceptions();
126
127  /*
128   *  initialize the device driver parameters
129   */
130
131#if    ( defined(mbx860_001b) || \
132         defined(mbx860_002b) || \
133         defined(mbx860_003b) || \
134         defined(mbx860_003b) || \
135         defined(mbx860_004b) || \
136         defined(mbx860_005b) || \
137         defined(mbx860_006b) || \
138         defined(mbx821_001b) || \
139         defined(mbx821_002b) || \
140         defined(mbx821_003b) || \
141         defined(mbx821_004b) || \
142         defined(mbx821_005b) || \
143         defined(mbx821_006b))
144  bsp_clicks_per_usec = 0;  /* for 32768Hz extclk */
145#else
146  bsp_clicks_per_usec = 1;  /* for 4MHz extclk */
147#endif
148
149  bsp_serial_per_sec = 10000000;
150  bsp_serial_external_clock = true;
151  bsp_serial_xon_xoff = false;
152  bsp_serial_cts_rts = true;
153  bsp_serial_rate = 9600;
154#if ( defined(mbx821_001) || defined(mbx821_001b) || defined(mbx860_001b) )
155  bsp_clock_speed = 50000000;
156  bsp_timer_average_overhead = 3;
157  bsp_timer_least_valid = 3;
158#else
159  bsp_clock_speed = 40000000;
160  bsp_timer_average_overhead = 3;
161  bsp_timer_least_valid = 3;
162#endif
163
164  m8xx.scc2.sccm=0;
165  m8xx.scc2p.rbase=0;
166  m8xx.scc2p.tbase=0;
167  m8xx_cp_execute_cmd( M8xx_CR_OP_STOP_TX | M8xx_CR_CHAN_SCC2 );
168  /*
169   * Initalize RTEMS IRQ system
170   */
171  BSP_rtems_irq_mng_init(0);
172#ifdef SHOW_MORE_INIT_SETTINGS
173  printk("Exit from bspstart\n");
174#endif
175
176}
Note: See TracBrowser for help on using the repository browser.