diff options
author | Chris Johns <chrisj@rtems.org> | 2017-12-23 18:18:56 +1100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-01-25 08:45:26 +0100 |
commit | 2afb22b7e1ebcbe40373ff7e0efae7d207c655a9 (patch) | |
tree | 44759efe9374f13200a97e96d91bd9a2b7e5ce2a /cpukit/include/rtems/score/schedulerpriorityimpl.h | |
parent | MAINTAINERS: Add myself to Write After Approval. (diff) | |
download | rtems-2afb22b7e1ebcbe40373ff7e0efae7d207c655a9.tar.bz2 |
Remove make preinstall
A speciality of the RTEMS build system was the make preinstall step. It
copied header files from arbitrary locations into the build tree. The
header files were included via the -Bsome/build/tree/path GCC command
line option.
This has at least seven problems:
* The make preinstall step itself needs time and disk space.
* Errors in header files show up in the build tree copy. This makes it
hard for editors to open the right file to fix the error.
* There is no clear relationship between source and build tree header
files. This makes an audit of the build process difficult.
* The visibility of all header files in the build tree makes it
difficult to enforce API barriers. For example it is discouraged to
use BSP-specifics in the cpukit.
* An introduction of a new build system is difficult.
* Include paths specified by the -B option are system headers. This
may suppress warnings.
* The parallel build had sporadic failures on some hosts.
This patch removes the make preinstall step. All installed header
files are moved to dedicated include directories in the source tree.
Let @RTEMS_CPU@ be the target architecture, e.g. arm, powerpc, sparc,
etc. Let @RTEMS_BSP_FAMILIY@ be a BSP family base directory, e.g.
erc32, imx, qoriq, etc.
The new cpukit include directories are:
* cpukit/include
* cpukit/score/cpu/@RTEMS_CPU@/include
* cpukit/libnetworking
The new BSP include directories are:
* bsps/include
* bsps/@RTEMS_CPU@/include
* bsps/@RTEMS_CPU@/@RTEMS_BSP_FAMILIY@/include
There are build tree include directories for generated files.
The include directory order favours the most general header file, e.g.
it is not possible to override general header files via the include path
order.
The "bootstrap -p" option was removed. The new "bootstrap -H" option
should be used to regenerate the "headers.am" files.
Update #3254.
Diffstat (limited to 'cpukit/include/rtems/score/schedulerpriorityimpl.h')
-rw-r--r-- | cpukit/include/rtems/score/schedulerpriorityimpl.h | 241 |
1 files changed, 241 insertions, 0 deletions
diff --git a/cpukit/include/rtems/score/schedulerpriorityimpl.h b/cpukit/include/rtems/score/schedulerpriorityimpl.h new file mode 100644 index 0000000000..354065fac4 --- /dev/null +++ b/cpukit/include/rtems/score/schedulerpriorityimpl.h @@ -0,0 +1,241 @@ +/** + * @file + * + * @brief Inlined Routines Associated with the Manipulation of the + * Priority-Based Scheduling Structures + * + * This inline file contains all of the inlined routines associated with + * the manipulation of the priority-based scheduling structures. + */ + +/* + * Copyright (C) 2010 Gedare Bloom. + * Copyright (C) 2011 On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.org/license/LICENSE. + */ + +#ifndef _RTEMS_SCORE_SCHEDULERPRIORITYIMPL_H +#define _RTEMS_SCORE_SCHEDULERPRIORITYIMPL_H + +#include <rtems/score/schedulerpriority.h> +#include <rtems/score/chainimpl.h> +#include <rtems/score/prioritybitmapimpl.h> +#include <rtems/score/schedulerimpl.h> +#include <rtems/score/thread.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup ScoreSchedulerDPS + */ +/**@{**/ + +RTEMS_INLINE_ROUTINE Scheduler_priority_Context * + _Scheduler_priority_Get_context( const Scheduler_Control *scheduler ) +{ + return (Scheduler_priority_Context *) _Scheduler_Get_context( scheduler ); +} + +RTEMS_INLINE_ROUTINE Scheduler_priority_Node *_Scheduler_priority_Thread_get_node( + Thread_Control *the_thread +) +{ + return (Scheduler_priority_Node *) _Thread_Scheduler_get_home_node( the_thread ); +} + +RTEMS_INLINE_ROUTINE Scheduler_priority_Node *_Scheduler_priority_Node_downcast( + Scheduler_Node *node +) +{ + return (Scheduler_priority_Node *) node; +} + +/** + * @brief Ready queue initialization. + * + * This routine initializes @a ready_queues for priority-based scheduling. + */ +RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_initialize( + Chain_Control *ready_queues, + Priority_Control maximum_priority +) +{ + size_t index; + + for ( index = 0 ; index <= (size_t) maximum_priority ; ++index ) { + _Chain_Initialize_empty( &ready_queues[ index ] ); + } +} + +/** + * @brief Enqueues a node on the specified ready queue. + * + * The node is placed as the last element of its priority group. + * + * @param[in] node The node to enqueue. + * @param[in] ready_queue The ready queue. + * @param[in] bit_map The priority bit map of the scheduler instance. + */ +RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_enqueue( + Chain_Node *node, + Scheduler_priority_Ready_queue *ready_queue, + Priority_bit_map_Control *bit_map +) +{ + Chain_Control *ready_chain = ready_queue->ready_chain; + + _Chain_Append_unprotected( ready_chain, node ); + _Priority_bit_map_Add( bit_map, &ready_queue->Priority_map ); +} + +/** + * @brief Enqueues a node on the specified ready queue as first. + * + * The node is placed as the first element of its priority group. + * + * @param[in] node The node to enqueue as first. + * @param[in] ready_queue The ready queue. + * @param[in] bit_map The priority bit map of the scheduler instance. + */ +RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_enqueue_first( + Chain_Node *node, + Scheduler_priority_Ready_queue *ready_queue, + Priority_bit_map_Control *bit_map +) +{ + Chain_Control *ready_chain = ready_queue->ready_chain; + + _Chain_Prepend_unprotected( ready_chain, node ); + _Priority_bit_map_Add( bit_map, &ready_queue->Priority_map ); +} + +/** + * @brief Extracts a node from the specified ready queue. + * + * @param[in] node The node to extract. + * @param[in] ready_queue The ready queue. + * @param[in] bit_map The priority bit map of the scheduler instance. + */ +RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_extract( + Chain_Node *node, + Scheduler_priority_Ready_queue *ready_queue, + Priority_bit_map_Control *bit_map +) +{ + Chain_Control *ready_chain = ready_queue->ready_chain; + + if ( _Chain_Has_only_one_node( ready_chain ) ) { + _Chain_Initialize_empty( ready_chain ); + _Chain_Initialize_node( node ); + _Priority_bit_map_Remove( bit_map, &ready_queue->Priority_map ); + } else { + _Chain_Extract_unprotected( node ); + } +} + +RTEMS_INLINE_ROUTINE void _Scheduler_priority_Extract_body( + const Scheduler_Control *scheduler, + Thread_Control *the_thread, + Scheduler_Node *node +) +{ + Scheduler_priority_Context *context; + Scheduler_priority_Node *the_node; + + context = _Scheduler_priority_Get_context( scheduler ); + the_node = _Scheduler_priority_Node_downcast( node ); + + _Scheduler_priority_Ready_queue_extract( + &the_thread->Object.Node, + &the_node->Ready_queue, + &context->Bit_map + ); +} + +/** + * @brief Return a pointer to the first node. + * + * This routines returns a pointer to the first node on @a ready_queues. + * + * @param[in] bit_map The priority bit map of the scheduler instance. + * @param[in] ready_queues The ready queues of the scheduler instance. + * + * @return This method returns the first node. + */ +RTEMS_INLINE_ROUTINE Chain_Node *_Scheduler_priority_Ready_queue_first( + Priority_bit_map_Control *bit_map, + Chain_Control *ready_queues +) +{ + Priority_Control index = _Priority_bit_map_Get_highest( bit_map ); + Chain_Node *first = _Chain_First( &ready_queues[ index ] ); + + _Assert( first != _Chain_Tail( &ready_queues[ index ] ) ); + + return first; +} + +/** + * @brief Scheduling decision logic. + * + * This kernel routine implements scheduling decision logic + * for priority-based scheduling. + */ +RTEMS_INLINE_ROUTINE void _Scheduler_priority_Schedule_body( + const Scheduler_Control *scheduler, + Thread_Control *the_thread, + bool force_dispatch +) +{ + Scheduler_priority_Context *context = + _Scheduler_priority_Get_context( scheduler ); + Thread_Control *heir = (Thread_Control *) + _Scheduler_priority_Ready_queue_first( + &context->Bit_map, + &context->Ready[ 0 ] + ); + + ( void ) the_thread; + + _Scheduler_Update_heir( heir, force_dispatch ); +} + +/** + * @brief Updates the specified ready queue data according to the new priority + * value. + * + * @param[in] ready_queue The ready queue. + * @param[in] new_priority The new priority. + * @param[in] bit_map The priority bit map of the scheduler instance. + * @param[in] ready_queues The ready queues of the scheduler instance. + */ +RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_update( + Scheduler_priority_Ready_queue *ready_queue, + unsigned int new_priority, + Priority_bit_map_Control *bit_map, + Chain_Control *ready_queues +) +{ + ready_queue->current_priority = new_priority; + ready_queue->ready_chain = &ready_queues[ new_priority ]; + + _Priority_bit_map_Initialize_information( + bit_map, + &ready_queue->Priority_map, + new_priority + ); +} + +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ |