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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rtems-20020807/] [c/] [src/] [lib/] [libbsp/] [arm/] [vegaplus/] [startup/] [bspstart.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1026 ivang
/*-------------------------------------------------------------------------+
2
| This file contains the ARM BSP startup package. It includes application,
3
| board, and monitor specific initialization and configuration. The generic CPU
4
| dependent initialization has been performed before this routine is invoked.
5
+--------------------------------------------------------------------------+
6
|
7
| Copyright (c) 2000 Canon Research Centre France SA.
8
| Emmanuel Raguet, mailto:raguet@crf.canon.fr
9
|
10
|   The license and distribution terms for this file may be
11
|   found in found in the file LICENSE in this distribution or at
12
|   http://www.OARcorp.com/rtems/license.html.
13
|
14
+--------------------------------------------------------------------------*/
15
 
16
 
17
#include <bsp.h>
18
#include <rtems/libcsupport.h>
19
#include <rtems/libio.h>
20
 
21
#include <uart.h>
22
 
23
/*-------------------------------------------------------------------------+
24
| Global Variables
25
+--------------------------------------------------------------------------*/
26
volatile unsigned long *Regs = (unsigned long*)0xF0000;                 /* Chip registers */
27
 
28
extern rtems_unsigned32 _end;         /* End of BSS. Defined in 'linkcmds'. */
29
/*
30
 * Size of heap if it is 0 it will be dynamically defined by memory size,
31
 * otherwise the value should be changed by binary patch
32
 */
33
rtems_unsigned32 _heap_size = 0;
34
 
35
/* Size of stack used during initialization. Defined in 'start.s'.  */
36
extern rtems_unsigned32 _stack_size;
37
 
38
rtems_unsigned32 rtemsFreeMemStart;
39
                         /* Address of start of free memory - should be updated
40
                            after creating new partitions or regions.         */
41
 
42
/* The original BSP configuration table from the application and our copy of it
43
   with some changes. */
44
 
45
extern rtems_configuration_table  Configuration;
46
       rtems_configuration_table  BSP_Configuration;
47
 
48
rtems_cpu_table Cpu_table;                     /* CPU configuration table.    */
49
char            *rtems_progname;               /* Program name - from main(). */
50
 
51
/*-------------------------------------------------------------------------+
52
| External Prototypes
53
+--------------------------------------------------------------------------*/
54
extern void rtems_irq_mngt_init(void);
55
void bsp_libc_init( void *, unsigned32, int );
56
void bsp_postdriver_hook(void);
57
 
58
/*-------------------------------------------------------------------------+
59
|         Function: bsp_pretasking_hook
60
|      Description: BSP pretasking hook.  Called just before drivers are
61
|                   initialized. Used to setup libc and install any BSP
62
|                   extensions. NOTE: Must not use libc (to do io) from here,
63
|                   since drivers are not yet initialized.
64
| Global Variables: None.
65
|        Arguments: None.
66
|          Returns: Nothing.
67
+--------------------------------------------------------------------------*/
68
void bsp_pretasking_hook(void)
69
{
70
 
71
  if(_heap_size == 0)
72
    {
73
      _heap_size = 0x420000 - rtemsFreeMemStart;
74
    }
75
 
76
  bsp_libc_init((void *)rtemsFreeMemStart, _heap_size, 0);
77
 
78
  rtemsFreeMemStart += _heap_size;           /* HEAP_SIZE  in KBytes */
79
 
80
 
81
#ifdef RTEMS_DEBUG
82
 
83
  rtems_debug_enable(RTEMS_DEBUG_ALL_MASK);
84
 
85
#endif /* RTEMS_DEBUG */
86
 
87
} /* bsp_pretasking_hook */
88
 
89
 
90
/*-------------------------------------------------------------------------+
91
|         Function: bsp_start
92
|      Description: Called before main is invoked.
93
| Global Variables: None.
94
|        Arguments: None.
95
|          Returns: Nothing.
96
+--------------------------------------------------------------------------*/
97
void bsp_start_default( void )
98
{
99
  rtemsFreeMemStart = (rtems_unsigned32)(&_end);  /* &_end+_stack_size;*/
100
                                    /* set the value of start of free memory. */
101
 
102
  /* If we don't have command line arguments set default program name. */
103
 
104
  Cpu_table.pretasking_hook         = bsp_pretasking_hook; /* init libc, etc. */
105
  Cpu_table.predriver_hook          = NULL;                /* use system's    */
106
  Cpu_table.postdriver_hook         = bsp_postdriver_hook;
107
  Cpu_table.idle_task               = NULL;
108
                                          /* do not override system IDLE task */
109
  Cpu_table.do_zero_of_workspace    = TRUE;
110
  Cpu_table.interrupt_stack_size    = 4096;
111
  Cpu_table.extra_mpci_receive_server_stack = 0;
112
 
113
  /* Place RTEMS workspace at beginning of free memory. */
114
  BSP_Configuration.work_space_start = (void *)rtemsFreeMemStart;
115
 
116
   rtemsFreeMemStart += BSP_Configuration.work_space_size;
117
 
118
  /*
119
   * Init rtems exceptions management
120
   */
121
  rtems_exception_init_mngt();
122
 
123
  /*
124
   * Init rtems interrupt management
125
   */
126
  rtems_irq_mngt_init();
127
 
128
  /*
129
   *  The following information is very useful when debugging.
130
   */
131
 
132
#if 0
133
  printk( "work_space_size = 0x%x\n", BSP_Configuration.work_space_size );
134
  printk( "maximum_extensions = 0x%x\n", BSP_Configuration.maximum_extensions );
135
  printk( "microseconds_per_tick = 0x%x\n",
136
     BSP_Configuration.microseconds_per_tick );
137
  printk( "ticks_per_timeslice = 0x%x\n",
138
     BSP_Configuration.ticks_per_timeslice );
139
  printk( "maximum_devices = 0x%x\n", BSP_Configuration.maximum_devices );
140
  printk( "number_of_device_drivers = 0x%x\n",
141
     BSP_Configuration.number_of_device_drivers );
142
  printk( "Device_driver_table = 0x%x\n",
143
     BSP_Configuration.Device_driver_table );
144
 
145
  printk( "_heap_size = 0x%x\n", _heap_size );
146
  /*  printk( "_stack_size = 0x%x\n", _stack_size );*/
147
  printk( "rtemsFreeMemStart = 0x%x\n", rtemsFreeMemStart );
148
  printk( "work_space_start = 0x%x\n", BSP_Configuration.work_space_start );
149
  printk( "work_space_size = 0x%x\n", BSP_Configuration.work_space_size );
150
#endif
151
 
152
} /* bsp_start */
153
 
154
/*
155
 *  By making this a weak alias for bsp_start_default, a brave soul
156
 *  can override the actual bsp_start routine used.
157
 */
158
 
159
void bsp_start (void) __attribute__ ((weak, alias("bsp_start_default")));

powered by: WebSVN 2.1.0

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