forked from Imagelibrary/rtems
2008-09-23 Joel Sherrill <joel.sherrill@oarcorp.com>
* bootcard.c, include/bootcard.h: Make letting boot_card() handle work area allocation mandatory. Rename RTEMS_BSP_BOOTCARD_HANDLES_RAM_ALLOCATION to BSP_BOOTCARD_OPTIONS.
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
2008-09-23 Joel Sherrill <joel.sherrill@oarcorp.com>
|
||||
|
||||
* bootcard.c, include/bootcard.h: Make letting boot_card() handle work
|
||||
area allocation mandatory. Rename
|
||||
RTEMS_BSP_BOOTCARD_HANDLES_RAM_ALLOCATION to BSP_BOOTCARD_OPTIONS.
|
||||
|
||||
2008-09-23 Sebastian Huber <sebastian.huber@embedded-brains.de>
|
||||
|
||||
* include/utility.h: New file.
|
||||
|
||||
@@ -62,14 +62,13 @@ extern bool rtems_unified_work_area;
|
||||
* when the BSP lets the framework handle RAM allocation between
|
||||
* the RTEMS Workspace and C Program Heap.
|
||||
*/
|
||||
#if defined(BSP_BOOTCARD_HANDLES_RAM_ALLOCATION)
|
||||
static rtems_status_code bootcard_bsp_libc_helper(
|
||||
static rtems_status_code bootcard_bsp_libc_helper(
|
||||
void *work_area_start,
|
||||
size_t work_area_size,
|
||||
void *heap_start,
|
||||
size_t heap_size
|
||||
)
|
||||
{
|
||||
)
|
||||
{
|
||||
size_t heap_size_default = 0;
|
||||
|
||||
if ( !rtems_unified_work_area &&
|
||||
@@ -107,8 +106,7 @@ extern bool rtems_unified_work_area;
|
||||
bsp_libc_init(heap_start, heap_size, 0);
|
||||
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* This is the initialization framework routine that weaves together
|
||||
@@ -127,13 +125,11 @@ int boot_card(
|
||||
char **argv_p = &argv_pointer;
|
||||
char **envp_p = &envp_pointer;
|
||||
rtems_interrupt_level bsp_isr_level;
|
||||
#if defined(BSP_BOOTCARD_HANDLES_RAM_ALLOCATION)
|
||||
rtems_status_code sc = RTEMS_SUCCESSFUL;
|
||||
void *work_area_start = NULL;
|
||||
size_t work_area_size = 0;
|
||||
void *heap_start = NULL;
|
||||
size_t heap_size = 0;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Special case for PowerPC: The interrupt disable mask is stored in SPRG0.
|
||||
@@ -174,14 +170,7 @@ int boot_card(
|
||||
* Find out where the block of memory the BSP will use for
|
||||
* the RTEMS Workspace and the C Program Heap is.
|
||||
*/
|
||||
#if defined(BSP_BOOTCARD_HANDLES_RAM_ALLOCATION)
|
||||
{
|
||||
bsp_get_work_area(
|
||||
&work_area_start,
|
||||
&work_area_size,
|
||||
&heap_start,
|
||||
&heap_size
|
||||
);
|
||||
bsp_get_work_area(&work_area_start, &work_area_size, &heap_start, &heap_size);
|
||||
|
||||
if ( work_area_size <= Configuration.work_space_size ) {
|
||||
printk( "bootcard: Work space too big for work area!\n");
|
||||
@@ -198,9 +187,7 @@ int boot_card(
|
||||
}
|
||||
|
||||
#if (BSP_DIRTY_MEMORY == 1)
|
||||
memset( work_area_start, 0xCF, work_area_size);
|
||||
#endif
|
||||
}
|
||||
memset( work_area_start, 0xCF, work_area_size );
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -212,19 +199,17 @@ int boot_card(
|
||||
* Initialize the C library for those BSPs using the shared
|
||||
* framework.
|
||||
*/
|
||||
#if defined(BSP_BOOTCARD_HANDLES_RAM_ALLOCATION)
|
||||
sc = bootcard_bsp_libc_helper(
|
||||
work_area_start,
|
||||
work_area_size,
|
||||
heap_start,
|
||||
heap_size
|
||||
);
|
||||
if (sc != RTEMS_SUCCESSFUL) {
|
||||
if ( sc != RTEMS_SUCCESSFUL ) {
|
||||
printk( "bootcard: Cannot initialize C library!\n");
|
||||
bsp_cleanup();
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* All BSP to do any required initialization now that RTEMS
|
||||
@@ -295,6 +280,5 @@ int boot_card(
|
||||
/*
|
||||
* Now return to the start code.
|
||||
*/
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <bspopts.h> /* for BSP_BOOTCARD_HANDLES_RAM_ALLOCATION */
|
||||
#include <bspopts.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -48,18 +48,16 @@ void bsp_cleanup(void);
|
||||
|
||||
void bsp_reset(void);
|
||||
|
||||
#ifdef BSP_BOOTCARD_HANDLES_RAM_ALLOCATION
|
||||
#define BSP_BOOTCARD_HEAP_USES_WORK_AREA NULL
|
||||
#define BSP_BOOTCARD_HEAP_USES_WORK_AREA NULL
|
||||
|
||||
#define BSP_BOOTCARD_HEAP_SIZE_DEFAULT 0
|
||||
#define BSP_BOOTCARD_HEAP_SIZE_DEFAULT 0
|
||||
|
||||
void bsp_get_work_area(
|
||||
void bsp_get_work_area(
|
||||
void **work_area_start,
|
||||
size_t *work_area_size,
|
||||
void **heap_start,
|
||||
size_t *heap_size
|
||||
);
|
||||
#endif
|
||||
);
|
||||
|
||||
int boot_card( int argc, char **argv, char **envp);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user