1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @ingroup ScoreSMP |
---|
5 | * |
---|
6 | * @brief SuperCore SMP Support API |
---|
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_SMP_H |
---|
19 | #define _RTEMS_SCORE_SMP_H |
---|
20 | |
---|
21 | #include <rtems/score/cpu.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 | #if defined( RTEMS_SMP ) |
---|
52 | SCORE_EXTERN uint32_t _SMP_Processor_count; |
---|
53 | |
---|
54 | static inline uint32_t _SMP_Get_processor_count( void ) |
---|
55 | { |
---|
56 | return _SMP_Processor_count; |
---|
57 | } |
---|
58 | #else |
---|
59 | #define _SMP_Get_processor_count() UINT32_C(1) |
---|
60 | #endif |
---|
61 | |
---|
62 | #if defined( RTEMS_SMP ) |
---|
63 | |
---|
64 | /** |
---|
65 | * @brief Sends a SMP message to a processor. |
---|
66 | * |
---|
67 | * The target processor may be the sending processor. |
---|
68 | * |
---|
69 | * @param[in] cpu The target processor of the message. |
---|
70 | * @param[in] message The message. |
---|
71 | */ |
---|
72 | void _SMP_Send_message( uint32_t cpu, uint32_t message ); |
---|
73 | |
---|
74 | /** |
---|
75 | * @brief Request of others CPUs. |
---|
76 | * |
---|
77 | * This method is invoked by RTEMS when it needs to make a request |
---|
78 | * of the other CPUs. It should be implemented using some type of |
---|
79 | * interprocessor interrupt. CPUs not including the originating |
---|
80 | * CPU should receive the message. |
---|
81 | * |
---|
82 | * @param [in] message is message to send |
---|
83 | */ |
---|
84 | void _SMP_Broadcast_message( |
---|
85 | uint32_t message |
---|
86 | ); |
---|
87 | |
---|
88 | /** |
---|
89 | * @brief Request other cores to perform first context switch. |
---|
90 | * |
---|
91 | * Send message to other cores requesting them to perform |
---|
92 | * their first context switch operation. |
---|
93 | */ |
---|
94 | void _SMP_Request_other_cores_to_perform_first_context_switch(void); |
---|
95 | |
---|
96 | #endif /* defined( RTEMS_SMP ) */ |
---|
97 | |
---|
98 | /** |
---|
99 | * @brief Request other cores to shutdown. |
---|
100 | * |
---|
101 | * Send message to other cores requesting them to shutdown. |
---|
102 | */ |
---|
103 | #if defined( RTEMS_SMP ) |
---|
104 | void _SMP_Request_other_cores_to_shutdown( void ); |
---|
105 | #else |
---|
106 | #define _SMP_Request_other_cores_to_shutdown() \ |
---|
107 | do { } while ( 0 ) |
---|
108 | #endif |
---|
109 | |
---|
110 | /** @} */ |
---|
111 | |
---|
112 | #if defined( RTEMS_SMP ) |
---|
113 | RTEMS_COMPILER_PURE_ATTRIBUTE static inline uint32_t |
---|
114 | _SMP_Get_current_processor( void ) |
---|
115 | { |
---|
116 | return _CPU_SMP_Get_current_processor(); |
---|
117 | } |
---|
118 | #else |
---|
119 | #define _SMP_Get_current_processor() UINT32_C(0) |
---|
120 | #endif |
---|
121 | |
---|
122 | #ifdef __cplusplus |
---|
123 | } |
---|
124 | #endif |
---|
125 | |
---|
126 | #endif |
---|
127 | /* end of include file */ |
---|