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

4.104.114.84.95
Last change on this file since 1fc35374 was 1fc35374, checked in by Joel Sherrill <joel.sherrill@…>, on 10/12/01 at 21:07:45

2001-10-12 Joel Sherrill <joel@…>

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