source: rtems/c/src/lib/libbsp/powerpc/mbx8xx/startup/bspstart.c.nocache @ 51664e75

4.104.114.95
Last change on this file since 51664e75 was 51664e75, checked in by Joel Sherrill <joel.sherrill@…>, on 04/23/08 at 21:50:49

2008-04-23 Joel Sherrill <joel.sherrill@…>

  • startup/bspstart.c, startup/bspstart.c.nocache: Remove all references to console_reserve_resources and termios_reserve_resources.
  • Property mode set to 100644
File size: 5.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 *  Modifications for MBX860:
16 *  Copyright (c) 1999, National Research Council of Canada
17 *
18 *  $Id$
19 */
20
21#include <string.h>
22
23#include <bsp.h>
24#include <rtems/libio.h>
25#include <rtems/libcsupport.h>
26 
27/*
28 *  Driver configuration parameters
29 */
30uint32_t   bsp_clicks_per_usec;
31uint32_t   bsp_serial_per_sec;         /* Serial clocks per second */
32boolean    bsp_serial_external_clock;
33boolean    bsp_serial_xon_xoff;
34boolean    bsp_serial_cts_rts;
35uint32_t   bsp_serial_rate;
36uint32_t   bsp_timer_average_overhead; /* Average overhead of timer in ticks */
37uint32_t   bsp_timer_least_valid;      /* Least valid number from timer      */
38boolean    bsp_timer_internal_clock;   /* TRUE, when timer runs with CPU clk */
39
40/*
41 *  Use the shared implementations of the following routines.
42 *  Look in rtems/c/src/lib/libbsp/shared/bsppost.c and
43 *  rtems/c/src/lib/libbsp/shared/bsplibc.c.
44 */
45void bsp_postdriver_hook(void);
46void bsp_libc_init( void *, uint32_t, int );
47
48/*
49 *  bsp_pretasking_hook
50 *
51 *  Called when RTEMS initialization is complete but before interrupts and
52 *  tasking are enabled. Used to setup libc and install any BSP extensions.
53 *
54 *  Must not use libc (to do io) from here, since drivers are not yet
55 *  initialized.
56 *
57 *  Input parameters: NONE
58 *
59 *  Output parameters: NONE
60 *
61 *  Return values: NONE
62 */
63void bsp_pretasking_hook(void)
64{
65  /*
66   *  These are assigned addresses in the linkcmds file for the BSP. This
67   *  approach is better than having these defined as manifest constants and
68   *  compiled into the kernel, but it is still not ideal when dealing with
69   *  multiprocessor configuration in which each board as a different memory
70   *  map. A better place for defining these symbols might be the makefiles.
71   *  Consideration should also be given to developing an approach in which
72   *  the kernel and the application can be linked and burned into ROM
73   *  independently of each other.
74   */
75    extern unsigned char _HeapStart;
76    extern unsigned char _HeapEnd;
77
78    bsp_libc_init( &_HeapStart, &_HeapEnd - &_HeapStart, 0 );
79 
80#ifdef RTEMS_DEBUG
81  rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
82#endif
83}
84
85
86/*
87 *  bsp_start()
88 *
89 *  Board-specific initialization code. Called from the generic boot_card()
90 *  function defined in rtems/c/src/lib/libbsp/shared/main.c. That function
91 *  does some of the board independent initialization. It is called from the
92 *  MBX8xx entry point _start() defined in
93 *  rtems/c/src/lib/libbsp/powerpc/mbx8xx/startup/start.S
94 *
95 *  _start() has set up a stack, has zeroed the .bss section, has turned off
96 *  interrupts, and placed the processor in the supervisor mode. boot_card()
97 *  has left the processor in that state when bsp_start() was called.
98 *
99 *  RUNS WITH ADDRESS TRANSLATION AND CACHING TURNED OFF!
100 *  ASSUMES THAT THE VIRTUAL ADDRESSES WILL BE IDENTICAL TO THE PHYSICAL
101 *  ADDRESSES. Software-controlled address translation would be required
102 *  otherwise.
103 *
104 *  Input parameters: NONE
105 *
106 *  Output parameters: NONE
107 *
108 *  Return values: NONE
109 */
110void bsp_start(void)
111{
112  extern void *_WorkspaceBase;
113  uint32_t   r1;
114
115  mmu_init();
116 
117  /*
118   * Enable instruction and data caches. Do not force writethrough mode.
119   */
120  #ifdef INSTRUCTION_CACHE_ENABLE
121  r1 = M8xx_CACHE_CMD_ENABLE;
122  _mtspr( M8xx_IC_CST, r1 );
123  _isync;
124  #endif
125
126  /*
127   * Warning: EPPCBug 1.1 chokes to death if the data cache is turned on.
128   * Set DATA_CACHE_ENABLE to zero in mbx8xx.cfg if EPPCBUG is used.
129   */
130  #ifdef DATA_CACHE_ENABLE
131  r1 = M8xx_CACHE_CMD_ENABLE;
132  _mtspr( M8xx_DC_CST, r1 );
133  _isync;
134  #endif
135   
136  /*
137   *  Allocate the memory for the RTEMS Work Space.  This can come from
138   *  a variety of places: hard coded address, malloc'ed from outside
139   *  RTEMS world (e.g. simulator or primitive memory manager), or (as
140   *  typically done by stock BSPs) by subtracting the required amount
141   *  of work space from the last physical address on the CPU board.
142   *
143   *  In this case, the memory is not malloc'ed.  It is just
144   *  "pulled from the air".
145   */
146  Configuration.work_space_start = (void *)&_WorkspaceBase;
147
148  /*
149   *  initialize the device driver parameters
150   */
151  bsp_clicks_per_usec = 1;  /* for 4MHz extclk */
152  bsp_serial_per_sec = 10000000;
153  bsp_serial_external_clock = 1;
154  bsp_serial_xon_xoff = 0;
155  bsp_serial_cts_rts = 1;
156  bsp_serial_rate = 9600;
157#if ( defined(mbx821_001) || defined(mbx821_001b) || defined(mbx860_001b) )
158  bsp_clock_speed = 50000000;
159  bsp_timer_average_overhead = 3;
160  bsp_timer_least_valid = 3;
161#else
162  bsp_clock_speed = 40000000;
163  bsp_timer_average_overhead = 3;
164  bsp_timer_least_valid = 3;
165#endif
166
167  m8xx.scc2.sccm=0;
168  m8xx.scc2p.rbase=0;
169  m8xx.scc2p.tbase=0;
170  m8xx_cp_execute_cmd( M8xx_CR_OP_STOP_TX | M8xx_CR_CHAN_SCC2 );
171}
172
Note: See TracBrowser for help on using the repository browser.