mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-09-28 05:52:46 +08:00
score: Move thread dispatch content to new file
Move thread dispatch declarations and inline functions to new header <rtems/score/threaddispatch.h> to make it independent of the Thread_Control structure. This avoids a cyclic dependency in case thread dispatch functions are used for the object implementation.
This commit is contained in:
@@ -44,6 +44,7 @@ include_rtems_score_HEADERS += include/rtems/score/stack.h
|
|||||||
include_rtems_score_HEADERS += include/rtems/score/states.h
|
include_rtems_score_HEADERS += include/rtems/score/states.h
|
||||||
include_rtems_score_HEADERS += include/rtems/score/sysstate.h
|
include_rtems_score_HEADERS += include/rtems/score/sysstate.h
|
||||||
include_rtems_score_HEADERS += include/rtems/score/thread.h
|
include_rtems_score_HEADERS += include/rtems/score/thread.h
|
||||||
|
include_rtems_score_HEADERS += include/rtems/score/threaddispatch.h
|
||||||
include_rtems_score_HEADERS += include/rtems/score/threadq.h
|
include_rtems_score_HEADERS += include/rtems/score/threadq.h
|
||||||
include_rtems_score_HEADERS += include/rtems/score/threadsync.h
|
include_rtems_score_HEADERS += include/rtems/score/threadsync.h
|
||||||
include_rtems_score_HEADERS += include/rtems/score/timespec.h
|
include_rtems_score_HEADERS += include/rtems/score/timespec.h
|
||||||
|
|||||||
@@ -50,18 +50,6 @@
|
|||||||
#define RTEMS_SCORE_THREAD_ENABLE_USER_PROVIDED_STACK_VIA_API
|
#define RTEMS_SCORE_THREAD_ENABLE_USER_PROVIDED_STACK_VIA_API
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(RTEMS_SMP) || \
|
|
||||||
defined(RTEMS_HEAVY_STACK_DEBUG) || \
|
|
||||||
defined(RTEMS_HEAVY_MALLOC_DEBUG)
|
|
||||||
#define __THREAD_DO_NOT_INLINE_DISABLE_DISPATCH__
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(RTEMS_SMP) || \
|
|
||||||
(CPU_INLINE_ENABLE_DISPATCH == FALSE) || \
|
|
||||||
(__RTEMS_DO_NOT_INLINE_THREAD_ENABLE_DISPATCH__ == 1)
|
|
||||||
#define __THREAD_DO_NOT_INLINE_ENABLE_DISPATCH__
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Deferred floating point context switches are not currently
|
* Deferred floating point context switches are not currently
|
||||||
* supported when in SMP configuration.
|
* supported when in SMP configuration.
|
||||||
@@ -462,28 +450,6 @@ SCORE_EXTERN Objects_Information _Thread_Internal_information;
|
|||||||
*/
|
*/
|
||||||
SCORE_EXTERN Context_Control _Thread_BSP_context;
|
SCORE_EXTERN Context_Control _Thread_BSP_context;
|
||||||
|
|
||||||
/**
|
|
||||||
* The following declares the dispatch critical section nesting
|
|
||||||
* counter which is used to prevent context switches at inopportune
|
|
||||||
* moments.
|
|
||||||
*/
|
|
||||||
SCORE_EXTERN volatile uint32_t _Thread_Dispatch_disable_level;
|
|
||||||
|
|
||||||
#if defined(RTEMS_SMP)
|
|
||||||
typedef struct {
|
|
||||||
SMP_lock_Control lock;
|
|
||||||
int owner_cpu;
|
|
||||||
int nest_level;
|
|
||||||
} Thread_Dispatch_disable_level_lock_control;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The following declares the smp spinlock to be used to control
|
|
||||||
* the dispatch critical section accesses across cpus.
|
|
||||||
*/
|
|
||||||
SCORE_EXTERN Thread_Dispatch_disable_level_lock_control
|
|
||||||
_Thread_Dispatch_disable_level_lock;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The following holds how many user extensions are in the system. This
|
* The following holds how many user extensions are in the system. This
|
||||||
* is used to determine how many user extension data areas to allocate
|
* is used to determine how many user extension data areas to allocate
|
||||||
@@ -541,26 +507,6 @@ void _Thread_Create_idle(void);
|
|||||||
*/
|
*/
|
||||||
void _Thread_Start_multitasking( void );
|
void _Thread_Start_multitasking( void );
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Dispatch thread.
|
|
||||||
*
|
|
||||||
* This routine is responsible for transferring control of the
|
|
||||||
* processor from the executing thread to the heir thread. Once the
|
|
||||||
* heir is running an attempt is made to dispatch any ASRs.
|
|
||||||
* As part of this process, it is responsible for the following actions:
|
|
||||||
* + saving the context of the executing thread
|
|
||||||
* + restoring the context of the heir thread
|
|
||||||
* + dispatching any signals for the resulting executing thread
|
|
||||||
|
|
||||||
* ALTERNATE ENTRY POINTS:
|
|
||||||
* void _Thread_Enable_dispatch();
|
|
||||||
*
|
|
||||||
* - INTERRUPT LATENCY:
|
|
||||||
* + dispatch thread
|
|
||||||
* + no dispatch thread
|
|
||||||
*/
|
|
||||||
void _Thread_Dispatch( void );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Allocate the requested stack space for the thread.
|
* @brief Allocate the requested stack space for the thread.
|
||||||
*
|
*
|
||||||
@@ -903,57 +849,6 @@ void _Thread_blocking_operation_Cancel(
|
|||||||
Thread_Control *the_thread,
|
Thread_Control *the_thread,
|
||||||
ISR_Level level
|
ISR_Level level
|
||||||
);
|
);
|
||||||
#if defined(RTEMS_SMP)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Initializes the thread dispatching subsystem.
|
|
||||||
*
|
|
||||||
* This routine initializes the thread dispatching subsystem.
|
|
||||||
*/
|
|
||||||
void _Thread_Dispatch_initialization(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Checks if thread dispatch says that we are in a critical section.
|
|
||||||
*
|
|
||||||
* This routine returns true if thread dispatch indicates
|
|
||||||
* that we are in a critical section.
|
|
||||||
*/
|
|
||||||
bool _Thread_Dispatch_in_critical_section(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Returns value of the the thread dispatch level.
|
|
||||||
*
|
|
||||||
* This routine returns value of the the thread dispatch level.
|
|
||||||
*/
|
|
||||||
uint32_t _Thread_Dispatch_get_disable_level(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Sets thread dispatch level to the value passed in.
|
|
||||||
*
|
|
||||||
* This routine sets thread dispatch level to the
|
|
||||||
* value passed in.
|
|
||||||
*/
|
|
||||||
uint32_t _Thread_Dispatch_set_disable_level(uint32_t value);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Increments the thread dispatch level.
|
|
||||||
*
|
|
||||||
* This rountine increments the thread dispatch level
|
|
||||||
*/
|
|
||||||
uint32_t _Thread_Dispatch_increment_disable_level(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Decrements the thread dispatch level.
|
|
||||||
*
|
|
||||||
* This routine decrements the thread dispatch level.
|
|
||||||
*/
|
|
||||||
uint32_t _Thread_Dispatch_decrement_disable_level(void);
|
|
||||||
|
|
||||||
#else
|
|
||||||
/*
|
|
||||||
* The _Thread_Dispatch_... functions are in thread.inl
|
|
||||||
*/
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __RTEMS_APPLICATION__
|
#ifndef __RTEMS_APPLICATION__
|
||||||
#include <rtems/score/thread.inl>
|
#include <rtems/score/thread.inl>
|
||||||
|
|||||||
@@ -0,0 +1,264 @@
|
|||||||
|
/**
|
||||||
|
* @brief Constants and Structures Related with Thread Dispatch
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* COPYRIGHT (c) 1989-2009.
|
||||||
|
* On-Line Applications Research Corporation (OAR).
|
||||||
|
*
|
||||||
|
* The license and distribution terms for this file may be
|
||||||
|
* found in the file LICENSE in this distribution or at
|
||||||
|
* http://www.rtems.com/license/LICENSE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _RTEMS_SCORE_THREADDISPATCH_H
|
||||||
|
#define _RTEMS_SCORE_THREADDISPATCH_H
|
||||||
|
|
||||||
|
#include <rtems/score/cpu.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
#if defined(RTEMS_SMP) || \
|
||||||
|
defined(RTEMS_HEAVY_STACK_DEBUG) || \
|
||||||
|
defined(RTEMS_HEAVY_MALLOC_DEBUG)
|
||||||
|
#define __THREAD_DO_NOT_INLINE_DISABLE_DISPATCH__
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(RTEMS_SMP) || \
|
||||||
|
(CPU_INLINE_ENABLE_DISPATCH == FALSE) || \
|
||||||
|
(__RTEMS_DO_NOT_INLINE_THREAD_ENABLE_DISPATCH__ == 1)
|
||||||
|
#define __THREAD_DO_NOT_INLINE_ENABLE_DISPATCH__
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @addtogroup ScoreThread
|
||||||
|
*
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The following declares the dispatch critical section nesting
|
||||||
|
* counter which is used to prevent context switches at inopportune
|
||||||
|
* moments.
|
||||||
|
*/
|
||||||
|
SCORE_EXTERN volatile uint32_t _Thread_Dispatch_disable_level;
|
||||||
|
|
||||||
|
#if defined(RTEMS_SMP)
|
||||||
|
typedef struct {
|
||||||
|
SMP_lock_Control lock;
|
||||||
|
int owner_cpu;
|
||||||
|
int nest_level;
|
||||||
|
} Thread_Dispatch_disable_level_lock_control;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The following declares the smp spinlock to be used to control
|
||||||
|
* the dispatch critical section accesses across cpus.
|
||||||
|
*/
|
||||||
|
SCORE_EXTERN Thread_Dispatch_disable_level_lock_control
|
||||||
|
_Thread_Dispatch_disable_level_lock;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Initializes the thread dispatching subsystem.
|
||||||
|
*
|
||||||
|
* This routine initializes the thread dispatching subsystem.
|
||||||
|
*/
|
||||||
|
void _Thread_Dispatch_initialization(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Checks if thread dispatch says that we are in a critical section.
|
||||||
|
*
|
||||||
|
* This routine returns true if thread dispatch indicates
|
||||||
|
* that we are in a critical section.
|
||||||
|
*/
|
||||||
|
bool _Thread_Dispatch_in_critical_section(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns value of the the thread dispatch level.
|
||||||
|
*
|
||||||
|
* This routine returns value of the the thread dispatch level.
|
||||||
|
*/
|
||||||
|
uint32_t _Thread_Dispatch_get_disable_level(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Sets thread dispatch level to the value passed in.
|
||||||
|
*
|
||||||
|
* This routine sets thread dispatch level to the
|
||||||
|
* value passed in.
|
||||||
|
*/
|
||||||
|
uint32_t _Thread_Dispatch_set_disable_level(uint32_t value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Increments the thread dispatch level.
|
||||||
|
*
|
||||||
|
* This rountine increments the thread dispatch level
|
||||||
|
*/
|
||||||
|
uint32_t _Thread_Dispatch_increment_disable_level(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Decrements the thread dispatch level.
|
||||||
|
*
|
||||||
|
* This routine decrements the thread dispatch level.
|
||||||
|
*/
|
||||||
|
uint32_t _Thread_Dispatch_decrement_disable_level(void);
|
||||||
|
#else /* RTEMS_SMP */
|
||||||
|
/**
|
||||||
|
* @brief _Thread_Dispatch_in_critical_section
|
||||||
|
*
|
||||||
|
* This routine returns true if thread dispatch indicates
|
||||||
|
* that we are in a critical section.
|
||||||
|
*/
|
||||||
|
RTEMS_INLINE_ROUTINE bool _Thread_Dispatch_in_critical_section(void)
|
||||||
|
{
|
||||||
|
if ( _Thread_Dispatch_disable_level == 0 )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get thread dispatch disable level.
|
||||||
|
*
|
||||||
|
* This routine returns value of the the thread dispatch level.
|
||||||
|
*/
|
||||||
|
RTEMS_INLINE_ROUTINE uint32_t _Thread_Dispatch_get_disable_level(void)
|
||||||
|
{
|
||||||
|
return _Thread_Dispatch_disable_level;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set thread dispatch disable level.
|
||||||
|
*
|
||||||
|
* This routine sets thread dispatch level to the
|
||||||
|
* value passed in.
|
||||||
|
*/
|
||||||
|
RTEMS_INLINE_ROUTINE uint32_t _Thread_Dispatch_set_disable_level(uint32_t value)
|
||||||
|
{
|
||||||
|
_Thread_Dispatch_disable_level = value;
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Increase thread dispatch disable level.
|
||||||
|
*
|
||||||
|
* This rountine increments the thread dispatch level
|
||||||
|
*/
|
||||||
|
RTEMS_INLINE_ROUTINE uint32_t _Thread_Dispatch_increment_disable_level(void)
|
||||||
|
{
|
||||||
|
uint32_t level = _Thread_Dispatch_disable_level;
|
||||||
|
|
||||||
|
++level;
|
||||||
|
_Thread_Dispatch_disable_level = level;
|
||||||
|
|
||||||
|
return level;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Decrease thread dispatch disable level.
|
||||||
|
*
|
||||||
|
* This routine decrements the thread dispatch level.
|
||||||
|
*/
|
||||||
|
RTEMS_INLINE_ROUTINE uint32_t _Thread_Dispatch_decrement_disable_level(void)
|
||||||
|
{
|
||||||
|
uint32_t level = _Thread_Dispatch_disable_level;
|
||||||
|
|
||||||
|
--level;
|
||||||
|
_Thread_Dispatch_disable_level = level;
|
||||||
|
|
||||||
|
return level;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Thread dispatch initialization.
|
||||||
|
*
|
||||||
|
* This routine initializes the thread dispatching subsystem.
|
||||||
|
*/
|
||||||
|
RTEMS_INLINE_ROUTINE void _Thread_Dispatch_initialization( void )
|
||||||
|
{
|
||||||
|
_Thread_Dispatch_set_disable_level( 1 );
|
||||||
|
}
|
||||||
|
#endif /* RTEMS_SMP */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Dispatch thread.
|
||||||
|
*
|
||||||
|
* This routine is responsible for transferring control of the
|
||||||
|
* processor from the executing thread to the heir thread. Once the
|
||||||
|
* heir is running an attempt is made to dispatch any ASRs.
|
||||||
|
* As part of this process, it is responsible for the following actions:
|
||||||
|
* + saving the context of the executing thread
|
||||||
|
* + restoring the context of the heir thread
|
||||||
|
* + dispatching any signals for the resulting executing thread
|
||||||
|
|
||||||
|
* ALTERNATE ENTRY POINTS:
|
||||||
|
* void _Thread_Enable_dispatch();
|
||||||
|
*
|
||||||
|
* - INTERRUPT LATENCY:
|
||||||
|
* + dispatch thread
|
||||||
|
* + no dispatch thread
|
||||||
|
*/
|
||||||
|
void _Thread_Dispatch( void );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This routine prevents dispatching.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined ( __THREAD_DO_NOT_INLINE_DISABLE_DISPATCH__ )
|
||||||
|
void _Thread_Disable_dispatch( void );
|
||||||
|
#else
|
||||||
|
RTEMS_INLINE_ROUTINE void _Thread_Disable_dispatch( void )
|
||||||
|
{
|
||||||
|
_Thread_Dispatch_increment_disable_level();
|
||||||
|
RTEMS_COMPILER_MEMORY_BARRIER();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This routine allows dispatching to occur again. If this is
|
||||||
|
* the outer most dispatching critical section, then a dispatching
|
||||||
|
* operation will be performed and, if necessary, control of the
|
||||||
|
* processor will be transferred to the heir thread.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined ( __THREAD_DO_NOT_INLINE_ENABLE_DISPATCH__ )
|
||||||
|
void _Thread_Enable_dispatch( void );
|
||||||
|
#else
|
||||||
|
/* inlining of enable dispatching must be true */
|
||||||
|
RTEMS_INLINE_ROUTINE void _Thread_Enable_dispatch( void )
|
||||||
|
{
|
||||||
|
RTEMS_COMPILER_MEMORY_BARRIER();
|
||||||
|
if ( _Thread_Dispatch_decrement_disable_level() == 0 )
|
||||||
|
_Thread_Dispatch();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This routine allows dispatching to occur again. However,
|
||||||
|
* no dispatching operation is performed even if this is the outer
|
||||||
|
* most dispatching critical section.
|
||||||
|
*/
|
||||||
|
|
||||||
|
RTEMS_INLINE_ROUTINE void _Thread_Unnest_dispatch( void )
|
||||||
|
{
|
||||||
|
RTEMS_COMPILER_MEMORY_BARRIER();
|
||||||
|
_Thread_Dispatch_decrement_disable_level();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function returns true if dispatching is disabled, and false
|
||||||
|
* otherwise.
|
||||||
|
*/
|
||||||
|
|
||||||
|
RTEMS_INLINE_ROUTINE bool _Thread_Is_dispatching_enabled( void )
|
||||||
|
{
|
||||||
|
return ( _Thread_Dispatch_in_critical_section() == false );
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
#endif /* _RTEMS_SCORE_THREADDISPATCH_H */
|
||||||
@@ -23,6 +23,8 @@
|
|||||||
#ifndef _RTEMS_SCORE_COREMUTEX_INL
|
#ifndef _RTEMS_SCORE_COREMUTEX_INL
|
||||||
#define _RTEMS_SCORE_COREMUTEX_INL
|
#define _RTEMS_SCORE_COREMUTEX_INL
|
||||||
|
|
||||||
|
#include <rtems/score/threaddispatch.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @addtogroup ScoreMutex
|
* @addtogroup ScoreMutex
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
/**@{**/
|
/**@{**/
|
||||||
|
|
||||||
#include <rtems/score/thread.h>
|
#include <rtems/score/thread.h>
|
||||||
|
#include <rtems/score/threaddispatch.h>
|
||||||
#include <rtems/score/threadq.h>
|
#include <rtems/score/threadq.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -23,6 +23,8 @@
|
|||||||
#ifndef _RTEMS_SCORE_OBJECT_INL
|
#ifndef _RTEMS_SCORE_OBJECT_INL
|
||||||
#define _RTEMS_SCORE_OBJECT_INL
|
#define _RTEMS_SCORE_OBJECT_INL
|
||||||
|
|
||||||
|
#include <rtems/score/threaddispatch.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function builds an object's id from the processor node and index
|
* This function builds an object's id from the processor node and index
|
||||||
* values specified.
|
* values specified.
|
||||||
|
|||||||
@@ -31,91 +31,6 @@
|
|||||||
*/
|
*/
|
||||||
/**@{**/
|
/**@{**/
|
||||||
|
|
||||||
#if defined(RTEMS_SMP)
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The _Thread_Dispatch_... functions are prototyped in thread.h.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief _Thread_Dispatch_in_critical_section
|
|
||||||
*
|
|
||||||
* This routine returns true if thread dispatch indicates
|
|
||||||
* that we are in a critical section.
|
|
||||||
*/
|
|
||||||
RTEMS_INLINE_ROUTINE bool _Thread_Dispatch_in_critical_section(void)
|
|
||||||
{
|
|
||||||
if ( _Thread_Dispatch_disable_level == 0 )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Get thread dispatch disable level.
|
|
||||||
*
|
|
||||||
* This routine returns value of the the thread dispatch level.
|
|
||||||
*/
|
|
||||||
RTEMS_INLINE_ROUTINE uint32_t _Thread_Dispatch_get_disable_level(void)
|
|
||||||
{
|
|
||||||
return _Thread_Dispatch_disable_level;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Set thread dispatch disable level.
|
|
||||||
*
|
|
||||||
* This routine sets thread dispatch level to the
|
|
||||||
* value passed in.
|
|
||||||
*/
|
|
||||||
RTEMS_INLINE_ROUTINE uint32_t _Thread_Dispatch_set_disable_level(uint32_t value)
|
|
||||||
{
|
|
||||||
_Thread_Dispatch_disable_level = value;
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Increase thread dispatch disable level.
|
|
||||||
*
|
|
||||||
* This rountine increments the thread dispatch level
|
|
||||||
*/
|
|
||||||
RTEMS_INLINE_ROUTINE uint32_t _Thread_Dispatch_increment_disable_level(void)
|
|
||||||
{
|
|
||||||
uint32_t level = _Thread_Dispatch_disable_level;
|
|
||||||
|
|
||||||
++level;
|
|
||||||
_Thread_Dispatch_disable_level = level;
|
|
||||||
|
|
||||||
return level;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Decrease thread dispatch disable level.
|
|
||||||
*
|
|
||||||
* This routine decrements the thread dispatch level.
|
|
||||||
*/
|
|
||||||
RTEMS_INLINE_ROUTINE uint32_t _Thread_Dispatch_decrement_disable_level(void)
|
|
||||||
{
|
|
||||||
uint32_t level = _Thread_Dispatch_disable_level;
|
|
||||||
|
|
||||||
--level;
|
|
||||||
_Thread_Dispatch_disable_level = level;
|
|
||||||
|
|
||||||
return level;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Thread dispatch initialization.
|
|
||||||
*
|
|
||||||
* This routine initializes the thread dispatching subsystem.
|
|
||||||
*/
|
|
||||||
RTEMS_INLINE_ROUTINE void _Thread_Dispatch_initialization( void )
|
|
||||||
{
|
|
||||||
_Thread_Dispatch_set_disable_level( 1 );
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This routine halts multitasking and returns control to
|
* This routine halts multitasking and returns control to
|
||||||
@@ -236,61 +151,6 @@ RTEMS_INLINE_ROUTINE void _Thread_Deallocate_fp( void )
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
|
||||||
* This routine prevents dispatching.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if defined ( __THREAD_DO_NOT_INLINE_DISABLE_DISPATCH__ )
|
|
||||||
void _Thread_Disable_dispatch( void );
|
|
||||||
#else
|
|
||||||
RTEMS_INLINE_ROUTINE void _Thread_Disable_dispatch( void )
|
|
||||||
{
|
|
||||||
_Thread_Dispatch_increment_disable_level();
|
|
||||||
RTEMS_COMPILER_MEMORY_BARRIER();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This routine allows dispatching to occur again. If this is
|
|
||||||
* the outer most dispatching critical section, then a dispatching
|
|
||||||
* operation will be performed and, if necessary, control of the
|
|
||||||
* processor will be transferred to the heir thread.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if defined ( __THREAD_DO_NOT_INLINE_ENABLE_DISPATCH__ )
|
|
||||||
void _Thread_Enable_dispatch( void );
|
|
||||||
#else
|
|
||||||
/* inlining of enable dispatching must be true */
|
|
||||||
RTEMS_INLINE_ROUTINE void _Thread_Enable_dispatch( void )
|
|
||||||
{
|
|
||||||
RTEMS_COMPILER_MEMORY_BARRIER();
|
|
||||||
if ( _Thread_Dispatch_decrement_disable_level() == 0 )
|
|
||||||
_Thread_Dispatch();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This routine allows dispatching to occur again. However,
|
|
||||||
* no dispatching operation is performed even if this is the outer
|
|
||||||
* most dispatching critical section.
|
|
||||||
*/
|
|
||||||
|
|
||||||
RTEMS_INLINE_ROUTINE void _Thread_Unnest_dispatch( void )
|
|
||||||
{
|
|
||||||
RTEMS_COMPILER_MEMORY_BARRIER();
|
|
||||||
_Thread_Dispatch_decrement_disable_level();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This function returns true if dispatching is disabled, and false
|
|
||||||
* otherwise.
|
|
||||||
*/
|
|
||||||
|
|
||||||
RTEMS_INLINE_ROUTINE bool _Thread_Is_dispatching_enabled( void )
|
|
||||||
{
|
|
||||||
return ( _Thread_Dispatch_in_critical_section() == false );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function returns true if dispatching is disabled, and false
|
* This function returns true if dispatching is disabled, and false
|
||||||
* otherwise.
|
* otherwise.
|
||||||
|
|||||||
@@ -159,6 +159,10 @@ $(PROJECT_INCLUDE)/rtems/score/thread.h: include/rtems/score/thread.h $(PROJECT_
|
|||||||
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/thread.h
|
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/thread.h
|
||||||
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/thread.h
|
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/thread.h
|
||||||
|
|
||||||
|
$(PROJECT_INCLUDE)/rtems/score/threaddispatch.h: include/rtems/score/threaddispatch.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
|
||||||
|
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/threaddispatch.h
|
||||||
|
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/threaddispatch.h
|
||||||
|
|
||||||
$(PROJECT_INCLUDE)/rtems/score/threadq.h: include/rtems/score/threadq.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
|
$(PROJECT_INCLUDE)/rtems/score/threadq.h: include/rtems/score/threadq.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
|
||||||
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/threadq.h
|
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/threadq.h
|
||||||
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/threadq.h
|
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/threadq.h
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
#include <rtems/system.h>
|
#include <rtems/system.h>
|
||||||
#include <rtems/score/corerwlock.h>
|
#include <rtems/score/corerwlock.h>
|
||||||
#include <rtems/score/corerwlock.h>
|
#include <rtems/score/threaddispatch.h>
|
||||||
|
|
||||||
void _CORE_RWLock_Timeout(
|
void _CORE_RWLock_Timeout(
|
||||||
Objects_Id id,
|
Objects_Id id,
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
#include <rtems/score/corespinlock.h>
|
#include <rtems/score/corespinlock.h>
|
||||||
#include <rtems/score/states.h>
|
#include <rtems/score/states.h>
|
||||||
#include <rtems/score/thread.h>
|
#include <rtems/score/thread.h>
|
||||||
|
#include <rtems/score/threaddispatch.h>
|
||||||
#include <rtems/score/watchdog.h>
|
#include <rtems/score/watchdog.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
#include <rtems/system.h>
|
#include <rtems/system.h>
|
||||||
#include <rtems/score/object.h>
|
#include <rtems/score/object.h>
|
||||||
#include <rtems/score/thread.h>
|
#include <rtems/score/thread.h>
|
||||||
|
#include <rtems/score/threaddispatch.h>
|
||||||
#include <rtems/score/timestamp.h>
|
#include <rtems/score/timestamp.h>
|
||||||
#include <rtems/score/tod.h>
|
#include <rtems/score/tod.h>
|
||||||
#include <rtems/score/watchdog.h>
|
#include <rtems/score/watchdog.h>
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
#include <rtems/system.h>
|
#include <rtems/system.h>
|
||||||
#include <rtems/score/isr.h>
|
#include <rtems/score/isr.h>
|
||||||
#include <rtems/score/thread.h>
|
#include <rtems/score/thread.h>
|
||||||
|
#include <rtems/score/threaddispatch.h>
|
||||||
#include <rtems/score/smp.h>
|
#include <rtems/score/smp.h>
|
||||||
|
|
||||||
void _ISR_SMP_Initialize(void)
|
void _ISR_SMP_Initialize(void)
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
#include <rtems/config.h>
|
#include <rtems/config.h>
|
||||||
#include <rtems/score/scheduler.h>
|
#include <rtems/score/scheduler.h>
|
||||||
#include <rtems/score/schedulercbs.h>
|
#include <rtems/score/schedulercbs.h>
|
||||||
|
#include <rtems/score/threaddispatch.h>
|
||||||
#include <rtems/rtems/object.h>
|
#include <rtems/rtems/object.h>
|
||||||
|
|
||||||
int _Scheduler_CBS_Attach_thread (
|
int _Scheduler_CBS_Attach_thread (
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
#include <rtems/config.h>
|
#include <rtems/config.h>
|
||||||
#include <rtems/score/scheduler.h>
|
#include <rtems/score/scheduler.h>
|
||||||
#include <rtems/score/schedulercbs.h>
|
#include <rtems/score/schedulercbs.h>
|
||||||
|
#include <rtems/score/threaddispatch.h>
|
||||||
|
|
||||||
int _Scheduler_CBS_Detach_thread (
|
int _Scheduler_CBS_Detach_thread (
|
||||||
Scheduler_CBS_Server_id server_id,
|
Scheduler_CBS_Server_id server_id,
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
#include <rtems/config.h>
|
#include <rtems/config.h>
|
||||||
#include <rtems/score/scheduler.h>
|
#include <rtems/score/scheduler.h>
|
||||||
#include <rtems/score/schedulercbs.h>
|
#include <rtems/score/schedulercbs.h>
|
||||||
|
#include <rtems/score/threaddispatch.h>
|
||||||
|
|
||||||
int _Scheduler_CBS_Get_execution_time (
|
int _Scheduler_CBS_Get_execution_time (
|
||||||
Scheduler_CBS_Server_id server_id,
|
Scheduler_CBS_Server_id server_id,
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
#include <rtems/config.h>
|
#include <rtems/config.h>
|
||||||
#include <rtems/score/scheduler.h>
|
#include <rtems/score/scheduler.h>
|
||||||
#include <rtems/score/schedulercbs.h>
|
#include <rtems/score/schedulercbs.h>
|
||||||
|
#include <rtems/score/threaddispatch.h>
|
||||||
|
|
||||||
int _Scheduler_CBS_Get_remaining_budget (
|
int _Scheduler_CBS_Get_remaining_budget (
|
||||||
Scheduler_CBS_Server_id server_id,
|
Scheduler_CBS_Server_id server_id,
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
#include <rtems/bspsmp.h>
|
#include <rtems/bspsmp.h>
|
||||||
#include <rtems/score/smp.h>
|
#include <rtems/score/smp.h>
|
||||||
#include <rtems/score/thread.h>
|
#include <rtems/score/thread.h>
|
||||||
|
#include <rtems/score/threaddispatch.h>
|
||||||
|
|
||||||
#if defined(RTEMS_DEBUG)
|
#if defined(RTEMS_DEBUG)
|
||||||
#include <rtems/bspIo.h>
|
#include <rtems/bspIo.h>
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
#include <rtems/score/states.h>
|
#include <rtems/score/states.h>
|
||||||
#include <rtems/score/sysstate.h>
|
#include <rtems/score/sysstate.h>
|
||||||
#include <rtems/score/thread.h>
|
#include <rtems/score/thread.h>
|
||||||
|
#include <rtems/score/threaddispatch.h>
|
||||||
#include <rtems/score/threadq.h>
|
#include <rtems/score/threadq.h>
|
||||||
#include <rtems/score/userextimpl.h>
|
#include <rtems/score/userextimpl.h>
|
||||||
#include <rtems/score/wkspace.h>
|
#include <rtems/score/wkspace.h>
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
#include <rtems/score/states.h>
|
#include <rtems/score/states.h>
|
||||||
#include <rtems/score/sysstate.h>
|
#include <rtems/score/sysstate.h>
|
||||||
#include <rtems/score/thread.h>
|
#include <rtems/score/thread.h>
|
||||||
|
#include <rtems/score/threaddispatch.h>
|
||||||
#include <rtems/score/threadq.h>
|
#include <rtems/score/threadq.h>
|
||||||
#include <rtems/score/wkspace.h>
|
#include <rtems/score/wkspace.h>
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
#include <rtems/system.h>
|
#include <rtems/system.h>
|
||||||
#include <rtems/score/thread.h>
|
#include <rtems/score/thread.h>
|
||||||
|
#include <rtems/score/threaddispatch.h>
|
||||||
|
|
||||||
#if defined ( __THREAD_DO_NOT_INLINE_DISABLE_DISPATCH__ )
|
#if defined ( __THREAD_DO_NOT_INLINE_DISABLE_DISPATCH__ )
|
||||||
void _Thread_Disable_dispatch( void )
|
void _Thread_Disable_dispatch( void )
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
#include <rtems/score/states.h>
|
#include <rtems/score/states.h>
|
||||||
#include <rtems/score/sysstate.h>
|
#include <rtems/score/sysstate.h>
|
||||||
#include <rtems/score/thread.h>
|
#include <rtems/score/thread.h>
|
||||||
|
#include <rtems/score/threaddispatch.h>
|
||||||
#include <rtems/score/threadq.h>
|
#include <rtems/score/threadq.h>
|
||||||
#include <rtems/score/userextimpl.h>
|
#include <rtems/score/userextimpl.h>
|
||||||
#include <rtems/score/wkspace.h>
|
#include <rtems/score/wkspace.h>
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
#include <rtems/score/priority.h>
|
#include <rtems/score/priority.h>
|
||||||
#include <rtems/score/states.h>
|
#include <rtems/score/states.h>
|
||||||
#include <rtems/score/sysstate.h>
|
#include <rtems/score/sysstate.h>
|
||||||
#include <rtems/score/thread.h>
|
#include <rtems/score/threaddispatch.h>
|
||||||
|
|
||||||
#define NO_OWNER_CPU (-1)
|
#define NO_OWNER_CPU (-1)
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
#include <rtems/score/states.h>
|
#include <rtems/score/states.h>
|
||||||
#include <rtems/score/sysstate.h>
|
#include <rtems/score/sysstate.h>
|
||||||
#include <rtems/score/thread.h>
|
#include <rtems/score/thread.h>
|
||||||
|
#include <rtems/score/threaddispatch.h>
|
||||||
#include <rtems/score/threadq.h>
|
#include <rtems/score/threadq.h>
|
||||||
|
|
||||||
Thread_Control *_Thread_Get (
|
Thread_Control *_Thread_Get (
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
#include <rtems/score/states.h>
|
#include <rtems/score/states.h>
|
||||||
#include <rtems/score/sysstate.h>
|
#include <rtems/score/sysstate.h>
|
||||||
#include <rtems/score/thread.h>
|
#include <rtems/score/thread.h>
|
||||||
|
#include <rtems/score/threaddispatch.h>
|
||||||
#include <rtems/score/threadq.h>
|
#include <rtems/score/threadq.h>
|
||||||
#include <rtems/score/userextimpl.h>
|
#include <rtems/score/userextimpl.h>
|
||||||
#include <rtems/score/wkspace.h>
|
#include <rtems/score/wkspace.h>
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
#include <rtems/score/object.h>
|
#include <rtems/score/object.h>
|
||||||
#include <rtems/score/states.h>
|
#include <rtems/score/states.h>
|
||||||
#include <rtems/score/thread.h>
|
#include <rtems/score/thread.h>
|
||||||
|
#include <rtems/score/threaddispatch.h>
|
||||||
#include <rtems/score/threadq.h>
|
#include <rtems/score/threadq.h>
|
||||||
#include <rtems/score/tqdata.h>
|
#include <rtems/score/tqdata.h>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user