source: rtems/c/src/lib/libbsp/i960/cvme961/startup/bspstart.c @ ac7d5ef0

4.104.114.84.95
Last change on this file since ac7d5ef0 was ac7d5ef0, checked in by Joel Sherrill <joel.sherrill@…>, on 05/11/95 at 17:39:37

Initial revision

  • Property mode set to 100644
File size: 3.5 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 *  $Id$
21 */
22
23#include <rtems.h>
24#include <bsp.h>
25#include "libcsupport.h"
26
27
28#include "stackchk.h"
29
30/*
31 *  The original table from the application and our copy of it with
32 *  some changes.
33 */
34
35extern rtems_configuration_table Configuration;
36
37rtems_configuration_table  BSP_Configuration;
38
39rtems_cpu_table Cpu_table;
40
41/*      Initialize whatever libc we are using
42 *      called from postdriver hook
43 */
44
45void bsp_libc_init()
46{
47    extern int end;
48    rtems_unsigned32        heap_start;
49
50    heap_start = (rtems_unsigned32) &end;
51    if (heap_start & (CPU_ALIGNMENT-1))
52        heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
53
54    RTEMS_Malloc_Initialize((void *) heap_start, 64 * 1024, 0);
55
56    /*
57     * Set up for the libc handling.
58     */
59
60    if (BSP_Configuration.ticks_per_timeslice > 0)
61        libc_init(1);                /* reentrant if possible */
62    else
63        libc_init(0);                /* non-reentrant */
64    /*
65     *  Initialize the stack bounds checker
66     */
67
68#ifdef STACK_CHECKER_ON
69    Stack_check_Initialize();
70#endif
71}
72
73int bsp_start(
74  int argc,
75  char **argv,
76  char **environp
77)
78{
79  /* set node number in SQSIO4 CTL REG */
80
81  *((rtems_unsigned32 *)0xc00000b0) =
82       (Configuration.User_multiprocessing_table) ?
83          Configuration.User_multiprocessing_table->node : 0;
84
85  Prcb    = get_prcb();
86  Ctl_tbl = Prcb->control_tbl;
87
88  /* following configures the data breakpoint (which must be set
89   *   before this is executed) to break on writes only.
90   */
91
92  Ctl_tbl->bpcon &= ~0x00cc0000;
93  i960_reload_ctl_group( 6 );
94
95  /*  bit 31 of the Register Cache Control can be set to
96   *  enable an alternative caching algorithm.  It does
97   *  not appear to help RTEMS.
98   */
99
100  /* Configure Number of Register Caches */
101
102  Prcb->reg_cache_cfg = 8;
103  i960_soft_reset( Prcb );
104
105  /*
106   *  we do not use the pretasking_hook.
107   */
108
109  Cpu_table.pretasking_hook = NULL;
110
111  Cpu_table.predriver_hook = bsp_libc_init;  /* RTEMS resources available */
112
113  Cpu_table.postdriver_hook = NULL;   /* Call our main() for constructors */
114
115  Cpu_table.idle_task = NULL;  /* do not override system IDLE task */
116
117  Cpu_table.do_zero_of_workspace = TRUE;
118
119  Cpu_table.interrupt_stack_size = 4096;
120
121  Cpu_table.extra_system_initialization_stack = 0;
122
123  Cpu_table.Prcb = Prcb;
124
125  /*
126   *  Copy the table
127   */
128
129  BSP_Configuration = Configuration;
130
131  /*
132   * Add 1 region for the RTEMS Malloc
133   */
134
135  BSP_Configuration.maximum_regions++;
136
137  /*
138   * Add 1 extension for newlib libc
139   */
140
141#ifdef RTEMS_NEWLIB
142    BSP_Configuration.maximum_extensions++;
143#endif
144
145  /*
146   * Add another extension if using the stack checker
147   */
148
149#ifdef STACK_CHECKER_ON
150    BSP_Configuration.maximum_extensions++;
151#endif
152
153  BSP_Configuration.work_space_start = (void *)
154     (RAM_END - BSP_Configuration.work_space_size);
155
156  rtems_initialize_executive( &BSP_Configuration, &Cpu_table );
157  /* does not return */
158
159  bsp_cleanup();
160
161  return 0;
162
163}
Note: See TracBrowser for help on using the repository browser.