source: rtems/c/src/lib/libbsp/i960/rxgen960/startup/bspstart.c @ bc85fd5a

4.104.114.84.95
Last change on this file since bc85fd5a was bc85fd5a, checked in by Joel Sherrill <joel.sherrill@…>, on Jul 11, 2000 at 7:31:04 PM

Reworked score/cpu/i960 so it can be safely compiled multilib. All
routines and structures that require CPU model specific information
are now in libcpu. This required significant rework of the
score/cpu header files and the creation of multiple header files
and subdirectories in libcpu/i960.

  • Property mode set to 100644
File size: 3.3 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-1997.
13 *  On-Line Applications Research Corporation (OAR).
14 *  Copyright assigned to U.S. Government, 1994.
15 *
16 *  The license and distribution terms for this file may in
17 *  the file LICENSE in this distribution or at
18 *  http://www.OARcorp.com/rtems/license.html.
19 *
20 *  $Id$
21 */
22
23#include <bsp.h>
24#include <rtems/libio.h>
25 
26#include <libcsupport.h>
27 
28#include <string.h>
29#include <fcntl.h>
30#include <stdio.h>
31#include <rtems/libio.h>
32 
33#define HEAP_SIZE 1024*1024*2
34
35/*
36 *  The original table from the application and our copy of it with
37 *  some changes.
38 */
39
40extern int putnum(unsigned int);
41
42extern rtems_configuration_table Configuration;
43extern void bsp_postdriver_hook(void); /* defined in shared directory */
44
45rtems_configuration_table  BSP_Configuration;
46
47rtems_cpu_table Cpu_table;
48
49char *rtems_progname;
50unsigned int top_of_used_memory;
51
52/*
53 *  Function:   bsp_pretasking_hook
54 *  Created:    95/03/10
55 *
56 *  Description:
57 *      BSP pretasking hook.  Called just before drivers are initialized.
58 *      Used to setup libc and install any BSP extensions.
59 *
60 *  NOTES:
61 *      Must not use libc (to do io) from here, since drivers are
62 *      not yet initialized.
63 *
64 */
65 
66void
67bsp_pretasking_hook(void)
68{
69
70    extern int end;
71    rtems_unsigned32        heap_start;
72
73*(unsigned char *)(0x120f) = 0xd;
74/*     heap_start = (rtems_unsigned32) &end; */
75    heap_start = (rtems_unsigned32) top_of_used_memory;
76    if (heap_start & (CPU_ALIGNMENT-1))
77        heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
78
79    bsp_libc_init((void *) heap_start, 64 * 1024, 0);
80
81
82#ifdef RTEMS_DEBUG
83    rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
84#endif
85*(unsigned char *)(0x120f) = 0xf;
86}
87 
88
89/* we need to have the top of memory remembered later to start libc_init with
90   the correct values
91*/
92int rx_boot_card( int argc, char **argv, char **environp)
93{
94    extern int end;
95    top_of_used_memory = (rtems_unsigned32) &end + 0x1000;
96  if ((argc > 0) && argv && argv[0])
97    rtems_progname = argv[0];
98  else
99    rtems_progname = "RTEMS/RP";
100
101        boot_card(argc, argv);
102
103}
104
105bsp_start(void)
106{
107
108  *(unsigned int *)OIMR_ADDR = 0xff;    /* Mask all primary PCI Interrupts*/
109  Prcb    = get_prcb();
110  Ctl_tbl = Prcb->control_tbl;
111
112*(unsigned char *)(0x120f) = 8;
113  /*
114   *  we do not use the pretasking_hook.
115   */
116
117  Cpu_table.pretasking_hook = bsp_pretasking_hook;  /* init libc, etc. */
118  Cpu_table.postdriver_hook = bsp_postdriver_hook;
119  Cpu_table.do_zero_of_workspace = TRUE;
120  Cpu_table.interrupt_stack_size = CONFIGURE_INTERRUPT_STACK_MEMORY;
121  Cpu_table.extra_mpci_receive_server_stack = 0;
122
123  /* just trying to get along */
124  Cpu_table.stack_allocate_hook = 0;
125  Cpu_table.stack_free_hook = 0;
126 
127  /*
128   * Tell libio how many fd's we want and allow it to tweak config
129   */
130
131*(unsigned char *)(0x120f) = 0x09;
132
133  BSP_Configuration.work_space_start = (void *) top_of_used_memory;
134     top_of_used_memory +=  (BSP_Configuration.work_space_size + 0x1000);
135
136
137*(unsigned char *)(0x120f) = 0x0a;
138
139  return 0;
140}
141
Note: See TracBrowser for help on using the repository browser.