diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2011-05-17 19:31:24 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2011-05-17 19:31:24 +0000 |
commit | aebb1ca3839f59dfb79f7022e00a995a98caaa69 (patch) | |
tree | e1c04d639fa32094b9f47de2552fd625b5ec7e63 | |
parent | 2011-05-17 Joel Sherrill <joel.sherrill@oarcorp.com> (diff) | |
download | rtems-schedsim-aebb1ca3839f59dfb79f7022e00a995a98caaa69.tar.bz2 |
2011-05-17 Joel Sherrill <joel.sherrill@oarcorp.com>
* Makefile.am, rtems_init.c, sched_cpu/cpu.c,
sched_cpu/rtems/score/cpu.h: Merge and update code. Simulators for
Deterministic Priority and SMP Simple Schedulers now work.
* debugio.c: New file.
* sched_cpu/rtems/score/cpuopts.h: Removed.
-rw-r--r-- | schedsim/rtems/ChangeLog | 8 | ||||
-rw-r--r-- | schedsim/rtems/Makefile.am | 22 | ||||
-rw-r--r-- | schedsim/rtems/debugio.c | 17 | ||||
-rw-r--r-- | schedsim/rtems/rtems_init.c | 14 | ||||
-rw-r--r-- | schedsim/rtems/sched_cpu/cpu.c | 12 | ||||
-rw-r--r-- | schedsim/rtems/sched_cpu/rtems/score/cpu.h | 17 | ||||
-rw-r--r-- | schedsim/rtems/sched_cpu/rtems/score/cpuopts.h | 72 |
7 files changed, 87 insertions, 75 deletions
diff --git a/schedsim/rtems/ChangeLog b/schedsim/rtems/ChangeLog index 22d4c31..5a3eca0 100644 --- a/schedsim/rtems/ChangeLog +++ b/schedsim/rtems/ChangeLog @@ -1,3 +1,11 @@ +2011-05-17 Joel Sherrill <joel.sherrill@oarcorp.com> + + * Makefile.am, rtems_init.c, sched_cpu/cpu.c, + sched_cpu/rtems/score/cpu.h: Merge and update code. Simulators for + Deterministic Priority and SMP Simple Schedulers now work. + * debugio.c: New file. + * sched_cpu/rtems/score/cpuopts.h: Removed. + 2011-04-11 Joel Sherrill <joel.sherrill@oarcorp.com> * Makefile.am: Add schedulersimple.h diff --git a/schedsim/rtems/Makefile.am b/schedsim/rtems/Makefile.am index 40e52c1..1d7ea48 100644 --- a/schedsim/rtems/Makefile.am +++ b/schedsim/rtems/Makefile.am @@ -8,6 +8,7 @@ lib_LIBRARIES = librtems.a cpukitdir=@rtems_srcdir@/cpukit librtems_a_CPPFLAGS = -D__RTEMS_VIOLATE_KERNEL_VISIBILITY__ +librtems_a_CPPFLAGS += -I$(top_builddir)/score/include librtems_a_CPPFLAGS += -I$(srcdir)/sched_cpu librtems_a_CPPFLAGS += -I$(cpukitdir)/include librtems_a_CPPFLAGS += -I$(cpukitdir)/score/include @@ -20,7 +21,9 @@ librtems_a_CPPFLAGS += -I$(cpukitdir)/libcsupport/include librtems_a_CPPFLAGS += -I$(cpukitdir)/libmisc/stringto ## Have own version of these -librtems_a_SOURCES = rtems_init.c wkspace.c +librtems_a_SOURCES = rtems_init.c +librtems_a_SOURCES += wkspace.c +librtems_a_SOURCES += debugio.c librtems_a_SOURCES += sched_cpu/cpu_asm.c librtems_a_SOURCES += sched_cpu/cpu.c @@ -55,6 +58,7 @@ librtems_a_SOURCES += $(cpukitdir)/score/src/coretodset.c librtems_a_SOURCES += $(cpukitdir)/score/src/coretodtickle.c librtems_a_SOURCES += $(cpukitdir)/score/src/coretodtickspersec.c librtems_a_SOURCES += $(cpukitdir)/score/src/coretodusectoticks.c +librtems_a_SOURCES += $(cpukitdir)/score/src/isr.c librtems_a_SOURCES += $(cpukitdir)/score/src/objectallocate.c librtems_a_SOURCES += $(cpukitdir)/score/src/objectapimaximumclass.c librtems_a_SOURCES += $(cpukitdir)/score/src/objectclose.c @@ -214,6 +218,8 @@ librtems_a_SOURCES += $(cpukitdir)/libcsupport/src/assocremotebylocalbitfield.c librtems_a_SOURCES += $(cpukitdir)/libcsupport/src/assocremotebylocal.c librtems_a_SOURCES += $(cpukitdir)/libcsupport/src/assocremotebyname.c librtems_a_SOURCES += $(cpukitdir)/libcsupport/src/error.c +librtems_a_SOURCES += $(cpukitdir)/libcsupport/src/printk.c +librtems_a_SOURCES += $(cpukitdir)/libcsupport/src/vprintk.c librtems_a_SOURCES += $(cpukitdir)/libmisc/stringto/stringtodouble.c librtems_a_SOURCES += $(cpukitdir)/libmisc/stringto/stringtofloat.c librtems_a_SOURCES += $(cpukitdir)/libmisc/stringto/stringtoint.c @@ -223,6 +229,18 @@ librtems_a_SOURCES += $(cpukitdir)/libmisc/stringto/stringtounsignedchar.c librtems_a_SOURCES += $(cpukitdir)/libmisc/stringto/stringtounsignedint.c librtems_a_SOURCES += $(cpukitdir)/libmisc/stringto/stringtounsignedlong.c +if HAS_SMP +librtems_a_SOURCES += $(cpukitdir)/score/src/smp.c +librtems_a_SOURCES += $(cpukitdir)/score/src/smplock.c +librtems_a_SOURCES += $(cpukitdir)/score/src/isrsmp.c +librtems_a_SOURCES += $(cpukitdir)/score/src/threaddisabledispatch.c +librtems_a_SOURCES += $(cpukitdir)/score/src/threadenabledispatch.c +librtems_a_SOURCES += $(cpukitdir)/score/src/threaddispatchdisablelevel.c +librtems_a_SOURCES += $(cpukitdir)/score/src/schedulersimplesmpblock.c +librtems_a_SOURCES += $(cpukitdir)/score/src/schedulersimplesmpschedule.c +librtems_a_SOURCES += $(cpukitdir)/score/src/schedulersimplesmpunblock.c +endif + schedsim_includedir = $(includedir)/schedsim schedsim_rtems_includedir = $(includedir)/schedsim/rtems schedsim_rtems_score_includedir = $(includedir)/schedsim/rtems/score @@ -331,7 +349,7 @@ schedsim_rtems_score_include_HEADERS = \ $(cpukitdir)/score/inline/rtems/score/prioritybitmap.inl \ $(cpukitdir)/score/inline/rtems/score/thread.inl \ sched_cpu/rtems/score/cpu_asm.h \ - sched_cpu/rtems/score/cpuopts.h \ + $(top_builddir)/score/include/rtems/score/cpuopts.h \ sched_cpu/rtems/score/cpu.h \ sched_cpu/rtems/score/types.h \ sched_cpu/rtems/score/no_cpu.h diff --git a/schedsim/rtems/debugio.c b/schedsim/rtems/debugio.c new file mode 100644 index 0000000..2beb89e --- /dev/null +++ b/schedsim/rtems/debugio.c @@ -0,0 +1,17 @@ +/* + * $Id$ + */ + +#include <rtems.h> +#include <rtems/bspIo.h> + +#include <stdio.h> + +void BSP_output_char_f(char c) +{ + putchar( c ); +} + +BSP_output_char_function_type BSP_output_char = BSP_output_char_f; +BSP_polling_getchar_function_type BSP_poll_char = NULL; + diff --git a/schedsim/rtems/rtems_init.c b/schedsim/rtems/rtems_init.c index 4e7ab0d..76fa499 100644 --- a/schedsim/rtems/rtems_init.c +++ b/schedsim/rtems/rtems_init.c @@ -48,9 +48,13 @@ void rtems_initialize_data_structures(void) */ _Workspace_Handler_initialization(); + #if defined(RTEMS_SMP) + _SMP_Handler_initialize(); + #endif + _User_extensions_Handler_initialization(); - // _ISR_Handler_initialization(); + _ISR_Handler_initialization(); /* * Initialize the internal support API and allocator Mutex @@ -79,6 +83,14 @@ void rtems_initialize_data_structures(void) _RTEMS_tasks_Manager_initialization(); _Semaphore_Manager_initialization(); + /* + * Discover and initialize the secondary cores in an SMP system. + */ + #if defined(RTEMS_SMP) + _SMP_Processor_count = + bsp_smp_initialize( rtems_configuration_smp_maximum_processors ); + #endif + _System_state_Set( SYSTEM_STATE_BEFORE_MULTITASKING ); /* diff --git a/schedsim/rtems/sched_cpu/cpu.c b/schedsim/rtems/sched_cpu/cpu.c index 0d2e6f6..be6eec7 100644 --- a/schedsim/rtems/sched_cpu/cpu.c +++ b/schedsim/rtems/sched_cpu/cpu.c @@ -167,3 +167,15 @@ void *_CPU_Thread_Idle_body( uintptr_t ignored ) for( ; ; ) /* insert your "halt" instruction here */ ; } + +#include <stdio.h> +void _SMP_cpu_swap( + uint32_t *a, + uint32_t *value, + uint32_t *prev +) +{ + *prev = *a; + *a = *value; + // printf( "(%d %d) ", *prev, *value ); +} diff --git a/schedsim/rtems/sched_cpu/rtems/score/cpu.h b/schedsim/rtems/sched_cpu/rtems/score/cpu.h index 7e206fd..4d397d8 100644 --- a/schedsim/rtems/sched_cpu/rtems/score/cpu.h +++ b/schedsim/rtems/sched_cpu/rtems/score/cpu.h @@ -1257,6 +1257,23 @@ static inline uint32_t CPU_swap_u32( #define CPU_swap_u16( value ) \ (((value&0xff) << 8) | ((value >> 8)&0xff)) +/* + * SMP Support + */ +void __SMP_cpu_swap( + uint32_t *a, + uint32_t *value, + uint32_t *prev +); +#define SMP_CPU_SWAP( _address, _value, _previous ) \ + do { \ + volatile unsigned int *_a = (volatile unsigned int *)_address; \ + _previous = *(_a); \ + *(_a) = _value; \ + } while (0) + +#define _CPU_Context_switch_to_first_task_smp(_ignored) + #ifdef __cplusplus } #endif diff --git a/schedsim/rtems/sched_cpu/rtems/score/cpuopts.h b/schedsim/rtems/sched_cpu/rtems/score/cpuopts.h deleted file mode 100644 index 1db8d43..0000000 --- a/schedsim/rtems/sched_cpu/rtems/score/cpuopts.h +++ /dev/null @@ -1,72 +0,0 @@ -/** - * @file rtems/score/cpuopts.h - */ - -/* BASED UPON SOURCE IN RTEMS, MODIFIED FOR SIMULATOR */ - -/* target cpu dependent options file */ -/* automatically generated -- DO NOT EDIT!! */ -#ifndef _RTEMS_SCORE_CPUOPTS_H -#define _RTEMS_SCORE_CPUOPTS_H - -/* This is added by hand to indicate we are on the RTEMS Scheduler Simulator */ -#define RTEMS_SCHEDSIM - -/* if RTEMS_DEBUG is enabled */ -/* #undef RTEMS_DEBUG */ - -/* if itron api is supported */ -/* #undef RTEMS_ITRON_API */ - -/* if multiprocessing is enabled */ -/* #undef RTEMS_MULTIPROCESSING */ - -/* if using newlib */ -#define RTEMS_NEWLIB 1 - -/* if posix api is supported */ -/* #undef RTEMS_POSIX_API */ - -/* if networking is enabled */ -#define RTEMS_NETWORKING 1 - -/* if RTEMS uses tar.h */ -#define RTEMS_USES_TAR_H 1 - -/* RTEMS version string */ -#define RTEMS_VERSION "4.10.99.0" - -/* disable nanosecond granularity for statistics */ -/* #undef __RTEMS_USE_TICKS_FOR_STATISTICS__ */ - -/* disable nanosecond granularity for cpu usage statistics */ -/* #undef __RTEMS_USE_TICKS_CPU_USAGE_STATISTICS__ */ - -/* disable nanosecond granularity for period statistics */ -/* #undef __RTEMS_USE_TICKS_RATE_MONOTONIC_STATISTICS__ */ - -/* disable inlining _Thread_Enable_dispatch */ -/* #undef __RTEMS_DO_NOT_INLINE_THREAD_ENABLE_DISPATCH__ */ - -/* disable inlining _Thread_Enable_dispatch */ -/* #undef __RTEMS_DO_NOT_INLINE_CORE_MUTEX_SEIZE__ */ - -/* disable inlining _Thread_queue_Enqueue_priority */ -/* #undef __RTEMS_DO_NOT_UNROLL_THREADQ_ENQUEUE_PRIORITY__ */ - -/* disable strict order mutex */ -/* #undef __RTEMS_STRICT_ORDER_MUTEX__ */ - -/* Define to 1 if ada/gnat bindings are built-in */ -#define __RTEMS_ADA__ 1 - -/* major version portion of an RTEMS release */ -#define __RTEMS_MAJOR__ 4 - -/* minor version portion of an RTEMS release */ -#define __RTEMS_MINOR__ 10 - -/* revision version portion of an RTEMS release */ -#define __RTEMS_REVISION__ 99 - -#endif /* _RTEMS_SCORE_CPUOPTS_H */ |