forked from Imagelibrary/rtems
rtems: rtems_scheduler_get_processor_maximum()
In uniprocessor configurations, use compile-time constants for rtems_scheduler_get_processor_maximum() and rtems_scheduler_get_processor(). This helps compilers and static analyzers to deduce that some loop bodies are only executed once and some conditional statements have a fixed outcome (may improve code generation and reduce false positives). In SMP configurations, directly provide the internal implementation for performance reasons.
This commit is contained in:
@@ -700,8 +700,6 @@ librtemscpu_a_SOURCES += rtems/src/eventseize.c
|
|||||||
librtemscpu_a_SOURCES += rtems/src/eventsend.c
|
librtemscpu_a_SOURCES += rtems/src/eventsend.c
|
||||||
librtemscpu_a_SOURCES += rtems/src/eventsurrender.c
|
librtemscpu_a_SOURCES += rtems/src/eventsurrender.c
|
||||||
librtemscpu_a_SOURCES += rtems/src/getapiconfig.c
|
librtemscpu_a_SOURCES += rtems/src/getapiconfig.c
|
||||||
librtemscpu_a_SOURCES += rtems/src/getcurrentprocessor.c
|
|
||||||
librtemscpu_a_SOURCES += rtems/src/getprocessorcount.c
|
|
||||||
librtemscpu_a_SOURCES += rtems/src/intrbody.c
|
librtemscpu_a_SOURCES += rtems/src/intrbody.c
|
||||||
librtemscpu_a_SOURCES += rtems/src/intrcatch.c
|
librtemscpu_a_SOURCES += rtems/src/intrcatch.c
|
||||||
librtemscpu_a_SOURCES += rtems/src/modes.c
|
librtemscpu_a_SOURCES += rtems/src/modes.c
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
#include <rtems/rtems/attr.h>
|
#include <rtems/rtems/attr.h>
|
||||||
#include <rtems/rtems/status.h>
|
#include <rtems/rtems/status.h>
|
||||||
#include <rtems/rtems/types.h>
|
#include <rtems/rtems/types.h>
|
||||||
|
#include <rtems/score/smp.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@@ -600,7 +601,7 @@ rtems_status_code rtems_scheduler_ident_by_processor_set(
|
|||||||
*
|
*
|
||||||
* @return The index of the current processor.
|
* @return The index of the current processor.
|
||||||
*/
|
*/
|
||||||
uint32_t rtems_scheduler_get_processor( void );
|
#define rtems_scheduler_get_processor() _SMP_Get_current_processor()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns the index of the current processor.
|
* @brief Returns the index of the current processor.
|
||||||
@@ -633,7 +634,7 @@ rtems_get_current_processor( void )
|
|||||||
*
|
*
|
||||||
* @see rtems_scheduler_add_processor() and rtems_scheduler_remove_processor().
|
* @see rtems_scheduler_add_processor() and rtems_scheduler_remove_processor().
|
||||||
*/
|
*/
|
||||||
RTEMS_CONST uint32_t rtems_scheduler_get_processor_maximum( void );
|
#define rtems_scheduler_get_processor_maximum() _SMP_Get_processor_maximum()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns the processor maximum supported by the system.
|
* @brief Returns the processor maximum supported by the system.
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2014 embedded brains GmbH. All rights reserved.
|
|
||||||
*
|
|
||||||
* embedded brains GmbH
|
|
||||||
* Dornierstr. 4
|
|
||||||
* 82178 Puchheim
|
|
||||||
* Germany
|
|
||||||
* <rtems@embedded-brains.de>
|
|
||||||
*
|
|
||||||
* The license and distribution terms for this file may be
|
|
||||||
* found in the file LICENSE in this distribution or at
|
|
||||||
* http://www.rtems.org/license/LICENSE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if HAVE_CONFIG_H
|
|
||||||
#include "config.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <rtems/rtems/tasks.h>
|
|
||||||
#include <rtems/score/smp.h>
|
|
||||||
|
|
||||||
uint32_t rtems_scheduler_get_processor(void)
|
|
||||||
{
|
|
||||||
return _SMP_Get_current_processor();
|
|
||||||
}
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2014 embedded brains GmbH. All rights reserved.
|
|
||||||
*
|
|
||||||
* embedded brains GmbH
|
|
||||||
* Dornierstr. 4
|
|
||||||
* 82178 Puchheim
|
|
||||||
* Germany
|
|
||||||
* <rtems@embedded-brains.de>
|
|
||||||
*
|
|
||||||
* The license and distribution terms for this file may be
|
|
||||||
* found in the file LICENSE in this distribution or at
|
|
||||||
* http://www.rtems.org/license/LICENSE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if HAVE_CONFIG_H
|
|
||||||
#include "config.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <rtems/rtems/tasks.h>
|
|
||||||
#include <rtems/score/smp.h>
|
|
||||||
|
|
||||||
uint32_t rtems_scheduler_get_processor_maximum(void)
|
|
||||||
{
|
|
||||||
return _SMP_Get_processor_maximum();
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user