forked from Imagelibrary/rtems
Remove white-spaces.
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rtems.com/license/LICENSE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef _RTEMS_PERCPU_H
|
||||
@@ -64,7 +64,7 @@ typedef struct Thread_Control_struct Thread_Control;
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
|
||||
|
||||
/**
|
||||
* This defines the constant used to indicate that the cpu code is in
|
||||
* its initial powered up start.
|
||||
@@ -92,17 +92,17 @@ typedef enum {
|
||||
typedef struct {
|
||||
#if defined(RTEMS_SMP)
|
||||
/** This element is used to lock this structure */
|
||||
SMP_lock_spinlock_simple_Control lock;
|
||||
SMP_lock_spinlock_simple_Control lock;
|
||||
|
||||
/** This indicates that the CPU is online. */
|
||||
uint32_t state;
|
||||
uint32_t state;
|
||||
|
||||
/**
|
||||
* This is the request for the interrupt.
|
||||
*
|
||||
*
|
||||
* @note This may become a chain protected by atomic instructions.
|
||||
*/
|
||||
uint32_t message;
|
||||
uint32_t message;
|
||||
#endif
|
||||
|
||||
#if (CPU_ALLOCATE_INTERRUPT_STACK == TRUE) || \
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
#define _RTEMS_SCORE_PRIORITYBITMAP_H
|
||||
|
||||
/**
|
||||
* @addtogroup ScorePriority
|
||||
*
|
||||
* @addtogroup ScorePriority
|
||||
*
|
||||
*/
|
||||
/**@{*/
|
||||
|
||||
@@ -38,8 +38,8 @@ extern "C" {
|
||||
#include <rtems/score/priority.h>
|
||||
|
||||
|
||||
/*
|
||||
* The Priority_bit_map_Control variables are instantiated only
|
||||
/*
|
||||
* The Priority_bit_map_Control variables are instantiated only
|
||||
* if using the bit map handler.
|
||||
*/
|
||||
|
||||
|
||||
@@ -83,12 +83,12 @@ extern "C" {
|
||||
/**
|
||||
* @brief macro to return the structure containing the @a node.
|
||||
*
|
||||
* This macro returns a pointer of type @a container_type that points
|
||||
* to the structure containing @a node, where @a node_field_name is the
|
||||
* This macro returns a pointer of type @a container_type that points
|
||||
* to the structure containing @a node, where @a node_field_name is the
|
||||
* field name of the RBTree_Node structure in @a container_type.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#define _RBTree_Container_of(node,container_type, node_field_name) \
|
||||
((container_type*) \
|
||||
((size_t)node - ((size_t)(&((container_type *)0)->node_field_name))))
|
||||
@@ -107,12 +107,12 @@ extern "C" {
|
||||
*
|
||||
* @note This implementation does not require special checks for
|
||||
* manipulating the root element of the RBT.
|
||||
* To accomplish this the @a RBTree_Control structure can be overlaid
|
||||
* with a @ref RBTree_Node structure to act as a "dummy root",
|
||||
* To accomplish this the @a RBTree_Control structure can be overlaid
|
||||
* with a @ref RBTree_Node structure to act as a "dummy root",
|
||||
* which has a NULL parent and its left child is the root.
|
||||
*/
|
||||
|
||||
/* the RBTree_Control is actually part of the RBTree structure as an
|
||||
/* the RBTree_Control is actually part of the RBTree structure as an
|
||||
* RBTree_Node. The mapping of fields from RBTree_Control to RBTree_Node are:
|
||||
* permanent_null == parent
|
||||
* root == left
|
||||
@@ -201,7 +201,7 @@ extern "C" {
|
||||
* @brief Check the min or max node on a rbtree
|
||||
*
|
||||
* This function returns a pointer to the min or max node of @a the_rbtree.
|
||||
* If @a the_rbtree is empty, then NULL is returned. @a dir specifies
|
||||
* If @a the_rbtree is empty, then NULL is returned. @a dir specifies
|
||||
* whether to return the min (0) or max (1).
|
||||
*
|
||||
* @return This method returns a pointer to a node.
|
||||
@@ -216,18 +216,18 @@ extern "C" {
|
||||
|
||||
/** @brief Find the node with given value in the tree
|
||||
*
|
||||
* This function returns a pointer to the node with value equal to @a value
|
||||
* if it exists in the Red-Black Tree @a the_rbtree, and NULL if not.
|
||||
* This function returns a pointer to the node with value equal to @a value
|
||||
* if it exists in the Red-Black Tree @a the_rbtree, and NULL if not.
|
||||
*/
|
||||
RBTree_Node *_RBTree_Find(
|
||||
RBTree_Control *the_rbtree,
|
||||
RBTree_Control *the_rbtree,
|
||||
unsigned int value
|
||||
);
|
||||
|
||||
/** @brief Find the control structure of the tree containing the given node
|
||||
/** @brief Find the control structure of the tree containing the given node
|
||||
*
|
||||
* This function returns a pointer to the control structure of the tree
|
||||
* containing @a the_node, if it exists, and NULL if not.
|
||||
* This function returns a pointer to the control structure of the tree
|
||||
* containing @a the_node, if it exists, and NULL if not.
|
||||
*/
|
||||
RBTree_Control *_RBTree_Find_header(
|
||||
RBTree_Node *the_node
|
||||
@@ -239,7 +239,7 @@ extern "C" {
|
||||
*
|
||||
* @retval 0 Successfully inserted.
|
||||
* @retval -1 NULL @a the_node.
|
||||
* @retval RBTree_Node* if one with equal value to @a the_node->value exists
|
||||
* @retval RBTree_Node* if one with equal value to @a the_node->value exists
|
||||
* in @a the_rbtree.
|
||||
*
|
||||
* @note It does NOT disable interrupts to ensure the atomicity
|
||||
|
||||
@@ -68,19 +68,19 @@ typedef struct {
|
||||
void _Scheduler_priority_Initialize(void);
|
||||
|
||||
/**
|
||||
* This routine removes @a the_thread from the scheduling decision,
|
||||
* This routine removes @a the_thread from the scheduling decision,
|
||||
* that is, removes it from the ready queue. It performs
|
||||
* any necessary scheduling operations including the selection of
|
||||
* a new heir thread.
|
||||
*
|
||||
* @param[in] the_thread is the thread to be blocked
|
||||
*/
|
||||
void _Scheduler_priority_Block(
|
||||
Thread_Control *the_thread
|
||||
void _Scheduler_priority_Block(
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/**
|
||||
* This kernel routine sets the heir thread to be the next ready thread
|
||||
* This kernel routine sets the heir thread to be the next ready thread
|
||||
* by invoking the_scheduler->ready_queue->operations->first().
|
||||
*/
|
||||
void _Scheduler_priority_Schedule(void);
|
||||
@@ -106,7 +106,7 @@ void _Scheduler_priority_Free(
|
||||
);
|
||||
|
||||
/**
|
||||
* This routine updates @a the_thread->scheduler based on @a the_scheduler
|
||||
* This routine updates @a the_thread->scheduler based on @a the_scheduler
|
||||
* structures and thread state.
|
||||
*
|
||||
* @param[in] the_thread will have its scheduler specific information
|
||||
@@ -117,14 +117,14 @@ void _Scheduler_priority_Update(
|
||||
);
|
||||
|
||||
/**
|
||||
* This routine adds @a the_thread to the scheduling decision,
|
||||
* that is, adds it to the ready queue and
|
||||
* This routine adds @a the_thread to the scheduling decision,
|
||||
* that is, adds it to the ready queue and
|
||||
* updates any appropriate scheduling variables, for example the heir thread.
|
||||
*
|
||||
* @param[in] the_thread will be unblocked
|
||||
*/
|
||||
void _Scheduler_priority_Unblock(
|
||||
Thread_Control *the_thread
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -150,7 +150,7 @@ void _Scheduler_priority_Enqueue(
|
||||
);
|
||||
|
||||
/**
|
||||
* This routine puts @a the_thread to the head of the ready queue.
|
||||
* This routine puts @a the_thread to the head of the ready queue.
|
||||
* For priority-based ready queues, the thread will be the first thread
|
||||
* at its priority level.
|
||||
*
|
||||
|
||||
@@ -53,7 +53,7 @@ extern "C" {
|
||||
void _Scheduler_simple_Initialize( void );
|
||||
|
||||
/**
|
||||
* This routine sets the heir thread to be the next ready thread
|
||||
* This routine sets the heir thread to be the next ready thread
|
||||
* on the ready queue by getting the first node in the scheduler
|
||||
* information.
|
||||
*/
|
||||
@@ -62,41 +62,41 @@ void _Scheduler_simple_Schedule( void );
|
||||
/**
|
||||
* This routine is invoked when a thread wishes to voluntarily
|
||||
* transfer control of the processor to another thread in the queue.
|
||||
* It will remove the running THREAD from the scheduler.informaiton
|
||||
* (where the ready queue is stored) and place it immediately at the
|
||||
* between the last entry of its priority and the next priority thread.
|
||||
* Reset timeslice and yield the processor functions both use this routine,
|
||||
* therefore if reset is true and this is the only thread on the queue then
|
||||
* It will remove the running THREAD from the scheduler.informaiton
|
||||
* (where the ready queue is stored) and place it immediately at the
|
||||
* between the last entry of its priority and the next priority thread.
|
||||
* Reset timeslice and yield the processor functions both use this routine,
|
||||
* therefore if reset is true and this is the only thread on the queue then
|
||||
* the timeslice counter is reset. The heir THREAD will be updated if the
|
||||
* running is also the currently the heir.
|
||||
*/
|
||||
void _Scheduler_simple_Yield( void );
|
||||
|
||||
/**
|
||||
* This routine removes @a the_thread from the scheduling decision,
|
||||
* This routine removes @a the_thread from the scheduling decision,
|
||||
* that is, removes it from the ready queue. It performs
|
||||
* any necessary scheduling operations including the selection of
|
||||
* a new heir thread.
|
||||
*
|
||||
* @param[in] the_thread is the thread that is to be blocked
|
||||
*/
|
||||
void _Scheduler_simple_Block(
|
||||
Thread_Control *the_thread
|
||||
void _Scheduler_simple_Block(
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/**
|
||||
* This routine adds @a the_thread to the scheduling decision,
|
||||
* that is, adds it to the ready queue and
|
||||
* This routine adds @a the_thread to the scheduling decision,
|
||||
* that is, adds it to the ready queue and
|
||||
* updates any appropriate scheduling variables, for example the heir thread.
|
||||
*
|
||||
* @param[in] the_thread is the thread that is to be unblocked
|
||||
*/
|
||||
void _Scheduler_simple_Unblock(
|
||||
Thread_Control *the_thread
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/**
|
||||
* This routine removes a specific thread from the specified
|
||||
* This routine removes a specific thread from the specified
|
||||
* simple-based ready queue.
|
||||
*
|
||||
* @param[in] the_thread is the thread to be blocked
|
||||
@@ -115,7 +115,7 @@ void _Scheduler_simple_Enqueue(
|
||||
);
|
||||
|
||||
/**
|
||||
* This routine puts @a the_thread to the head of the ready queue.
|
||||
* This routine puts @a the_thread to the head of the ready queue.
|
||||
* The thread will be the first thread at its priority level.
|
||||
*
|
||||
* @param[in] the_thread is the thread to be blocked
|
||||
@@ -135,7 +135,7 @@ void _Scheduler_simple_Enqueue_first(
|
||||
* @return this routine returns -1 since this is just an empty placeholder
|
||||
* and the return value may be defined differently by each scheduler.
|
||||
*/
|
||||
void *_Scheduler_simple_Allocate(
|
||||
void *_Scheduler_simple_Allocate(
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
@@ -146,7 +146,7 @@ void *_Scheduler_simple_Allocate(
|
||||
*
|
||||
* @param[in] the_thread is the thread to be blocked
|
||||
*/
|
||||
void _Scheduler_simple_Update(
|
||||
void _Scheduler_simple_Update(
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
@@ -157,7 +157,7 @@ void _Scheduler_simple_Update(
|
||||
*
|
||||
* @param[in] the_thread is the thread to be blocked
|
||||
*/
|
||||
void _Scheduler_simple_Free(
|
||||
void _Scheduler_simple_Free(
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
@@ -166,7 +166,7 @@ void _Scheduler_simple_Free(
|
||||
*
|
||||
* This routine puts @a the_thread on the ready queue
|
||||
* at the end of its priority group.
|
||||
*
|
||||
*
|
||||
* @param[in] the_thread - pointer to a thread control block
|
||||
*/
|
||||
void _Scheduler_simple_Ready_queue_enqueue(
|
||||
@@ -178,7 +178,7 @@ void _Scheduler_simple_Ready_queue_enqueue(
|
||||
*
|
||||
* This routine puts @a the_thread on to the ready queue
|
||||
* at the beginning of its priority group.
|
||||
*
|
||||
*
|
||||
* @param[in] the_thread - pointer to a thread control block
|
||||
*/
|
||||
void _Scheduler_simple_Ready_queue_enqueue_first(
|
||||
|
||||
@@ -64,35 +64,35 @@ extern "C" {
|
||||
*
|
||||
* This routine allocates ready threads to individual cores in an SMP
|
||||
* system. If the allocation results in a new heir which requires
|
||||
* a dispatch, then the dispatch needed flag for that core is set.
|
||||
* a dispatch, then the dispatch needed flag for that core is set.
|
||||
*/
|
||||
void _Scheduler_simple_smp_Schedule( void );
|
||||
|
||||
/**
|
||||
* @brief Scheduler Simple SMP Block Method
|
||||
*
|
||||
* This routine removes @a the_thread from the scheduling decision,
|
||||
* This routine removes @a the_thread from the scheduling decision,
|
||||
* that is, removes it from the ready queue. It performs
|
||||
* any necessary scheduling operations including the selection of
|
||||
* a new heir thread.
|
||||
*
|
||||
* @param[in] the_thread is the thread that is to be blocked
|
||||
*/
|
||||
void _Scheduler_simple_smp_Block(
|
||||
Thread_Control *the_thread
|
||||
void _Scheduler_simple_smp_Block(
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/**
|
||||
* @brief Scheduler Simple SMP Unblock Method
|
||||
*
|
||||
* This routine adds @a the_thread to the scheduling decision,
|
||||
* This routine adds @a the_thread to the scheduling decision,
|
||||
* that is, adds it to the ready queue and updates any appropriate
|
||||
* scheduling variables, for example the heir thread.
|
||||
*
|
||||
* @param[in] the_thread is the thread that is to be unblocked
|
||||
*/
|
||||
void _Scheduler_simple_smp_Unblock(
|
||||
Thread_Control *the_thread
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -77,7 +77,7 @@ SCORE_EXTERN uint32_t _SMP_Processor_count;
|
||||
*
|
||||
* This method is invoked by RTEMS when it needs to make a request
|
||||
* of the other CPUs. It should be implemented using some type of
|
||||
* interprocessor interrupt. CPUs not including the originating
|
||||
* interprocessor interrupt. CPUs not including the originating
|
||||
* CPU should receive the message.
|
||||
*
|
||||
* @param [in] message is message to send
|
||||
|
||||
@@ -35,7 +35,7 @@ extern "C" {
|
||||
/**
|
||||
* This type is used to lock elements for atomic access.
|
||||
* This spinlock is a simple non-nesting spinlock, and
|
||||
* may be used for short non-nesting accesses.
|
||||
* may be used for short non-nesting accesses.
|
||||
*/
|
||||
typedef uint32_t SMP_lock_spinlock_simple_Control;
|
||||
|
||||
@@ -106,9 +106,9 @@ void _SMP_lock_spinlock_nested_Initialize(
|
||||
* This method is used to obtain the lock at @a lock. ISR's are
|
||||
* disabled when this routine returns and it is the callers responsibility
|
||||
* to either:
|
||||
* 1) Do something very short and then call
|
||||
* 1) Do something very short and then call
|
||||
* _SMP_lock_spinlock_nested_Release or
|
||||
* 2) Do something very sort, call isr enable, then when ready
|
||||
* 2) Do something very sort, call isr enable, then when ready
|
||||
* call isr_disable and _SMP_lock_spinlock_nested_Release
|
||||
*
|
||||
* @param [in] lock is the address of the lock to obtain.
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
|
||||
#if defined(RTEMS_SMP) || \
|
||||
(CPU_INLINE_ENABLE_DISPATCH == FALSE) || \
|
||||
(__RTEMS_DO_NOT_INLINE_THREAD_ENABLE_DISPATCH__ == 1)
|
||||
(__RTEMS_DO_NOT_INLINE_THREAD_ENABLE_DISPATCH__ == 1)
|
||||
#define __THREAD_DO_NOT_INLINE_ENABLE_DISPATCH__
|
||||
#endif
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
_Heap_Alloc_area_of_block( block );
|
||||
uintptr_t *const pattern_end = (uintptr_t *)
|
||||
((uintptr_t) block + _Heap_Block_size( block ) + HEAP_ALLOC_BONUS);
|
||||
uintptr_t const delayed_free_block_count =
|
||||
uintptr_t const delayed_free_block_count =
|
||||
heap->Protection.delayed_free_block_count;
|
||||
uintptr_t *current = NULL;
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
|
||||
if ( delayed_free_block_count > 0 ) {
|
||||
Heap_Block *const last = heap->Protection.last_delayed_free_block;
|
||||
|
||||
|
||||
last->Protection_begin.next_delayed_free_block = block;
|
||||
} else {
|
||||
heap->Protection.first_delayed_free_block = block;
|
||||
@@ -123,10 +123,10 @@ bool _Heap_Free( Heap_Control *heap, void *alloc_begin_ptr )
|
||||
if ( alloc_begin_ptr == NULL ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
alloc_begin = (uintptr_t) alloc_begin_ptr;
|
||||
block = _Heap_Block_of_alloc_area( alloc_begin, heap->page_size );
|
||||
|
||||
|
||||
if ( !_Heap_Is_block_in_heap( heap, block ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ void _Objects_Initialize_information(
|
||||
name_length = (name_length + OBJECTS_NAME_ALIGNMENT) &
|
||||
~(OBJECTS_NAME_ALIGNMENT-1);
|
||||
#endif
|
||||
|
||||
|
||||
information->name_length = name_length;
|
||||
|
||||
_Chain_Initialize_empty( &information->Inactive );
|
||||
|
||||
@@ -47,7 +47,7 @@ void _RBTree_Initialize(
|
||||
|
||||
/* could do sanity checks here */
|
||||
_RBTree_Initialize_empty(the_rbtree);
|
||||
|
||||
|
||||
count = number_nodes;
|
||||
next = starting_address;
|
||||
while ( count-- ) {
|
||||
|
||||
@@ -32,7 +32,7 @@ void _RBTree_Extract_validate_unprotected(
|
||||
RBTree_Node *parent, *sibling;
|
||||
RBTree_Direction dir;
|
||||
|
||||
parent = the_node->parent;
|
||||
parent = the_node->parent;
|
||||
if(!parent->parent) return;
|
||||
|
||||
sibling = _RBTree_Sibling(the_node);
|
||||
@@ -40,9 +40,9 @@ void _RBTree_Extract_validate_unprotected(
|
||||
/* continue to correct tree as long as the_node is black and not the root */
|
||||
while (!_RBTree_Is_red(the_node) && parent->parent) {
|
||||
|
||||
/* if sibling is red, switch parent (black) and sibling colors,
|
||||
/* if sibling is red, switch parent (black) and sibling colors,
|
||||
* then rotate parent left, making the sibling be the_node's grandparent.
|
||||
* Now the_node has a black sibling and red parent. After rotation,
|
||||
* Now the_node has a black sibling and red parent. After rotation,
|
||||
* update sibling pointer.
|
||||
*/
|
||||
if (_RBTree_Is_red(sibling)) {
|
||||
@@ -54,8 +54,8 @@ void _RBTree_Extract_validate_unprotected(
|
||||
}
|
||||
|
||||
/* sibling is black, see if both of its children are also black. */
|
||||
if (sibling &&
|
||||
!_RBTree_Is_red(sibling->child[RBT_RIGHT]) &&
|
||||
if (sibling &&
|
||||
!_RBTree_Is_red(sibling->child[RBT_RIGHT]) &&
|
||||
!_RBTree_Is_red(sibling->child[RBT_LEFT])) {
|
||||
sibling->color = RBT_RED;
|
||||
if (_RBTree_Is_red(parent)) {
|
||||
@@ -66,9 +66,9 @@ void _RBTree_Extract_validate_unprotected(
|
||||
parent = the_node->parent;
|
||||
sibling = _RBTree_Sibling(the_node);
|
||||
} else if(sibling) {
|
||||
/* at least one of sibling's children is red. we now proceed in two
|
||||
* cases, either the_node is to the left or the right of the parent.
|
||||
* In both cases, first check if one of sibling's children is black,
|
||||
/* at least one of sibling's children is red. we now proceed in two
|
||||
* cases, either the_node is to the left or the right of the parent.
|
||||
* In both cases, first check if one of sibling's children is black,
|
||||
* and if so rotate in the proper direction and update sibling pointer.
|
||||
* Then switch the sibling and parent colors, and rotate through parent.
|
||||
*/
|
||||
@@ -113,7 +113,7 @@ void _RBTree_Extract_unprotected(
|
||||
the_rbtree->first[RBT_LEFT] = the_node->child[RBT_RIGHT];
|
||||
else {
|
||||
the_rbtree->first[RBT_LEFT] = the_node->parent;
|
||||
if(_RBTree_Are_nodes_equal((RBTree_Node *)the_rbtree,
|
||||
if(_RBTree_Are_nodes_equal((RBTree_Node *)the_rbtree,
|
||||
the_rbtree->first[RBT_LEFT]))
|
||||
the_rbtree->first[RBT_LEFT] = NULL;
|
||||
}
|
||||
@@ -124,7 +124,7 @@ void _RBTree_Extract_unprotected(
|
||||
the_rbtree->first[RBT_RIGHT] = the_node->child[RBT_LEFT];
|
||||
else {
|
||||
the_rbtree->first[RBT_RIGHT] = the_node->parent;
|
||||
if(_RBTree_Are_nodes_equal((RBTree_Node *)the_rbtree,
|
||||
if(_RBTree_Are_nodes_equal((RBTree_Node *)the_rbtree,
|
||||
the_rbtree->first[RBT_RIGHT]))
|
||||
the_rbtree->first[RBT_RIGHT] = NULL;
|
||||
}
|
||||
@@ -132,8 +132,8 @@ void _RBTree_Extract_unprotected(
|
||||
|
||||
/* if the_node has at most one non-null child then it is safe to proceed
|
||||
* check if both children are non-null, if so then we must find a target node
|
||||
* either max in node->child[RBT_LEFT] or min in node->child[RBT_RIGHT],
|
||||
* and replace the_node with the target node. This maintains the binary
|
||||
* either max in node->child[RBT_LEFT] or min in node->child[RBT_RIGHT],
|
||||
* and replace the_node with the target node. This maintains the binary
|
||||
* search tree property, but may violate the red-black properties.
|
||||
*/
|
||||
|
||||
@@ -141,14 +141,14 @@ void _RBTree_Extract_unprotected(
|
||||
target = the_node->child[RBT_LEFT]; /* find max in node->child[RBT_LEFT] */
|
||||
while (target->child[RBT_RIGHT]) target = target->child[RBT_RIGHT];
|
||||
|
||||
/* if the target node has a child, need to move it up the tree into
|
||||
* target's position (target is the right child of target->parent)
|
||||
* when target vacates it. if there is no child, then target->parent
|
||||
/* if the target node has a child, need to move it up the tree into
|
||||
* target's position (target is the right child of target->parent)
|
||||
* when target vacates it. if there is no child, then target->parent
|
||||
* should become NULL. This may cause the coloring to be violated.
|
||||
* For now we store the color of the node being deleted in victim_color.
|
||||
*/
|
||||
leaf = target->child[RBT_LEFT];
|
||||
if(leaf) {
|
||||
if(leaf) {
|
||||
leaf->parent = target->parent;
|
||||
} else {
|
||||
/* fix the tree here if the child is a null leaf. */
|
||||
@@ -168,20 +168,20 @@ void _RBTree_Extract_unprotected(
|
||||
target->child[RBT_LEFT] = the_node->child[RBT_LEFT];
|
||||
the_node->child[RBT_LEFT]->parent = target;
|
||||
|
||||
/* finally, update the parent node and recolor. target has completely
|
||||
/* finally, update the parent node and recolor. target has completely
|
||||
* replaced the_node, and target's child has moved up the tree if needed.
|
||||
* the_node is no longer part of the tree, although it has valid pointers
|
||||
* still.
|
||||
*/
|
||||
target->parent = the_node->parent;
|
||||
target->color = the_node->color;
|
||||
} else {
|
||||
/* the_node has at most 1 non-null child. Move the child in to
|
||||
* the_node's location in the tree. This may cause the coloring to be
|
||||
} else {
|
||||
/* the_node has at most 1 non-null child. Move the child in to
|
||||
* the_node's location in the tree. This may cause the coloring to be
|
||||
* violated. We will fix it later.
|
||||
* For now we store the color of the node being deleted in victim_color.
|
||||
*/
|
||||
leaf = the_node->child[RBT_LEFT] ?
|
||||
leaf = the_node->child[RBT_LEFT] ?
|
||||
the_node->child[RBT_LEFT] : the_node->child[RBT_RIGHT];
|
||||
if( leaf ) {
|
||||
leaf->parent = the_node->parent;
|
||||
@@ -196,9 +196,9 @@ void _RBTree_Extract_unprotected(
|
||||
the_node->parent->child[dir] = leaf;
|
||||
}
|
||||
|
||||
/* fix coloring. leaf has moved up the tree. The color of the deleted
|
||||
/* fix coloring. leaf has moved up the tree. The color of the deleted
|
||||
* node is in victim_color. There are three cases:
|
||||
* 1. Deleted a red node, its child must be black. Nothing must be done.
|
||||
* 1. Deleted a red node, its child must be black. Nothing must be done.
|
||||
* 2. Deleted a black node and the child is red. Paint child black.
|
||||
* 3. Deleted a black node and its child is black. This requires some
|
||||
* care and rotations.
|
||||
|
||||
@@ -20,9 +20,9 @@
|
||||
/*
|
||||
* _RBTree_Find
|
||||
*
|
||||
* This kernel routine returns a pointer to the rbtree node containing the
|
||||
* given value within the given tree, if it exists, or NULL otherwise.
|
||||
*
|
||||
* This kernel routine returns a pointer to the rbtree node containing the
|
||||
* given value within the given tree, if it exists, or NULL otherwise.
|
||||
*
|
||||
* Input parameters:
|
||||
* the_rbtree - pointer to rbtree control
|
||||
* the_value - value of the node to search for
|
||||
|
||||
@@ -19,9 +19,9 @@
|
||||
|
||||
/** @brief Validate and fix-up tree properties for a new insert/colored node
|
||||
*
|
||||
* This routine checks and fixes the Red-Black Tree properties based on
|
||||
* This routine checks and fixes the Red-Black Tree properties based on
|
||||
* @a the_node being just added to the tree.
|
||||
*
|
||||
*
|
||||
* @note It does NOT disable interrupts to ensure the atomicity of the
|
||||
* append operation.
|
||||
*/
|
||||
@@ -37,7 +37,7 @@ void _RBTree_Validate_insert_unprotected(
|
||||
while (_RBTree_Is_red(_RBTree_Parent(the_node))) {
|
||||
u = _RBTree_Parent_sibling(the_node);
|
||||
g = the_node->parent->parent;
|
||||
|
||||
|
||||
/* if uncle is red, repaint uncle/parent black and grandparent red */
|
||||
if(_RBTree_Is_red(u)) {
|
||||
the_node->parent->color = RBT_BLACK;
|
||||
@@ -47,7 +47,7 @@ void _RBTree_Validate_insert_unprotected(
|
||||
} else { /* if uncle is black */
|
||||
RBTree_Direction dir = the_node != the_node->parent->child[0];
|
||||
RBTree_Direction pdir = the_node->parent != g->child[0];
|
||||
|
||||
|
||||
/* ensure node is on the same branch direction as parent */
|
||||
if (dir != pdir) {
|
||||
_RBTree_Rotate(the_node->parent, pdir);
|
||||
@@ -55,7 +55,7 @@ void _RBTree_Validate_insert_unprotected(
|
||||
}
|
||||
the_node->parent->color = RBT_BLACK;
|
||||
g->color = RBT_RED;
|
||||
|
||||
|
||||
/* now rotate grandparent in the other branch direction (toward uncle) */
|
||||
_RBTree_Rotate(g, (1-pdir));
|
||||
}
|
||||
@@ -71,7 +71,7 @@ void _RBTree_Validate_insert_unprotected(
|
||||
*
|
||||
* @retval 0 Successfully inserted.
|
||||
* @retval -1 NULL @a the_node.
|
||||
* @retval RBTree_Node* if one with equal value to @a the_node->value exists
|
||||
* @retval RBTree_Node* if one with equal value to @a the_node->value exists
|
||||
* in @a the_rbtree.
|
||||
*
|
||||
* @note It does NOT disable interrupts to ensure the atomicity
|
||||
@@ -92,7 +92,7 @@ RBTree_Node *_RBTree_Insert_unprotected(
|
||||
the_rbtree->first[0] = the_rbtree->first[1] = the_node;
|
||||
the_node->parent = (RBTree_Node *) the_rbtree;
|
||||
the_node->child[RBT_LEFT] = the_node->child[RBT_RIGHT] = NULL;
|
||||
} else {
|
||||
} else {
|
||||
/* typical binary search tree insert, descend tree to leaf and insert */
|
||||
while (iter_node) {
|
||||
if(the_node->value == iter_node->value) return(iter_node);
|
||||
@@ -112,7 +112,7 @@ RBTree_Node *_RBTree_Insert_unprotected(
|
||||
}
|
||||
|
||||
} /* while(iter_node) */
|
||||
|
||||
|
||||
/* verify red-black properties */
|
||||
_RBTree_Validate_insert_unprotected(the_node);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
/*
|
||||
* _RBTree_Get
|
||||
*
|
||||
* This kernel routine returns a pointer to the min or max node on the tree,
|
||||
* This kernel routine returns a pointer to the min or max node on the tree,
|
||||
* without removing that node.
|
||||
*
|
||||
* Input parameters:
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include <rtems/score/scheduler.h>
|
||||
#include <rtems/score/schedulerpriority.h>
|
||||
|
||||
void _Scheduler_priority_Enqueue(
|
||||
void _Scheduler_priority_Enqueue(
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include <rtems/score/chain.h>
|
||||
#include <rtems/score/schedulerpriority.h>
|
||||
|
||||
void _Scheduler_priority_Enqueue_first(
|
||||
void _Scheduler_priority_Enqueue_first(
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include <rtems/score/chain.h>
|
||||
#include <rtems/score/schedulerpriority.h>
|
||||
|
||||
void _Scheduler_priority_Extract(
|
||||
void _Scheduler_priority_Extract(
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
|
||||
@@ -35,8 +35,8 @@ void _Scheduler_priority_Update(
|
||||
|
||||
sched_info->ready_chain = &rq[ the_thread->current_priority ];
|
||||
|
||||
_Priority_bit_map_Initialize_information(
|
||||
&sched_info->Priority_map,
|
||||
the_thread->current_priority
|
||||
_Priority_bit_map_Initialize_information(
|
||||
&sched_info->Priority_map,
|
||||
the_thread->current_priority
|
||||
);
|
||||
}
|
||||
|
||||
@@ -29,12 +29,12 @@
|
||||
/**
|
||||
* This routine does nothing, and is used as a stub for Schedule allocate
|
||||
*
|
||||
* Note: returns a non-zero value, or else thread initialize thinks the
|
||||
* Note: returns a non-zero value, or else thread initialize thinks the
|
||||
* allocation failed.
|
||||
*
|
||||
* The overhead of a function call will still be imposed.
|
||||
*/
|
||||
void * _Scheduler_simple_Allocate(
|
||||
void * _Scheduler_simple_Allocate(
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
@@ -47,7 +47,7 @@ void * _Scheduler_simple_Allocate(
|
||||
*
|
||||
* The overhead of a function call will still be imposed.
|
||||
*/
|
||||
void _Scheduler_simple_Update(
|
||||
void _Scheduler_simple_Update(
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
@@ -58,7 +58,7 @@ void _Scheduler_simple_Update(
|
||||
*
|
||||
* The overhead of a function call will still be imposed.
|
||||
*/
|
||||
void _Scheduler_simple_Free(
|
||||
void _Scheduler_simple_Free(
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
@@ -71,7 +71,7 @@ void _Scheduler_simple_Initialize ( void )
|
||||
{
|
||||
void *f;
|
||||
|
||||
/*
|
||||
/*
|
||||
* Initialize Ready Queue
|
||||
*/
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Schedule Simple Handler / Extract
|
||||
* Schedule Simple Handler / Extract
|
||||
*
|
||||
* COPYRIGHT (c) 2011.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
void _Scheduler_simple_Schedule(void)
|
||||
{
|
||||
_Thread_Heir = (Thread_Control *) _Chain_First(
|
||||
(Chain_Control *) _Scheduler.information
|
||||
_Thread_Heir = (Thread_Control *) _Chain_First(
|
||||
(Chain_Control *) _Scheduler.information
|
||||
);
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#if 0
|
||||
#define D(format,...) printk( format, __VA_ARGS__)
|
||||
#else
|
||||
#define D(format,...)
|
||||
#define D(format,...)
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -144,7 +144,7 @@ bool _Scheduler_simple_smp_Assign(
|
||||
* for this thread to be placed.
|
||||
*
|
||||
* Check 1: heir of potential CPU is more important
|
||||
* then heir of current CPU. We want to
|
||||
* then heir of current CPU. We want to
|
||||
* replace the least important thread possible.
|
||||
*/
|
||||
if ( h->current_priority > pheir->current_priority ) {
|
||||
@@ -164,7 +164,7 @@ bool _Scheduler_simple_smp_Assign(
|
||||
*
|
||||
* Which CPU has had its executing thread longer?
|
||||
*/
|
||||
if ( _Timestamp_Less_than(
|
||||
if ( _Timestamp_Less_than(
|
||||
&_Per_CPU_Information[cpu].time_of_last_context_switch,
|
||||
&_Per_CPU_Information[found_cpu].time_of_last_context_switch
|
||||
) ) {
|
||||
@@ -187,7 +187,7 @@ bool _Scheduler_simple_smp_Assign(
|
||||
D( "SCHED CPU=%d PHeir=0x%08x considering=0x%08x PREEMPTIBLE\n",
|
||||
cpu, h->Object.id, consider->Object.id );
|
||||
continue;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,7 +216,7 @@ bool _Scheduler_simple_smp_Assign(
|
||||
* scheduling needs to examine more threads.
|
||||
*/
|
||||
return found;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Reschedule threads -- select heirs for all cores
|
||||
|
||||
@@ -28,13 +28,13 @@ void _Scheduler_simple_Yield( void )
|
||||
|
||||
executing = _Thread_Executing;
|
||||
_ISR_Disable( level );
|
||||
|
||||
|
||||
_Scheduler_simple_Ready_queue_requeue(&_Scheduler, executing);
|
||||
|
||||
_ISR_Flash( level );
|
||||
|
||||
_Scheduler_simple_Schedule();
|
||||
|
||||
|
||||
if ( !_Thread_Is_heir( executing ) )
|
||||
_Thread_Dispatch_necessary = true;
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ void rtems_smp_secondary_cpu_initialize(void)
|
||||
* HACK: Should not have to enable interrupts in real system here.
|
||||
* It should happen as part of switching to the first task.
|
||||
*/
|
||||
|
||||
|
||||
_Per_CPU_Information[cpu].isr_nest_level = 1;
|
||||
_ISR_Set_level( 0 );
|
||||
while(1) ;
|
||||
@@ -119,7 +119,7 @@ void rtems_smp_process_interrupt(void)
|
||||
}
|
||||
}
|
||||
|
||||
void rtems_smp_send_message(
|
||||
void rtems_smp_send_message(
|
||||
int cpu,
|
||||
uint32_t message
|
||||
)
|
||||
|
||||
@@ -35,7 +35,7 @@ ISR_Level _SMP_lock_spinlock_simple_Obtain(
|
||||
ISR_Level level;
|
||||
uint32_t value = 1;
|
||||
uint32_t previous;
|
||||
|
||||
|
||||
/* Note: Disable provides an implicit memory barrier. */
|
||||
_ISR_Disable( level );
|
||||
do {
|
||||
@@ -72,7 +72,7 @@ ISR_Level _SMP_lock_spinlock_nested_Obtain(
|
||||
int cpu_id;
|
||||
|
||||
/* Note: Disable provides an implicit memory barrier. */
|
||||
_ISR_Disable( level );
|
||||
_ISR_Disable( level );
|
||||
|
||||
cpu_id = bsp_smp_processor_id();
|
||||
|
||||
@@ -81,7 +81,7 @@ ISR_Level _SMP_lock_spinlock_nested_Obtain(
|
||||
lock->count++;
|
||||
return level;
|
||||
}
|
||||
|
||||
|
||||
do {
|
||||
SMP_CPU_SWAP( lock, value, previous );
|
||||
} while (previous == 1);
|
||||
@@ -102,6 +102,6 @@ void _SMP_lock_spinlock_nested_Release(
|
||||
printk ("Releasing spinlock when count is already zero?!?!\n");
|
||||
#endif
|
||||
lock->count--;
|
||||
|
||||
_ISR_Enable( level );
|
||||
|
||||
_ISR_Enable( level );
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
static inline void _Thread_Create_idle_helper(
|
||||
uint32_t name_u32,
|
||||
int cpu
|
||||
)
|
||||
)
|
||||
{
|
||||
Objects_Name name;
|
||||
Thread_Control *idle;
|
||||
|
||||
@@ -80,7 +80,7 @@ Thread_Control *_Thread_Get (
|
||||
* is actually a test case in sp43 for this which trips it whether or
|
||||
* not POSIX is enabled. So in the interest of safety, this is left
|
||||
* on in all configurations.
|
||||
*/
|
||||
*/
|
||||
if ( !api_information ) {
|
||||
*location = OBJECTS_ERROR;
|
||||
goto done;
|
||||
|
||||
@@ -41,7 +41,7 @@ void _Thread_Set_state(
|
||||
)
|
||||
{
|
||||
ISR_Level level;
|
||||
|
||||
|
||||
_ISR_Disable( level );
|
||||
if ( !_States_Is_ready( the_thread->current_state ) ) {
|
||||
the_thread->current_state =
|
||||
|
||||
@@ -41,7 +41,7 @@ void _Thread_Set_transient(
|
||||
{
|
||||
ISR_Level level;
|
||||
uint32_t old_state;
|
||||
|
||||
|
||||
_ISR_Disable( level );
|
||||
|
||||
old_state = the_thread->current_state;
|
||||
|
||||
Reference in New Issue
Block a user