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

Subversion Repositories openrisc

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*
2
 *  This routine starts the application.  It includes application,
3
 *  board, and monitor specific initialization and configuration.
4
 *  The generic CPU dependent initialization has been performed
5
 *  before this routine is invoked.
6
 *
7
 *  COPYRIGHT (c) 1989-1999.
8
 *  On-Line Applications Research Corporation (OAR).
9
 *
10
 *  The license and distribution terms for this file may be
11
 *  found in the file LICENSE in this distribution or at
12
 *  http://www.OARcorp.com/rtems/license.html.
13
 *
14
 *  $Id: bspstart.c,v 1.2 2001-09-27 12:00:25 chris Exp $
15
 */
16
 
17
/*
18
 *  Rather than deleting this, it is commented out to (hopefully) help
19
 *  the submitter send updates.
20
 *
21
 *  static char _sccsid[] = "@(#)bspstart.c 06/11/96     1.2\n";
22
 */
23
 
24
 
25
#include <bsp.h>
26
#include <rtems/libio.h>
27
 
28
#include <libcsupport.h>
29
 
30
#include <string.h>
31
 
32
/*
33
 *  The original table from the application and our copy of it with
34
 *  some changes.
35
 */
36
 
37
extern rtems_configuration_table Configuration;
38
 
39
rtems_configuration_table  BSP_Configuration;
40
 
41
rtems_cpu_table Cpu_table;
42
 
43
char *rtems_progname;
44
 
45
/*
46
 *  Use the shared implementations of the following routines
47
 */
48
 
49
void bsp_postdriver_hook(void);
50
void bsp_libc_init( void *, unsigned32, int );
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
 
66
#define LIBC_HEAP_SIZE (64 * 1024)
67
 
68
void bsp_pretasking_hook(void)
69
{
70
    extern int end;
71
    rtems_unsigned32        heap_start;
72
 
73
    heap_start = (rtems_unsigned32) &end;
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, LIBC_HEAP_SIZE, 0);
78
 
79
#ifdef RTEMS_DEBUG
80
    rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
81
#endif
82
}
83
 
84
extern int end; /* defined by linker */
85
 
86
/*
87
 *  bsp_start
88
 *
89
 *  This routine does the bulk of the system initialization.
90
 */
91
 
92
void bsp_start( void )
93
{
94
  /*
95
   *  Allocate the memory for the RTEMS Work Space.  This can come from
96
   *  a variety of places: hard coded address, malloc'ed from outside
97
   *  RTEMS world (e.g. simulator or primitive memory manager), or (as
98
   *  typically done by stock BSPs) by subtracting the required amount
99
   *  of work space from the last physical address on the CPU board.
100
   */
101
 
102
  /*
103
   *  Need to "allocate" the memory for the RTEMS Workspace and
104
   *  tell the RTEMS configuration where it is.  This memory is
105
   *  not malloc'ed.  It is just "pulled from the air".
106
   */
107
 
108
  BSP_Configuration.work_space_start =
109
       (void *)((unsigned64)((&end) + LIBC_HEAP_SIZE + 0x2000) & ~0x7);
110
 
111
  /*
112
   *  initialize the CPU table for this BSP
113
   */
114
 
115
  Cpu_table.pretasking_hook = bsp_pretasking_hook;  /* init libc, etc. */
116
  Cpu_table.postdriver_hook = bsp_postdriver_hook;
117
  Cpu_table.interrupt_stack_size = CONFIGURE_INTERRUPT_STACK_MEMORY;
118
  Cpu_table.clicks_per_microsecond = CPU_CLOCK_RATE_MHZ;
119
}

powered by: WebSVN 2.1.0

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