1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * This routine is an implementation of the _Memory_Get() |
---|
5 | * that can be used by all BSPs following linkcmds conventions |
---|
6 | * regarding heap, stack, and workspace allocation. |
---|
7 | */ |
---|
8 | |
---|
9 | /* |
---|
10 | * COPYRIGHT (c) 1989-2008. |
---|
11 | * On-Line Applications Research Corporation (OAR). |
---|
12 | * |
---|
13 | * Copyright (c) 2011-2012 embedded brains GmbH. |
---|
14 | * |
---|
15 | * The license and distribution terms for this file may be |
---|
16 | * found in the file LICENSE in this distribution or at |
---|
17 | * http://www.rtems.org/license/LICENSE. |
---|
18 | */ |
---|
19 | |
---|
20 | #include <bsp.h> |
---|
21 | #include <bsp/bootcard.h> |
---|
22 | |
---|
23 | #if defined(HAS_UBOOT) && !defined(BSP_DISABLE_UBOOT_WORK_AREA_CONFIG) |
---|
24 | #define USE_UBOOT |
---|
25 | #endif |
---|
26 | |
---|
27 | /* |
---|
28 | * These are provided by the linkcmds for ALL of the BSPs which use this file. |
---|
29 | */ |
---|
30 | extern char WorkAreaBase[]; |
---|
31 | |
---|
32 | /* |
---|
33 | * We may get the size information from U-Boot or the linker scripts. |
---|
34 | */ |
---|
35 | #ifdef USE_UBOOT |
---|
36 | #include <bsp/u-boot.h> |
---|
37 | #include <rtems/sysinit.h> |
---|
38 | |
---|
39 | static Memory_Area _Memory_Areas[ 1 ]; |
---|
40 | |
---|
41 | static void bsp_memory_initialize( void ) |
---|
42 | { |
---|
43 | char *end; |
---|
44 | |
---|
45 | end = (char *) bsp_uboot_board_info.bi_memstart |
---|
46 | + bsp_uboot_board_info.bi_memsize; |
---|
47 | _Memory_Initialize( &_Memory_Areas[ 0 ], WorkAreaBase, end ); |
---|
48 | } |
---|
49 | |
---|
50 | RTEMS_SYSINIT_ITEM( |
---|
51 | bsp_memory_initialize, |
---|
52 | RTEMS_SYSINIT_MEMORY, |
---|
53 | RTEMS_SYSINIT_ORDER_MIDDLE |
---|
54 | ); |
---|
55 | #else /* !USE_UBOOT */ |
---|
56 | extern char RamEnd[]; |
---|
57 | |
---|
58 | static Memory_Area _Memory_Areas[] = { |
---|
59 | MEMORY_INITIALIZER(WorkAreaBase, RamEnd) |
---|
60 | }; |
---|
61 | #endif /* USE_UBOOT */ |
---|
62 | |
---|
63 | static const Memory_Information _Memory_Information = |
---|
64 | MEMORY_INFORMATION_INITIALIZER( _Memory_Areas ); |
---|
65 | |
---|
66 | const Memory_Information *_Memory_Get( void ) |
---|
67 | { |
---|
68 | return &_Memory_Information; |
---|
69 | } |
---|