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

4.104.114.84.95
Last change on this file since 129daf3 was 129daf3, checked in by Joel Sherrill <joel.sherrill@…>, on 09/04/03 at 18:51:33

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