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

4.115
Last change on this file since c499856 was c499856, checked in by Chris Johns <chrisj@…>, on 03/20/14 at 21:10:47

Change all references of rtems.com to rtems.org.

  • Property mode set to 100644
File size: 3.1 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.org/license/LICENSE.
14 *
15 *  Modifications for MBX860:
16 *  Copyright (c) 1999, National Research Council of Canada
17 */
18
19#include <bsp.h>
20 
21/*
22 *  Driver configuration parameters
23 */
24uint32_t   bsp_clicks_per_usec;
25uint32_t   bsp_serial_per_sec;         /* Serial clocks per second */
26bool       bsp_serial_external_clock;
27bool       bsp_serial_xon_xoff;
28bool       bsp_serial_cts_rts;
29uint32_t   bsp_serial_rate;
30uint32_t   bsp_timer_average_overhead; /* Average overhead of timer in ticks */
31uint32_t   bsp_timer_least_valid;      /* Least valid number from timer      */
32bool       bsp_timer_internal_clock;   /* TRUE, when timer runs with CPU clk */
33
34/*
35 *  bsp_start()
36 *
37 *  Board-specific initialization code. Called from the generic boot_card()
38 *  function defined in rtems/c/src/lib/libbsp/shared/main.c. That function
39 *  does some of the board independent initialization. It is called from the
40 *  MBX8xx entry point _start() defined in
41 *  rtems/c/src/lib/libbsp/powerpc/mbx8xx/startup/start.S
42 *
43 *  _start() has set up a stack, has zeroed the .bss section, has turned off
44 *  interrupts, and placed the processor in the supervisor mode. boot_card()
45 *  has left the processor in that state when bsp_start() was called.
46 *
47 *  RUNS WITH ADDRESS TRANSLATION AND CACHING TURNED OFF!
48 *  ASSUMES THAT THE VIRTUAL ADDRESSES WILL BE IDENTICAL TO THE PHYSICAL
49 *  ADDRESSES. Software-controlled address translation would be required
50 *  otherwise.
51 *
52 *  Input parameters: NONE
53 *
54 *  Output parameters: NONE
55 *
56 *  Return values: NONE
57 */
58void bsp_start(void)
59{
60  uint32_t   r1;
61
62  mmu_init();
63 
64  /*
65   * Enable instruction and data caches. Do not force writethrough mode.
66   */
67  #ifdef INSTRUCTION_CACHE_ENABLE
68  r1 = M8xx_CACHE_CMD_ENABLE;
69  _mtspr( M8xx_IC_CST, r1 );
70  _isync;
71  #endif
72
73  /*
74   * Warning: EPPCBug 1.1 chokes to death if the data cache is turned on.
75   * Set DATA_CACHE_ENABLE to zero in mbx8xx.cfg if EPPCBUG is used.
76   */
77  #ifdef DATA_CACHE_ENABLE
78  r1 = M8xx_CACHE_CMD_ENABLE;
79  _mtspr( M8xx_DC_CST, r1 );
80  _isync;
81  #endif
82   
83  /*
84   *  initialize the device driver parameters
85   */
86  bsp_clicks_per_usec = 1;  /* for 4MHz extclk */
87  bsp_serial_per_sec = 10000000;
88  bsp_serial_external_clock = 1;
89  bsp_serial_xon_xoff = 0;
90  bsp_serial_cts_rts = 1;
91  bsp_serial_rate = 9600;
92#if ( defined(mbx821_001) || defined(mbx821_001b) || defined(mbx860_001b) )
93  bsp_clock_speed = 50000000;
94  bsp_timer_average_overhead = 3;
95  bsp_timer_least_valid = 3;
96#else
97  bsp_clock_speed = 40000000;
98  bsp_timer_average_overhead = 3;
99  bsp_timer_least_valid = 3;
100#endif
101
102  m8xx.scc2.sccm=0;
103  m8xx.scc2p.rbase=0;
104  m8xx.scc2p.tbase=0;
105  m8xx_cp_execute_cmd( M8xx_CR_OP_STOP_TX | M8xx_CR_CHAN_SCC2 );
106}
107
Note: See TracBrowser for help on using the repository browser.