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

4.104.114.84.95
Last change on this file since eba2e4f was eba2e4f, checked in by Joel Sherrill <joel.sherrill@…>, on Nov 1, 2000 at 9:19:23 PM

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