source: rtems/cpukit/score/include/rtems/bspsmp.h @ a1f9934a

4.115
Last change on this file since a1f9934a was a1f9934a, checked in by Mathew Kallada <matkallada@…>, on 01/04/13 at 15:01:21

score: Doxygen Clean Up Task #3

  • Property mode set to 100644
File size: 5.2 KB
Line 
1/**
2 *  @file  rtems/bspsmp.h
3 *
4 *  @brief Interface Between RTEMS and an SMP Aware BSP
5 *
6 *  This include file defines the interface between RTEMS and an
7 *  SMP aware BSP.  These methods will only be used when RTEMS
8 *  is configured with SMP support enabled.
9 */
10
11/*
12 *  COPYRIGHT (c) 1989-2011.
13 *  On-Line Applications Research Corporation (OAR).
14 *
15 *  The license and distribution terms for this file may be
16 *  found in the file LICENSE in this distribution or at
17 *  http://www.rtems.com/license/LICENSE.
18 */
19
20#ifndef _RTEMS_BSPSMP_H
21#define _RTEMS_BSPSMP_H
22
23#if defined (RTEMS_SMP)
24#include <rtems/score/percpu.h>
25
26/**
27 *  @defgroup RTEMS BSP SMP Interface
28 *
29 *  @ingroup Score
30 *
31 *  This defines the interface between RTEMS and the BSP for
32 *  SMP support.  The interface uses the term primary
33 *  to refer to the "boot" processor and secondary to refer
34 *  to the "application" processors.  Different architectures
35 *  use different terminology.
36 *
37 *  It is assumed that when the processor is reset and thus
38 *  when RTEMS is initialized, that the primary processor is
39 *  the only one executing.  The others are assumed to be in
40 *  a quiescent or reset state awaiting a command to come online.
41 */
42
43/**@{*/
44
45#ifdef __cplusplus
46extern "C" {
47#endif
48
49
50#ifndef ASM
51/**
52 *  @brief Maximum number of CPUs in SMP system.
53 *
54 *  This variable is set during the SMP initialization sequence to
55 *  indicate the Maximum number of CPUs in this system.
56 */
57extern uint32_t rtems_configuration_smp_maximum_processors;
58
59/**
60 *  @brief Initialize secondary CPUs.
61 *
62 *  This method is invoked by RTEMS during initialization to bring the
63 *  secondary CPUs out of reset.
64 *
65 *  @param [in] maximum is the maximum number of CPU cores that RTEMS
66 *              can handle
67 *
68 *  @retval This method returns the number of cores available in the
69 *          system.
70 */
71int bsp_smp_initialize(
72  int maximum
73);
74
75/**
76 *  @brief Obtain current CPU index.
77 *
78 *  This method is invoked by RTEMS when it needs to know the index
79 *  of the CPU it is executing on.
80 *
81 *  @retval This method returns the current CPU index.
82 */
83int bsp_smp_processor_id(void) RTEMS_COMPILER_PURE_ATTRIBUTE;
84
85/**
86 *  @brief Make request of another CPU.
87 *
88 *  This method is invoked by RTEMS when it needs to make a request
89 *  of another CPU.  It should be implemented using some type of
90 *  interprocessor interrupt.
91 *
92 *  @param [in] cpu is the target CPU for this request.
93 *  @param [in] message is message to send
94 */
95void rtems_smp_send_message(
96  int       cpu,
97  uint32_t  message
98);
99
100/**
101 *  @brief Generate an interprocessor broadcast interrupt.
102 *
103 *  This method is invoked when RTEMS wants to let all of the other
104 *  CPUs know that it has sent them message.  CPUs not including
105 *  the originating CPU should receive the interrupt.
106
107 *
108 *  @note On CPUs without the capability to generate a broadcast
109 *        to all other CPUs interrupt, this can be implemented by
110 *        a loop of sending interrupts to specific CPUs.
111 */
112void bsp_smp_broadcast_interrupt(void);
113
114/**
115 *  @brief Generate a interprocessor interrupt.
116 *
117 *  This method is invoked by RTEMS to let @a cpu know that it
118 *  has sent it a message.
119 *
120 *  @param [in] cpu is the recipient CPU
121 */
122void bsp_smp_interrupt_cpu(
123  int cpu
124);
125
126/**
127 *  @brief Obtain CPU core number.
128 *
129 *  This method is invoked by RTEMS when it needs to know which core
130 *  number it is executing on.  This is used when it needs to perform
131 *  some action or bookkeeping and needs to distinguish itself from
132 *  the other cores.  For example, it may need to realize it needs to
133 *  preempt a thread on another node.
134 *
135 *  @retval This method returns the Id of the current CPU core.
136 */
137int   bsp_smp_processor_id( void );
138
139/**
140 *  This method is invoked by @ref rtems_smp_secondary_cpu_initialize
141 *  to allow the BSP to perform some intialization.  The @a cpu
142 *  parameter indicates the secondary CPU that the code is executing on
143 *  and is currently being initialized.
144 *
145 *  @note This is called by @ref rtems_smp_secondary_cpu_initialize.
146 */
147void bsp_smp_secondary_cpu_initialize(int cpu);
148
149/**
150 *  @brief Initialize secondary CPU and coordinates.
151 *
152 *  This method is the C entry point which secondary CPUs should
153 *  arrange to call.  It performs OS initialization for the secondary
154 *  CPU and coordinates bring it to a useful state.
155 *
156 *  @note This is provided by RTEMS.
157 */
158void rtems_smp_secondary_cpu_initialize(void);
159
160/**
161 *  This method is invoked by the BSP to initialize the per CPU structure
162 *  for the specified @a cpu while it is bringing the secondary CPUs
163 *  out of their reset state and into a useful state.
164 *
165 *  @param [in] cpu indicates the CPU whose per cpu structure is to
166 *              be initialized.
167 */
168void rtems_smp_initialize_per_cpu(int cpu);
169
170/**
171 *  @brief Process the incoming interprocessor request.
172 *
173 *  This is the method called by the BSP's interrupt handler
174 *  to process the incoming interprocessor request.
175 */
176void rtems_smp_process_interrupt(void);
177
178void bsp_smp_wait_for(
179  volatile unsigned int *address,
180  unsigned int           desired,
181  int                    maximum_usecs
182);
183
184#endif
185
186#ifdef __cplusplus
187}
188#endif
189
190#else
191  #define bsp_smp_processor_id()  0
192#endif
193
194/**@}*/
195#endif
196
197/* end of include file */
Note: See TracBrowser for help on using the repository browser.