Changeset 647b95d in rtems


Ignore:
Timestamp:
Jun 10, 2014, 2:32:12 PM (6 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
8f0c7a46
Parents:
2d36931
git-author:
Sebastian Huber <sebastian.huber@…> (06/10/14 14:32:12)
git-committer:
Sebastian Huber <sebastian.huber@…> (06/23/14 07:13:00)
Message:

score: Use chain nodes for ready queue support

This reduces the API to the minimum data structures to maximize the
re-usability.

Location:
cpukit/score
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/include/rtems/score/schedulerpriorityimpl.h

    r2d36931 r647b95d  
    6666
    6767/**
    68  * @brief Enqueues a thread on the specified ready queue.
    69  *
    70  * The thread is placed as the last element of its priority group.
    71  *
    72  * @param[in] the_thread The thread to enqueue.
     68 * @brief Enqueues a node on the specified ready queue.
     69 *
     70 * The node is placed as the last element of its priority group.
     71 *
     72 * @param[in] node The node to enqueue.
    7373 * @param[in] ready_queue The ready queue.
    7474 * @param[in] bit_map The priority bit map of the scheduler instance.
    7575 */
    7676RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_enqueue(
    77   Thread_Control                 *the_thread,
     77  Chain_Node                     *node,
    7878  Scheduler_priority_Ready_queue *ready_queue,
    7979  Priority_bit_map_Control       *bit_map
     
    8282  Chain_Control *ready_chain = ready_queue->ready_chain;
    8383
    84   _Chain_Append_unprotected( ready_chain, &the_thread->Object.Node );
     84  _Chain_Append_unprotected( ready_chain, node );
    8585  _Priority_bit_map_Add( bit_map, &ready_queue->Priority_map );
    8686}
    8787
    8888/**
    89  * @brief Enqueues a thread on the specified ready queue as first.
    90  *
    91  * The thread is placed as the first element of its priority group.
    92  *
    93  * @param[in] the_thread The thread to enqueue as first.
     89 * @brief Enqueues a node on the specified ready queue as first.
     90 *
     91 * The node is placed as the first element of its priority group.
     92 *
     93 * @param[in] node The node to enqueue as first.
    9494 * @param[in] ready_queue The ready queue.
    9595 * @param[in] bit_map The priority bit map of the scheduler instance.
    9696 */
    9797RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_enqueue_first(
    98   Thread_Control                 *the_thread,
     98  Chain_Node                     *node,
    9999  Scheduler_priority_Ready_queue *ready_queue,
    100100  Priority_bit_map_Control       *bit_map
     
    103103  Chain_Control *ready_chain = ready_queue->ready_chain;
    104104
    105   _Chain_Prepend_unprotected( ready_chain, &the_thread->Object.Node );
     105  _Chain_Prepend_unprotected( ready_chain, node );
    106106  _Priority_bit_map_Add( bit_map, &ready_queue->Priority_map );
    107107}
    108108
    109109/**
    110  * @brief Extracts a thread from the specified ready queue.
    111  *
    112  * @param[in] the_thread The thread to extract.
     110 * @brief Extracts a node from the specified ready queue.
     111 *
     112 * @param[in] node The node to extract.
    113113 * @param[in] ready_queue The ready queue.
    114114 * @param[in] bit_map The priority bit map of the scheduler instance.
    115115 */
    116116RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_extract(
    117   Thread_Control                 *the_thread,
     117  Chain_Node                     *node,
    118118  Scheduler_priority_Ready_queue *ready_queue,
    119119  Priority_bit_map_Control       *bit_map
     
    126126    _Priority_bit_map_Remove( bit_map, &ready_queue->Priority_map );
    127127  } else {
    128     _Chain_Extract_unprotected( &the_thread->Object.Node );
     128    _Chain_Extract_unprotected( node );
    129129  }
    130130}
     
    140140
    141141  _Scheduler_priority_Ready_queue_extract(
    142     the_thread,
     142    &the_thread->Object.Node,
    143143    &node->Ready_queue,
    144144    &context->Bit_map
     
    147147
    148148/**
    149  * @brief Return a pointer to the first thread.
    150  *
    151  * This routines returns a pointer to the first thread on @a ready_queues.
     149 * @brief Return a pointer to the first node.
     150 *
     151 * This routines returns a pointer to the first node on @a ready_queues.
    152152 *
    153153 * @param[in] bit_map The priority bit map of the scheduler instance.
    154154 * @param[in] ready_queues The ready queues of the scheduler instance.
    155155 *
    156  * @return This method returns the first thread or NULL
    157  */
    158 RTEMS_INLINE_ROUTINE Thread_Control *_Scheduler_priority_Ready_queue_first(
     156 * @return This method returns the first node.
     157 */
     158RTEMS_INLINE_ROUTINE Chain_Node *_Scheduler_priority_Ready_queue_first(
    159159  Priority_bit_map_Control *bit_map,
    160160  Chain_Control            *ready_queues
     
    163163  Priority_Control index = _Priority_bit_map_Get_highest( bit_map );
    164164
    165   return (Thread_Control *) _Chain_First( &ready_queues[ index ] );
     165  return _Chain_First( &ready_queues[ index ] );
    166166}
    167167
     
    180180  Scheduler_priority_Context *context =
    181181    _Scheduler_priority_Get_context( scheduler );
    182   Thread_Control *heir = _Scheduler_priority_Ready_queue_first(
    183     &context->Bit_map,
    184     &context->Ready[ 0 ]
    185   );
     182  Thread_Control *heir = (Thread_Control *)
     183    _Scheduler_priority_Ready_queue_first(
     184      &context->Bit_map,
     185      &context->Ready[ 0 ]
     186    );
    186187
    187188  ( void ) the_thread;
  • cpukit/score/include/rtems/score/schedulerprioritysmpimpl.h

    r2d36931 r647b95d  
    7070  _Chain_Extract_unprotected( &scheduled_to_ready->Object.Node );
    7171  _Scheduler_priority_Ready_queue_enqueue_first(
    72     scheduled_to_ready,
     72    &scheduled_to_ready->Object.Node,
    7373    &node->Ready_queue,
    7474    &self->Bit_map
     
    8787
    8888  _Scheduler_priority_Ready_queue_extract(
    89     ready_to_scheduled,
     89    &ready_to_scheduled->Object.Node,
    9090    &node->Ready_queue,
    9191    &self->Bit_map
     
    9393  _Scheduler_simple_Insert_priority_fifo(
    9494    &self->Base.Scheduled,
    95     ready_to_scheduled
     95    &ready_to_scheduled->Object.Node
    9696  );
    9797}
     
    108108
    109109  _Scheduler_priority_Ready_queue_enqueue(
    110     thread,
     110    &thread->Object.Node,
    111111    &node->Ready_queue,
    112112    &self->Bit_map
     
    125125
    126126  _Scheduler_priority_Ready_queue_enqueue_first(
    127     thread,
     127    &thread->Object.Node,
    128128    &node->Ready_queue,
    129129    &self->Bit_map
     
    142142
    143143  _Scheduler_priority_Ready_queue_extract(
    144     thread,
     144    &thread->Object.Node,
    145145    &node->Ready_queue,
    146146    &self->Bit_map
  • cpukit/score/src/schedulerprioritychangepriority.c

    r2d36931 r647b95d  
    3434
    3535  _Scheduler_priority_Ready_queue_extract(
    36     the_thread,
     36    &the_thread->Object.Node,
    3737    &node->Ready_queue,
    3838    &context->Bit_map
     
    4848  if ( prepend_it ) {
    4949    _Scheduler_priority_Ready_queue_enqueue_first(
    50       the_thread,
     50      &the_thread->Object.Node,
    5151      &node->Ready_queue,
    5252      &context->Bit_map
     
    5454  } else {
    5555    _Scheduler_priority_Ready_queue_enqueue(
    56       the_thread,
     56      &the_thread->Object.Node,
    5757      &node->Ready_queue,
    5858      &context->Bit_map
  • cpukit/score/src/schedulerprioritysmp.c

    r2d36931 r647b95d  
    7676  (void) thread;
    7777
    78   return _Scheduler_priority_Ready_queue_first(
     78  return (Thread_Control *) _Scheduler_priority_Ready_queue_first(
    7979    &self->Bit_map,
    8080    &self->Ready[ 0 ]
  • cpukit/score/src/schedulerpriorityunblock.c

    r2d36931 r647b95d  
    3333
    3434  _Scheduler_priority_Ready_queue_enqueue(
    35     the_thread,
     35    &the_thread->Object.Node,
    3636    &node->Ready_queue,
    3737    &context->Bit_map
Note: See TracChangeset for help on using the changeset viewer.