OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [lib/] [libbsp/] [i960/] [rxgen960/] [startup/] [bspstart.c] - Blame information for rev 173

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*  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: bspstart.c,v 1.2 2001-09-27 11:59:59 chris Exp $
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 "i960RP.h"
32
#include <rtems/libio.h>
33
 
34
#ifdef STACK_CHECKER_ON
35
#include <stackchk.h>
36
#endif
37
 
38
#define HEAP_SIZE 1024*1024*2
39
 
40
/*
41
 *  The original table from the application and our copy of it with
42
 *  some changes.
43
 */
44
 
45
extern int putnum(unsigned int);
46
 
47
extern rtems_configuration_table Configuration;
48
extern void bsp_postdriver_hook(void); /* defined in shared directory */
49
 
50
rtems_configuration_table  BSP_Configuration;
51
 
52
rtems_cpu_table Cpu_table;
53
 
54
char *rtems_progname;
55
unsigned int top_of_used_memory;
56
 
57
/*
58
 *  Function:   bsp_pretasking_hook
59
 *  Created:    95/03/10
60
 *
61
 *  Description:
62
 *      BSP pretasking hook.  Called just before drivers are initialized.
63
 *      Used to setup libc and install any BSP extensions.
64
 *
65
 *  NOTES:
66
 *      Must not use libc (to do io) from here, since drivers are
67
 *      not yet initialized.
68
 *
69
 */
70
 
71
void
72
bsp_pretasking_hook(void)
73
{
74
 
75
    extern int end;
76
    rtems_unsigned32        heap_start;
77
 
78
*(unsigned char *)(0x120f) = 0xd;
79
/*     heap_start = (rtems_unsigned32) &end; */
80
    heap_start = (rtems_unsigned32) top_of_used_memory;
81
    if (heap_start & (CPU_ALIGNMENT-1))
82
        heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
83
 
84
    bsp_libc_init((void *) heap_start, 64 * 1024, 0);
85
 
86
 
87
#ifdef STACK_CHECKER_ON
88
    /*
89
     *  Initialize the stack bounds checker
90
     *  We can either turn it on here or from the app.
91
     */
92
 
93
*(unsigned char *)(0x120f) = 0xe;
94
    Stack_check_Initialize();
95
#endif
96
 
97
#ifdef RTEMS_DEBUG
98
    rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
99
#endif
100
*(unsigned char *)(0x120f) = 0xf;
101
}
102
 
103
 
104
/* we need to have the top of memory remembered later to start libc_init with
105
   the correct values
106
*/
107
int rx_boot_card( int argc, char **argv, char **environp)
108
{
109
    extern int end;
110
    top_of_used_memory = (rtems_unsigned32) &end + 0x1000;
111
  if ((argc > 0) && argv && argv[0])
112
    rtems_progname = argv[0];
113
  else
114
    rtems_progname = "RTEMS/RP";
115
 
116
        boot_card(argc, argv);
117
 
118
}
119
 
120
bsp_start(void)
121
{
122
 
123
  *(unsigned int *)OIMR_ADDR = 0xff;    /* Mask all primary PCI Interrupts*/
124
  Prcb    = get_prcb();
125
  Ctl_tbl = Prcb->control_tbl;
126
 
127
*(unsigned char *)(0x120f) = 8;
128
  /*
129
   *  we do not use the pretasking_hook.
130
   */
131
 
132
  Cpu_table.pretasking_hook = bsp_pretasking_hook;  /* init libc, etc. */
133
  Cpu_table.postdriver_hook = bsp_postdriver_hook;
134
  Cpu_table.do_zero_of_workspace = TRUE;
135
  Cpu_table.interrupt_stack_size = CONFIGURE_INTERRUPT_STACK_MEMORY;
136
  Cpu_table.extra_mpci_receive_server_stack = 0;
137
  Cpu_table.Prcb = Prcb;
138
 
139
  /* just trying to get along */
140
  Cpu_table.stack_allocate_hook = 0;
141
  Cpu_table.stack_free_hook = 0;
142
 
143
  /*
144
   * Tell libio how many fd's we want and allow it to tweak config
145
   */
146
 
147
*(unsigned char *)(0x120f) = 0x09;
148
 
149
  BSP_Configuration.work_space_start = (void *) top_of_used_memory;
150
     top_of_used_memory +=  (BSP_Configuration.work_space_size + 0x1000);
151
 
152
 
153
*(unsigned char *)(0x120f) = 0x0a;
154
 
155
  return 0;
156
}
157
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.