diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-05-02 15:33:23 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-05-05 08:26:27 +0200 |
commit | 145becf0759d39d7779760af8f1e11d623997938 (patch) | |
tree | 104e027282b896e3cf1a35bfcaecd0a6bf25505c /cpukit | |
parent | score: SMP_FATAL_SCHEDULER_WITHOUT_PROCESSORS (diff) | |
download | rtems-145becf0759d39d7779760af8f1e11d623997938.tar.bz2 |
score: Add SMP test message handler
This handler can be used to test the inter-processor interrupt
implementation.
Diffstat (limited to 'cpukit')
-rw-r--r-- | cpukit/score/include/rtems/score/smpimpl.h | 28 | ||||
-rw-r--r-- | cpukit/score/src/smp.c | 8 |
2 files changed, 36 insertions, 0 deletions
diff --git a/cpukit/score/include/rtems/score/smpimpl.h b/cpukit/score/include/rtems/score/smpimpl.h index 27cf188131..1868546996 100644 --- a/cpukit/score/include/rtems/score/smpimpl.h +++ b/cpukit/score/include/rtems/score/smpimpl.h @@ -44,6 +44,13 @@ extern "C" { #define SMP_MESSAGE_SHUTDOWN UINT32_C(0x1) /** + * @brief SMP message to request a test handler invocation. + * + * @see _SMP_Send_message(). + */ +#define SMP_MESSAGE_TEST UINT32_C(0x2) + +/** * @brief SMP fatal codes. */ typedef enum { @@ -101,6 +108,23 @@ static inline void _SMP_Fatal( SMP_Fatal_code code ) void _SMP_Start_multitasking_on_secondary_processor( void ) RTEMS_COMPILER_NO_RETURN_ATTRIBUTE; +typedef void ( *SMP_Test_message_handler )( Per_CPU_Control *cpu_self ); + +extern SMP_Test_message_handler _SMP_Test_message_handler; + +/** + * @brief Sets the handler for test messages. + * + * This handler can be used to test the inter-processor interrupt + * implementation. + */ +static inline void _SMP_Set_test_message_handler( + SMP_Test_message_handler handler +) +{ + _SMP_Test_message_handler = handler; +} + /** * @brief Interrupt handler for inter-processor interrupts. */ @@ -121,6 +145,10 @@ static inline void _SMP_Inter_processor_interrupt_handler( void ) rtems_fatal( RTEMS_FATAL_SOURCE_SMP, SMP_FATAL_SHUTDOWN ); /* does not continue past here */ } + + if ( ( message & SMP_MESSAGE_TEST ) != 0 ) { + ( *_SMP_Test_message_handler )( cpu_self ); + } } } diff --git a/cpukit/score/src/smp.c b/cpukit/score/src/smp.c index 34db46ad1e..3094fe31f8 100644 --- a/cpukit/score/src/smp.c +++ b/cpukit/score/src/smp.c @@ -166,3 +166,11 @@ void _SMP_Broadcast_message( uint32_t message ) } } } + +static void _SMP_Test_message_default_handler( Per_CPU_Control *cpu_self ) +{ + (void) cpu_self; +} + +SMP_Test_message_handler _SMP_Test_message_handler = + _SMP_Test_message_default_handler; |