1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @ingroup ClassicSMP |
---|
5 | * |
---|
6 | * @brief SMP Services 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.org/license/LICENSE. |
---|
16 | */ |
---|
17 | |
---|
18 | #ifndef _RTEMS_RTEMS_SMP_H |
---|
19 | #define _RTEMS_RTEMS_SMP_H |
---|
20 | |
---|
21 | #ifdef __cplusplus |
---|
22 | extern "C" { |
---|
23 | #endif |
---|
24 | |
---|
25 | #include <rtems/score/smp.h> |
---|
26 | |
---|
27 | /** |
---|
28 | * @defgroup ClassicSMP SMP Services |
---|
29 | * |
---|
30 | * @ingroup ClassicRTEMS |
---|
31 | * |
---|
32 | * This encapsulates functionality which is useful for SMP applications. |
---|
33 | * |
---|
34 | * This API is also available on uni-processor configurations. Here compile |
---|
35 | * time constants are used whenever possible. |
---|
36 | * |
---|
37 | * @{ |
---|
38 | */ |
---|
39 | |
---|
40 | /** |
---|
41 | * @brief Returns the count of processors in the system. |
---|
42 | * |
---|
43 | * On uni-processor configurations a value of one will be returned. |
---|
44 | * |
---|
45 | * On SMP configurations this returns the value of a global variable set during |
---|
46 | * system initialization to indicate the count of processors. The processor |
---|
47 | * count depends on the hardware and application configuration. The value will |
---|
48 | * always be less than or equal to the maximum count of application configured |
---|
49 | * processors. |
---|
50 | * |
---|
51 | * @return The count of processors in the system. |
---|
52 | */ |
---|
53 | uint32_t rtems_get_processor_count(void); |
---|
54 | |
---|
55 | /** |
---|
56 | * @brief Returns the index of the current processor. |
---|
57 | * |
---|
58 | * On uni-processor configurations this is a compile time constant and defined |
---|
59 | * to be zero. |
---|
60 | * |
---|
61 | * On SMP configurations an architecture specific method is used to obtain the |
---|
62 | * index of the current processor in the system. The set of processor indices |
---|
63 | * is the range of integers starting with zero up to the processor count minus |
---|
64 | * one. |
---|
65 | * |
---|
66 | * Outside of sections with disabled thread dispatching the current processor |
---|
67 | * index may change after every instruction since the thread may migrate from |
---|
68 | * one processor to another. Sections with disabled interrupts are sections |
---|
69 | * with thread dispatching disabled. |
---|
70 | * |
---|
71 | * @return The index of the current processor. |
---|
72 | */ |
---|
73 | #define rtems_smp_get_current_processor() \ |
---|
74 | _SMP_Get_current_processor() |
---|
75 | |
---|
76 | /** @} */ |
---|
77 | |
---|
78 | #ifdef __cplusplus |
---|
79 | } |
---|
80 | #endif |
---|
81 | |
---|
82 | #endif |
---|
83 | /* end of include file */ |
---|