summaryrefslogtreecommitdiffstats
path: root/cpukit/include/rtems/score/percpu.h
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2021-07-27 11:08:54 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2021-07-28 19:07:37 +0200
commit4adaed7328e39eac4fe1879cba61919e74965cc8 (patch)
tree6289a5896a12a38381921063622daaa1196d40de /cpukit/include/rtems/score/percpu.h
parentlibcsupport: Consistent rtems_putc() output (diff)
downloadrtems-4adaed7328e39eac4fe1879cba61919e74965cc8.tar.bz2
score: Remove processor event broadcast/receive
Remove _CPU_SMP_Processor_event_broadcast() and _CPU_SMP_Processor_event_receive(). These functions are hard to use since they are subject to the lost wake up problem.
Diffstat (limited to 'cpukit/include/rtems/score/percpu.h')
-rw-r--r--cpukit/include/rtems/score/percpu.h35
1 files changed, 34 insertions, 1 deletions
diff --git a/cpukit/include/rtems/score/percpu.h b/cpukit/include/rtems/score/percpu.h
index 3242383b9d..e79596c244 100644
--- a/cpukit/include/rtems/score/percpu.h
+++ b/cpukit/include/rtems/score/percpu.h
@@ -553,7 +553,7 @@ typedef struct Per_CPU_Control {
*
* @see _Per_CPU_State_change().
*/
- Per_CPU_State state;
+ Atomic_Uint state;
/**
* @brief FIFO list of jobs to be performed by this processor.
@@ -775,6 +775,39 @@ RTEMS_INLINE_ROUTINE void _Per_CPU_Release_all(
#if defined( RTEMS_SMP )
+/**
+ * @brief Gets the current processor state.
+ *
+ * @param cpu is the processor control.
+ *
+ * @return Returns the current state of the processor.
+ */
+static inline Per_CPU_State _Per_CPU_Get_state( const Per_CPU_Control *cpu )
+{
+ return (Per_CPU_State)
+ _Atomic_Load_uint( &cpu->state, ATOMIC_ORDER_ACQUIRE );
+}
+
+/**
+ * @brief Sets the processor state of the current processor.
+ *
+ * @param cpu_self is the processor control of the processor executing this
+ * function.
+ *
+ * @param state is the new processor state.
+ */
+static inline void _Per_CPU_Set_state(
+ Per_CPU_Control *cpu_self,
+ Per_CPU_State state
+)
+{
+ _Atomic_Store_uint(
+ &cpu_self->state,
+ (unsigned int) state,
+ ATOMIC_ORDER_RELEASE
+ );
+}
+
void _Per_CPU_State_change(
Per_CPU_Control *cpu,
Per_CPU_State new_state