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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [lib/] [libbsp/] [or1k/] [bender/] [startup/] [bspstart.c] - Blame information for rev 30

Go to most recent revision | 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
 *  This file adapted from no_bsp board library of the RTEMS distribution.
15
 *  The body has been modified for the Bender Or1k implementation by
16
 *  Chris Ziomkowski. <chris@asics.ws>
17
 */
18
 
19
#include <bsp.h>
20
#include <rtems/libio.h>
21
 
22
#include <libcsupport.h>
23
 
24
#include <string.h>
25
extern int _mem_end;
26
 
27
/*
28
 *  The original table from the application and our copy of it with
29
 *  some changes.
30
 */
31
 
32
extern rtems_configuration_table Configuration;
33
 
34
rtems_configuration_table  BSP_Configuration;
35
 
36
rtems_cpu_table Cpu_table;
37
 
38
char *rtems_progname;
39
 
40
/*
41
 *  Use the shared implementations of the following routines
42
 */
43
 
44
void bsp_postdriver_hook(void);
45
void bsp_libc_init( void *, unsigned32, int );
46
 
47
/*
48
 *  Function:   bsp_pretasking_hook
49
 *  Created:    95/03/10
50
 *
51
 *  Description:
52
 *      BSP pretasking hook.  Called just before drivers are initialized.
53
 *      Used to setup libc and install any BSP extensions.
54
 *
55
 *  NOTES:
56
 *      Must not use libc (to do io) from here, since drivers are
57
 *      not yet initialized.
58
 *
59
 */
60
 
61
void bsp_pretasking_hook(void)
62
{
63
    rtems_unsigned32        heap_start;
64
 
65
    heap_start = (rtems_unsigned32) _mem_end;
66
    if (heap_start & (CPU_ALIGNMENT-1))
67
        heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
68
 
69
    bsp_libc_init((void *) heap_start, 64 * 1024, 0);
70
 
71
#ifdef RTEMS_DEBUG
72
    rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
73
#endif
74
}
75
 
76
/*
77
 *  bsp_start
78
 *
79
 *  This routine does the bulk of the system initialization.
80
 */
81
 
82
void bsp_start( void )
83
{
84
  /*
85
   *  Allocate the memory for the RTEMS Work Space.  This can come from
86
   *  a variety of places: hard coded address, malloc'ed from outside
87
   *  RTEMS world (e.g. simulator or primitive memory manager), or (as
88
   *  typically done by stock BSPs) by subtracting the required amount
89
   *  of work space from the last physical address on the CPU board.
90
   */
91
 
92
  /*
93
   *  Need to "allocate" the memory for the RTEMS Workspace and
94
   *  tell the RTEMS configuration where it is.  This memory is
95
   *  not malloc'ed.  It is just "pulled from the air".
96
   */
97
 
98
  BSP_Configuration.work_space_start = _mem_end;
99
  _mem_end += BSP_Configuration.work_space_size + 512;
100
  ( BSP_Configuration.work_space_size + 512 );
101
 
102
  BSP_Configuration.work_space_start = (void *) ((unsigned int)((char *)BSP_Configuration.work_space_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1));
103
 
104
  /*
105
   *  initialize the CPU table for this BSP
106
   */
107
 
108
  Cpu_table.pretasking_hook = bsp_pretasking_hook;  /* init libc, etc. */
109
  Cpu_table.postdriver_hook = bsp_postdriver_hook;
110
  Cpu_table.do_zero_of_workspace = FALSE;
111
  Cpu_table.interrupt_stack_size = CONFIGURE_INTERRUPT_STACK_MEMORY;
112
 
113
  /*
114
   *  Start RTEMS
115
   */
116
 
117
  rtems_initialize_executive( &BSP_Configuration, &Cpu_table );
118
 
119
  bsp_cleanup();
120
 
121
  return 0;
122
}

powered by: WebSVN 2.1.0

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