source: rtems/c/src/lib/libbsp/powerpc/shared/startup/pretaskinghook.c @ 8c6579b

4.104.114.84.95
Last change on this file since 8c6579b was 8c6579b, checked in by Till Straumann <strauman@…>, on 11/29/05 at 18:47:05
  • trivial correction in comment
  • Property mode set to 100644
File size: 2.2 KB
Line 
1/*
2 *  bsp_pretasking_hook().
3 *  Initializes the heap, libc and VME.
4 *
5 *  COPYRIGHT (c) 1989-1998.
6 *  On-Line Applications Research Corporation (OAR).
7 *
8 *  The license and distribution terms for this file may be
9 *  found in the file LICENSE in this distribution or at
10 *  http://www.rtems.com/license/LICENSE.
11 *
12 *  Modified to support the MCP750.
13 *  Modifications Copyright (C) 1999 Eric Valette. valette@crf.canon.fr
14 *
15 *  $Id$
16 */
17
18#include <string.h>
19
20#include <bsp.h>
21#include <bsp/consoleIo.h>
22#ifndef BSP_HAS_NO_VME
23#include <bsp/VME.h>
24#endif
25
26void bsp_libc_init( void *, uint32_t, int );
27
28/*
29 *  Function:   bsp_pretasking_hook
30 *  Created:    95/03/10
31 *
32 *  Description:
33 *      BSP pretasking hook.  Called just before drivers are initialized.
34 *      Used to setup libc and install any BSP extensions.
35 *
36 *  NOTES:
37 *      Must not use libc (to do io) from here, since drivers are
38 *      not yet initialized.
39 *
40 */
41
42void bsp_pretasking_hook(void)
43{
44  uint32_t        heap_size;
45  uint32_t        heap_sbrk_spared;
46  extern uint32_t _bsp_sbrk_init(uint32_t, uint32_t*);
47  extern void     BSP_vme_config();
48
49  /* make sure it's properly aligned */
50  BSP_heap_start = (BSP_heap_start + CPU_ALIGNMENT - 1) & ~(CPU_ALIGNMENT-1);
51
52  heap_size = (BSP_mem_size - BSP_heap_start) - BSP_Configuration.work_space_size;
53  heap_sbrk_spared=_bsp_sbrk_init(BSP_heap_start, &heap_size);
54
55#ifdef SHOW_MORE_INIT_SETTINGS
56  printk( "HEAP start %x  size %x (%x bytes spared for sbrk)\n",
57             BSP_heap_start, heap_size, heap_sbrk_spared);
58#endif   
59
60  bsp_libc_init((void *) 0, heap_size, heap_sbrk_spared);
61
62  /* Note that VME support may be omitted also by
63   * providing a NULL BSP_vme_config routine
64   * (e.g., linker script)
65   */
66#ifndef BSP_HAS_NO_VME
67  /*
68   * Initialize VME bridge - needs working PCI
69   * and IRQ subsystems...
70   *
71   * NOTE: vmeUniverse driver now uses shared interrupts.
72   *       this requires malloc/free which are not available
73   *       from bspstart()...
74   */
75#ifdef SHOW_MORE_INIT_SETTINGS
76  printk("Going to initialize VME bridge\n");
77#endif
78  if ( BSP_vme_config )
79    BSP_vme_config();
80#endif
81
82#ifdef RTEMS_DEBUG
83  rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
84#endif
85}
Note: See TracBrowser for help on using the repository browser.