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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rtems-20020807/] [c/] [src/] [lib/] [libbsp/] [mips/] [p4000/] [startup/] [bspstart.c] - Blame information for rev 1026

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1026 ivang
/*
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
 *  bspstart.c,v 1.14 2000/11/01 21:17:00 joel 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
#include <string.h>
25
 
26
#include <bsp.h>
27
#include <rtems/libio.h>
28
#include <rtems/libcsupport.h>
29
 
30
/*
31
 *  The original table from the application and our copy of it with
32
 *  some changes.
33
 */
34
 
35
extern rtems_configuration_table Configuration;
36
 
37
rtems_configuration_table  BSP_Configuration;
38
 
39
rtems_cpu_table Cpu_table;
40
 
41
char *rtems_progname;
42
 
43
/*
44
 *  Use the shared implementations of the following routines
45
 */
46
 
47
void bsp_postdriver_hook(void);
48
void bsp_libc_init( void *, unsigned32, int );
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
 
64
#define LIBC_HEAP_SIZE (64 * 1024)
65
 
66
void bsp_pretasking_hook(void)
67
{
68
    extern int end;
69
    rtems_unsigned32        heap_start;
70
 
71
    heap_start = (rtems_unsigned32) &end;
72
    if (heap_start & (CPU_ALIGNMENT-1))
73
        heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
74
 
75
    bsp_libc_init((void *) heap_start, LIBC_HEAP_SIZE, 0);
76
 
77
#ifdef RTEMS_DEBUG
78
    rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
79
#endif
80
}
81
 
82
extern int end; /* defined by linker */
83
 
84
/*
85
 *  bsp_start
86
 *
87
 *  This routine does the bulk of the system initialization.
88
 */
89
 
90
void bsp_start( void )
91
{
92
  /*
93
   *  Allocate the memory for the RTEMS Work Space.  This can come from
94
   *  a variety of places: hard coded address, malloc'ed from outside
95
   *  RTEMS world (e.g. simulator or primitive memory manager), or (as
96
   *  typically done by stock BSPs) by subtracting the required amount
97
   *  of work space from the last physical address on the CPU board.
98
   */
99
 
100
  /*
101
   *  Need to "allocate" the memory for the RTEMS Workspace and
102
   *  tell the RTEMS configuration where it is.  This memory is
103
   *  not malloc'ed.  It is just "pulled from the air".
104
   */
105
 
106
  BSP_Configuration.work_space_start =
107
       (void *)((unsigned64)((&end) + LIBC_HEAP_SIZE + 0x2000) & ~0x7);
108
 
109
  /*
110
   *  initialize the CPU table for this BSP
111
   */
112
 
113
  Cpu_table.pretasking_hook = bsp_pretasking_hook;  /* init libc, etc. */
114
  Cpu_table.postdriver_hook = bsp_postdriver_hook;
115
  Cpu_table.interrupt_stack_size = CONFIGURE_INTERRUPT_STACK_MEMORY;
116
  Cpu_table.clicks_per_microsecond = CPU_CLOCK_RATE_MHZ;
117
}

powered by: WebSVN 2.1.0

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