source: rtems/c/src/lib/libbsp/powerpc/eth_comm/startup/bspstart.c @ fd152eb2

4.104.114.84.95
Last change on this file since fd152eb2 was 12c074d8, checked in by Joel Sherrill <joel.sherrill@…>, on 11/01/00 at 21:22:04

2000-11-01 Joel Sherrill <joel@…>

  • startup/bspstart.c: assoc.h, error.h, libio_.h, libio.h, and libcsupport.h moved from libc to lib/include/rtems and now must be referenced as <rtems/XXX.h>. Header file order was cleaned up while doing this. Also removed obsolete references to STACK_CHECKER_ON.
  • Property mode set to 100644
File size: 4.6 KB
Line 
1/*  bsp_start()
2 *
3 *  This routine 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 *  The MPC860 specific stuff was written by Jay Monkman (jmonkman@frasca.com)
9 *
10 *  COPYRIGHT (c) 1989-1999.
11 *  On-Line Applications Research Corporation (OAR).
12 *
13 *  The license and distribution terms for this file may be
14 *  found in the file LICENSE in this distribution or at
15 *  http://www.OARcorp.com/rtems/license.html.
16 *
17 *  $Id$
18 */
19
20#include <string.h>
21
22#include <bsp.h>
23#include <rtems/libio.h>
24#include <rtems/libcsupport.h>
25#include <info.h>
26 
27boardinfo_t M860_binfo;
28
29/*
30 *  The original table from the application and our copy of it with
31 *  some changes.
32 */
33extern rtems_configuration_table Configuration;
34
35rtems_configuration_table  BSP_Configuration;
36
37rtems_cpu_table Cpu_table;
38
39char *rtems_progname;
40
41/*
42 *  Use the shared implementations of the following routines
43 */
44void bsp_postdriver_hook(void);
45void bsp_libc_init( void *, unsigned32, int );
46
47/*
48 *  Function:   bsp_pretasking_hook
49 *  Created:    95/03/10
50 *
51 *  Description:
52 *      BSP pretasking hook.  Called just before drivers are initialized.
53 *      Used to setup libc and install any BSP extensions.
54 *
55 *  NOTES:
56 *      Must not use libc (to do io) from here, since drivers are
57 *      not yet initialized.
58 *
59 */
60 
61void
62bsp_pretasking_hook(void)
63{
64  extern int       _end;
65  rtems_unsigned32  heap_start;
66
67  /*
68   * Let's check to see if the size of M860_binfo is what
69   * it should be. It might not be if the info.h files
70   * for RTEMS and the bootloader define boardinfo_t
71   * differently.
72   */
73
74  /* Oops. printf() won't work yet, since the console is not initialized.
75     I should probably find some way of doing this though.
76  if (M860_binfo.size != sizeof(boardinfo_t)) {
77      printf("The size of the Board Info Block appears to be incorrect.\n");
78      printf(" This could occur if the 'info.h' files for RTEMS and the\n");
79      printf(" bootloader differ in their definition of boardinfo_t\n");
80  }
81  */
82  heap_start = (rtems_unsigned32) &_end;
83
84  /* Align the heap on a natural boundary (4 bytes?) */
85  if (heap_start & (CPU_ALIGNMENT-1)) {
86    heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
87  }
88  /* set up a 256K heap */
89  bsp_libc_init((void *) heap_start, 256 * 1024, 0);
90 
91#ifdef RTEMS_DEBUG
92  rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
93#endif
94}
95
96
97void bsp_start(void)
98{
99  extern int _end;
100  rtems_unsigned32  heap_start;
101  rtems_unsigned32  ws_start;
102
103  cpu_init();
104  mmu_init();
105 
106  /*
107   *  Allocate the memory for the RTEMS Work Space.  This can come from
108   *  a variety of places: hard coded address, malloc'ed from outside
109   *  RTEMS world (e.g. simulator or primitive memory manager), or (as
110   *  typically done by stock BSPs) by subtracting the required amount
111   *  of work space from the last physical address on the CPU board.
112   */
113
114  /*
115   *  Need to "allocate" the memory for the RTEMS Workspace and
116   *  tell the RTEMS configuration where it is.  This memory is
117   *  not malloc'ed.  It is just "pulled from the air".
118   */
119
120  heap_start = (rtems_unsigned32) &_end;
121  if (heap_start & (CPU_ALIGNMENT-1))
122    heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
123
124
125  ws_start = heap_start + (256 * 1024);
126  if (ws_start & ((512 * 1024) - 1)) {  /* align to 512K boundary */
127    ws_start = (ws_start + (512 * 1024)) & ~((512 * 1024) - 1);
128  }
129
130  BSP_Configuration.work_space_start = (void *)ws_start;
131  BSP_Configuration.work_space_size = 512 * 1024;
132
133  /*
134   *  initialize the CPU table for this BSP
135   */
136
137  Cpu_table.pretasking_hook = bsp_pretasking_hook;  /* init libc, etc. */
138  Cpu_table.postdriver_hook = bsp_postdriver_hook;
139  Cpu_table.interrupt_stack_size = CONFIGURE_INTERRUPT_STACK_MEMORY;
140
141  Cpu_table.clicks_per_usec = 1;  /* for 4MHz extclk */
142  Cpu_table.serial_per_sec = 10000000;
143  Cpu_table.serial_external_clock = 1;
144  Cpu_table.serial_xon_xoff = 0;
145  Cpu_table.serial_cts_rts = 1;
146  Cpu_table.serial_rate = 9600;
147  Cpu_table.timer_average_overhead = 0;
148  Cpu_table.timer_least_valid = 0;
149  Cpu_table.clock_speed = 40000000;
150
151  /*
152   * Since we are currently autodetecting whether to use SCC1 or
153   * the FEC for ethernet, we set up a register in the ethernet
154   * transciever that is used for 10/100 Mbps ethernet now, so that
155   * we can attempt to read it later in rtems_enet_driver_attach()
156  */
157  m8xx.fec.mii_speed = 0x0a;
158  m8xx.fec.mii_data = 0x680a0000;
159
160
161  m8xx.scc2.sccm=0;
162  m8xx.scc2p.rbase=0;
163  m8xx.scc2p.tbase=0;
164  m8xx_cp_execute_cmd( M8xx_CR_OP_STOP_TX | M8xx_CR_CHAN_SCC2 );
165}
166
167
Note: See TracBrowser for help on using the repository browser.