source: rtems/c/src/lib/libbsp/m68k/shared/m68kpretaskinghook.c @ 492bb09

4.104.114.84.95
Last change on this file since 492bb09 was 7e0e4546, checked in by Joel Sherrill <joel.sherrill@…>, on Sep 4, 2003 at 6:52:09 PM

2003-09-04 Joel Sherrill <joel@…>

  • bspspuriousinit.c, m68000spurious.c, m68kpretaskinghook.c, setvec.c, start.S, mvme/mvme16x_hw.h: URL for license changed.
  • Property mode set to 100644
File size: 1.7 KB
Line 
1/* 
2 *  This routine is an implementation of the bsp_pretasking_hook
3 *  that can be used by all m68k BSPs following linkcmds conventions
4 *  regarding heap, stack, and workspace allocation.
5 *
6 *  COPYRIGHT (c) 1989-1999.
7 *  On-Line Applications Research Corporation (OAR).
8 *
9 *  The license and distribution terms for this file may be
10 *  found in the file LICENSE in this distribution or at
11 *  http://www.rtems.com/license/LICENSE.
12 *
13 *  $Id$
14 */
15
16#include <bsp.h>
17#include <rtems/libio.h>
18#include <rtems/libcsupport.h>
19
20/*
21 *  Function:   bsp_pretasking_hook
22 *  Created:    95/03/10
23 *
24 *  Description:
25 *      BSP pretasking hook.  Called just before drivers are initialized.
26 *      Used to setup libc and install any BSP extensions.
27 *
28 *  NOTES:
29 *      Must not use libc (to do io) from here, since drivers are
30 *      not yet initialized.
31 *
32 */
33
34extern void bsp_libc_init( void *, unsigned long, int );
35extern rtems_configuration_table  BSP_Configuration;
36
37extern void          *_RamBase;
38extern void          *_WorkspaceBase;
39extern void          *_HeapSize;
40
41
42unsigned long  _M68k_Ramsize;
43
44void bsp_pretasking_hook(void)
45{
46    void         *heapStart;
47    unsigned long heapSize = (unsigned long)&_HeapSize;
48    unsigned long ramSpace;
49
50    heapStart =  (void *)
51       ((unsigned long)&_WorkspaceBase + BSP_Configuration.work_space_size);
52    ramSpace = (unsigned long) &_RamBase + _M68k_Ramsize - (unsigned long) heapStart;
53
54    if (heapSize == 0)
55        heapSize = ramSpace;
56    else if (heapSize > ramSpace)
57        rtems_fatal_error_occurred (('H'<<24) | ('E'<<16) | ('A'<<8) | 'P');
58
59    bsp_libc_init(heapStart, heapSize, 0);
60
61#ifdef RTEMS_DEBUG
62    rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
63#endif
64
65}
Note: See TracBrowser for help on using the repository browser.