summaryrefslogtreecommitdiffstats
path: root/cpukit
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2019-04-05 08:03:12 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2019-04-09 08:06:46 +0200
commit03c9f2406127b71ad5abdfd02af1609f8a67f012 (patch)
tree0da26b51a42fdcd2403bc12445ffed8066d27547 /cpukit
parentscore: Add RTEMS_CONST (diff)
downloadrtems-03c9f2406127b71ad5abdfd02af1609f8a67f012.tar.bz2
rtems: Add rtems_scheduler_get_processor()
Add rtems_scheduler_get_processor() as a replacement for rtems_get_current_processor(). The rtems_get_current_processor() is a bit orphaned. Adopt it by the Scheduler Manager. This is in line with the glibc sched_getcpu() function. Deprecate rtems_get_current_processor(). Update #3731.
Diffstat (limited to 'cpukit')
-rw-r--r--cpukit/include/rtems/rtems/smp.h19
-rw-r--r--cpukit/include/rtems/rtems/tasks.h34
-rw-r--r--cpukit/libmisc/capture/capture.c4
-rw-r--r--cpukit/libtest/t-test-rtems-measure.c2
-rw-r--r--cpukit/libtest/testparallel.c2
-rw-r--r--cpukit/rtems/src/getcurrentprocessor.c4
6 files changed, 40 insertions, 25 deletions
diff --git a/cpukit/include/rtems/rtems/smp.h b/cpukit/include/rtems/rtems/smp.h
index 2e0fd67d99..046c306290 100644
--- a/cpukit/include/rtems/rtems/smp.h
+++ b/cpukit/include/rtems/rtems/smp.h
@@ -49,25 +49,6 @@ extern "C" {
*/
uint32_t rtems_get_processor_count(void);
-/**
- * @brief Returns the index of the current processor.
- *
- * On uni-processor configurations a value of zero will be returned.
- *
- * On SMP configurations an architecture specific method is used to obtain the
- * index of the current processor in the system. The set of processor indices
- * is the range of integers starting with zero up to the processor count minus
- * one.
- *
- * Outside of sections with disabled thread dispatching the current processor
- * index may change after every instruction since the thread may migrate from
- * one processor to another. Sections with disabled interrupts are sections
- * with thread dispatching disabled.
- *
- * @return The index of the current processor.
- */
-uint32_t rtems_get_current_processor(void);
-
/** @} */
#ifdef __cplusplus
diff --git a/cpukit/include/rtems/rtems/tasks.h b/cpukit/include/rtems/rtems/tasks.h
index 4a04e71349..630a5c5295 100644
--- a/cpukit/include/rtems/rtems/tasks.h
+++ b/cpukit/include/rtems/rtems/tasks.h
@@ -584,6 +584,40 @@ rtems_status_code rtems_scheduler_ident_by_processor_set(
);
/**
+ * @brief Returns the index of the current processor.
+ *
+ * In uniprocessor configurations, a value of zero will be returned.
+ *
+ * In SMP configurations, an architecture specific method is used to obtain the
+ * index of the current processor in the system. The set of processor indices
+ * is the range of integers starting with zero up to the processor count minus
+ * one.
+ *
+ * Outside of sections with disabled thread dispatching the current processor
+ * index may change after every instruction since the thread may migrate from
+ * one processor to another. Sections with disabled interrupts are sections
+ * with thread dispatching disabled.
+ *
+ * @return The index of the current processor.
+ */
+uint32_t rtems_scheduler_get_processor( void );
+
+/**
+ * @brief Returns the index of the current processor.
+ *
+ * @return The index of the current processor.
+ *
+ * @deprecated
+ *
+ * Use rtems_scheduler_get_processor() instead.
+ */
+RTEMS_DEPRECATED RTEMS_INLINE_ROUTINE uint32_t
+rtems_get_current_processor( void )
+{
+ return rtems_scheduler_get_processor();
+}
+
+/**
* @brief Gets the set of processors owned by the specified scheduler instance.
*
* @param[in] scheduler_id Identifier of the scheduler instance.
diff --git a/cpukit/libmisc/capture/capture.c b/cpukit/libmisc/capture/capture.c
index 4d40b8f630..6accd509e7 100644
--- a/cpukit/libmisc/capture/capture.c
+++ b/cpukit/libmisc/capture/capture.c
@@ -356,7 +356,7 @@ void
rtems_capture_record_lock (rtems_capture_record_lock_context* context)
{
rtems_capture_per_cpu_data* cpu;
- cpu = capture_per_cpu_get (rtems_get_current_processor ());
+ cpu = capture_per_cpu_get (rtems_scheduler_get_processor ());
rtems_interrupt_lock_interrupt_disable (&context->lock_context);
context->lock = &cpu->lock;
rtems_interrupt_lock_acquire_isr (&cpu->lock, &context->lock_context);
@@ -379,7 +379,7 @@ rtems_capture_record_open (rtems_tcb* tcb,
size += sizeof (rtems_capture_record);
- cpu = capture_per_cpu_get (rtems_get_current_processor ());
+ cpu = capture_per_cpu_get (rtems_scheduler_get_processor ());
rtems_capture_record_lock (context);
diff --git a/cpukit/libtest/t-test-rtems-measure.c b/cpukit/libtest/t-test-rtems-measure.c
index 207aef7afa..242855f19f 100644
--- a/cpukit/libtest/t-test-rtems-measure.c
+++ b/cpukit/libtest/t-test-rtems-measure.c
@@ -115,7 +115,7 @@ load_worker(rtems_task_argument arg)
chunk = lctx->chunk;
chunk_size = ctx->chunk_size;
cache_line_size = ctx->cache_line_size;
- token = (unsigned int)rtems_get_current_processor();
+ token = (unsigned int)rtems_scheduler_get_processor();
token = dirty_data_cache(chunk, chunk_size, cache_line_size, token);
wakeup_master(ctx);
diff --git a/cpukit/libtest/testparallel.c b/cpukit/libtest/testparallel.c
index 1182242a7b..ea805a3cf4 100644
--- a/cpukit/libtest/testparallel.c
+++ b/cpukit/libtest/testparallel.c
@@ -74,7 +74,7 @@ static void run_tests(
*/
rtems_interrupt_local_disable(level);
_SMP_barrier_Wait(&ctx->barrier, &bs, ctx->worker_count);
- worker_index = rtems_get_current_processor();
+ worker_index = rtems_scheduler_get_processor();
rtems_interrupt_local_enable(level);
_Assert(worker_index < ctx->worker_count);
diff --git a/cpukit/rtems/src/getcurrentprocessor.c b/cpukit/rtems/src/getcurrentprocessor.c
index 5fc48b9426..10811ade66 100644
--- a/cpukit/rtems/src/getcurrentprocessor.c
+++ b/cpukit/rtems/src/getcurrentprocessor.c
@@ -16,10 +16,10 @@
#include "config.h"
#endif
-#include <rtems/rtems/smp.h>
+#include <rtems/rtems/tasks.h>
#include <rtems/score/smp.h>
-uint32_t rtems_get_current_processor(void)
+uint32_t rtems_scheduler_get_processor(void)
{
return _SMP_Get_current_processor();
}