mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-12-05 15:15:44 +00:00
2007-12-11 Joel Sherrill <joel.sherrill@OARcorp.com>
* clock/clock.c, include/bsp.h, startup/bspstart.c, startup/rtems-ctor.cc: Eliminate copies of the Configuration Table. Use the RTEMS provided accessor macros to obtain configuration fields.
This commit is contained in:
@@ -1,3 +1,10 @@
|
||||
2007-12-11 Joel Sherrill <joel.sherrill@OARcorp.com>
|
||||
|
||||
* clock/clock.c, include/bsp.h, startup/bspstart.c,
|
||||
startup/rtems-ctor.cc: Eliminate copies of the Configuration Table.
|
||||
Use the RTEMS provided accessor macros to obtain configuration
|
||||
fields.
|
||||
|
||||
2007-12-04 Joel Sherrill <joel.sherrill@OARcorp.com>
|
||||
|
||||
* include/bsp.h, startup/bspstart.c: Move interrupt_stack_size field
|
||||
|
||||
@@ -36,7 +36,7 @@ void Install_clock(rtems_isr_entry clock_isr)
|
||||
|
||||
(void) set_vector( clock_isr, Clock_driver_vector, 1 );
|
||||
|
||||
_CPU_Start_clock( BSP_Configuration.microseconds_per_tick );
|
||||
_CPU_Start_clock( rtems_configuration_get_microseconds_per_tick() );
|
||||
|
||||
atexit(Clock_exit);
|
||||
}
|
||||
|
||||
@@ -31,8 +31,6 @@ extern "C" {
|
||||
|
||||
/* miscellaneous stuff assumed to exist */
|
||||
|
||||
extern rtems_configuration_table BSP_Configuration;
|
||||
|
||||
/*
|
||||
* Device Driver Table Entries
|
||||
*/
|
||||
@@ -53,14 +51,9 @@ void bsp_cleanup( void );
|
||||
|
||||
/* miscellaneous stuff assumed to exist */
|
||||
|
||||
extern rtems_configuration_table BSP_Configuration; /* owned by BSP */
|
||||
extern int rtems_argc;
|
||||
extern char **rtems_argv;
|
||||
|
||||
extern uint32_t bsp_isr_level;
|
||||
|
||||
extern char *rtems_progname; /* UNIX executable name */
|
||||
|
||||
extern int cpu_number;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -24,16 +24,6 @@
|
||||
#include <rtems/libcsupport.h>
|
||||
#include <rtems/libio.h>
|
||||
|
||||
extern rtems_configuration_table Configuration;
|
||||
|
||||
/*
|
||||
* A copy of the configuration table from the application
|
||||
* with some changes applied to it.
|
||||
*/
|
||||
|
||||
rtems_configuration_table BSP_Configuration;
|
||||
rtems_multiprocessing_table BSP_Multiprocessing;
|
||||
uint32_t bsp_isr_level;
|
||||
uint32_t Heap_size;
|
||||
int rtems_argc;
|
||||
char **rtems_argv;
|
||||
@@ -118,36 +108,24 @@ void bsp_start(void)
|
||||
{
|
||||
uintptr_t workspace_ptr;
|
||||
|
||||
/*
|
||||
* Copy the table (normally done in shared main).
|
||||
*/
|
||||
|
||||
BSP_Configuration = Configuration;
|
||||
|
||||
/*
|
||||
* If the node number is -1 then the application better provide
|
||||
* it through environment variables RTEMS_NODE.
|
||||
* Ditto for RTEMS_MAXIMUM_NODES
|
||||
*/
|
||||
|
||||
if (BSP_Configuration.User_multiprocessing_table) {
|
||||
if (Configuration.User_multiprocessing_table) {
|
||||
char *p;
|
||||
|
||||
/* make a copy for possible editing */
|
||||
BSP_Multiprocessing = *BSP_Configuration.User_multiprocessing_table;
|
||||
BSP_Configuration.User_multiprocessing_table = &BSP_Multiprocessing;
|
||||
|
||||
if (BSP_Multiprocessing.node == -1)
|
||||
{
|
||||
if (Configuration.User_multiprocessing_table->node == -1) {
|
||||
p = getenv("RTEMS_NODE");
|
||||
BSP_Multiprocessing.node = p ? atoi(p) : 1;
|
||||
Configuration.User_multiprocessing_table->node = p ? atoi(p) : 1;
|
||||
}
|
||||
|
||||
/* If needed provide maximum_nodes also */
|
||||
if (BSP_Multiprocessing.maximum_nodes == -1)
|
||||
{
|
||||
if (Configuration.User_multiprocessing_table->maximum_nodes == -1) {
|
||||
p = getenv("RTEMS_MAXIMUM_NODES");
|
||||
BSP_Multiprocessing.maximum_nodes = p ? atoi(p) : 1;
|
||||
Configuration.User_multiprocessing_table->maximum_nodes = p ? atoi(p) : 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,41 +133,28 @@ void bsp_start(void)
|
||||
* Set cpu_number to accurately reflect our cpu number
|
||||
*/
|
||||
|
||||
if (BSP_Configuration.User_multiprocessing_table)
|
||||
cpu_number = BSP_Configuration.User_multiprocessing_table->node - 1;
|
||||
if (Configuration.User_multiprocessing_table->User_multiprocessing_table)
|
||||
cpu_number = Configuration.User_multiprocessing_table->node - 1;
|
||||
else
|
||||
cpu_number = 0;
|
||||
|
||||
if (getenv("RTEMS_WORKSPACE_SIZE"))
|
||||
BSP_Configuration.work_space_size =
|
||||
rtems_configuration_get_work_space_size() =
|
||||
strtol(getenv("RTEMS_WORKSPACE_SIZE"), 0, 0);
|
||||
else
|
||||
BSP_Configuration.work_space_size = DEFAULT_WORKSPACE_SIZE;
|
||||
rtems_configuration_get_work_space_size() = DEFAULT_WORKSPACE_SIZE;
|
||||
|
||||
/*
|
||||
* Allocate workspace memory, ensuring it is properly aligned
|
||||
*/
|
||||
|
||||
workspace_ptr =
|
||||
(uintptr_t) sbrk(BSP_Configuration.work_space_size + CPU_ALIGNMENT);
|
||||
(uintptr_t) sbrk(rtems_configuration_get_work_space_size() + CPU_ALIGNMENT);
|
||||
workspace_ptr += CPU_ALIGNMENT - 1;
|
||||
workspace_ptr &= ~(CPU_ALIGNMENT - 1);
|
||||
|
||||
BSP_Configuration.work_space_start = (void *) workspace_ptr;
|
||||
|
||||
/*
|
||||
* Add 1 extension for MPCI_fatal
|
||||
*/
|
||||
|
||||
if (BSP_Configuration.User_multiprocessing_table)
|
||||
BSP_Configuration.maximum_extensions++;
|
||||
Configuration.work_space_start = (void *) workspace_ptr;
|
||||
|
||||
CPU_CLICKS_PER_TICK = 1;
|
||||
|
||||
/*
|
||||
* Start most of RTEMS
|
||||
* main() will start the rest
|
||||
*/
|
||||
|
||||
bsp_isr_level = rtems_initialize_executive_early( &BSP_Configuration );
|
||||
}
|
||||
|
||||
@@ -49,15 +49,6 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/*
|
||||
* RTEMS program name
|
||||
* Probably not used by anyone, but it is nice to have it.
|
||||
* Actually the UNIX version of CPU_INVOKE_DEBUGGER will probably
|
||||
* need to use it
|
||||
*/
|
||||
|
||||
char *rtems_progname;
|
||||
|
||||
class RTEMS {
|
||||
public:
|
||||
RTEMS();
|
||||
@@ -89,6 +80,14 @@ extern "C" {
|
||||
rtems_argc = argc;
|
||||
rtems_argv = argv;
|
||||
|
||||
rtems_interrupt_level bsp_isr_level;
|
||||
|
||||
/*
|
||||
* Make sure interrupts are disabled.
|
||||
*/
|
||||
|
||||
rtems_interrupt_disable( bsp_isr_level );
|
||||
|
||||
if ((argc > 0) && argv && argv[0])
|
||||
rtems_progname = argv[0];
|
||||
else
|
||||
@@ -102,6 +101,8 @@ extern "C" {
|
||||
invoke_non_gnu_constructors();
|
||||
#endif
|
||||
|
||||
rtems_initialize_executive_early( &Configuration );
|
||||
|
||||
/*
|
||||
* Start multitasking
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user