source: rtems/c/src/lib/libbsp/shared/bspgetworkarea.c @ c499856

4.115
Last change on this file since c499856 was c499856, checked in by Chris Johns <chrisj@…>, on 03/20/14 at 21:10:47

Change all references of rtems.com to rtems.org.

  • Property mode set to 100644
File size: 1.5 KB
Line 
1/*
2 *  This routine is an implementation of the bsp_work_area_initialize()
3 *  that can be used by all BSPs following linkcmds conventions
4 *  regarding heap, stack, and workspace allocation.
5 *
6 *  COPYRIGHT (c) 1989-2008.
7 *  On-Line Applications Research Corporation (OAR).
8 *
9 *  Copyright (c) 2011-2012 embedded brains GmbH.
10 *
11 *  The license and distribution terms for this file may be
12 *  found in the file LICENSE in this distribution or at
13 *  http://www.rtems.org/license/LICENSE.
14 */
15
16#include <bsp.h>
17#include <bsp/bootcard.h>
18#ifdef BSP_INTERRUPT_STACK_AT_WORK_AREA_BEGIN
19  #include <rtems/config.h>
20#endif
21
22#if defined(HAS_UBOOT) && !defined(BSP_DISABLE_UBOOT_WORK_AREA_CONFIG)
23  #define USE_UBOOT
24#endif
25
26/*
27 *  These are provided by the linkcmds for ALL of the BSPs which use this file.
28 */
29extern char WorkAreaBase[];
30
31/*
32 *  We may get the size information from U-Boot or the linker scripts.
33 */
34#ifdef USE_UBOOT
35  #include <bsp/u-boot.h>
36#else
37  extern char RamBase[];
38  extern char RamSize[];
39#endif
40
41void bsp_work_area_initialize(void)
42{
43  uintptr_t work_base = (uintptr_t) WorkAreaBase;
44  uintptr_t ram_end;
45
46  #ifdef USE_UBOOT
47    ram_end = (uintptr_t) bsp_uboot_board_info.bi_memstart +
48                          bsp_uboot_board_info.bi_memsize;
49  #else
50    ram_end = (uintptr_t)RamBase + (uintptr_t)RamSize;
51  #endif
52
53  #ifdef BSP_INTERRUPT_STACK_AT_WORK_AREA_BEGIN
54    work_base += rtems_configuration_get_interrupt_stack_size();
55  #endif
56
57  bsp_work_area_initialize_default( (void *) work_base, ram_end - work_base );
58}
Note: See TracBrowser for help on using the repository browser.