1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @ingroup ScoreSMPImpl |
---|
5 | * |
---|
6 | * @brief SuperCore SMP Implementation |
---|
7 | */ |
---|
8 | |
---|
9 | /* |
---|
10 | * COPYRIGHT (c) 1989-2011. |
---|
11 | * On-Line Applications Research Corporation (OAR). |
---|
12 | * |
---|
13 | * The license and distribution terms for this file may be |
---|
14 | * found in the file LICENSE in this distribution or at |
---|
15 | * http://www.rtems.com/license/LICENSE. |
---|
16 | */ |
---|
17 | |
---|
18 | #ifndef _RTEMS_SCORE_SMPIMPL_H |
---|
19 | #define _RTEMS_SCORE_SMPIMPL_H |
---|
20 | |
---|
21 | #include <rtems/score/smp.h> |
---|
22 | |
---|
23 | #ifdef __cplusplus |
---|
24 | extern "C" { |
---|
25 | #endif |
---|
26 | |
---|
27 | /** |
---|
28 | * @defgroup ScoreSMP SMP Support |
---|
29 | * |
---|
30 | * @ingroup Score |
---|
31 | * |
---|
32 | * This defines the interface of the SuperCore SMP support. |
---|
33 | * |
---|
34 | * @{ |
---|
35 | */ |
---|
36 | |
---|
37 | /** |
---|
38 | * @brief SMP message to request a processor shutdown. |
---|
39 | * |
---|
40 | * @see _SMP_Send_message(). |
---|
41 | */ |
---|
42 | #define SMP_MESSAGE_SHUTDOWN UINT32_C(0x1) |
---|
43 | |
---|
44 | /** |
---|
45 | * @brief SMP fatal codes. |
---|
46 | */ |
---|
47 | typedef enum { |
---|
48 | SMP_FATAL_SHUTDOWN |
---|
49 | } SMP_Fatal_code; |
---|
50 | |
---|
51 | /** |
---|
52 | * @brief Initialize SMP Handler |
---|
53 | * |
---|
54 | * This method initialize the SMP Handler. |
---|
55 | */ |
---|
56 | #if defined( RTEMS_SMP ) |
---|
57 | void _SMP_Handler_initialize( void ); |
---|
58 | #else |
---|
59 | #define _SMP_Handler_initialize() \ |
---|
60 | do { } while ( 0 ) |
---|
61 | #endif |
---|
62 | |
---|
63 | #if defined( RTEMS_SMP ) |
---|
64 | |
---|
65 | /** |
---|
66 | * @brief Performs high-level initialization of a secondary processor and runs |
---|
67 | * the application threads. |
---|
68 | * |
---|
69 | * The low-level initialization code must call this function to hand over the |
---|
70 | * control of this processor to RTEMS. Interrupts must be disabled. It must |
---|
71 | * be possible to send inter-processor interrupts to this processor. Since |
---|
72 | * interrupts are disabled the inter-processor interrupt delivery is postponed |
---|
73 | * until interrupts are enabled the first time. Interrupts are enabled during |
---|
74 | * the execution begin of threads in case they have interrupt level zero (this |
---|
75 | * is the default). |
---|
76 | * |
---|
77 | * The pre-requisites for the call to this function are |
---|
78 | * - disabled interrupts, |
---|
79 | * - delivery of inter-processor interrupts is possible, |
---|
80 | * - a valid stack pointer and enough stack space, |
---|
81 | * - a valid code memory, and |
---|
82 | * - a valid BSS section. |
---|
83 | * |
---|
84 | * This function must not be called by the main processor. The main processor |
---|
85 | * uses _Thread_Start_multitasking() instead. |
---|
86 | * |
---|
87 | * This function does not return to the caller. |
---|
88 | */ |
---|
89 | void _SMP_Start_multitasking_on_secondary_processor( void ) |
---|
90 | RTEMS_COMPILER_NO_RETURN_ATTRIBUTE; |
---|
91 | |
---|
92 | /** |
---|
93 | * @brief Interrupt handler for inter-processor interrupts. |
---|
94 | */ |
---|
95 | void _SMP_Inter_processor_interrupt_handler( void ); |
---|
96 | |
---|
97 | /** |
---|
98 | * @brief Sends a SMP message to a processor. |
---|
99 | * |
---|
100 | * The target processor may be the sending processor. |
---|
101 | * |
---|
102 | * @param[in] cpu The target processor of the message. |
---|
103 | * @param[in] message The message. |
---|
104 | */ |
---|
105 | void _SMP_Send_message( uint32_t cpu, uint32_t message ); |
---|
106 | |
---|
107 | /** |
---|
108 | * @brief Request of others CPUs. |
---|
109 | * |
---|
110 | * This method is invoked by RTEMS when it needs to make a request |
---|
111 | * of the other CPUs. It should be implemented using some type of |
---|
112 | * interprocessor interrupt. CPUs not including the originating |
---|
113 | * CPU should receive the message. |
---|
114 | * |
---|
115 | * @param [in] message is message to send |
---|
116 | */ |
---|
117 | void _SMP_Broadcast_message( |
---|
118 | uint32_t message |
---|
119 | ); |
---|
120 | |
---|
121 | #endif /* defined( RTEMS_SMP ) */ |
---|
122 | |
---|
123 | /** |
---|
124 | * @brief Request other cores to perform first context switch. |
---|
125 | * |
---|
126 | * Send message to other cores requesting them to perform |
---|
127 | * their first context switch operation. |
---|
128 | */ |
---|
129 | #if defined( RTEMS_SMP ) |
---|
130 | void _SMP_Request_other_cores_to_perform_first_context_switch( void ); |
---|
131 | #else |
---|
132 | #define _SMP_Request_other_cores_to_perform_first_context_switch() \ |
---|
133 | do { } while ( 0 ) |
---|
134 | #endif |
---|
135 | |
---|
136 | /** |
---|
137 | * @brief Request other cores to shutdown. |
---|
138 | * |
---|
139 | * Send message to other cores requesting them to shutdown. |
---|
140 | */ |
---|
141 | #if defined( RTEMS_SMP ) |
---|
142 | void _SMP_Request_other_cores_to_shutdown( void ); |
---|
143 | #else |
---|
144 | #define _SMP_Request_other_cores_to_shutdown() \ |
---|
145 | do { } while ( 0 ) |
---|
146 | #endif |
---|
147 | |
---|
148 | /** @} */ |
---|
149 | |
---|
150 | #ifdef __cplusplus |
---|
151 | } |
---|
152 | #endif |
---|
153 | |
---|
154 | #endif |
---|
155 | /* end of include file */ |
---|