source: rtems/c/src/lib/libbsp/m68k/mvme162/startup/bspstart.c @ 497428a2

4.104.114.84.95
Last change on this file since 497428a2 was 497428a2, checked in by Joel Sherrill <joel.sherrill@…>, on 05/30/95 at 19:42:36

cpu/*types.h added and successfully compiled.
IDLE task priority changed from 0 to 255 during initialization.

  • Property mode set to 100644
File size: 4.0 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 *  INPUT:  NONE
9 *
10 *  OUTPUT: NONE
11 *
12 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
13 *  On-Line Applications Research Corporation (OAR).
14 *  All rights assigned to U.S. Government, 1994.
15 *
16 *  This material may be reproduced by or for the U.S. Government pursuant
17 *  to the copyright license under the clause at DFARS 252.227-7013.  This
18 *  notice must appear in all copies of this file and its derivatives.
19 *
20 *  Modifications of respective RTEMS file: COPYRIGHT (c) 1994.
21 *  EISCAT Scientific Association. M.Savitski
22 *
23 *  This material is a part of the MVME162 Board Support Package
24 *  for the RTEMS executive. Its licensing policies are those of the
25 *  RTEMS above.
26 *
27 *  $Id$
28 */
29
30#include <rtems.h>
31#include <bsp.h>
32#include <libcsupport.h>
33#include <z8036.h>
34
35/*
36 *  The original table from the application and our copy of it with
37 *  some changes.
38 */
39
40extern rtems_configuration_table  Configuration;
41rtems_configuration_table  BSP_Configuration;
42
43rtems_cpu_table Cpu_table;
44
45/*      Initialize whatever libc we are using
46 *      called from postdriver hook
47 */
48
49void bsp_libc_init()
50{
51    extern int end;
52    rtems_unsigned32        heap_start;
53
54    heap_start = (rtems_unsigned32) &end;
55    if (heap_start & (CPU_ALIGNMENT-1))
56        heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
57
58    RTEMS_Malloc_Initialize((void *) heap_start, 64 * 1024, 0);
59
60    /*
61     * Set up for the libc handling.
62     */
63
64    if (BSP_Configuration.ticks_per_timeslice > 0)
65        libc_init(1);                /* reentrant if possible */
66    else
67        libc_init(0);                /* non-reentrant */
68
69    /*
70     *  Initialize the stack bounds checker
71     */
72
73#ifdef STACK_CHECKER_ON
74    Stack_check_Initialize();
75#endif
76}
77
78int bsp_start(
79  int argc,
80  char **argv,
81  char **environp
82)
83{
84  m68k_isr_entry *monitors_vector_table;
85  int             index;
86
87  /*
88   *  162Bug Vectors are at 0xFFE00000
89   */
90
91  monitors_vector_table = (m68k_isr_entry *)0xFFE00000;
92
93  m68k_set_vbr( monitors_vector_table );
94
95  for ( index=2 ; index<=255 ; index++ )
96    M68Kvec[ index ] = monitors_vector_table[ 32 ];
97
98  M68Kvec[  2 ] = monitors_vector_table[  2 ];   /* bus error vector */
99  M68Kvec[  4 ] = monitors_vector_table[  4 ];   /* breakpoints vector */
100  M68Kvec[  9 ] = monitors_vector_table[  9 ];   /* trace vector */
101  M68Kvec[ 47 ] = monitors_vector_table[ 47 ];   /* system call vector */
102
103  m68k_set_vbr( &M68Kvec );
104
105  /*
106   *  You may wish to make VME access round-robin here, currently
107   *  we leave it as it is.
108   */
109
110  lcsr->vector_base = VECTOR_BASE;        /* set the vector base register */
111
112  m68k_enable_caching();
113
114  /*
115   *  we only use a hook to get the C library initialized.
116   */
117
118  Cpu_table.pretasking_hook = NULL;
119
120  Cpu_table.predriver_hook = bsp_libc_init;  /* RTEMS resources available */
121
122  Cpu_table.postdriver_hook = NULL;   /* Call our main() for constructors */
123
124  Cpu_table.idle_task = NULL;  /* do not override system IDLE task */
125
126  Cpu_table.do_zero_of_workspace = TRUE;
127
128  Cpu_table.interrupt_vector_table = (m68k_isr_entry *) &M68Kvec;
129
130  Cpu_table.interrupt_stack_size = 4096;
131
132  Cpu_table.extra_system_initialization_stack = 0;
133
134  /*
135   *  Copy the table
136   */
137
138  BSP_Configuration = Configuration;
139
140  /*
141   * Add 1 region for the RTEMS Malloc
142   */
143
144  BSP_Configuration.maximum_regions++;
145
146  /*
147   * Add 1 extension for newlib libc
148   */
149
150#ifdef RTEMS_NEWLIB
151    BSP_Configuration.maximum_extensions++;
152#endif
153
154  /*
155   * Add another extension if using the stack checker
156   */
157
158#ifdef STACK_CHECKER_ON
159    BSP_Configuration.maximum_extensions++;
160#endif
161
162  BSP_Configuration.work_space_start = (void *)
163     (RAM_END - BSP_Configuration.work_space_size);
164
165  rtems_initialize_executive( &BSP_Configuration, &Cpu_table );
166  /* does not return */
167
168  bsp_cleanup();
169
170  return 0;
171}
Note: See TracBrowser for help on using the repository browser.