forked from Imagelibrary/rtems
score: Static scheduler configuration
Do not allocate the scheduler control structures from the workspace. This is a preparation step for configuration of clustered/partitioned schedulers on SMP.
This commit is contained in:
@@ -17,6 +17,7 @@ include_rtems_HEADERS += include/rtems/cbs.h
|
||||
include_rtems_HEADERS += include/rtems/profiling.h
|
||||
include_rtems_HEADERS += include/rtems/rbheap.h
|
||||
include_rtems_HEADERS += include/rtems/rbtree.h
|
||||
include_rtems_HEADERS += include/rtems/scheduler.h
|
||||
include_rtems_HEADERS += include/rtems/sptables.h
|
||||
include_rtems_HEADERS += include/rtems/test.h
|
||||
include_rtems_HEADERS += include/rtems/timespec.h
|
||||
|
||||
@@ -639,15 +639,10 @@ const rtems_libio_helper rtems_fs_init_helper =
|
||||
*
|
||||
* An application can define its own scheduling policy by defining
|
||||
* CONFIGURE_SCHEDULER_USER and the following:
|
||||
* - CONFIGURE_SCHEDULER_ENTRY_POINTS
|
||||
* - CONFIGURE_MEMORY_FOR_SCHEDULER - base memory
|
||||
* - CONFIGURE_SCHEDULER_CONTEXT
|
||||
* - CONFIGURE_SCHEDULER_CONTROLS
|
||||
* - CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER - per task memory
|
||||
*/
|
||||
#include <rtems/score/scheduler.h>
|
||||
|
||||
#if !defined(RTEMS_SMP)
|
||||
#undef CONFIGURE_SCHEDULER_SIMPLE_SMP
|
||||
#endif
|
||||
|
||||
/* If no scheduler is specified, the priority scheduler is default. */
|
||||
#if !defined(CONFIGURE_SCHEDULER_USER) && \
|
||||
@@ -665,21 +660,26 @@ const rtems_libio_helper rtems_fs_init_helper =
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <rtems/scheduler.h>
|
||||
|
||||
/*
|
||||
* If the Priority Scheduler is selected, then configure for it.
|
||||
*/
|
||||
#if defined(CONFIGURE_SCHEDULER_PRIORITY)
|
||||
#include <rtems/score/schedulerpriority.h>
|
||||
#define CONFIGURE_SCHEDULER_ENTRY_POINTS SCHEDULER_PRIORITY_ENTRY_POINTS
|
||||
#if !defined(CONFIGURE_SCHEDULER_CONTROLS)
|
||||
#define CONFIGURE_SCHEDULER_CONTEXT \
|
||||
RTEMS_SCHEDULER_CONTEXT_PRIORITY( \
|
||||
dflt, \
|
||||
CONFIGURE_MAXIMUM_PRIORITY + 1 \
|
||||
)
|
||||
|
||||
#define CONFIGURE_SCHEDULER_CONTROLS \
|
||||
RTEMS_SCHEDULER_CONTROL_PRIORITY(dflt)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* This defines the memory used by the priority scheduler.
|
||||
*/
|
||||
#define CONFIGURE_MEMORY_FOR_SCHEDULER ( \
|
||||
_Configure_From_workspace( \
|
||||
sizeof(Scheduler_priority_Control) + \
|
||||
((CONFIGURE_MAXIMUM_PRIORITY) * sizeof(Chain_Control)) ) \
|
||||
)
|
||||
#define CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER ( \
|
||||
_Configure_From_workspace(sizeof(Scheduler_priority_Per_thread)) )
|
||||
#endif
|
||||
@@ -689,17 +689,20 @@ const rtems_libio_helper rtems_fs_init_helper =
|
||||
* it.
|
||||
*/
|
||||
#if defined(CONFIGURE_SCHEDULER_PRIORITY_SMP)
|
||||
#include <rtems/score/schedulerprioritysmp.h>
|
||||
#define CONFIGURE_SCHEDULER_ENTRY_POINTS SCHEDULER_PRIORITY_SMP_ENTRY_POINTS
|
||||
#if !defined(CONFIGURE_SCHEDULER_CONTROLS)
|
||||
#define CONFIGURE_SCHEDULER_CONTEXT \
|
||||
RTEMS_SCHEDULER_CONTEXT_PRIORITY_SMP( \
|
||||
dflt, \
|
||||
CONFIGURE_MAXIMUM_PRIORITY + 1 \
|
||||
)
|
||||
|
||||
#define CONFIGURE_SCHEDULER_CONTROLS \
|
||||
RTEMS_SCHEDULER_CONTROL_PRIORITY_SMP(dflt)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* This defines the memory used by the priority scheduler.
|
||||
*/
|
||||
#define CONFIGURE_MEMORY_FOR_SCHEDULER ( \
|
||||
_Configure_From_workspace( \
|
||||
sizeof(Scheduler_priority_SMP_Control) + \
|
||||
((CONFIGURE_MAXIMUM_PRIORITY) * sizeof(Chain_Control)) ) \
|
||||
)
|
||||
#define CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER ( \
|
||||
_Configure_From_workspace(sizeof(Scheduler_priority_Per_thread)) )
|
||||
#endif
|
||||
@@ -709,17 +712,20 @@ const rtems_libio_helper rtems_fs_init_helper =
|
||||
* it.
|
||||
*/
|
||||
#if defined(CONFIGURE_SCHEDULER_PRIORITY_AFFINITY_SMP)
|
||||
#include <rtems/score/schedulerpriorityaffinitysmp.h>
|
||||
#define CONFIGURE_SCHEDULER_ENTRY_POINTS SCHEDULER_PRIORITY_AFFINITY_SMP_ENTRY_POINTS
|
||||
#if !defined(CONFIGURE_SCHEDULER_CONTROLS)
|
||||
#define CONFIGURE_SCHEDULER_CONTEXT \
|
||||
RTEMS_SCHEDULER_CONTEXT_PRIORITY_AFFINITY_SMP( \
|
||||
dflt, \
|
||||
CONFIGURE_MAXIMUM_PRIORITY + 1 \
|
||||
)
|
||||
|
||||
#define CONFIGURE_SCHEDULER_CONTROLS \
|
||||
RTEMS_SCHEDULER_CONTROL_PRIORITY_AFFINITY_SMP(dflt)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* This defines the memory used by the priority scheduler.
|
||||
*/
|
||||
#define CONFIGURE_MEMORY_FOR_SCHEDULER ( \
|
||||
_Configure_From_workspace( \
|
||||
sizeof(Scheduler_SMP_Control) + \
|
||||
((CONFIGURE_MAXIMUM_PRIORITY) * sizeof(Chain_Control)) ) \
|
||||
)
|
||||
#define CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER ( \
|
||||
_Configure_From_workspace(sizeof(Scheduler_priority_Per_thread)) )
|
||||
#endif
|
||||
@@ -728,15 +734,15 @@ const rtems_libio_helper rtems_fs_init_helper =
|
||||
* If the Simple Priority Scheduler is selected, then configure for it.
|
||||
*/
|
||||
#if defined(CONFIGURE_SCHEDULER_SIMPLE)
|
||||
#include <rtems/score/schedulersimple.h>
|
||||
#define CONFIGURE_SCHEDULER_ENTRY_POINTS SCHEDULER_SIMPLE_ENTRY_POINTS
|
||||
#if !defined(CONFIGURE_SCHEDULER_CONTROLS)
|
||||
#define CONFIGURE_SCHEDULER_CONTEXT RTEMS_SCHEDULER_CONTEXT_SIMPLE(dflt)
|
||||
|
||||
#define CONFIGURE_SCHEDULER_CONTROLS RTEMS_SCHEDULER_CONTROL_SIMPLE(dflt)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* define the memory used by the simple scheduler
|
||||
*/
|
||||
#define CONFIGURE_MEMORY_FOR_SCHEDULER ( \
|
||||
_Configure_From_workspace( sizeof( Scheduler_simple_Control ) ) \
|
||||
)
|
||||
#define CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER (0)
|
||||
#endif
|
||||
|
||||
@@ -744,17 +750,19 @@ const rtems_libio_helper rtems_fs_init_helper =
|
||||
* If the Simple SMP Priority Scheduler is selected, then configure for it.
|
||||
*/
|
||||
#if defined(CONFIGURE_SCHEDULER_SIMPLE_SMP)
|
||||
#include <rtems/score/schedulersimplesmp.h>
|
||||
#define CONFIGURE_SCHEDULER_ENTRY_POINTS SCHEDULER_SIMPLE_SMP_ENTRY_POINTS
|
||||
#if !defined(CONFIGURE_SCHEDULER_CONTROLS)
|
||||
#define CONFIGURE_SCHEDULER_CONTEXT \
|
||||
RTEMS_SCHEDULER_CONTEXT_SIMPLE_SMP(dflt)
|
||||
|
||||
#define CONFIGURE_SCHEDULER_CONTROLS \
|
||||
RTEMS_SCHEDULER_CONTROL_SIMPLE_SMP(dflt)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Define the memory used by the Simple SMP Scheduler
|
||||
*
|
||||
* NOTE: This is the same as the Simple Scheduler
|
||||
*/
|
||||
#define CONFIGURE_MEMORY_FOR_SCHEDULER ( \
|
||||
_Configure_From_workspace( sizeof( Scheduler_simple_SMP_Control ) ) \
|
||||
)
|
||||
#define CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER (0)
|
||||
#endif
|
||||
|
||||
@@ -762,14 +770,15 @@ const rtems_libio_helper rtems_fs_init_helper =
|
||||
* If the EDF Scheduler is selected, then configure for it.
|
||||
*/
|
||||
#if defined(CONFIGURE_SCHEDULER_EDF)
|
||||
#include <rtems/score/scheduleredf.h>
|
||||
#define CONFIGURE_SCHEDULER_ENTRY_POINTS SCHEDULER_EDF_ENTRY_POINTS
|
||||
#if !defined(CONFIGURE_SCHEDULER_CONTROLS)
|
||||
#define CONFIGURE_SCHEDULER_CONTEXT RTEMS_SCHEDULER_CONTEXT_EDF(dflt)
|
||||
|
||||
#define CONFIGURE_SCHEDULER_CONTROLS RTEMS_SCHEDULER_CONTROL_EDF(dflt)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* define the memory used by the EDF scheduler
|
||||
*/
|
||||
#define CONFIGURE_MEMORY_FOR_SCHEDULER ( \
|
||||
_Configure_From_workspace(sizeof(Scheduler_EDF_Control)))
|
||||
#define CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER ( \
|
||||
_Configure_From_workspace(sizeof(Scheduler_EDF_Per_thread)))
|
||||
#endif
|
||||
@@ -778,26 +787,27 @@ const rtems_libio_helper rtems_fs_init_helper =
|
||||
* If the CBS Scheduler is selected, then configure for it.
|
||||
*/
|
||||
#if defined(CONFIGURE_SCHEDULER_CBS)
|
||||
#include <rtems/score/schedulercbs.h>
|
||||
#define CONFIGURE_SCHEDULER_ENTRY_POINTS SCHEDULER_CBS_ENTRY_POINTS
|
||||
#if !defined(CONFIGURE_SCHEDULER_CONTROLS)
|
||||
#define CONFIGURE_SCHEDULER_CONTEXT RTEMS_SCHEDULER_CONTEXT_CBS(dflt)
|
||||
|
||||
#define CONFIGURE_SCHEDULER_CONTROLS RTEMS_SCHEDULER_CONTROL_CBS(dflt)
|
||||
#endif
|
||||
|
||||
#ifndef CONFIGURE_CBS_MAXIMUM_SERVERS
|
||||
#define CONFIGURE_CBS_MAXIMUM_SERVERS CONFIGURE_MAXIMUM_TASKS
|
||||
#endif
|
||||
|
||||
#ifdef CONFIGURE_INIT
|
||||
uint32_t _Scheduler_CBS_Maximum_servers = CONFIGURE_CBS_MAXIMUM_SERVERS;
|
||||
const uint32_t _Scheduler_CBS_Maximum_servers =
|
||||
CONFIGURE_CBS_MAXIMUM_SERVERS;
|
||||
|
||||
Scheduler_CBS_Server
|
||||
_Scheduler_CBS_Server_list[ CONFIGURE_CBS_MAXIMUM_SERVERS ];
|
||||
#endif
|
||||
|
||||
/**
|
||||
* define the memory used by the CBS scheduler
|
||||
*/
|
||||
#define CONFIGURE_MEMORY_FOR_SCHEDULER ( \
|
||||
_Configure_From_workspace(sizeof(Scheduler_EDF_Control)) + \
|
||||
_Configure_From_workspace(CONFIGURE_CBS_MAXIMUM_SERVERS * \
|
||||
sizeof(Scheduler_CBS_Server *)) + \
|
||||
CONFIGURE_CBS_MAXIMUM_SERVERS * \
|
||||
_Configure_From_workspace(sizeof(Scheduler_CBS_Server)))
|
||||
#define CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER ( \
|
||||
_Configure_From_workspace(sizeof(Scheduler_CBS_Per_thread)))
|
||||
#endif
|
||||
@@ -807,11 +817,17 @@ const rtems_libio_helper rtems_fs_init_helper =
|
||||
* this code to know which scheduler is configured by the user.
|
||||
*/
|
||||
#ifdef CONFIGURE_INIT
|
||||
Scheduler_Control _Scheduler = {
|
||||
NULL, /* Scheduler Specific Data Pointer */
|
||||
CONFIGURE_SCHEDULER_ENTRY_POINTS /* Scheduler Operations */
|
||||
CONFIGURE_SCHEDULER_CONTEXT;
|
||||
|
||||
const Scheduler_Control _Scheduler_Table[] = {
|
||||
CONFIGURE_SCHEDULER_CONTROLS
|
||||
};
|
||||
|
||||
#if defined(RTEMS_SMP)
|
||||
const size_t _Scheduler_Count =
|
||||
RTEMS_ARRAY_SIZE( _Scheduler_Table );
|
||||
#endif
|
||||
|
||||
#if defined(CONFIGURE_SCHEDULER_EDF)
|
||||
const bool _Scheduler_FIXME_thread_priority_queues_are_broken = true;
|
||||
#else
|
||||
@@ -2207,7 +2223,6 @@ const rtems_libio_helper rtems_fs_init_helper =
|
||||
*/
|
||||
#define CONFIGURE_MEMORY_FOR_SYSTEM_OVERHEAD \
|
||||
( CONFIGURE_MEMORY_FOR_IDLE_TASK + /* IDLE and stack */ \
|
||||
CONFIGURE_MEMORY_FOR_SCHEDULER + /* Scheduler */ \
|
||||
CONFIGURE_INTERRUPT_VECTOR_TABLE + /* interrupt vectors */ \
|
||||
CONFIGURE_INTERRUPT_STACK_MEMORY + /* interrupt stack */ \
|
||||
CONFIGURE_API_MUTEX_MEMORY /* allocation mutex */ \
|
||||
@@ -2475,7 +2490,7 @@ const rtems_libio_helper rtems_fs_init_helper =
|
||||
CONFIGURE_MULTIPROCESSING_TABLE, /* pointer to MP config table */
|
||||
#endif
|
||||
#ifdef RTEMS_SMP
|
||||
CONFIGURE_SMP_MAXIMUM_PROCESSORS
|
||||
CONFIGURE_SMP_MAXIMUM_PROCESSORS,
|
||||
#endif
|
||||
};
|
||||
#endif
|
||||
@@ -2557,7 +2572,6 @@ const rtems_libio_helper rtems_fs_init_helper =
|
||||
uint32_t INTERRUPT_VECTOR_TABLE;
|
||||
uint32_t INTERRUPT_STACK_MEMORY;
|
||||
uint32_t MEMORY_FOR_IDLE_TASK;
|
||||
uint32_t MEMORY_FOR_SCHEDULER;
|
||||
uint32_t MEMORY_PER_TASK_FOR_SCHEDULER;
|
||||
|
||||
/* Classic API Pieces */
|
||||
@@ -2614,7 +2628,6 @@ const rtems_libio_helper rtems_fs_init_helper =
|
||||
CONFIGURE_INTERRUPT_VECTOR_TABLE,
|
||||
CONFIGURE_INTERRUPT_STACK_MEMORY,
|
||||
CONFIGURE_MEMORY_FOR_IDLE_TASK,
|
||||
CONFIGURE_MEMORY_FOR_SCHEDULER,
|
||||
CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER,
|
||||
|
||||
/* Classic API Pieces */
|
||||
|
||||
160
cpukit/sapi/include/rtems/scheduler.h
Normal file
160
cpukit/sapi/include/rtems/scheduler.h
Normal file
@@ -0,0 +1,160 @@
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @brief Scheduler Configuration API
|
||||
*/
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _RTEMS_SAPI_SCHEDULER_H
|
||||
#define _RTEMS_SAPI_SCHEDULER_H
|
||||
|
||||
#include <rtems/score/scheduler.h>
|
||||
|
||||
#define RTEMS_SCHEDULER_CONTEXT_NAME( name ) \
|
||||
_Configuration_Scheduler_ ## name
|
||||
|
||||
/*
|
||||
* This file should be only included in the context of <rtems/confdefs.h>.
|
||||
* Define the scheduler configuration macros only in case the corresponding
|
||||
* configure symbol is defined. This is necessary to prevent invalid workspace
|
||||
* size estimates since we have to account for the per-thread scheduler
|
||||
* information.
|
||||
*/
|
||||
|
||||
#ifdef CONFIGURE_SCHEDULER_CBS
|
||||
#include <rtems/score/schedulercbs.h>
|
||||
|
||||
#define RTEMS_SCHEDULER_CONTEXT_CBS_NAME( name ) \
|
||||
RTEMS_SCHEDULER_CONTEXT_NAME( CBS_ ## name )
|
||||
|
||||
#define RTEMS_SCHEDULER_CONTEXT_CBS( name ) \
|
||||
static Scheduler_EDF_Context RTEMS_SCHEDULER_CONTEXT_CBS_NAME( name )
|
||||
|
||||
#define RTEMS_SCHEDULER_CONTROL_CBS( name ) \
|
||||
{ \
|
||||
&RTEMS_SCHEDULER_CONTEXT_CBS_NAME( name ).Base, \
|
||||
SCHEDULER_CBS_ENTRY_POINTS \
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIGURE_SCHEDULER_EDF
|
||||
#include <rtems/score/scheduleredf.h>
|
||||
|
||||
#define RTEMS_SCHEDULER_CONTEXT_EDF_NAME( name ) \
|
||||
RTEMS_SCHEDULER_CONTEXT_NAME( EDF_ ## name )
|
||||
|
||||
#define RTEMS_SCHEDULER_CONTEXT_EDF( name ) \
|
||||
static Scheduler_EDF_Context RTEMS_SCHEDULER_CONTEXT_EDF_NAME( name )
|
||||
|
||||
#define RTEMS_SCHEDULER_CONTROL_EDF( name ) \
|
||||
{ \
|
||||
&RTEMS_SCHEDULER_CONTEXT_EDF_NAME( name ).Base, \
|
||||
SCHEDULER_EDF_ENTRY_POINTS \
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIGURE_SCHEDULER_PRIORITY
|
||||
#include <rtems/score/schedulerpriority.h>
|
||||
|
||||
#define RTEMS_SCHEDULER_CONTEXT_PRIORITY_NAME( name ) \
|
||||
RTEMS_SCHEDULER_CONTEXT_NAME( priority_ ## name )
|
||||
|
||||
#define RTEMS_SCHEDULER_CONTEXT_PRIORITY( name, prio_count ) \
|
||||
static struct { \
|
||||
Scheduler_priority_Context Base; \
|
||||
Chain_Control Ready[ ( prio_count ) ]; \
|
||||
} RTEMS_SCHEDULER_CONTEXT_PRIORITY_NAME( name )
|
||||
|
||||
#define RTEMS_SCHEDULER_CONTROL_PRIORITY( name ) \
|
||||
{ \
|
||||
&RTEMS_SCHEDULER_CONTEXT_PRIORITY_NAME( name ).Base.Base, \
|
||||
SCHEDULER_PRIORITY_ENTRY_POINTS \
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIGURE_SCHEDULER_PRIORITY_AFFINITY_SMP
|
||||
#include <rtems/score/schedulerpriorityaffinitysmp.h>
|
||||
|
||||
#define RTEMS_SCHEDULER_CONTEXT_PRIORITY_AFFINITY_SMP_NAME( name ) \
|
||||
RTEMS_SCHEDULER_CONTEXT_NAME( priority_affinity_SMP_ ## name )
|
||||
|
||||
#define RTEMS_SCHEDULER_CONTEXT_PRIORITY_AFFINITY_SMP( name, prio_count ) \
|
||||
static struct { \
|
||||
Scheduler_priority_SMP_Context Base; \
|
||||
Chain_Control Ready[ ( prio_count ) ]; \
|
||||
} RTEMS_SCHEDULER_CONTEXT_PRIORITY_AFFINITY_SMP_NAME( name )
|
||||
|
||||
#define RTEMS_SCHEDULER_CONTROL_PRIORITY_AFFINITY_SMP( name ) \
|
||||
{ \
|
||||
&RTEMS_SCHEDULER_CONTEXT_PRIORITY_AFFINITY_SMP_NAME( name ).Base.Base, \
|
||||
SCHEDULER_PRIORITY_AFFINITY_SMP_ENTRY_POINTS \
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIGURE_SCHEDULER_PRIORITY_SMP
|
||||
#include <rtems/score/schedulerprioritysmp.h>
|
||||
|
||||
#define RTEMS_SCHEDULER_CONTEXT_PRIORITY_SMP_NAME( name ) \
|
||||
RTEMS_SCHEDULER_CONTEXT_NAME( priority_SMP_ ## name )
|
||||
|
||||
#define RTEMS_SCHEDULER_CONTEXT_PRIORITY_SMP( name, prio_count ) \
|
||||
static struct { \
|
||||
Scheduler_priority_SMP_Context Base; \
|
||||
Chain_Control Ready[ ( prio_count ) ]; \
|
||||
} RTEMS_SCHEDULER_CONTEXT_PRIORITY_SMP_NAME( name )
|
||||
|
||||
#define RTEMS_SCHEDULER_CONTROL_PRIORITY_SMP( name ) \
|
||||
{ \
|
||||
&RTEMS_SCHEDULER_CONTEXT_PRIORITY_SMP_NAME( name ).Base.Base, \
|
||||
SCHEDULER_PRIORITY_SMP_ENTRY_POINTS \
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIGURE_SCHEDULER_SIMPLE
|
||||
#include <rtems/score/schedulersimple.h>
|
||||
|
||||
#define RTEMS_SCHEDULER_CONTEXT_SIMPLE_NAME( name ) \
|
||||
RTEMS_SCHEDULER_CONTEXT_NAME( simple_ ## name )
|
||||
|
||||
#define RTEMS_SCHEDULER_CONTEXT_SIMPLE( name ) \
|
||||
static Scheduler_simple_Context \
|
||||
RTEMS_SCHEDULER_CONTEXT_SIMPLE_NAME( name )
|
||||
|
||||
#define RTEMS_SCHEDULER_CONTROL_SIMPLE( name ) \
|
||||
{ \
|
||||
&RTEMS_SCHEDULER_CONTEXT_SIMPLE_NAME( name ).Base, \
|
||||
SCHEDULER_SIMPLE_ENTRY_POINTS \
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIGURE_SCHEDULER_SIMPLE_SMP
|
||||
#include <rtems/score/schedulersimplesmp.h>
|
||||
|
||||
#define RTEMS_SCHEDULER_CONTEXT_SIMPLE_SMP_NAME( name ) \
|
||||
RTEMS_SCHEDULER_CONTEXT_NAME( simple_SMP_ ## name )
|
||||
|
||||
#define RTEMS_SCHEDULER_CONTEXT_SIMPLE_SMP( name ) \
|
||||
static Scheduler_simple_SMP_Context \
|
||||
RTEMS_SCHEDULER_CONTEXT_SIMPLE_SMP_NAME( name )
|
||||
|
||||
#define RTEMS_SCHEDULER_CONTROL_SIMPLE_SMP( name ) \
|
||||
{ \
|
||||
&RTEMS_SCHEDULER_CONTEXT_SIMPLE_SMP_NAME( name ).Base, \
|
||||
SCHEDULER_SIMPLE_SMP_ENTRY_POINTS \
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _RTEMS_SAPI_SCHEDULER_H */
|
||||
@@ -84,6 +84,10 @@ $(PROJECT_INCLUDE)/rtems/rbtree.h: include/rtems/rbtree.h $(PROJECT_INCLUDE)/rte
|
||||
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/rbtree.h
|
||||
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/rbtree.h
|
||||
|
||||
$(PROJECT_INCLUDE)/rtems/scheduler.h: include/rtems/scheduler.h $(PROJECT_INCLUDE)/rtems/$(dirstamp)
|
||||
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/scheduler.h
|
||||
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/scheduler.h
|
||||
|
||||
$(PROJECT_INCLUDE)/rtems/sptables.h: include/rtems/sptables.h $(PROJECT_INCLUDE)/rtems/$(dirstamp)
|
||||
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/sptables.h
|
||||
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/sptables.h
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
#define _RTEMS_SCORE_SCHEDULER_H
|
||||
|
||||
#include <rtems/score/percpu.h>
|
||||
#include <rtems/score/chain.h>
|
||||
#include <rtems/score/priority.h>
|
||||
#include <rtems/score/thread.h>
|
||||
#if defined(__RTEMS_HAVE_SYS_CPUSET_H__) && defined(RTEMS_SMP)
|
||||
#include <sys/cpuset.h>
|
||||
#endif
|
||||
@@ -48,42 +48,42 @@ typedef struct Scheduler_Control Scheduler_Control;
|
||||
*/
|
||||
typedef struct {
|
||||
/** Implements the scheduling decision logic (policy). */
|
||||
void ( *initialize )(void);
|
||||
void ( *initialize )( const Scheduler_Control * );
|
||||
|
||||
/** Implements the scheduling decision logic (policy). */
|
||||
void ( *schedule )( Scheduler_Control *, Thread_Control *);
|
||||
void ( *schedule )( const Scheduler_Control *, Thread_Control *);
|
||||
|
||||
/**
|
||||
* @brief Voluntarily yields the processor per the scheduling policy.
|
||||
*
|
||||
* @see _Scheduler_Yield().
|
||||
*/
|
||||
void ( *yield )( Scheduler_Control *, Thread_Control *);
|
||||
void ( *yield )( const Scheduler_Control *, Thread_Control *);
|
||||
|
||||
/** Removes the given thread from scheduling decisions. */
|
||||
void ( *block )( Scheduler_Control *, Thread_Control * );
|
||||
void ( *block )( const Scheduler_Control *, Thread_Control * );
|
||||
|
||||
/** Adds the given thread to scheduling decisions. */
|
||||
void ( *unblock )( Scheduler_Control *, Thread_Control * );
|
||||
void ( *unblock )( const Scheduler_Control *, Thread_Control * );
|
||||
|
||||
/** allocates the scheduler field of the given thread */
|
||||
void * ( *allocate )( Scheduler_Control *, Thread_Control * );
|
||||
void * ( *allocate )( const Scheduler_Control *, Thread_Control * );
|
||||
|
||||
/** frees the scheduler field of the given thread */
|
||||
void ( *free )( Scheduler_Control *, Thread_Control * );
|
||||
void ( *free )( const Scheduler_Control *, Thread_Control * );
|
||||
|
||||
/** updates the scheduler field of the given thread -- primarily used
|
||||
* when changing the thread's priority. */
|
||||
void ( *update )( Scheduler_Control *, Thread_Control * );
|
||||
void ( *update )( const Scheduler_Control *, Thread_Control * );
|
||||
|
||||
/** enqueue a thread as the last of its priority group */
|
||||
void ( *enqueue )( Scheduler_Control *, Thread_Control * );
|
||||
void ( *enqueue )( const Scheduler_Control *, Thread_Control * );
|
||||
|
||||
/** enqueue a thread as the first of its priority group */
|
||||
void ( *enqueue_first )( Scheduler_Control *, Thread_Control * );
|
||||
void ( *enqueue_first )( const Scheduler_Control *, Thread_Control * );
|
||||
|
||||
/** extract a thread from the ready set */
|
||||
void ( *extract )( Scheduler_Control *, Thread_Control * );
|
||||
void ( *extract )( const Scheduler_Control *, Thread_Control * );
|
||||
|
||||
/**
|
||||
* Compares two priorities (returns >0 for higher priority, 0 for equal
|
||||
@@ -95,10 +95,14 @@ typedef struct {
|
||||
);
|
||||
|
||||
/** This routine is called upon release of a new job. */
|
||||
void ( *release_job ) ( Scheduler_Control *, Thread_Control *, uint32_t );
|
||||
void ( *release_job ) (
|
||||
const Scheduler_Control *,
|
||||
Thread_Control *,
|
||||
uint32_t
|
||||
);
|
||||
|
||||
/** perform scheduler update actions required at each clock tick */
|
||||
void ( *tick )( Scheduler_Control * );
|
||||
void ( *tick )( const Scheduler_Control * );
|
||||
|
||||
/**
|
||||
* @brief Starts the idle thread for a particular processor.
|
||||
@@ -106,7 +110,7 @@ typedef struct {
|
||||
* @see _Scheduler_Start_idle().
|
||||
*/
|
||||
void ( *start_idle )(
|
||||
Scheduler_Control *,
|
||||
const Scheduler_Control *,
|
||||
Thread_Control *,
|
||||
Per_CPU_Control *
|
||||
);
|
||||
@@ -118,7 +122,7 @@ typedef struct {
|
||||
* @see _Scheduler_Get_affinity().
|
||||
*/
|
||||
bool ( *get_affinity )(
|
||||
Scheduler_Control *,
|
||||
const Scheduler_Control *,
|
||||
Thread_Control *,
|
||||
size_t,
|
||||
cpu_set_t *
|
||||
@@ -130,7 +134,7 @@ typedef struct {
|
||||
* @see _Scheduler_Set_affinity().
|
||||
*/
|
||||
bool ( *set_affinity )(
|
||||
Scheduler_Control *,
|
||||
const Scheduler_Control *,
|
||||
Thread_Control *,
|
||||
size_t,
|
||||
const cpu_set_t *
|
||||
@@ -139,29 +143,55 @@ typedef struct {
|
||||
} Scheduler_Operations;
|
||||
|
||||
/**
|
||||
* This is the structure used to manage the scheduler.
|
||||
* @brief Scheduler context.
|
||||
*
|
||||
* The scheduler context of a particular scheduler implementation must place
|
||||
* this structure at the begin of its context structure.
|
||||
*/
|
||||
typedef struct {
|
||||
/* No fields yet */
|
||||
} Scheduler_Context;
|
||||
|
||||
/**
|
||||
* @brief Scheduler control.
|
||||
*/
|
||||
struct Scheduler_Control {
|
||||
/**
|
||||
* This points to the data structure used to manage the ready set of
|
||||
* tasks. The pointer varies based upon the type of
|
||||
* ready queue required by the scheduler.
|
||||
* @brief Reference to a statically allocated scheduler context.
|
||||
*/
|
||||
void *information;
|
||||
Scheduler_Context *context;
|
||||
|
||||
/** The jump table for scheduler-specific functions */
|
||||
Scheduler_Operations Operations;
|
||||
/**
|
||||
* @brief The scheduler operations.
|
||||
*/
|
||||
Scheduler_Operations Operations;
|
||||
};
|
||||
|
||||
/**
|
||||
* The _Scheduler holds the structures used to manage the
|
||||
* scheduler.
|
||||
* @brief Registered schedulers.
|
||||
*
|
||||
* @note Can we make this per-cpu? then _Scheduler will be a macro.
|
||||
* Application provided via <rtems/confdefs.h>.
|
||||
*
|
||||
* @note This is instantiated and initialized in confdefs.h.
|
||||
* @see _Scheduler_Count.
|
||||
*/
|
||||
extern Scheduler_Control _Scheduler;
|
||||
extern const Scheduler_Control _Scheduler_Table[];
|
||||
|
||||
/**
|
||||
* @brief Count of registered schedulers.
|
||||
*
|
||||
* Application provided via <rtems/confdefs.h> on SMP configurations.
|
||||
*
|
||||
* It is very important that this is a compile-time constant on uni-processor
|
||||
* configurations (in this case RTEMS_SMP is not defined) so that the compiler
|
||||
* can optimize the some loops away
|
||||
*
|
||||
* @see _Scheduler_Table.
|
||||
*/
|
||||
#if defined(RTEMS_SMP)
|
||||
extern const size_t _Scheduler_Count;
|
||||
#else
|
||||
#define _Scheduler_Count ( (size_t) 1 )
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Returns an arbitrary non-NULL value.
|
||||
@@ -172,8 +202,8 @@ extern Scheduler_Control _Scheduler;
|
||||
* @return An arbitrary non-NULL value.
|
||||
*/
|
||||
void *_Scheduler_default_Allocate(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -183,8 +213,8 @@ void *_Scheduler_default_Allocate(
|
||||
* @param[in] the_thread Unused.
|
||||
*/
|
||||
void _Scheduler_default_Free(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -194,8 +224,8 @@ void _Scheduler_default_Free(
|
||||
* @param[in] the_thread Unused.
|
||||
*/
|
||||
void _Scheduler_default_Update(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -206,9 +236,9 @@ void _Scheduler_default_Update(
|
||||
* @param[in] deadline Unused.
|
||||
*/
|
||||
void _Scheduler_default_Release_job(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread,
|
||||
uint32_t deadline
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread,
|
||||
uint32_t deadline
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -219,7 +249,7 @@ void _Scheduler_default_Release_job(
|
||||
*
|
||||
* @param[in] scheduler The scheduler.
|
||||
*/
|
||||
void _Scheduler_default_Tick( Scheduler_Control *scheduler );
|
||||
void _Scheduler_default_Tick( const Scheduler_Control *scheduler );
|
||||
|
||||
/**
|
||||
* @brief Starts an idle thread.
|
||||
@@ -229,9 +259,9 @@ void _Scheduler_default_Tick( Scheduler_Control *scheduler );
|
||||
* @param[in] cpu This parameter is unused.
|
||||
*/
|
||||
void _Scheduler_default_Start_idle(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread,
|
||||
Per_CPU_Control *cpu
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread,
|
||||
Per_CPU_Control *cpu
|
||||
);
|
||||
|
||||
#if defined(__RTEMS_HAVE_SYS_CPUSET_H__) && defined(RTEMS_SMP)
|
||||
@@ -246,10 +276,10 @@ void _Scheduler_default_Start_idle(
|
||||
* @retval -1 The cpusetsize is invalid for the system
|
||||
*/
|
||||
bool _Scheduler_default_Get_affinity(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *thread,
|
||||
size_t cpusetsize,
|
||||
cpu_set_t *cpuset
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *thread,
|
||||
size_t cpusetsize,
|
||||
cpu_set_t *cpuset
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -265,10 +295,10 @@ void _Scheduler_default_Start_idle(
|
||||
* the cpuset.
|
||||
*/
|
||||
bool _Scheduler_default_Set_affinity(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *thread,
|
||||
size_t cpusetsize,
|
||||
const cpu_set_t *cpuset
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *thread,
|
||||
size_t cpusetsize,
|
||||
const cpu_set_t *cpuset
|
||||
);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ extern "C" {
|
||||
#define SCHEDULER_CBS_ERROR_NOSERVER SCHEDULER_CBS_ERROR_NOT_FOUND
|
||||
|
||||
/** Maximum number of simultaneous servers. */
|
||||
extern uint32_t _Scheduler_CBS_Maximum_servers;
|
||||
extern const uint32_t _Scheduler_CBS_Maximum_servers;
|
||||
|
||||
/** Server id. */
|
||||
typedef uint32_t Scheduler_CBS_Server_id;
|
||||
@@ -115,6 +115,13 @@ typedef struct {
|
||||
Scheduler_CBS_Parameters parameters;
|
||||
/** Callback function invoked when a budget overrun occurs. */
|
||||
Scheduler_CBS_Budget_overrun cbs_budget_overrun;
|
||||
|
||||
/**
|
||||
* @brief Indicates if this CBS server is initialized.
|
||||
*
|
||||
* @see _Scheduler_CBS_Create_server() and _Scheduler_CBS_Destroy_server().
|
||||
*/
|
||||
bool initialized;
|
||||
} Scheduler_CBS_Server;
|
||||
|
||||
/**
|
||||
@@ -132,7 +139,7 @@ typedef struct {
|
||||
* List of servers. The @a Scheduler_CBS_Server is the index to the array
|
||||
* of pointers to @a _Scheduler_CBS_Server_list.
|
||||
*/
|
||||
extern Scheduler_CBS_Server **_Scheduler_CBS_Server_list;
|
||||
extern Scheduler_CBS_Server _Scheduler_CBS_Server_list[];
|
||||
|
||||
/**
|
||||
* @brief Unblocks a thread from the queue.
|
||||
@@ -148,8 +155,8 @@ extern Scheduler_CBS_Server **_Scheduler_CBS_Server_list;
|
||||
* @note This has to be asessed as missed deadline of the current job.
|
||||
*/
|
||||
void _Scheduler_CBS_Unblock(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -165,9 +172,9 @@ void _Scheduler_CBS_Unblock(
|
||||
*/
|
||||
|
||||
void _Scheduler_CBS_Release_job (
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread,
|
||||
uint32_t length
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread,
|
||||
uint32_t length
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -338,9 +345,10 @@ void _Scheduler_CBS_Budget_callout(
|
||||
* management memory for.
|
||||
*/
|
||||
void *_Scheduler_CBS_Allocate(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -67,11 +67,16 @@ extern "C" {
|
||||
#define SCHEDULER_EDF_PRIO_MSB 0x80000000
|
||||
|
||||
typedef struct {
|
||||
/**
|
||||
* @brief Basic scheduler context.
|
||||
*/
|
||||
Scheduler_Context Base;
|
||||
|
||||
/**
|
||||
* Top of the ready queue.
|
||||
*/
|
||||
RBTree_Control Ready;
|
||||
} Scheduler_EDF_Control;
|
||||
} Scheduler_EDF_Context;
|
||||
|
||||
/**
|
||||
* @typedef Scheduler_EDF_Queue_state
|
||||
@@ -108,7 +113,7 @@ typedef struct {
|
||||
*
|
||||
* This routine initializes the EDF scheduler.
|
||||
*/
|
||||
void _Scheduler_EDF_Initialize( void );
|
||||
void _Scheduler_EDF_Initialize( const Scheduler_Control *scheduler );
|
||||
|
||||
/**
|
||||
* @brief Removes thread from ready queue.
|
||||
@@ -121,8 +126,8 @@ void _Scheduler_EDF_Initialize( void );
|
||||
* @param[in] the_thread is the thread to be blocked.
|
||||
*/
|
||||
void _Scheduler_EDF_Block(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -133,8 +138,8 @@ void _Scheduler_EDF_Block(
|
||||
* in the rbtree ready queue.
|
||||
*/
|
||||
void _Scheduler_EDF_Schedule(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -146,8 +151,8 @@ void _Scheduler_EDF_Schedule(
|
||||
* management memory for.
|
||||
*/
|
||||
void *_Scheduler_EDF_Allocate(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -159,8 +164,8 @@ void *_Scheduler_EDF_Allocate(
|
||||
* will be deallocated.
|
||||
*/
|
||||
void _Scheduler_EDF_Free(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -172,8 +177,8 @@ void _Scheduler_EDF_Free(
|
||||
* structure updated.
|
||||
*/
|
||||
void _Scheduler_EDF_Update(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -186,8 +191,8 @@ void _Scheduler_EDF_Update(
|
||||
* @param[in] the_thread will be unblocked.
|
||||
*/
|
||||
void _Scheduler_EDF_Unblock(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -206,8 +211,8 @@ void _Scheduler_EDF_Unblock(
|
||||
* @param[in,out] thread The yielding thread.
|
||||
*/
|
||||
void _Scheduler_EDF_Yield(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -218,8 +223,8 @@ void _Scheduler_EDF_Yield(
|
||||
* @param[in] the_thread will be enqueued to the ready queue.
|
||||
*/
|
||||
void _Scheduler_EDF_Enqueue(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -231,8 +236,8 @@ void _Scheduler_EDF_Enqueue(
|
||||
* @param[in] the_thread will be enqueued to the ready queue.
|
||||
*/
|
||||
void _Scheduler_EDF_Enqueue_first(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -245,8 +250,8 @@ void _Scheduler_EDF_Enqueue_first(
|
||||
* @param[in] the_thread will be extracted from the ready set.
|
||||
*/
|
||||
void _Scheduler_EDF_Extract(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -275,9 +280,9 @@ int _Scheduler_EDF_Priority_compare (
|
||||
* has to be suspended.
|
||||
*/
|
||||
void _Scheduler_EDF_Release_job (
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread,
|
||||
uint32_t deadline
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread,
|
||||
uint32_t deadline
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -31,21 +31,21 @@ extern "C" {
|
||||
* @{
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE Scheduler_EDF_Control *
|
||||
_Scheduler_EDF_Self_from_base( Scheduler_Control *scheduler_base )
|
||||
RTEMS_INLINE_ROUTINE Scheduler_EDF_Context *
|
||||
_Scheduler_EDF_Get_context( const Scheduler_Control *scheduler )
|
||||
{
|
||||
return (Scheduler_EDF_Control *) scheduler_base->information;
|
||||
return (Scheduler_EDF_Context *) scheduler->context;
|
||||
}
|
||||
|
||||
RTEMS_INLINE_ROUTINE void _Scheduler_EDF_Schedule_body(
|
||||
Scheduler_Control *scheduler_base,
|
||||
Thread_Control *the_thread,
|
||||
bool force_dispatch
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread,
|
||||
bool force_dispatch
|
||||
)
|
||||
{
|
||||
Scheduler_EDF_Control *scheduler =
|
||||
_Scheduler_EDF_Self_from_base( scheduler_base );
|
||||
RBTree_Node *first = _RBTree_First(&scheduler->Ready, RBT_LEFT);
|
||||
Scheduler_EDF_Context *context =
|
||||
_Scheduler_EDF_Get_context( scheduler );
|
||||
RBTree_Node *first = _RBTree_First( &context->Ready, RBT_LEFT );
|
||||
Scheduler_EDF_Per_thread *sched_info =
|
||||
_RBTree_Container_of(first, Scheduler_EDF_Per_thread, Node);
|
||||
Thread_Control *heir = (Thread_Control *) sched_info->thread;
|
||||
|
||||
@@ -64,8 +64,8 @@ void _Scheduler_Handler_initialization( void );
|
||||
* @param[in] the_thread The thread which state changed previously.
|
||||
*/
|
||||
RTEMS_INLINE_ROUTINE void _Scheduler_Schedule(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
( *scheduler->Operations.schedule )( scheduler, the_thread );
|
||||
@@ -80,8 +80,8 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Schedule(
|
||||
* @param[in] the_thread The yielding thread.
|
||||
*/
|
||||
RTEMS_INLINE_ROUTINE void _Scheduler_Yield(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
( *scheduler->Operations.yield )( scheduler, the_thread );
|
||||
@@ -96,8 +96,8 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Yield(
|
||||
* including the selection of a new heir thread.
|
||||
*/
|
||||
RTEMS_INLINE_ROUTINE void _Scheduler_Block(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
( *scheduler->Operations.block )( scheduler, the_thread );
|
||||
@@ -112,8 +112,8 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Block(
|
||||
* scheduling variables, for example the heir thread.
|
||||
*/
|
||||
RTEMS_INLINE_ROUTINE void _Scheduler_Unblock(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
( *scheduler->Operations.unblock )( scheduler, the_thread );
|
||||
@@ -125,8 +125,8 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Unblock(
|
||||
* This routine allocates @a the_thread->scheduler
|
||||
*/
|
||||
RTEMS_INLINE_ROUTINE void* _Scheduler_Allocate(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
return ( *scheduler->Operations.allocate )( scheduler, the_thread );
|
||||
@@ -138,8 +138,8 @@ RTEMS_INLINE_ROUTINE void* _Scheduler_Allocate(
|
||||
* This routine frees @a the_thread->scheduler
|
||||
*/
|
||||
RTEMS_INLINE_ROUTINE void _Scheduler_Free(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
( *scheduler->Operations.free )( scheduler, the_thread );
|
||||
@@ -151,8 +151,8 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Free(
|
||||
* This routine updates @a the_thread->scheduler
|
||||
*/
|
||||
RTEMS_INLINE_ROUTINE void _Scheduler_Update(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
( *scheduler->Operations.update )( scheduler, the_thread );
|
||||
@@ -164,8 +164,8 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Update(
|
||||
* This routine enqueue @a the_thread->scheduler
|
||||
*/
|
||||
RTEMS_INLINE_ROUTINE void _Scheduler_Enqueue(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
( *scheduler->Operations.enqueue )( scheduler, the_thread );
|
||||
@@ -177,8 +177,8 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Enqueue(
|
||||
* This routine enqueue_first @a the_thread->scheduler
|
||||
*/
|
||||
RTEMS_INLINE_ROUTINE void _Scheduler_Enqueue_first(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
( *scheduler->Operations.enqueue_first )( scheduler, the_thread );
|
||||
@@ -190,8 +190,8 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Enqueue_first(
|
||||
* This routine extract @a the_thread->scheduler
|
||||
*/
|
||||
RTEMS_INLINE_ROUTINE void _Scheduler_Extract(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
( *scheduler->Operations.extract )( scheduler, the_thread );
|
||||
@@ -203,9 +203,9 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Extract(
|
||||
* This routine compares two priorities.
|
||||
*/
|
||||
RTEMS_INLINE_ROUTINE int _Scheduler_Priority_compare(
|
||||
Scheduler_Control *scheduler,
|
||||
Priority_Control p1,
|
||||
Priority_Control p2
|
||||
const Scheduler_Control *scheduler,
|
||||
Priority_Control p1,
|
||||
Priority_Control p2
|
||||
)
|
||||
{
|
||||
return ( *scheduler->Operations.priority_compare )( p1, p2 );
|
||||
@@ -217,9 +217,9 @@ RTEMS_INLINE_ROUTINE int _Scheduler_Priority_compare(
|
||||
* This routine is called when a new period of task is issued.
|
||||
*/
|
||||
RTEMS_INLINE_ROUTINE void _Scheduler_Release_job(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread,
|
||||
uint32_t length
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread,
|
||||
uint32_t length
|
||||
)
|
||||
{
|
||||
( *scheduler->Operations.release_job )( scheduler, the_thread, length );
|
||||
@@ -233,7 +233,9 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Release_job(
|
||||
* scheduler which support standard RTEMS features, this includes
|
||||
* time-slicing management.
|
||||
*/
|
||||
RTEMS_INLINE_ROUTINE void _Scheduler_Tick( Scheduler_Control *scheduler )
|
||||
RTEMS_INLINE_ROUTINE void _Scheduler_Tick(
|
||||
const Scheduler_Control *scheduler
|
||||
)
|
||||
{
|
||||
( *scheduler->Operations.tick )( scheduler );
|
||||
}
|
||||
@@ -247,9 +249,9 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Tick( Scheduler_Control *scheduler )
|
||||
* @see _Thread_Create_idle().
|
||||
*/
|
||||
RTEMS_INLINE_ROUTINE void _Scheduler_Start_idle(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread,
|
||||
Per_CPU_Control *cpu
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread,
|
||||
Per_CPU_Control *cpu
|
||||
)
|
||||
{
|
||||
( *scheduler->Operations.start_idle )( scheduler, the_thread, cpu );
|
||||
@@ -263,15 +265,15 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Start_idle(
|
||||
* @parma[out] cpuset The processor affinity for this thread
|
||||
*/
|
||||
RTEMS_INLINE_ROUTINE int _Scheduler_Get_affinity(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *thread,
|
||||
size_t cpusetsize,
|
||||
cpu_set_t *cpuset
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread,
|
||||
size_t cpusetsize,
|
||||
cpu_set_t *cpuset
|
||||
)
|
||||
{
|
||||
return ( *scheduler->Operations.get_affinity )(
|
||||
scheduler,
|
||||
thread,
|
||||
the_thread,
|
||||
cpusetsize,
|
||||
cpuset
|
||||
);
|
||||
@@ -284,15 +286,15 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Start_idle(
|
||||
* @parma[in] cpuset The processor affinity for this thread
|
||||
*/
|
||||
RTEMS_INLINE_ROUTINE int _Scheduler_Set_affinity(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *thread,
|
||||
size_t cpusetsize,
|
||||
const cpu_set_t *cpuset
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread,
|
||||
size_t cpusetsize,
|
||||
const cpu_set_t *cpuset
|
||||
)
|
||||
{
|
||||
return ( *scheduler->Operations.set_affinity )(
|
||||
scheduler,
|
||||
thread,
|
||||
the_thread,
|
||||
cpusetsize,
|
||||
cpuset
|
||||
);
|
||||
@@ -313,10 +315,15 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Update_heir(
|
||||
}
|
||||
|
||||
RTEMS_INLINE_ROUTINE void _Scheduler_Generic_block(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread,
|
||||
void ( *extract )( Scheduler_Control *, Thread_Control * ),
|
||||
void ( *schedule )( Scheduler_Control *, Thread_Control *, bool )
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread,
|
||||
void ( *extract )(
|
||||
const Scheduler_Control *,
|
||||
Thread_Control * ),
|
||||
void ( *schedule )(
|
||||
const Scheduler_Control *,
|
||||
Thread_Control *,
|
||||
bool )
|
||||
)
|
||||
{
|
||||
( *extract )( scheduler, the_thread );
|
||||
@@ -333,9 +340,9 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Generic_block(
|
||||
* intuitive sense of priority.
|
||||
*/
|
||||
RTEMS_INLINE_ROUTINE bool _Scheduler_Is_priority_lower_than(
|
||||
Scheduler_Control *scheduler,
|
||||
Priority_Control p1,
|
||||
Priority_Control p2
|
||||
const Scheduler_Control *scheduler,
|
||||
Priority_Control p1,
|
||||
Priority_Control p2
|
||||
)
|
||||
{
|
||||
return _Scheduler_Priority_compare( scheduler, p1, p2 ) < 0;
|
||||
@@ -346,9 +353,9 @@ RTEMS_INLINE_ROUTINE bool _Scheduler_Is_priority_lower_than(
|
||||
* intuitive sense of priority.
|
||||
*/
|
||||
RTEMS_INLINE_ROUTINE bool _Scheduler_Is_priority_higher_than(
|
||||
Scheduler_Control *scheduler,
|
||||
Priority_Control p1,
|
||||
Priority_Control p2
|
||||
const Scheduler_Control *scheduler,
|
||||
Priority_Control p1,
|
||||
Priority_Control p2
|
||||
)
|
||||
{
|
||||
return _Scheduler_Priority_compare( scheduler, p1, p2 ) > 0;
|
||||
@@ -359,9 +366,9 @@ RTEMS_INLINE_ROUTINE bool _Scheduler_Is_priority_higher_than(
|
||||
* in the intuitive sense of priority.
|
||||
*/
|
||||
RTEMS_INLINE_ROUTINE Priority_Control _Scheduler_Highest_priority_of_two(
|
||||
Scheduler_Control *scheduler,
|
||||
Priority_Control p1,
|
||||
Priority_Control p2
|
||||
const Scheduler_Control *scheduler,
|
||||
Priority_Control p1,
|
||||
Priority_Control p2
|
||||
)
|
||||
{
|
||||
return _Scheduler_Is_priority_higher_than( scheduler, p1, p2 ) ? p1 : p2;
|
||||
@@ -372,9 +379,9 @@ RTEMS_INLINE_ROUTINE Priority_Control _Scheduler_Highest_priority_of_two(
|
||||
* current priority of the thread in the intuitive sense of priority.
|
||||
*/
|
||||
RTEMS_INLINE_ROUTINE void _Scheduler_Set_priority_if_higher(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread,
|
||||
Priority_Control priority
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread,
|
||||
Priority_Control priority
|
||||
)
|
||||
{
|
||||
Priority_Control current = the_thread->current_priority;
|
||||
@@ -389,10 +396,10 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Set_priority_if_higher(
|
||||
* current priority of the thread in the intuitive sense of priority.
|
||||
*/
|
||||
RTEMS_INLINE_ROUTINE void _Scheduler_Change_priority_if_higher(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread,
|
||||
Priority_Control priority,
|
||||
bool prepend_it
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread,
|
||||
Priority_Control priority,
|
||||
bool prepend_it
|
||||
)
|
||||
{
|
||||
Priority_Control current = the_thread->current_priority;
|
||||
@@ -402,13 +409,13 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Change_priority_if_higher(
|
||||
}
|
||||
}
|
||||
|
||||
RTEMS_INLINE_ROUTINE Scheduler_Control *_Scheduler_Get(
|
||||
RTEMS_INLINE_ROUTINE const Scheduler_Control *_Scheduler_Get(
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
(void) the_thread;
|
||||
|
||||
return &_Scheduler;
|
||||
return &_Scheduler_Table[ 0 ];
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
||||
@@ -66,6 +66,11 @@ extern "C" {
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
/**
|
||||
* @brief Basic scheduler context.
|
||||
*/
|
||||
Scheduler_Context Base;
|
||||
|
||||
/**
|
||||
* @brief Bit map to indicate non-empty ready queues.
|
||||
*/
|
||||
@@ -74,8 +79,8 @@ typedef struct {
|
||||
/**
|
||||
* @brief One ready queue per priority level.
|
||||
*/
|
||||
Chain_Control Ready[ 1 ];
|
||||
} Scheduler_priority_Control;
|
||||
Chain_Control Ready[ 0 ];
|
||||
} Scheduler_priority_Context;
|
||||
|
||||
/**
|
||||
* Per-thread data related to the _Scheduler_PRIORITY scheduling policy.
|
||||
@@ -92,7 +97,7 @@ typedef struct {
|
||||
* @brief Initializes the priority scheduler.
|
||||
* This routine initializes the priority scheduler.
|
||||
*/
|
||||
void _Scheduler_priority_Initialize(void);
|
||||
void _Scheduler_priority_Initialize( const Scheduler_Control *scheduler );
|
||||
|
||||
/**
|
||||
* @brief Removes @a the_thread from the scheduling decision.
|
||||
@@ -105,8 +110,8 @@ void _Scheduler_priority_Initialize(void);
|
||||
* @param[in] the_thread is the thread to be blocked
|
||||
*/
|
||||
void _Scheduler_priority_Block(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -116,8 +121,8 @@ void _Scheduler_priority_Block(
|
||||
* by invoking the_scheduler->ready_queue->operations->first().
|
||||
*/
|
||||
void _Scheduler_priority_Schedule(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -129,8 +134,8 @@ void _Scheduler_priority_Schedule(
|
||||
* management memory for
|
||||
*/
|
||||
void * _Scheduler_priority_Allocate(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -142,8 +147,8 @@ void * _Scheduler_priority_Allocate(
|
||||
* will be deallocated.
|
||||
*/
|
||||
void _Scheduler_priority_Free(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -155,8 +160,8 @@ void _Scheduler_priority_Free(
|
||||
* structure updated.
|
||||
*/
|
||||
void _Scheduler_priority_Update(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -169,8 +174,8 @@ void _Scheduler_priority_Update(
|
||||
* @param[in] the_thread will be unblocked
|
||||
*/
|
||||
void _Scheduler_priority_Unblock(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -193,8 +198,8 @@ void _Scheduler_priority_Unblock(
|
||||
* @param[in,out] thread The yielding thread.
|
||||
*/
|
||||
void _Scheduler_priority_Yield(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -205,8 +210,8 @@ void _Scheduler_priority_Yield(
|
||||
* @param[in] the_thread will be enqueued at the TAIL of its priority.
|
||||
*/
|
||||
void _Scheduler_priority_Enqueue(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -219,8 +224,8 @@ void _Scheduler_priority_Enqueue(
|
||||
* @param[in] the_thread will be enqueued at the HEAD of its priority.
|
||||
*/
|
||||
void _Scheduler_priority_Enqueue_first(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -232,8 +237,8 @@ void _Scheduler_priority_Enqueue_first(
|
||||
* @param[in] the_thread will be extracted from the ready set.
|
||||
*/
|
||||
void _Scheduler_priority_Extract(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/**
|
||||
|
||||
@@ -78,8 +78,8 @@ extern "C" {
|
||||
* management memory for.
|
||||
*/
|
||||
void * _Scheduler_priority_affinity_SMP_Allocate(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -94,10 +94,10 @@ void * _Scheduler_priority_affinity_SMP_Allocate(
|
||||
* @retval -1 The cpusetsize is invalid for the system
|
||||
*/
|
||||
bool _Scheduler_priority_affinity_SMP_Get_affinity(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *thread,
|
||||
size_t cpusetsize,
|
||||
cpu_set_t *cpuset
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *thread,
|
||||
size_t cpusetsize,
|
||||
cpu_set_t *cpuset
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -111,10 +111,10 @@ bool _Scheduler_priority_affinity_SMP_Get_affinity(
|
||||
* @retval 0 Successful
|
||||
*/
|
||||
bool _Scheduler_priority_affinity_SMP_Set_affinity(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *thread,
|
||||
size_t cpusetsize,
|
||||
cpu_set_t *cpuset
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *thread,
|
||||
size_t cpusetsize,
|
||||
cpu_set_t *cpuset
|
||||
);
|
||||
|
||||
/**
|
||||
|
||||
@@ -35,10 +35,10 @@ extern "C" {
|
||||
*/
|
||||
/**@{**/
|
||||
|
||||
RTEMS_INLINE_ROUTINE Scheduler_priority_Control *
|
||||
_Scheduler_priority_Self_from_base( Scheduler_Control *scheduler_base )
|
||||
RTEMS_INLINE_ROUTINE Scheduler_priority_Context *
|
||||
_Scheduler_priority_Get_context( const Scheduler_Control *scheduler )
|
||||
{
|
||||
return (Scheduler_priority_Control *) scheduler_base->information;
|
||||
return (Scheduler_priority_Context *) scheduler->context;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -134,14 +134,14 @@ RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_extract(
|
||||
}
|
||||
|
||||
RTEMS_INLINE_ROUTINE void _Scheduler_priority_Extract_body(
|
||||
Scheduler_Control *scheduler_base,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
Scheduler_priority_Control *scheduler =
|
||||
_Scheduler_priority_Self_from_base( scheduler_base );
|
||||
Scheduler_priority_Context *context =
|
||||
_Scheduler_priority_Get_context( scheduler );
|
||||
|
||||
_Scheduler_priority_Ready_queue_extract( the_thread, &scheduler->Bit_map );
|
||||
_Scheduler_priority_Ready_queue_extract( the_thread, &context->Bit_map );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -193,16 +193,16 @@ RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_requeue(
|
||||
* for priority-based scheduling.
|
||||
*/
|
||||
RTEMS_INLINE_ROUTINE void _Scheduler_priority_Schedule_body(
|
||||
Scheduler_Control *scheduler_base,
|
||||
Thread_Control *the_thread,
|
||||
bool force_dispatch
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread,
|
||||
bool force_dispatch
|
||||
)
|
||||
{
|
||||
Scheduler_priority_Control *scheduler =
|
||||
_Scheduler_priority_Self_from_base( scheduler_base );
|
||||
Scheduler_priority_Context *context =
|
||||
_Scheduler_priority_Get_context( scheduler );
|
||||
Thread_Control *heir = _Scheduler_priority_Ready_queue_first(
|
||||
&scheduler->Bit_map,
|
||||
&scheduler->Ready[ 0 ]
|
||||
&context->Bit_map,
|
||||
&context->Ready[ 0 ]
|
||||
);
|
||||
|
||||
( void ) the_thread;
|
||||
|
||||
@@ -47,6 +47,12 @@ extern "C" {
|
||||
* @{
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
Scheduler_SMP_Context Base;
|
||||
Priority_bit_map_Control Bit_map;
|
||||
Chain_Control Ready[ 0 ];
|
||||
} Scheduler_priority_SMP_Context;
|
||||
|
||||
/**
|
||||
* @brief Entry points for the Priority SMP Scheduler.
|
||||
*/
|
||||
@@ -71,45 +77,45 @@ extern "C" {
|
||||
_Scheduler_default_Set_affinity \
|
||||
}
|
||||
|
||||
void _Scheduler_priority_SMP_Initialize( void );
|
||||
void _Scheduler_priority_SMP_Initialize( const Scheduler_Control *scheduler );
|
||||
|
||||
void _Scheduler_priority_SMP_Schedule(
|
||||
Scheduler_Control *base,
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *thread
|
||||
);
|
||||
|
||||
void _Scheduler_priority_SMP_Block(
|
||||
Scheduler_Control *base,
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *thread
|
||||
);
|
||||
|
||||
void _Scheduler_priority_SMP_Update(
|
||||
Scheduler_Control *base,
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *thread
|
||||
);
|
||||
|
||||
void _Scheduler_priority_SMP_Enqueue_fifo(
|
||||
Scheduler_Control *base,
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *thread
|
||||
);
|
||||
|
||||
void _Scheduler_priority_SMP_Enqueue_lifo(
|
||||
Scheduler_Control *base,
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *thread
|
||||
);
|
||||
|
||||
void _Scheduler_priority_SMP_Extract(
|
||||
Scheduler_Control *base,
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *thread
|
||||
);
|
||||
|
||||
void _Scheduler_priority_SMP_Yield(
|
||||
Scheduler_Control *base,
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *thread
|
||||
);
|
||||
|
||||
void _Scheduler_priority_SMP_Start_idle(
|
||||
Scheduler_Control *base,
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *thread,
|
||||
Per_CPU_Control *cpu
|
||||
);
|
||||
|
||||
@@ -55,21 +55,26 @@ extern "C" {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Simple scheduler control.
|
||||
* @brief Simple scheduler context.
|
||||
*/
|
||||
typedef struct {
|
||||
/**
|
||||
* @brief Basic scheduler context.
|
||||
*/
|
||||
Scheduler_Context Base;
|
||||
|
||||
/**
|
||||
* @brief One ready queue for all ready threads.
|
||||
*/
|
||||
Chain_Control Ready;
|
||||
} Scheduler_simple_Control;
|
||||
} Scheduler_simple_Context;
|
||||
|
||||
/**
|
||||
* @brief Initialize simple scheduler.
|
||||
*
|
||||
* This routine initializes the simple scheduler.
|
||||
*/
|
||||
void _Scheduler_simple_Initialize( void );
|
||||
void _Scheduler_simple_Initialize( const Scheduler_Control *scheduler );
|
||||
|
||||
/**
|
||||
* This routine sets the heir thread to be the next ready thread
|
||||
@@ -77,8 +82,8 @@ void _Scheduler_simple_Initialize( void );
|
||||
* information.
|
||||
*/
|
||||
void _Scheduler_simple_Schedule(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -98,8 +103,8 @@ void _Scheduler_simple_Schedule(
|
||||
* @param[in,out] thread The yielding thread.
|
||||
*/
|
||||
void _Scheduler_simple_Yield(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -113,8 +118,8 @@ void _Scheduler_simple_Yield(
|
||||
* @param[in] the_thread is the thread that is to be blocked
|
||||
*/
|
||||
void _Scheduler_simple_Block(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -127,8 +132,8 @@ void _Scheduler_simple_Block(
|
||||
* @param[in] the_thread is the thread that is to be unblocked
|
||||
*/
|
||||
void _Scheduler_simple_Unblock(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -140,8 +145,8 @@ void _Scheduler_simple_Unblock(
|
||||
* @param[in] the_thread is the thread to be blocked
|
||||
*/
|
||||
void _Scheduler_simple_Extract(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -152,8 +157,8 @@ void _Scheduler_simple_Extract(
|
||||
* @param[in] the_thread is the thread to be enqueued
|
||||
*/
|
||||
void _Scheduler_simple_Enqueue(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -166,8 +171,8 @@ void _Scheduler_simple_Enqueue(
|
||||
* @param[in] the_thread is the thread to be blocked
|
||||
*/
|
||||
void _Scheduler_simple_Enqueue_first(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -179,8 +184,8 @@ void _Scheduler_simple_Enqueue_first(
|
||||
* @param[in] the_thread - pointer to a thread control block
|
||||
*/
|
||||
void _Scheduler_simple_Ready_queue_enqueue(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -193,8 +198,8 @@ void _Scheduler_simple_Ready_queue_enqueue(
|
||||
* @param[in] the_thread - pointer to a thread control block
|
||||
*/
|
||||
void _Scheduler_simple_Ready_queue_enqueue_first(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/**@}*/
|
||||
|
||||
@@ -32,10 +32,10 @@ extern "C" {
|
||||
*/
|
||||
/**@{**/
|
||||
|
||||
RTEMS_INLINE_ROUTINE Scheduler_simple_Control *
|
||||
_Scheduler_simple_Self_from_base( Scheduler_Control *scheduler_base )
|
||||
RTEMS_INLINE_ROUTINE Scheduler_simple_Context *
|
||||
_Scheduler_simple_Get_context( const Scheduler_Control *scheduler )
|
||||
{
|
||||
return (Scheduler_simple_Control *) scheduler_base->information;
|
||||
return (Scheduler_simple_Context *) scheduler->context;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -45,8 +45,8 @@ RTEMS_INLINE_ROUTINE Scheduler_simple_Control *
|
||||
* @param[in] the_thread is the thread to be blocked
|
||||
*/
|
||||
RTEMS_INLINE_ROUTINE void _Scheduler_simple_Ready_queue_requeue(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
/* extract */
|
||||
@@ -103,14 +103,14 @@ RTEMS_INLINE_ROUTINE void _Scheduler_simple_Insert_priority_fifo(
|
||||
}
|
||||
|
||||
RTEMS_INLINE_ROUTINE void _Scheduler_simple_Schedule_body(
|
||||
Scheduler_Control *scheduler_base,
|
||||
Thread_Control *the_thread,
|
||||
bool force_dispatch
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread,
|
||||
bool force_dispatch
|
||||
)
|
||||
{
|
||||
Scheduler_simple_Control *scheduler =
|
||||
_Scheduler_simple_Self_from_base( scheduler_base );
|
||||
Thread_Control *heir = (Thread_Control *) _Chain_First( &scheduler->Ready );
|
||||
Scheduler_simple_Context *context =
|
||||
_Scheduler_simple_Get_context( scheduler );
|
||||
Thread_Control *heir = (Thread_Control *) _Chain_First( &context->Ready );
|
||||
|
||||
( void ) the_thread;
|
||||
|
||||
|
||||
@@ -49,6 +49,11 @@ extern "C" {
|
||||
* @{
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
Scheduler_SMP_Context Base;
|
||||
Chain_Control Ready;
|
||||
} Scheduler_simple_SMP_Context;
|
||||
|
||||
/**
|
||||
* @brief Entry points for the Simple SMP Scheduler.
|
||||
*/
|
||||
@@ -73,40 +78,40 @@ extern "C" {
|
||||
_Scheduler_default_Set_affinity \
|
||||
}
|
||||
|
||||
void _Scheduler_simple_smp_Initialize( void );
|
||||
void _Scheduler_simple_smp_Initialize( const Scheduler_Control *scheduler );
|
||||
|
||||
void _Scheduler_simple_smp_Block(
|
||||
Scheduler_Control *base,
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *thread
|
||||
);
|
||||
|
||||
void _Scheduler_simple_smp_Enqueue_priority_fifo(
|
||||
Scheduler_Control *base,
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *thread
|
||||
);
|
||||
|
||||
void _Scheduler_simple_smp_Enqueue_priority_lifo(
|
||||
Scheduler_Control *base,
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *thread
|
||||
);
|
||||
|
||||
void _Scheduler_simple_smp_Extract(
|
||||
Scheduler_Control *base,
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *thread
|
||||
);
|
||||
|
||||
void _Scheduler_simple_smp_Yield(
|
||||
Scheduler_Control *base,
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *thread
|
||||
);
|
||||
|
||||
void _Scheduler_simple_smp_Schedule(
|
||||
Scheduler_Control *base,
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *thread
|
||||
);
|
||||
|
||||
void _Scheduler_simple_smp_Start_idle(
|
||||
Scheduler_Control *base,
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *thread,
|
||||
Per_CPU_Control *cpu
|
||||
);
|
||||
|
||||
@@ -41,19 +41,13 @@ extern "C" {
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
/**
|
||||
* @brief Basic scheduler context.
|
||||
*/
|
||||
Scheduler_Context Base;
|
||||
|
||||
Chain_Control Scheduled;
|
||||
} Scheduler_SMP_Control;
|
||||
|
||||
typedef struct {
|
||||
Scheduler_SMP_Control Base;
|
||||
Chain_Control Ready;
|
||||
} Scheduler_simple_SMP_Control;
|
||||
|
||||
typedef struct {
|
||||
Scheduler_SMP_Control Base;
|
||||
Priority_bit_map_Control Bit_map;
|
||||
Chain_Control Ready[ 1 ];
|
||||
} Scheduler_priority_SMP_Control;
|
||||
} Scheduler_SMP_Context;
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
@@ -39,26 +39,26 @@ extern "C" {
|
||||
*/
|
||||
|
||||
typedef Thread_Control *( *Scheduler_SMP_Get_highest_ready )(
|
||||
Scheduler_SMP_Control *self
|
||||
Scheduler_SMP_Context *self
|
||||
);
|
||||
|
||||
typedef void ( *Scheduler_SMP_Extract )(
|
||||
Scheduler_SMP_Control *self,
|
||||
Scheduler_SMP_Context *self,
|
||||
Thread_Control *thread
|
||||
);
|
||||
|
||||
typedef void ( *Scheduler_SMP_Insert )(
|
||||
Scheduler_SMP_Control *self,
|
||||
Scheduler_SMP_Context *self,
|
||||
Thread_Control *thread_to_insert
|
||||
);
|
||||
|
||||
typedef void ( *Scheduler_SMP_Move )(
|
||||
Scheduler_SMP_Control *self,
|
||||
Scheduler_SMP_Context *self,
|
||||
Thread_Control *thread_to_move
|
||||
);
|
||||
|
||||
static inline void _Scheduler_SMP_Initialize(
|
||||
Scheduler_SMP_Control *self
|
||||
Scheduler_SMP_Context *self
|
||||
)
|
||||
{
|
||||
_Chain_Initialize_empty( &self->Scheduled );
|
||||
@@ -107,7 +107,7 @@ static inline void _Scheduler_SMP_Allocate_processor(
|
||||
}
|
||||
|
||||
static inline Thread_Control *_Scheduler_SMP_Get_lowest_scheduled(
|
||||
Scheduler_SMP_Control *self
|
||||
Scheduler_SMP_Context *self
|
||||
)
|
||||
{
|
||||
Thread_Control *lowest_ready = NULL;
|
||||
@@ -121,7 +121,7 @@ static inline Thread_Control *_Scheduler_SMP_Get_lowest_scheduled(
|
||||
}
|
||||
|
||||
static inline void _Scheduler_SMP_Enqueue_ordered(
|
||||
Scheduler_SMP_Control *self,
|
||||
Scheduler_SMP_Context *self,
|
||||
Thread_Control *thread,
|
||||
Chain_Node_order order,
|
||||
Scheduler_SMP_Get_highest_ready get_highest_ready,
|
||||
@@ -177,7 +177,7 @@ static inline void _Scheduler_SMP_Enqueue_ordered(
|
||||
}
|
||||
|
||||
static inline void _Scheduler_SMP_Schedule_highest_ready(
|
||||
Scheduler_SMP_Control *self,
|
||||
Scheduler_SMP_Context *self,
|
||||
Thread_Control *victim,
|
||||
Scheduler_SMP_Get_highest_ready get_highest_ready,
|
||||
Scheduler_SMP_Move move_from_ready_to_scheduled
|
||||
@@ -191,7 +191,7 @@ static inline void _Scheduler_SMP_Schedule_highest_ready(
|
||||
}
|
||||
|
||||
static inline void _Scheduler_SMP_Block(
|
||||
Scheduler_SMP_Control *self,
|
||||
Scheduler_SMP_Context *self,
|
||||
Thread_Control *thread,
|
||||
Scheduler_SMP_Extract extract,
|
||||
Scheduler_SMP_Get_highest_ready get_highest_ready,
|
||||
@@ -213,7 +213,7 @@ static inline void _Scheduler_SMP_Block(
|
||||
}
|
||||
|
||||
static inline void _Scheduler_SMP_Extract(
|
||||
Scheduler_SMP_Control *self,
|
||||
Scheduler_SMP_Context *self,
|
||||
Thread_Control *thread,
|
||||
Scheduler_SMP_Extract extract
|
||||
)
|
||||
@@ -222,7 +222,7 @@ static inline void _Scheduler_SMP_Extract(
|
||||
}
|
||||
|
||||
static inline void _Scheduler_SMP_Schedule(
|
||||
Scheduler_SMP_Control *self,
|
||||
Scheduler_SMP_Context *self,
|
||||
Thread_Control *thread,
|
||||
Scheduler_SMP_Get_highest_ready get_highest_ready,
|
||||
Scheduler_SMP_Move move_from_ready_to_scheduled
|
||||
@@ -241,7 +241,7 @@ static inline void _Scheduler_SMP_Schedule(
|
||||
}
|
||||
|
||||
static inline void _Scheduler_SMP_Insert_scheduled_lifo(
|
||||
Scheduler_SMP_Control *self,
|
||||
Scheduler_SMP_Context *self,
|
||||
Thread_Control *thread
|
||||
)
|
||||
{
|
||||
@@ -253,7 +253,7 @@ static inline void _Scheduler_SMP_Insert_scheduled_lifo(
|
||||
}
|
||||
|
||||
static inline void _Scheduler_SMP_Insert_scheduled_fifo(
|
||||
Scheduler_SMP_Control *self,
|
||||
Scheduler_SMP_Context *self,
|
||||
Thread_Control *thread
|
||||
)
|
||||
{
|
||||
@@ -265,7 +265,7 @@ static inline void _Scheduler_SMP_Insert_scheduled_fifo(
|
||||
}
|
||||
|
||||
static inline void _Scheduler_SMP_Start_idle(
|
||||
Scheduler_SMP_Control *self,
|
||||
Scheduler_SMP_Context *self,
|
||||
Thread_Control *thread,
|
||||
Per_CPU_Control *cpu
|
||||
)
|
||||
|
||||
@@ -22,5 +22,12 @@
|
||||
|
||||
void _Scheduler_Handler_initialization(void)
|
||||
{
|
||||
(*_Scheduler.Operations.initialize)();
|
||||
size_t n = _Scheduler_Count;
|
||||
size_t i;
|
||||
|
||||
for ( i = 0 ; i < n ; ++i ) {
|
||||
const Scheduler_Control *scheduler = &_Scheduler_Table[ i ];
|
||||
|
||||
( *scheduler->Operations.initialize )( scheduler );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,8 +22,6 @@
|
||||
#include <rtems/score/threadimpl.h>
|
||||
#include <rtems/score/wkspace.h>
|
||||
|
||||
Scheduler_CBS_Server **_Scheduler_CBS_Server_list;
|
||||
|
||||
void _Scheduler_CBS_Budget_callout(
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
@@ -52,13 +50,5 @@ void _Scheduler_CBS_Budget_callout(
|
||||
|
||||
int _Scheduler_CBS_Initialize(void)
|
||||
{
|
||||
unsigned int i;
|
||||
_Scheduler_CBS_Server_list = (Scheduler_CBS_Server **) _Workspace_Allocate(
|
||||
_Scheduler_CBS_Maximum_servers * sizeof(Scheduler_CBS_Server*) );
|
||||
if ( !_Scheduler_CBS_Server_list )
|
||||
return SCHEDULER_CBS_ERROR_NO_MEMORY;
|
||||
for (i = 0; i<_Scheduler_CBS_Maximum_servers; i++) {
|
||||
_Scheduler_CBS_Server_list[i] = NULL;
|
||||
}
|
||||
return SCHEDULER_CBS_OK;
|
||||
}
|
||||
|
||||
@@ -26,8 +26,8 @@
|
||||
#include <rtems/score/wkspace.h>
|
||||
|
||||
void *_Scheduler_CBS_Allocate(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
void *sched;
|
||||
|
||||
@@ -33,11 +33,11 @@ int _Scheduler_CBS_Attach_thread (
|
||||
return SCHEDULER_CBS_ERROR_INVALID_PARAMETER;
|
||||
|
||||
/* Server is not valid. */
|
||||
if ( !_Scheduler_CBS_Server_list[server_id] )
|
||||
if ( !_Scheduler_CBS_Server_list[server_id].initialized )
|
||||
return SCHEDULER_CBS_ERROR_NOSERVER;
|
||||
|
||||
/* Server is already attached to a thread. */
|
||||
if ( _Scheduler_CBS_Server_list[server_id]->task_id != -1 )
|
||||
if ( _Scheduler_CBS_Server_list[server_id].task_id != -1 )
|
||||
return SCHEDULER_CBS_ERROR_FULL;
|
||||
|
||||
the_thread = _Thread_Get(task_id, &location);
|
||||
@@ -53,8 +53,8 @@ int _Scheduler_CBS_Attach_thread (
|
||||
return SCHEDULER_CBS_ERROR_FULL;
|
||||
}
|
||||
|
||||
_Scheduler_CBS_Server_list[server_id]->task_id = task_id;
|
||||
sched_info->cbs_server = (void *) _Scheduler_CBS_Server_list[server_id];
|
||||
_Scheduler_CBS_Server_list[server_id].task_id = task_id;
|
||||
sched_info->cbs_server = &_Scheduler_CBS_Server_list[server_id];
|
||||
|
||||
the_thread->budget_callout = _Scheduler_CBS_Budget_callout;
|
||||
the_thread->budget_algorithm = THREAD_CPU_BUDGET_ALGORITHM_CALLOUT;
|
||||
|
||||
@@ -26,9 +26,8 @@ int _Scheduler_CBS_Cleanup (void)
|
||||
unsigned int i;
|
||||
|
||||
for ( i = 0; i<_Scheduler_CBS_Maximum_servers; i++ ) {
|
||||
if ( _Scheduler_CBS_Server_list[ i ] )
|
||||
if ( _Scheduler_CBS_Server_list[ i ].initialized )
|
||||
_Scheduler_CBS_Destroy_server( i );
|
||||
}
|
||||
_Workspace_Free( _Scheduler_CBS_Server_list );
|
||||
return SCHEDULER_CBS_OK;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#endif
|
||||
|
||||
#include <rtems/score/schedulercbs.h>
|
||||
#include <rtems/score/wkspace.h>
|
||||
|
||||
int _Scheduler_CBS_Create_server (
|
||||
Scheduler_CBS_Parameters *params,
|
||||
@@ -37,7 +36,7 @@ int _Scheduler_CBS_Create_server (
|
||||
return SCHEDULER_CBS_ERROR_INVALID_PARAMETER;
|
||||
|
||||
for ( i = 0; i<_Scheduler_CBS_Maximum_servers; i++ ) {
|
||||
if ( !_Scheduler_CBS_Server_list[i] )
|
||||
if ( !_Scheduler_CBS_Server_list[i].initialized )
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -45,14 +44,10 @@ int _Scheduler_CBS_Create_server (
|
||||
return SCHEDULER_CBS_ERROR_FULL;
|
||||
|
||||
*server_id = i;
|
||||
_Scheduler_CBS_Server_list[*server_id] = (Scheduler_CBS_Server *)
|
||||
_Workspace_Allocate( sizeof(Scheduler_CBS_Server) );
|
||||
the_server = _Scheduler_CBS_Server_list[*server_id];
|
||||
if ( !the_server )
|
||||
return SCHEDULER_CBS_ERROR_NO_MEMORY;
|
||||
|
||||
the_server = &_Scheduler_CBS_Server_list[*server_id];
|
||||
the_server->parameters = *params;
|
||||
the_server->task_id = -1;
|
||||
the_server->cbs_budget_overrun = budget_overrun_callback;
|
||||
the_server->initialized = true;
|
||||
return SCHEDULER_CBS_OK;
|
||||
}
|
||||
|
||||
@@ -32,13 +32,12 @@ int _Scheduler_CBS_Destroy_server (
|
||||
if ( server_id >= _Scheduler_CBS_Maximum_servers )
|
||||
return SCHEDULER_CBS_ERROR_INVALID_PARAMETER;
|
||||
|
||||
if ( !_Scheduler_CBS_Server_list[server_id] )
|
||||
if ( !_Scheduler_CBS_Server_list[server_id].initialized )
|
||||
return SCHEDULER_CBS_ERROR_NOSERVER;
|
||||
|
||||
if ( (tid = _Scheduler_CBS_Server_list[server_id]->task_id) != -1 )
|
||||
if ( (tid = _Scheduler_CBS_Server_list[server_id].task_id) != -1 )
|
||||
ret = _Scheduler_CBS_Detach_thread ( server_id, tid );
|
||||
|
||||
_Workspace_Free( _Scheduler_CBS_Server_list[server_id] );
|
||||
_Scheduler_CBS_Server_list[server_id] = NULL;
|
||||
_Scheduler_CBS_Server_list[server_id].initialized = false;
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -34,16 +34,16 @@ int _Scheduler_CBS_Detach_thread (
|
||||
if ( server_id >= _Scheduler_CBS_Maximum_servers )
|
||||
return SCHEDULER_CBS_ERROR_INVALID_PARAMETER;
|
||||
/* Server is not valid. */
|
||||
if ( !_Scheduler_CBS_Server_list[server_id] )
|
||||
if ( !_Scheduler_CBS_Server_list[server_id].initialized )
|
||||
return SCHEDULER_CBS_ERROR_NOSERVER;
|
||||
/* Thread and server are not attached. */
|
||||
if ( _Scheduler_CBS_Server_list[server_id]->task_id != task_id )
|
||||
if ( _Scheduler_CBS_Server_list[server_id].task_id != task_id )
|
||||
return SCHEDULER_CBS_ERROR_INVALID_PARAMETER;
|
||||
|
||||
the_thread = _Thread_Get(task_id, &location);
|
||||
/* The routine _Thread_Get may disable dispatch and not enable again. */
|
||||
if ( the_thread ) {
|
||||
_Scheduler_CBS_Server_list[server_id]->task_id = -1;
|
||||
_Scheduler_CBS_Server_list[server_id].task_id = -1;
|
||||
sched_info = (Scheduler_CBS_Per_thread *) the_thread->scheduler_info;
|
||||
sched_info->cbs_server = NULL;
|
||||
|
||||
|
||||
@@ -30,9 +30,9 @@ int _Scheduler_CBS_Get_approved_budget (
|
||||
{
|
||||
if ( server_id >= _Scheduler_CBS_Maximum_servers )
|
||||
return SCHEDULER_CBS_ERROR_INVALID_PARAMETER;
|
||||
if ( !_Scheduler_CBS_Server_list[server_id] )
|
||||
if ( !_Scheduler_CBS_Server_list[server_id].initialized )
|
||||
return SCHEDULER_CBS_ERROR_NOSERVER;
|
||||
|
||||
*approved_budget = _Scheduler_CBS_Server_list[server_id]->parameters.budget;
|
||||
*approved_budget = _Scheduler_CBS_Server_list[server_id].parameters.budget;
|
||||
return SCHEDULER_CBS_OK;
|
||||
}
|
||||
|
||||
@@ -33,25 +33,25 @@ int _Scheduler_CBS_Get_execution_time (
|
||||
|
||||
if ( server_id >= _Scheduler_CBS_Maximum_servers )
|
||||
return SCHEDULER_CBS_ERROR_INVALID_PARAMETER;
|
||||
if ( !_Scheduler_CBS_Server_list[server_id] )
|
||||
if ( !_Scheduler_CBS_Server_list[server_id].initialized )
|
||||
return SCHEDULER_CBS_ERROR_NOSERVER;
|
||||
if ( _Scheduler_CBS_Server_list[server_id]->task_id == -1 ) {
|
||||
if ( _Scheduler_CBS_Server_list[server_id].task_id == -1 ) {
|
||||
*exec_time = 0;
|
||||
return SCHEDULER_CBS_OK;
|
||||
}
|
||||
|
||||
the_thread = _Thread_Get(
|
||||
_Scheduler_CBS_Server_list[server_id]->task_id,
|
||||
_Scheduler_CBS_Server_list[server_id].task_id,
|
||||
&location
|
||||
);
|
||||
/* The routine _Thread_Get may disable dispatch and not enable again. */
|
||||
if ( the_thread ) {
|
||||
*exec_time = _Scheduler_CBS_Server_list[server_id]->parameters.budget -
|
||||
*exec_time = _Scheduler_CBS_Server_list[server_id].parameters.budget -
|
||||
the_thread->cpu_time_budget;
|
||||
_Objects_Put( &the_thread->Object );
|
||||
}
|
||||
else {
|
||||
*exec_time = _Scheduler_CBS_Server_list[server_id]->parameters.budget;
|
||||
*exec_time = _Scheduler_CBS_Server_list[server_id].parameters.budget;
|
||||
}
|
||||
return SCHEDULER_CBS_OK;
|
||||
}
|
||||
|
||||
@@ -30,9 +30,9 @@ int _Scheduler_CBS_Get_parameters (
|
||||
{
|
||||
if ( server_id >= _Scheduler_CBS_Maximum_servers )
|
||||
return SCHEDULER_CBS_ERROR_INVALID_PARAMETER;
|
||||
if ( !_Scheduler_CBS_Server_list[server_id] )
|
||||
if ( !_Scheduler_CBS_Server_list[server_id].initialized )
|
||||
return SCHEDULER_CBS_ERROR_NOSERVER;
|
||||
|
||||
*params = _Scheduler_CBS_Server_list[server_id]->parameters;
|
||||
*params = _Scheduler_CBS_Server_list[server_id].parameters;
|
||||
return SCHEDULER_CBS_OK;
|
||||
}
|
||||
|
||||
@@ -31,15 +31,15 @@ int _Scheduler_CBS_Get_remaining_budget (
|
||||
|
||||
if ( server_id >= _Scheduler_CBS_Maximum_servers )
|
||||
return SCHEDULER_CBS_ERROR_INVALID_PARAMETER;
|
||||
if ( !_Scheduler_CBS_Server_list[server_id] )
|
||||
if ( !_Scheduler_CBS_Server_list[server_id].initialized )
|
||||
return SCHEDULER_CBS_ERROR_NOSERVER;
|
||||
if ( _Scheduler_CBS_Server_list[server_id]->task_id == -1 ) {
|
||||
*remaining_budget = _Scheduler_CBS_Server_list[server_id]->parameters.budget;
|
||||
if ( _Scheduler_CBS_Server_list[server_id].task_id == -1 ) {
|
||||
*remaining_budget = _Scheduler_CBS_Server_list[server_id].parameters.budget;
|
||||
return SCHEDULER_CBS_OK;
|
||||
}
|
||||
|
||||
the_thread = _Thread_Get(
|
||||
_Scheduler_CBS_Server_list[server_id]->task_id,
|
||||
_Scheduler_CBS_Server_list[server_id].task_id,
|
||||
&location
|
||||
);
|
||||
/* The routine _Thread_Get may disable dispatch and not enable again. */
|
||||
|
||||
@@ -30,8 +30,8 @@ int _Scheduler_CBS_Get_server_id (
|
||||
{
|
||||
unsigned int i;
|
||||
for ( i = 0; i<_Scheduler_CBS_Maximum_servers; i++ ) {
|
||||
if ( _Scheduler_CBS_Server_list[i] &&
|
||||
_Scheduler_CBS_Server_list[i]->task_id == task_id ) {
|
||||
if ( _Scheduler_CBS_Server_list[i].initialized &&
|
||||
_Scheduler_CBS_Server_list[i].task_id == task_id ) {
|
||||
*server_id = i;
|
||||
return SCHEDULER_CBS_OK;
|
||||
}
|
||||
|
||||
@@ -24,9 +24,9 @@
|
||||
#include <rtems/score/watchdogimpl.h>
|
||||
|
||||
void _Scheduler_CBS_Release_job(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread,
|
||||
uint32_t deadline
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread,
|
||||
uint32_t deadline
|
||||
)
|
||||
{
|
||||
Priority_Control new_priority;
|
||||
|
||||
@@ -38,9 +38,9 @@ int _Scheduler_CBS_Set_parameters (
|
||||
params->deadline >= SCHEDULER_EDF_PRIO_MSB )
|
||||
return SCHEDULER_CBS_ERROR_INVALID_PARAMETER;
|
||||
|
||||
if ( !_Scheduler_CBS_Server_list[server_id] )
|
||||
if ( !_Scheduler_CBS_Server_list[server_id].initialized )
|
||||
return SCHEDULER_CBS_ERROR_NOSERVER;
|
||||
|
||||
_Scheduler_CBS_Server_list[server_id]->parameters = *params;
|
||||
_Scheduler_CBS_Server_list[server_id].parameters = *params;
|
||||
return SCHEDULER_CBS_OK;
|
||||
}
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
#include <rtems/score/watchdogimpl.h>
|
||||
|
||||
void _Scheduler_CBS_Unblock(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
Scheduler_CBS_Per_thread *sched_info;
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
#include <rtems/score/scheduler.h>
|
||||
|
||||
void *_Scheduler_default_Allocate(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
( void ) scheduler;
|
||||
@@ -33,8 +33,8 @@ void *_Scheduler_default_Allocate(
|
||||
}
|
||||
|
||||
void _Scheduler_default_Free(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
( void ) scheduler;
|
||||
|
||||
@@ -23,10 +23,10 @@
|
||||
#include <rtems/score/cpusetimpl.h>
|
||||
|
||||
bool _Scheduler_default_Get_affinity(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *thread,
|
||||
size_t cpusetsize,
|
||||
cpu_set_t *cpuset
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *thread,
|
||||
size_t cpusetsize,
|
||||
cpu_set_t *cpuset
|
||||
)
|
||||
{
|
||||
const CPU_set_Control *ctl;
|
||||
|
||||
@@ -22,9 +22,9 @@
|
||||
#include <rtems/score/scheduler.h>
|
||||
|
||||
void _Scheduler_default_Release_job(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread,
|
||||
uint32_t deadline
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread,
|
||||
uint32_t deadline
|
||||
)
|
||||
{
|
||||
( void ) scheduler;
|
||||
|
||||
@@ -23,10 +23,10 @@
|
||||
#include <rtems/score/cpusetimpl.h>
|
||||
|
||||
bool _Scheduler_default_Set_affinity(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *thread,
|
||||
size_t cpusetsize,
|
||||
const cpu_set_t *cpuset
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *thread,
|
||||
size_t cpusetsize,
|
||||
const cpu_set_t *cpuset
|
||||
)
|
||||
{
|
||||
(void) scheduler;
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
#include <rtems/score/schedulerimpl.h>
|
||||
|
||||
void _Scheduler_default_Start_idle(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread,
|
||||
Per_CPU_Control *cpu
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread,
|
||||
Per_CPU_Control *cpu
|
||||
)
|
||||
{
|
||||
(void) cpu;
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
#include <rtems/config.h>
|
||||
|
||||
static void _Scheduler_default_Tick_for_executing(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *executing
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *executing
|
||||
)
|
||||
{
|
||||
#ifdef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
||||
@@ -84,7 +84,7 @@ static void _Scheduler_default_Tick_for_executing(
|
||||
}
|
||||
}
|
||||
|
||||
void _Scheduler_default_Tick( Scheduler_Control *scheduler )
|
||||
void _Scheduler_default_Tick( const Scheduler_Control *scheduler )
|
||||
{
|
||||
uint32_t processor_count = _SMP_Get_processor_count();
|
||||
uint32_t processor;
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
#include <rtems/score/scheduler.h>
|
||||
|
||||
void _Scheduler_default_Update(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
( void ) scheduler;
|
||||
|
||||
@@ -18,10 +18,7 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <rtems/score/scheduleredf.h>
|
||||
#include <rtems/score/schedulerimpl.h>
|
||||
#include <rtems/score/thread.h>
|
||||
#include <rtems/score/wkspace.h>
|
||||
#include <rtems/score/scheduleredfimpl.h>
|
||||
|
||||
static int _Scheduler_EDF_RBTree_compare_function
|
||||
(
|
||||
@@ -41,16 +38,14 @@ static int _Scheduler_EDF_RBTree_compare_function
|
||||
return (-1)*_Scheduler_EDF_Priority_compare(value1, value2);
|
||||
}
|
||||
|
||||
void _Scheduler_EDF_Initialize(void)
|
||||
void _Scheduler_EDF_Initialize( const Scheduler_Control *scheduler )
|
||||
{
|
||||
Scheduler_EDF_Control *scheduler =
|
||||
_Workspace_Allocate_or_fatal_error( sizeof( *scheduler ) );
|
||||
Scheduler_EDF_Context *context =
|
||||
_Scheduler_EDF_Get_context( scheduler );
|
||||
|
||||
_RBTree_Initialize_empty(
|
||||
&scheduler->Ready,
|
||||
&context->Ready,
|
||||
_Scheduler_EDF_RBTree_compare_function,
|
||||
0
|
||||
);
|
||||
|
||||
_Scheduler.information = scheduler;
|
||||
}
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
#include <rtems/score/wkspace.h>
|
||||
|
||||
void *_Scheduler_EDF_Allocate(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
void *sched;
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
#include <rtems/score/scheduleredfimpl.h>
|
||||
|
||||
void _Scheduler_EDF_Block(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
_Scheduler_Generic_block(
|
||||
|
||||
@@ -21,16 +21,16 @@
|
||||
#include <rtems/score/scheduleredfimpl.h>
|
||||
|
||||
void _Scheduler_EDF_Enqueue(
|
||||
Scheduler_Control *scheduler_base,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
Scheduler_EDF_Control *scheduler =
|
||||
_Scheduler_EDF_Self_from_base( scheduler_base );
|
||||
Scheduler_EDF_Context *context =
|
||||
_Scheduler_EDF_Get_context( scheduler );
|
||||
Scheduler_EDF_Per_thread *sched_info =
|
||||
(Scheduler_EDF_Per_thread*) the_thread->scheduler_info;
|
||||
RBTree_Node *node = &(sched_info->Node);
|
||||
|
||||
_RBTree_Insert( &scheduler->Ready, node );
|
||||
_RBTree_Insert( &context->Ready, node );
|
||||
sched_info->queue_state = SCHEDULER_EDF_QUEUE_STATE_YES;
|
||||
}
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
#include <rtems/score/scheduleredf.h>
|
||||
|
||||
void _Scheduler_EDF_Enqueue_first(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
_Scheduler_EDF_Enqueue( scheduler, the_thread );
|
||||
|
||||
@@ -21,16 +21,16 @@
|
||||
#include <rtems/score/scheduleredfimpl.h>
|
||||
|
||||
void _Scheduler_EDF_Extract(
|
||||
Scheduler_Control *scheduler_base,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
Scheduler_EDF_Control *scheduler =
|
||||
_Scheduler_EDF_Self_from_base( scheduler_base );
|
||||
Scheduler_EDF_Context *context =
|
||||
_Scheduler_EDF_Get_context( scheduler );
|
||||
Scheduler_EDF_Per_thread *sched_info =
|
||||
(Scheduler_EDF_Per_thread*) the_thread->scheduler_info;
|
||||
RBTree_Node *node = &(sched_info->Node);
|
||||
|
||||
_RBTree_Extract( &scheduler->Ready, node );
|
||||
_RBTree_Extract( &context->Ready, node );
|
||||
sched_info->queue_state = SCHEDULER_EDF_QUEUE_STATE_NOT_PRESENTLY;
|
||||
}
|
||||
|
||||
@@ -26,8 +26,8 @@
|
||||
#include <rtems/score/wkspace.h>
|
||||
|
||||
void _Scheduler_EDF_Free(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
(void) scheduler;
|
||||
|
||||
@@ -23,9 +23,9 @@
|
||||
#include <rtems/score/watchdogimpl.h>
|
||||
|
||||
void _Scheduler_EDF_Release_job(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread,
|
||||
uint32_t deadline
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread,
|
||||
uint32_t deadline
|
||||
)
|
||||
{
|
||||
Priority_Control new_priority;
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
#include <rtems/score/scheduleredfimpl.h>
|
||||
|
||||
void _Scheduler_EDF_Schedule(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
_Scheduler_EDF_Schedule_body( scheduler, the_thread, false );
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
#include <rtems/score/thread.h>
|
||||
|
||||
void _Scheduler_EDF_Unblock(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
_Scheduler_EDF_Enqueue( scheduler, the_thread);
|
||||
|
||||
@@ -26,8 +26,8 @@
|
||||
#include <rtems/score/thread.h>
|
||||
|
||||
void _Scheduler_EDF_Update(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
Scheduler_EDF_Per_thread *sched_info =
|
||||
|
||||
@@ -22,12 +22,12 @@
|
||||
#include <rtems/score/scheduleredfimpl.h>
|
||||
|
||||
void _Scheduler_EDF_Yield(
|
||||
Scheduler_Control *scheduler_base,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
Scheduler_EDF_Control *scheduler =
|
||||
_Scheduler_EDF_Self_from_base( scheduler_base );
|
||||
Scheduler_EDF_Context *context =
|
||||
_Scheduler_EDF_Get_context( scheduler );
|
||||
ISR_Level level;
|
||||
|
||||
Scheduler_EDF_Per_thread *thread_info =
|
||||
@@ -40,12 +40,12 @@ void _Scheduler_EDF_Yield(
|
||||
* The RBTree has more than one node, enqueue behind the tasks
|
||||
* with the same priority in case there are such ones.
|
||||
*/
|
||||
_RBTree_Extract( &scheduler->Ready, thread_node );
|
||||
_RBTree_Insert( &scheduler->Ready, thread_node );
|
||||
_RBTree_Extract( &context->Ready, thread_node );
|
||||
_RBTree_Insert( &context->Ready, thread_node );
|
||||
|
||||
_ISR_Flash( level );
|
||||
|
||||
_Scheduler_EDF_Schedule_body( scheduler_base, the_thread, false );
|
||||
_Scheduler_EDF_Schedule_body( scheduler, the_thread, false );
|
||||
|
||||
_ISR_Enable( level );
|
||||
}
|
||||
|
||||
@@ -21,14 +21,11 @@
|
||||
#include <rtems/score/schedulerpriorityimpl.h>
|
||||
#include <rtems/score/wkspace.h>
|
||||
|
||||
void _Scheduler_priority_Initialize(void)
|
||||
void _Scheduler_priority_Initialize( const Scheduler_Control *scheduler )
|
||||
{
|
||||
Scheduler_priority_Control *self = _Workspace_Allocate_or_fatal_error(
|
||||
sizeof( *self ) + PRIORITY_MAXIMUM * sizeof( Chain_Control )
|
||||
);
|
||||
Scheduler_priority_Context *context =
|
||||
_Scheduler_priority_Get_context( scheduler );
|
||||
|
||||
_Priority_bit_map_Initialize( &self->Bit_map );
|
||||
_Scheduler_priority_Ready_queue_initialize( &self->Ready[ 0 ] );
|
||||
|
||||
_Scheduler.information = self;
|
||||
_Priority_bit_map_Initialize( &context->Bit_map );
|
||||
_Scheduler_priority_Ready_queue_initialize( &context->Ready[ 0 ] );
|
||||
}
|
||||
|
||||
@@ -32,8 +32,8 @@ _Scheduler_priority_affinity_Get_scheduler_info( Thread_Control *thread )
|
||||
}
|
||||
|
||||
void * _Scheduler_priority_affinity_SMP_Allocate(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
Scheduler_priority_affinity_SMP_Per_thread *info =
|
||||
@@ -48,10 +48,10 @@ void * _Scheduler_priority_affinity_SMP_Allocate(
|
||||
}
|
||||
|
||||
bool _Scheduler_priority_affinity_SMP_Get_affinity(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *thread,
|
||||
size_t cpusetsize,
|
||||
cpu_set_t *cpuset
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *thread,
|
||||
size_t cpusetsize,
|
||||
cpu_set_t *cpuset
|
||||
)
|
||||
{
|
||||
Scheduler_priority_affinity_SMP_Per_thread *info =
|
||||
@@ -68,10 +68,10 @@ bool _Scheduler_priority_affinity_SMP_Get_affinity(
|
||||
}
|
||||
|
||||
bool _Scheduler_priority_affinity_SMP_Set_affinity(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *thread,
|
||||
size_t cpusetsize,
|
||||
cpu_set_t *cpuset
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *thread,
|
||||
size_t cpusetsize,
|
||||
cpu_set_t *cpuset
|
||||
)
|
||||
{
|
||||
Scheduler_priority_affinity_SMP_Per_thread *info =
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
#include <rtems/score/wkspace.h>
|
||||
|
||||
void *_Scheduler_priority_Allocate (
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
Scheduler_priority_Per_thread *sched_info_of_thread =
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
#include <rtems/score/schedulerpriorityimpl.h>
|
||||
|
||||
void _Scheduler_priority_Block(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
_Scheduler_Generic_block(
|
||||
|
||||
@@ -21,12 +21,12 @@
|
||||
#include <rtems/score/schedulerpriorityimpl.h>
|
||||
|
||||
void _Scheduler_priority_Enqueue(
|
||||
Scheduler_Control *base,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
Scheduler_priority_Control *scheduler =
|
||||
_Scheduler_priority_Self_from_base( base );
|
||||
Scheduler_priority_Context *context =
|
||||
_Scheduler_priority_Get_context( scheduler );
|
||||
|
||||
_Scheduler_priority_Ready_queue_enqueue( the_thread, &scheduler->Bit_map );
|
||||
_Scheduler_priority_Ready_queue_enqueue( the_thread, &context->Bit_map );
|
||||
}
|
||||
|
||||
@@ -21,16 +21,16 @@
|
||||
#include <rtems/score/schedulerpriorityimpl.h>
|
||||
|
||||
void _Scheduler_priority_Enqueue_first(
|
||||
Scheduler_Control *base,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
Scheduler_priority_Control *self =
|
||||
_Scheduler_priority_Self_from_base( base );
|
||||
Scheduler_priority_Context *context =
|
||||
_Scheduler_priority_Get_context( scheduler );
|
||||
|
||||
_Scheduler_priority_Ready_queue_enqueue_first(
|
||||
the_thread,
|
||||
&self->Bit_map
|
||||
&context->Bit_map
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,9 +22,9 @@
|
||||
#include <rtems/score/schedulerpriorityimpl.h>
|
||||
|
||||
void _Scheduler_priority_Extract(
|
||||
Scheduler_Control *base,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
_Scheduler_priority_Extract_body( base, the_thread );
|
||||
_Scheduler_priority_Extract_body( scheduler, the_thread );
|
||||
}
|
||||
|
||||
@@ -25,11 +25,11 @@
|
||||
#include <rtems/score/wkspace.h>
|
||||
|
||||
void _Scheduler_priority_Free (
|
||||
Scheduler_Control *base,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
(void) base;
|
||||
(void) scheduler;
|
||||
|
||||
_Workspace_Free( the_thread->scheduler_info );
|
||||
}
|
||||
|
||||
@@ -21,9 +21,9 @@
|
||||
#include <rtems/score/schedulerpriorityimpl.h>
|
||||
|
||||
void _Scheduler_priority_Schedule(
|
||||
Scheduler_Control *base,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
_Scheduler_priority_Schedule_body( base, the_thread, false );
|
||||
_Scheduler_priority_Schedule_body( scheduler, the_thread, false );
|
||||
}
|
||||
|
||||
@@ -29,40 +29,37 @@
|
||||
#include <rtems/score/schedulersmpimpl.h>
|
||||
#include <rtems/score/wkspace.h>
|
||||
|
||||
static Scheduler_priority_SMP_Control *
|
||||
_Scheduler_priority_SMP_Self_from_base( Scheduler_Control *base )
|
||||
static Scheduler_priority_SMP_Context *
|
||||
_Scheduler_priority_SMP_Get_context( const Scheduler_Control *scheduler )
|
||||
{
|
||||
return (Scheduler_priority_SMP_Control *) base->information;
|
||||
return (Scheduler_priority_SMP_Context *) scheduler->context;
|
||||
}
|
||||
|
||||
static Scheduler_priority_SMP_Control *
|
||||
_Scheduler_priority_SMP_Self_from_SMP_base( Scheduler_SMP_Control *smp_base )
|
||||
static Scheduler_priority_SMP_Context *
|
||||
_Scheduler_priority_SMP_Self_from_SMP_base( Scheduler_SMP_Context *smp_base )
|
||||
{
|
||||
return (Scheduler_priority_SMP_Control *)
|
||||
return (Scheduler_priority_SMP_Context *)
|
||||
( (char *) smp_base
|
||||
- offsetof( Scheduler_priority_SMP_Control, Base ) );
|
||||
- offsetof( Scheduler_priority_SMP_Context, Base ) );
|
||||
}
|
||||
|
||||
void _Scheduler_priority_SMP_Initialize( void )
|
||||
void _Scheduler_priority_SMP_Initialize( const Scheduler_Control *scheduler )
|
||||
{
|
||||
Scheduler_priority_SMP_Control *self = _Workspace_Allocate_or_fatal_error(
|
||||
sizeof( *self ) + PRIORITY_MAXIMUM * sizeof( Chain_Control )
|
||||
);
|
||||
Scheduler_priority_SMP_Context *self =
|
||||
_Scheduler_priority_SMP_Get_context( scheduler );
|
||||
|
||||
_Scheduler_SMP_Initialize( &self->Base );
|
||||
_Priority_bit_map_Initialize( &self->Bit_map );
|
||||
_Scheduler_priority_Ready_queue_initialize( &self->Ready[ 0 ] );
|
||||
|
||||
_Scheduler.information = self;
|
||||
}
|
||||
|
||||
void _Scheduler_priority_SMP_Update(
|
||||
Scheduler_Control *base,
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *thread
|
||||
)
|
||||
{
|
||||
Scheduler_priority_SMP_Control *self =
|
||||
_Scheduler_priority_SMP_Self_from_base( base );
|
||||
Scheduler_priority_SMP_Context *self =
|
||||
_Scheduler_priority_SMP_Get_context( scheduler );
|
||||
|
||||
_Scheduler_priority_Update_body(
|
||||
thread,
|
||||
@@ -72,10 +69,10 @@ void _Scheduler_priority_SMP_Update(
|
||||
}
|
||||
|
||||
static Thread_Control *_Scheduler_priority_SMP_Get_highest_ready(
|
||||
Scheduler_SMP_Control *smp_base
|
||||
Scheduler_SMP_Context *smp_base
|
||||
)
|
||||
{
|
||||
Scheduler_priority_SMP_Control *self =
|
||||
Scheduler_priority_SMP_Context *self =
|
||||
_Scheduler_priority_SMP_Self_from_SMP_base( smp_base );
|
||||
Thread_Control *highest_ready = NULL;
|
||||
|
||||
@@ -90,11 +87,11 @@ static Thread_Control *_Scheduler_priority_SMP_Get_highest_ready(
|
||||
}
|
||||
|
||||
static void _Scheduler_priority_SMP_Move_from_scheduled_to_ready(
|
||||
Scheduler_SMP_Control *smp_base,
|
||||
Scheduler_SMP_Context *smp_base,
|
||||
Thread_Control *scheduled_to_ready
|
||||
)
|
||||
{
|
||||
Scheduler_priority_SMP_Control *self =
|
||||
Scheduler_priority_SMP_Context *self =
|
||||
_Scheduler_priority_SMP_Self_from_SMP_base( smp_base );
|
||||
|
||||
_Chain_Extract_unprotected( &scheduled_to_ready->Object.Node );
|
||||
@@ -105,11 +102,11 @@ static void _Scheduler_priority_SMP_Move_from_scheduled_to_ready(
|
||||
}
|
||||
|
||||
static void _Scheduler_priority_SMP_Move_from_ready_to_scheduled(
|
||||
Scheduler_SMP_Control *smp_base,
|
||||
Scheduler_SMP_Context *smp_base,
|
||||
Thread_Control *ready_to_scheduled
|
||||
)
|
||||
{
|
||||
Scheduler_priority_SMP_Control *self =
|
||||
Scheduler_priority_SMP_Context *self =
|
||||
_Scheduler_priority_SMP_Self_from_SMP_base( smp_base );
|
||||
|
||||
_Scheduler_priority_Ready_queue_extract(
|
||||
@@ -123,33 +120,33 @@ static void _Scheduler_priority_SMP_Move_from_ready_to_scheduled(
|
||||
}
|
||||
|
||||
static void _Scheduler_priority_SMP_Insert_ready_lifo(
|
||||
Scheduler_SMP_Control *smp_base,
|
||||
Scheduler_SMP_Context *smp_base,
|
||||
Thread_Control *thread
|
||||
)
|
||||
{
|
||||
Scheduler_priority_SMP_Control *self =
|
||||
Scheduler_priority_SMP_Context *self =
|
||||
_Scheduler_priority_SMP_Self_from_SMP_base( smp_base );
|
||||
|
||||
_Scheduler_priority_Ready_queue_enqueue( thread, &self->Bit_map );
|
||||
}
|
||||
|
||||
static void _Scheduler_priority_SMP_Insert_ready_fifo(
|
||||
Scheduler_SMP_Control *smp_base,
|
||||
Scheduler_SMP_Context *smp_base,
|
||||
Thread_Control *thread
|
||||
)
|
||||
{
|
||||
Scheduler_priority_SMP_Control *self =
|
||||
Scheduler_priority_SMP_Context *self =
|
||||
_Scheduler_priority_SMP_Self_from_SMP_base( smp_base );
|
||||
|
||||
_Scheduler_priority_Ready_queue_enqueue_first( thread, &self->Bit_map );
|
||||
}
|
||||
|
||||
static void _Scheduler_priority_SMP_Do_extract(
|
||||
Scheduler_SMP_Control *smp_base,
|
||||
Scheduler_SMP_Context *smp_base,
|
||||
Thread_Control *thread
|
||||
)
|
||||
{
|
||||
Scheduler_priority_SMP_Control *self =
|
||||
Scheduler_priority_SMP_Context *self =
|
||||
_Scheduler_priority_SMP_Self_from_SMP_base( smp_base );
|
||||
bool is_scheduled = thread->is_scheduled;
|
||||
|
||||
@@ -164,12 +161,12 @@ static void _Scheduler_priority_SMP_Do_extract(
|
||||
}
|
||||
|
||||
void _Scheduler_priority_SMP_Block(
|
||||
Scheduler_Control *base,
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *thread
|
||||
)
|
||||
{
|
||||
Scheduler_priority_SMP_Control *self =
|
||||
_Scheduler_priority_SMP_Self_from_base( base );
|
||||
Scheduler_priority_SMP_Context *self =
|
||||
_Scheduler_priority_SMP_Get_context( scheduler );
|
||||
|
||||
_Scheduler_SMP_Block(
|
||||
&self->Base,
|
||||
@@ -181,7 +178,7 @@ void _Scheduler_priority_SMP_Block(
|
||||
}
|
||||
|
||||
static void _Scheduler_priority_SMP_Enqueue_ordered(
|
||||
Scheduler_SMP_Control *self,
|
||||
Scheduler_SMP_Context *self,
|
||||
Thread_Control *thread,
|
||||
Chain_Node_order order,
|
||||
Scheduler_SMP_Insert insert_ready,
|
||||
@@ -201,12 +198,12 @@ static void _Scheduler_priority_SMP_Enqueue_ordered(
|
||||
}
|
||||
|
||||
void _Scheduler_priority_SMP_Enqueue_lifo(
|
||||
Scheduler_Control *base,
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *thread
|
||||
)
|
||||
{
|
||||
Scheduler_priority_SMP_Control *self =
|
||||
_Scheduler_priority_SMP_Self_from_base( base );
|
||||
Scheduler_priority_SMP_Context *self =
|
||||
_Scheduler_priority_SMP_Get_context( scheduler );
|
||||
|
||||
_Scheduler_priority_SMP_Enqueue_ordered(
|
||||
&self->Base,
|
||||
@@ -218,12 +215,12 @@ void _Scheduler_priority_SMP_Enqueue_lifo(
|
||||
}
|
||||
|
||||
void _Scheduler_priority_SMP_Enqueue_fifo(
|
||||
Scheduler_Control *base,
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *thread
|
||||
)
|
||||
{
|
||||
Scheduler_priority_SMP_Control *self =
|
||||
_Scheduler_priority_SMP_Self_from_base( base );
|
||||
Scheduler_priority_SMP_Context *self =
|
||||
_Scheduler_priority_SMP_Get_context( scheduler );
|
||||
|
||||
_Scheduler_priority_SMP_Enqueue_ordered(
|
||||
&self->Base,
|
||||
@@ -235,12 +232,12 @@ void _Scheduler_priority_SMP_Enqueue_fifo(
|
||||
}
|
||||
|
||||
void _Scheduler_priority_SMP_Extract(
|
||||
Scheduler_Control *base,
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *thread
|
||||
)
|
||||
{
|
||||
Scheduler_priority_SMP_Control *self =
|
||||
_Scheduler_priority_SMP_Self_from_base( base );
|
||||
Scheduler_priority_SMP_Context *self =
|
||||
_Scheduler_priority_SMP_Get_context( scheduler );
|
||||
|
||||
_Scheduler_SMP_Extract(
|
||||
&self->Base,
|
||||
@@ -250,7 +247,7 @@ void _Scheduler_priority_SMP_Extract(
|
||||
}
|
||||
|
||||
void _Scheduler_priority_SMP_Yield(
|
||||
Scheduler_Control *base,
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *thread
|
||||
)
|
||||
{
|
||||
@@ -258,19 +255,19 @@ void _Scheduler_priority_SMP_Yield(
|
||||
|
||||
_ISR_Disable( level );
|
||||
|
||||
_Scheduler_priority_SMP_Extract( base, thread );
|
||||
_Scheduler_priority_SMP_Enqueue_fifo( base, thread );
|
||||
_Scheduler_priority_SMP_Extract( scheduler, thread );
|
||||
_Scheduler_priority_SMP_Enqueue_fifo( scheduler, thread );
|
||||
|
||||
_ISR_Enable( level );
|
||||
}
|
||||
|
||||
void _Scheduler_priority_SMP_Schedule(
|
||||
Scheduler_Control *base,
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *thread
|
||||
)
|
||||
{
|
||||
Scheduler_priority_SMP_Control *self =
|
||||
_Scheduler_priority_SMP_Self_from_base( base );
|
||||
Scheduler_priority_SMP_Context *self =
|
||||
_Scheduler_priority_SMP_Get_context( scheduler );
|
||||
|
||||
_Scheduler_SMP_Schedule(
|
||||
&self->Base,
|
||||
@@ -281,13 +278,13 @@ void _Scheduler_priority_SMP_Schedule(
|
||||
}
|
||||
|
||||
void _Scheduler_priority_SMP_Start_idle(
|
||||
Scheduler_Control *base,
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *thread,
|
||||
Per_CPU_Control *cpu
|
||||
)
|
||||
{
|
||||
Scheduler_priority_SMP_Control *self =
|
||||
_Scheduler_priority_SMP_Self_from_base( base );
|
||||
Scheduler_priority_SMP_Context *self =
|
||||
_Scheduler_priority_SMP_Get_context( scheduler );
|
||||
|
||||
_Scheduler_SMP_Start_idle( &self->Base, thread, cpu );
|
||||
}
|
||||
|
||||
@@ -23,14 +23,14 @@
|
||||
#include <rtems/score/schedulerpriorityimpl.h>
|
||||
|
||||
void _Scheduler_priority_Unblock (
|
||||
Scheduler_Control *base,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
Scheduler_priority_Control *self =
|
||||
_Scheduler_priority_Self_from_base( base );
|
||||
Scheduler_priority_Context *context =
|
||||
_Scheduler_priority_Get_context( scheduler );
|
||||
|
||||
_Scheduler_priority_Ready_queue_enqueue( the_thread, &self->Bit_map );
|
||||
_Scheduler_priority_Ready_queue_enqueue( the_thread, &context->Bit_map );
|
||||
|
||||
/* TODO: flash critical section? */
|
||||
|
||||
|
||||
@@ -21,16 +21,16 @@
|
||||
#include <rtems/score/schedulerpriorityimpl.h>
|
||||
|
||||
void _Scheduler_priority_Update(
|
||||
Scheduler_Control *base,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
Scheduler_priority_Control *self =
|
||||
_Scheduler_priority_Self_from_base( base );
|
||||
Scheduler_priority_Context *context =
|
||||
_Scheduler_priority_Get_context( scheduler );
|
||||
|
||||
_Scheduler_priority_Update_body(
|
||||
the_thread,
|
||||
&self->Bit_map,
|
||||
&self->Ready[ 0 ]
|
||||
&context->Bit_map,
|
||||
&context->Ready[ 0 ]
|
||||
);
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
#include <rtems/score/threadimpl.h>
|
||||
|
||||
void _Scheduler_priority_Yield(
|
||||
Scheduler_Control *base,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
Scheduler_priority_Per_thread *sched_info_of_thread =
|
||||
@@ -32,7 +32,7 @@ void _Scheduler_priority_Yield(
|
||||
Chain_Control *ready_chain = sched_info_of_thread->ready_chain;
|
||||
ISR_Level level;
|
||||
|
||||
(void) base;
|
||||
(void) scheduler;
|
||||
|
||||
_ISR_Disable( level );
|
||||
if ( !_Chain_Has_only_one_node( ready_chain ) ) {
|
||||
|
||||
@@ -19,16 +19,13 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <rtems/score/schedulersimple.h>
|
||||
#include <rtems/score/schedulersimpleimpl.h>
|
||||
#include <rtems/score/chainimpl.h>
|
||||
#include <rtems/score/wkspace.h>
|
||||
|
||||
void _Scheduler_simple_Initialize ( void )
|
||||
void _Scheduler_simple_Initialize( const Scheduler_Control *scheduler )
|
||||
{
|
||||
Scheduler_simple_Control *scheduler =
|
||||
_Workspace_Allocate_or_fatal_error( sizeof( *scheduler ) );
|
||||
Scheduler_simple_Context *context =
|
||||
_Scheduler_simple_Get_context( scheduler );
|
||||
|
||||
_Chain_Initialize_empty( &scheduler->Ready );
|
||||
|
||||
_Scheduler.information = scheduler;
|
||||
_Chain_Initialize_empty( &context->Ready );
|
||||
}
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
#include <rtems/score/schedulersimpleimpl.h>
|
||||
|
||||
void _Scheduler_simple_Block(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
_Scheduler_Generic_block(
|
||||
|
||||
@@ -19,15 +19,11 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <rtems/system.h>
|
||||
#include <rtems/score/chain.h>
|
||||
#include <rtems/score/isr.h>
|
||||
#include <rtems/score/thread.h>
|
||||
#include <rtems/score/schedulersimple.h>
|
||||
#include <rtems/score/schedulersimpleimpl.h>
|
||||
|
||||
void _Scheduler_simple_Enqueue(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
_Scheduler_simple_Ready_queue_enqueue( scheduler, the_thread );
|
||||
|
||||
@@ -18,14 +18,11 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <rtems/system.h>
|
||||
#include <rtems/score/chain.h>
|
||||
#include <rtems/score/thread.h>
|
||||
#include <rtems/score/schedulersimple.h>
|
||||
|
||||
void _Scheduler_simple_Enqueue_first(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
_Scheduler_simple_Ready_queue_enqueue_first( scheduler, the_thread );
|
||||
|
||||
@@ -19,13 +19,11 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <rtems/score/schedulersimple.h>
|
||||
#include <rtems/score/chainimpl.h>
|
||||
#include <rtems/score/thread.h>
|
||||
#include <rtems/score/schedulersimpleimpl.h>
|
||||
|
||||
void _Scheduler_simple_Extract(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
(void) scheduler;
|
||||
|
||||
@@ -21,12 +21,12 @@
|
||||
#include <rtems/score/schedulersimpleimpl.h>
|
||||
|
||||
void _Scheduler_simple_Ready_queue_enqueue(
|
||||
Scheduler_Control *scheduler_base,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
Scheduler_simple_Control *scheduler =
|
||||
_Scheduler_simple_Self_from_base( scheduler_base );
|
||||
Scheduler_simple_Context *context =
|
||||
_Scheduler_simple_Get_context( scheduler );
|
||||
|
||||
_Scheduler_simple_Insert_priority_fifo( &scheduler->Ready, the_thread );
|
||||
_Scheduler_simple_Insert_priority_fifo( &context->Ready, the_thread );
|
||||
}
|
||||
|
||||
@@ -21,12 +21,12 @@
|
||||
#include <rtems/score/schedulersimpleimpl.h>
|
||||
|
||||
void _Scheduler_simple_Ready_queue_enqueue_first(
|
||||
Scheduler_Control *scheduler_base,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
Scheduler_simple_Control *scheduler =
|
||||
_Scheduler_simple_Self_from_base( scheduler_base );
|
||||
Scheduler_simple_Context *context =
|
||||
_Scheduler_simple_Get_context( scheduler );
|
||||
|
||||
_Scheduler_simple_Insert_priority_lifo( &scheduler->Ready, the_thread );
|
||||
_Scheduler_simple_Insert_priority_lifo( &context->Ready, the_thread );
|
||||
}
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
#include <rtems/score/schedulersimpleimpl.h>
|
||||
|
||||
void _Scheduler_simple_Schedule(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
_Scheduler_simple_Schedule_body( scheduler, the_thread, false );
|
||||
|
||||
@@ -22,35 +22,33 @@
|
||||
#include <rtems/score/schedulersmpimpl.h>
|
||||
#include <rtems/score/wkspace.h>
|
||||
|
||||
static Scheduler_simple_SMP_Control *
|
||||
_Scheduler_simple_SMP_Self_from_base( Scheduler_Control *base )
|
||||
static Scheduler_simple_SMP_Context *
|
||||
_Scheduler_simple_SMP_Get_context( const Scheduler_Control *scheduler )
|
||||
{
|
||||
return (Scheduler_simple_SMP_Control *) base->information;
|
||||
return (Scheduler_simple_SMP_Context *) scheduler->context;
|
||||
}
|
||||
|
||||
static Scheduler_simple_SMP_Control *
|
||||
_Scheduler_simple_SMP_Self_from_SMP_base( Scheduler_SMP_Control *smp_base )
|
||||
static Scheduler_simple_SMP_Context *
|
||||
_Scheduler_simple_SMP_Self_from_SMP_base( Scheduler_SMP_Context *smp_base )
|
||||
{
|
||||
return (Scheduler_simple_SMP_Control *)
|
||||
( (char *) smp_base - offsetof( Scheduler_simple_SMP_Control, Base ) );
|
||||
return (Scheduler_simple_SMP_Context *)
|
||||
( (char *) smp_base - offsetof( Scheduler_simple_SMP_Context, Base ) );
|
||||
}
|
||||
|
||||
void _Scheduler_simple_smp_Initialize( void )
|
||||
void _Scheduler_simple_smp_Initialize( const Scheduler_Control *scheduler )
|
||||
{
|
||||
Scheduler_simple_SMP_Control *self =
|
||||
_Workspace_Allocate_or_fatal_error( sizeof( *self ) );
|
||||
Scheduler_simple_SMP_Context *self =
|
||||
_Scheduler_simple_SMP_Get_context( scheduler );
|
||||
|
||||
_Scheduler_SMP_Initialize( &self->Base );
|
||||
_Chain_Initialize_empty( &self->Ready );
|
||||
|
||||
_Scheduler.information = self;
|
||||
}
|
||||
|
||||
static Thread_Control *_Scheduler_simple_smp_Get_highest_ready(
|
||||
Scheduler_SMP_Control *smp_base
|
||||
Scheduler_SMP_Context *smp_base
|
||||
)
|
||||
{
|
||||
Scheduler_simple_SMP_Control *self =
|
||||
Scheduler_simple_SMP_Context *self =
|
||||
_Scheduler_simple_SMP_Self_from_SMP_base( smp_base );
|
||||
Thread_Control *highest_ready = NULL;
|
||||
Chain_Control *ready = &self->Ready;
|
||||
@@ -63,11 +61,11 @@ static Thread_Control *_Scheduler_simple_smp_Get_highest_ready(
|
||||
}
|
||||
|
||||
static void _Scheduler_simple_smp_Move_from_scheduled_to_ready(
|
||||
Scheduler_SMP_Control *smp_base,
|
||||
Scheduler_SMP_Context *smp_base,
|
||||
Thread_Control *scheduled_to_ready
|
||||
)
|
||||
{
|
||||
Scheduler_simple_SMP_Control *self =
|
||||
Scheduler_simple_SMP_Context *self =
|
||||
_Scheduler_simple_SMP_Self_from_SMP_base( smp_base );
|
||||
|
||||
_Chain_Extract_unprotected( &scheduled_to_ready->Object.Node );
|
||||
@@ -78,7 +76,7 @@ static void _Scheduler_simple_smp_Move_from_scheduled_to_ready(
|
||||
}
|
||||
|
||||
static void _Scheduler_simple_smp_Move_from_ready_to_scheduled(
|
||||
Scheduler_SMP_Control *smp_base,
|
||||
Scheduler_SMP_Context *smp_base,
|
||||
Thread_Control *ready_to_scheduled
|
||||
)
|
||||
{
|
||||
@@ -90,11 +88,11 @@ static void _Scheduler_simple_smp_Move_from_ready_to_scheduled(
|
||||
}
|
||||
|
||||
static void _Scheduler_simple_smp_Insert_ready_lifo(
|
||||
Scheduler_SMP_Control *smp_base,
|
||||
Scheduler_SMP_Context *smp_base,
|
||||
Thread_Control *thread
|
||||
)
|
||||
{
|
||||
Scheduler_simple_SMP_Control *self =
|
||||
Scheduler_simple_SMP_Context *self =
|
||||
_Scheduler_simple_SMP_Self_from_SMP_base( smp_base );
|
||||
|
||||
_Chain_Insert_ordered_unprotected(
|
||||
@@ -105,11 +103,11 @@ static void _Scheduler_simple_smp_Insert_ready_lifo(
|
||||
}
|
||||
|
||||
static void _Scheduler_simple_smp_Insert_ready_fifo(
|
||||
Scheduler_SMP_Control *smp_base,
|
||||
Scheduler_SMP_Context *smp_base,
|
||||
Thread_Control *thread
|
||||
)
|
||||
{
|
||||
Scheduler_simple_SMP_Control *self =
|
||||
Scheduler_simple_SMP_Context *self =
|
||||
_Scheduler_simple_SMP_Self_from_SMP_base( smp_base );
|
||||
|
||||
_Chain_Insert_ordered_unprotected(
|
||||
@@ -120,7 +118,7 @@ static void _Scheduler_simple_smp_Insert_ready_fifo(
|
||||
}
|
||||
|
||||
static void _Scheduler_simple_smp_Do_extract(
|
||||
Scheduler_SMP_Control *smp_base,
|
||||
Scheduler_SMP_Context *smp_base,
|
||||
Thread_Control *thread
|
||||
)
|
||||
{
|
||||
@@ -133,12 +131,12 @@ static void _Scheduler_simple_smp_Do_extract(
|
||||
}
|
||||
|
||||
void _Scheduler_simple_smp_Block(
|
||||
Scheduler_Control *base,
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *thread
|
||||
)
|
||||
{
|
||||
Scheduler_simple_SMP_Control *self =
|
||||
_Scheduler_simple_SMP_Self_from_base( base );
|
||||
Scheduler_simple_SMP_Context *self =
|
||||
_Scheduler_simple_SMP_Get_context( scheduler );
|
||||
|
||||
_Scheduler_SMP_Block(
|
||||
&self->Base,
|
||||
@@ -150,7 +148,7 @@ void _Scheduler_simple_smp_Block(
|
||||
}
|
||||
|
||||
static void _Scheduler_simple_smp_Enqueue_ordered(
|
||||
Scheduler_SMP_Control *smp_base,
|
||||
Scheduler_SMP_Context *smp_base,
|
||||
Thread_Control *thread,
|
||||
Chain_Node_order order,
|
||||
Scheduler_SMP_Insert insert_ready,
|
||||
@@ -170,12 +168,12 @@ static void _Scheduler_simple_smp_Enqueue_ordered(
|
||||
}
|
||||
|
||||
void _Scheduler_simple_smp_Enqueue_priority_lifo(
|
||||
Scheduler_Control *base,
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *thread
|
||||
)
|
||||
{
|
||||
Scheduler_simple_SMP_Control *self =
|
||||
_Scheduler_simple_SMP_Self_from_base( base );
|
||||
Scheduler_simple_SMP_Context *self =
|
||||
_Scheduler_simple_SMP_Get_context( scheduler );
|
||||
|
||||
_Scheduler_simple_smp_Enqueue_ordered(
|
||||
&self->Base,
|
||||
@@ -187,12 +185,12 @@ void _Scheduler_simple_smp_Enqueue_priority_lifo(
|
||||
}
|
||||
|
||||
void _Scheduler_simple_smp_Enqueue_priority_fifo(
|
||||
Scheduler_Control *base,
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *thread
|
||||
)
|
||||
{
|
||||
Scheduler_simple_SMP_Control *self =
|
||||
_Scheduler_simple_SMP_Self_from_base( base );
|
||||
Scheduler_simple_SMP_Context *self =
|
||||
_Scheduler_simple_SMP_Get_context( scheduler );
|
||||
|
||||
_Scheduler_simple_smp_Enqueue_ordered(
|
||||
&self->Base,
|
||||
@@ -204,12 +202,12 @@ void _Scheduler_simple_smp_Enqueue_priority_fifo(
|
||||
}
|
||||
|
||||
void _Scheduler_simple_smp_Extract(
|
||||
Scheduler_Control *base,
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *thread
|
||||
)
|
||||
{
|
||||
Scheduler_simple_SMP_Control *self =
|
||||
_Scheduler_simple_SMP_Self_from_base( base );
|
||||
Scheduler_simple_SMP_Context *self =
|
||||
_Scheduler_simple_SMP_Get_context( scheduler );
|
||||
|
||||
_Scheduler_SMP_Extract(
|
||||
&self->Base,
|
||||
@@ -219,7 +217,7 @@ void _Scheduler_simple_smp_Extract(
|
||||
}
|
||||
|
||||
void _Scheduler_simple_smp_Yield(
|
||||
Scheduler_Control *base,
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *thread
|
||||
)
|
||||
{
|
||||
@@ -227,19 +225,19 @@ void _Scheduler_simple_smp_Yield(
|
||||
|
||||
_ISR_Disable( level );
|
||||
|
||||
_Scheduler_simple_smp_Extract( base, thread );
|
||||
_Scheduler_simple_smp_Enqueue_priority_fifo( base, thread );
|
||||
_Scheduler_simple_smp_Extract( scheduler, thread );
|
||||
_Scheduler_simple_smp_Enqueue_priority_fifo( scheduler, thread );
|
||||
|
||||
_ISR_Enable( level );
|
||||
}
|
||||
|
||||
void _Scheduler_simple_smp_Schedule(
|
||||
Scheduler_Control *base,
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *thread
|
||||
)
|
||||
{
|
||||
Scheduler_simple_SMP_Control *self =
|
||||
_Scheduler_simple_SMP_Self_from_base( base );
|
||||
Scheduler_simple_SMP_Context *self =
|
||||
_Scheduler_simple_SMP_Get_context( scheduler );
|
||||
|
||||
_Scheduler_SMP_Schedule(
|
||||
&self->Base,
|
||||
@@ -250,13 +248,13 @@ void _Scheduler_simple_smp_Schedule(
|
||||
}
|
||||
|
||||
void _Scheduler_simple_smp_Start_idle(
|
||||
Scheduler_Control *base,
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *thread,
|
||||
Per_CPU_Control *cpu
|
||||
)
|
||||
{
|
||||
Scheduler_simple_SMP_Control *self =
|
||||
_Scheduler_simple_SMP_Self_from_base( base );
|
||||
Scheduler_simple_SMP_Context *self =
|
||||
_Scheduler_simple_SMP_Get_context( scheduler );
|
||||
|
||||
_Scheduler_SMP_Start_idle( &self->Base, thread, cpu );
|
||||
}
|
||||
|
||||
@@ -18,14 +18,12 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <rtems/system.h>
|
||||
#include <rtems/score/isr.h>
|
||||
#include <rtems/score/schedulersimple.h>
|
||||
#include <rtems/score/schedulersimpleimpl.h>
|
||||
#include <rtems/score/thread.h>
|
||||
|
||||
void _Scheduler_simple_Unblock(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
_Scheduler_simple_Ready_queue_enqueue( scheduler, the_thread );
|
||||
|
||||
@@ -20,11 +20,10 @@
|
||||
|
||||
#include <rtems/score/schedulersimpleimpl.h>
|
||||
#include <rtems/score/isr.h>
|
||||
#include <rtems/score/threadimpl.h>
|
||||
|
||||
void _Scheduler_simple_Yield(
|
||||
Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
const Scheduler_Control *scheduler,
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
ISR_Level level;
|
||||
|
||||
@@ -29,9 +29,9 @@ void _Thread_Change_priority(
|
||||
bool prepend_it
|
||||
)
|
||||
{
|
||||
Scheduler_Control *scheduler = _Scheduler_Get( the_thread );
|
||||
ISR_Level level;
|
||||
States_Control state, original_state;
|
||||
const Scheduler_Control *scheduler = _Scheduler_Get( the_thread );
|
||||
ISR_Level level;
|
||||
States_Control state, original_state;
|
||||
|
||||
/*
|
||||
* Save original state
|
||||
|
||||
@@ -216,9 +216,9 @@ void _Thread_Life_action_handler(
|
||||
}
|
||||
|
||||
static void _Thread_Start_life_change(
|
||||
Thread_Control *the_thread,
|
||||
Scheduler_Control *scheduler,
|
||||
Priority_Control priority
|
||||
Thread_Control *the_thread,
|
||||
const Scheduler_Control *scheduler,
|
||||
Priority_Control priority
|
||||
)
|
||||
{
|
||||
the_thread->is_preemptible = the_thread->Start.is_preemptible;
|
||||
@@ -245,7 +245,7 @@ static void _Thread_Request_life_change(
|
||||
Thread_Life_state previous_life_state;
|
||||
Per_CPU_Control *cpu;
|
||||
ISR_Level level;
|
||||
Scheduler_Control *scheduler;
|
||||
const Scheduler_Control *scheduler;
|
||||
|
||||
cpu = _Thread_Action_ISR_disable_and_acquire( the_thread, &level );
|
||||
previous_life_state = the_thread->Life.state;
|
||||
|
||||
@@ -3716,10 +3716,10 @@ support enabled.
|
||||
@code{CONFIGURE_SCHEDULER_USER}
|
||||
|
||||
@item DATA TYPE:
|
||||
Entry points for scheduler
|
||||
Boolean feature macro.
|
||||
|
||||
@item RANGE:
|
||||
Undefined or scheduler entry set
|
||||
Defined or undefined.
|
||||
|
||||
@item DEFAULT VALUE:
|
||||
This is not defined by default.
|
||||
@@ -3734,12 +3734,14 @@ own scheduling algorithm. If @code{CONFIGURE_SCHEDULER_USER} is defined
|
||||
then the following additional macros must be defined:
|
||||
|
||||
@itemize @bullet
|
||||
@item @code{CONFIGURE_MEMORY_FOR_SCHEDULER} must be defined with the
|
||||
amount of memory required as a base amount for the scheduler.
|
||||
@item @code{CONFIGURE_SCHEDULER_CONTEXT} must be defined to a static definition
|
||||
of the scheduler context of the user scheduler.
|
||||
|
||||
@item @code{CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER(_tasks)} must be
|
||||
defined as a formula which computes the amount of memory required based
|
||||
upon the number of tasks configured.
|
||||
@item @code{CONFIGURE_SCHEDULER_CONTROLS} must be defined to a scheduler
|
||||
control initializer for the user scheduler.
|
||||
|
||||
@item @code{CONFIGURE_SCHEDULER_USER_PER_THREAD} must be defined to the type of
|
||||
the per-thread information of the user scheduler.
|
||||
|
||||
@end itemize
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
#define CONFIGURE_INIT
|
||||
#include <timesys.h>
|
||||
#include <rtems/score/schedulerpriorityimpl.h>
|
||||
#include <rtems/timerdrv.h>
|
||||
#include <coverhd.h>
|
||||
|
||||
@@ -58,7 +59,10 @@ rtems_task Init(
|
||||
|
||||
puts( "*** START OF RHILATENCY ***" );
|
||||
|
||||
if (_Scheduler.Operations.initialize != _Scheduler_priority_Initialize) {
|
||||
if (
|
||||
_Scheduler_Table[ 0 ].Operations.initialize
|
||||
!= _Scheduler_priority_Initialize
|
||||
) {
|
||||
puts( " Error ==> " );
|
||||
puts( "Test only supported for deterministic priority scheduler\n" );
|
||||
rtems_test_exit( 0 );
|
||||
|
||||
@@ -70,11 +70,11 @@ static void *idle_body(uintptr_t ignored)
|
||||
|
||||
#define CONFIGURE_DISABLE_NEWLIB_REENTRANCY
|
||||
|
||||
#define CONFIGURE_SCHEDULER_ENTRY_POINTS NULL
|
||||
|
||||
#define CONFIGURE_SCHEDULER_USER
|
||||
|
||||
#define CONFIGURE_MEMORY_FOR_SCHEDULER 0
|
||||
#define CONFIGURE_SCHEDULER_CONTEXT
|
||||
|
||||
#define CONFIGURE_SCHEDULER_CONTROLS { }
|
||||
|
||||
#define CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER 0
|
||||
|
||||
|
||||
@@ -84,9 +84,6 @@ void print_formula(void);
|
||||
#include <rtems/score/prioritybitmapimpl.h>
|
||||
#include <rtems/score/schedulerpriority.h>
|
||||
|
||||
/* Priority scheduling uninitialized (globals) consumption */
|
||||
#define SCHEDULER_OVHD (sizeof _Scheduler)
|
||||
|
||||
/* Priority scheduling per-thread consumption. Gets
|
||||
* included in the PER_TASK consumption.
|
||||
*/
|
||||
@@ -94,11 +91,10 @@ void print_formula(void);
|
||||
|
||||
/* Priority scheduling workspace consumption
|
||||
*
|
||||
* Include allocation of ready queue. Pointers are already counted by
|
||||
* including _Scheduler in SCHEDULER_OVHD.
|
||||
* Include allocation of ready queue.
|
||||
*/
|
||||
#define SCHEDULER_WKSP_SIZE \
|
||||
(sizeof(Scheduler_priority_Control) + \
|
||||
(sizeof(Scheduler_priority_Context) + \
|
||||
RTEMS_MAXIMUM_PRIORITY * sizeof(Chain_Control ))
|
||||
/****** END OF MEMORY USAGE OF DEFAULT PRIORITY SCHEDULER ******/
|
||||
|
||||
@@ -352,8 +348,6 @@ uninitialized =
|
||||
|
||||
/*rtems.h*/ /* Not applicable */
|
||||
|
||||
/*scheduler.h*/ SCHEDULER_OVHD +
|
||||
|
||||
/*semimpl.h*/ (sizeof _Semaphore_Information) +
|
||||
|
||||
#if defined(RTEMS_MULTIPROCESSING)
|
||||
|
||||
@@ -223,7 +223,10 @@ rtems_task Init(
|
||||
|
||||
TEST_BEGIN();
|
||||
|
||||
if (_Scheduler.Operations.initialize != _Scheduler_priority_Initialize) {
|
||||
if (
|
||||
_Scheduler_Table[ 0 ].Operations.initialize
|
||||
!= _Scheduler_priority_Initialize
|
||||
) {
|
||||
puts(" Error ==> " );
|
||||
puts("Test only supported for deterministic priority scheduler\n" );
|
||||
TEST_END();
|
||||
@@ -371,8 +374,8 @@ rtems_task Middle_task(
|
||||
rtems_task_argument argument
|
||||
)
|
||||
{
|
||||
Scheduler_priority_Control *scheduler =
|
||||
_Scheduler_priority_Self_from_base( _Scheduler_Get( NULL ) );
|
||||
Scheduler_priority_Context *scheduler_context =
|
||||
_Scheduler_priority_Get_context( _Scheduler_Get( _Thread_Get_executing() ) );
|
||||
|
||||
thread_dispatch_no_fp_time = benchmark_timer_read();
|
||||
|
||||
@@ -381,7 +384,7 @@ rtems_task Middle_task(
|
||||
Middle_tcb = _Thread_Get_executing();
|
||||
|
||||
set_thread_executing(
|
||||
(Thread_Control *) _Chain_First(&scheduler->Ready[LOW_PRIORITY])
|
||||
(Thread_Control *) _Chain_First(&scheduler_context->Ready[LOW_PRIORITY])
|
||||
);
|
||||
|
||||
/* do not force context switch */
|
||||
@@ -404,8 +407,8 @@ rtems_task Low_task(
|
||||
rtems_task_argument argument
|
||||
)
|
||||
{
|
||||
Scheduler_priority_Control *scheduler =
|
||||
_Scheduler_priority_Self_from_base( _Scheduler_Get( NULL ) );
|
||||
Scheduler_priority_Context *scheduler_context =
|
||||
_Scheduler_priority_Get_context( _Scheduler_Get( _Thread_Get_executing() ) );
|
||||
Thread_Control *executing;
|
||||
|
||||
context_switch_no_fp_time = benchmark_timer_read();
|
||||
@@ -424,7 +427,7 @@ rtems_task Low_task(
|
||||
context_switch_another_task_time = benchmark_timer_read();
|
||||
|
||||
set_thread_executing(
|
||||
(Thread_Control *) _Chain_First(&scheduler->Ready[FP1_PRIORITY])
|
||||
(Thread_Control *) _Chain_First(&scheduler_context->Ready[FP1_PRIORITY])
|
||||
);
|
||||
|
||||
/* do not force context switch */
|
||||
@@ -447,8 +450,8 @@ rtems_task Floating_point_task_1(
|
||||
rtems_task_argument argument
|
||||
)
|
||||
{
|
||||
Scheduler_priority_Control *scheduler =
|
||||
_Scheduler_priority_Self_from_base( _Scheduler_Get( NULL ) );
|
||||
Scheduler_priority_Context *scheduler_context =
|
||||
_Scheduler_priority_Get_context( _Scheduler_Get( _Thread_Get_executing() ) );
|
||||
Thread_Control *executing;
|
||||
FP_DECLARE;
|
||||
|
||||
@@ -457,7 +460,7 @@ rtems_task Floating_point_task_1(
|
||||
executing = _Thread_Get_executing();
|
||||
|
||||
set_thread_executing(
|
||||
(Thread_Control *) _Chain_First(&scheduler->Ready[FP2_PRIORITY])
|
||||
(Thread_Control *) _Chain_First(&scheduler_context->Ready[FP2_PRIORITY])
|
||||
);
|
||||
|
||||
/* do not force context switch */
|
||||
@@ -484,7 +487,7 @@ rtems_task Floating_point_task_1(
|
||||
executing = _Thread_Get_executing();
|
||||
|
||||
set_thread_executing(
|
||||
(Thread_Control *) _Chain_First(&scheduler->Ready[FP2_PRIORITY])
|
||||
(Thread_Control *) _Chain_First(&scheduler_context->Ready[FP2_PRIORITY])
|
||||
);
|
||||
|
||||
benchmark_timer_initialize();
|
||||
@@ -503,8 +506,8 @@ rtems_task Floating_point_task_2(
|
||||
rtems_task_argument argument
|
||||
)
|
||||
{
|
||||
Scheduler_priority_Control *scheduler =
|
||||
_Scheduler_priority_Self_from_base( _Scheduler_Get( NULL ) );
|
||||
Scheduler_priority_Context *scheduler_context =
|
||||
_Scheduler_priority_Get_context( _Scheduler_Get( _Thread_Get_executing() ) );
|
||||
Thread_Control *executing;
|
||||
FP_DECLARE;
|
||||
|
||||
@@ -513,7 +516,7 @@ rtems_task Floating_point_task_2(
|
||||
executing = _Thread_Get_executing();
|
||||
|
||||
set_thread_executing(
|
||||
(Thread_Control *) _Chain_First(&scheduler->Ready[FP1_PRIORITY])
|
||||
(Thread_Control *) _Chain_First(&scheduler_context->Ready[FP1_PRIORITY])
|
||||
);
|
||||
|
||||
FP_LOAD( 1.0 );
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
#define CONFIGURE_INIT
|
||||
#include "system.h"
|
||||
|
||||
#include <rtems/score/schedulerpriorityimpl.h>
|
||||
#include <bsp.h>
|
||||
#include <rtems/score/schedulerpriorityimpl.h>
|
||||
|
||||
#define _RTEMS_TMTEST27
|
||||
#include <tm27.h>
|
||||
@@ -55,7 +55,11 @@ rtems_task Init(
|
||||
Print_Warning();
|
||||
|
||||
TEST_BEGIN();
|
||||
if (_Scheduler.Operations.initialize != _Scheduler_priority_Initialize) {
|
||||
|
||||
if (
|
||||
_Scheduler_Table[ 0 ].Operations.initialize
|
||||
!= _Scheduler_priority_Initialize
|
||||
) {
|
||||
puts(" Error ==> " );
|
||||
puts("Test only supported for deterministic priority scheduler\n" );
|
||||
TEST_END();
|
||||
@@ -102,8 +106,8 @@ rtems_task Task_1(
|
||||
rtems_task_argument argument
|
||||
)
|
||||
{
|
||||
Scheduler_priority_Control *scheduler =
|
||||
_Scheduler_priority_Self_from_base( _Scheduler_Get( NULL ) );
|
||||
Scheduler_priority_Context *scheduler_context =
|
||||
_Scheduler_priority_Get_context( _Scheduler_Get( _Thread_Get_executing() ) );
|
||||
#if defined(RTEMS_SMP)
|
||||
rtems_interrupt_level level;
|
||||
#endif
|
||||
@@ -188,7 +192,7 @@ rtems_task Task_1(
|
||||
#endif
|
||||
|
||||
_Thread_Executing =
|
||||
(Thread_Control *) _Chain_First(&scheduler->Ready[LOW_PRIORITY]);
|
||||
(Thread_Control *) _Chain_First(&scheduler_context->Ready[LOW_PRIORITY]);
|
||||
|
||||
_Thread_Dispatch_necessary = 1;
|
||||
|
||||
@@ -220,8 +224,8 @@ rtems_task Task_2(
|
||||
rtems_task_argument argument
|
||||
)
|
||||
{
|
||||
Scheduler_priority_Control *scheduler =
|
||||
_Scheduler_priority_Self_from_base( _Scheduler_Get( NULL ) );
|
||||
Scheduler_priority_Context *scheduler_context =
|
||||
_Scheduler_priority_Get_context( _Scheduler_Get( _Thread_Get_executing() ) );
|
||||
#if defined(RTEMS_SMP)
|
||||
rtems_interrupt_level level;
|
||||
#endif
|
||||
@@ -258,7 +262,7 @@ rtems_task Task_2(
|
||||
#endif
|
||||
|
||||
_Thread_Executing =
|
||||
(Thread_Control *) _Chain_First(&scheduler->Ready[LOW_PRIORITY]);
|
||||
(Thread_Control *) _Chain_First(&scheduler_context->Ready[LOW_PRIORITY]);
|
||||
|
||||
_Thread_Dispatch_necessary = 1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user