diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2011-04-04 18:44:16 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2011-04-04 18:44:16 +0000 |
commit | bd9baa8184e8ff78b6644e8d88817a3ac8ec67fe (patch) | |
tree | 626eb6aa1a8779330e88e16987c6f25c226507f6 /cpukit/score/src/rbtreefind.c | |
parent | 2011-04-04 Sebastien Bourdeauducq <sebastien.bourdeauducq@gmail.com> (diff) | |
download | rtems-bd9baa8184e8ff78b6644e8d88817a3ac8ec67fe.tar.bz2 |
2010-07-28 Gedare Bloom <giddyup44@yahoo.com>
PR 1641/cpukit
* sapi/Makefile.am, sapi/preinstall.am, score/Makefile.am,
score/preinstall.am: Add Red Black Tree data structure to score.
* sapi/include/rtems/rbtree.h, sapi/inline/rtems/rbtree.inl,
score/include/rtems/score/rbtree.h, score/inline/rtems/score/rbtree.inl,
score/src/rbtree.c, score/src/rbtreeextract.c,
score/src/rbtreefind.c, score/src/rbtreefindheader.c,
score/src/rbtreeget.c, score/src/rbtreeinsert.c,
score/src/rbtreepeek.c: New files.
Diffstat (limited to 'cpukit/score/src/rbtreefind.c')
-rw-r--r-- | cpukit/score/src/rbtreefind.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/cpukit/score/src/rbtreefind.c b/cpukit/score/src/rbtreefind.c new file mode 100644 index 0000000000..a11918ebde --- /dev/null +++ b/cpukit/score/src/rbtreefind.c @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2010 Gedare Bloom. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#if HAVE_CONFIG_H +#include "config.h" +#endif + +#include <rtems/system.h> +#include <rtems/score/address.h> +#include <rtems/score/rbtree.h> +#include <rtems/score/isr.h> + +/* + * _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. + * + * Input parameters: + * the_rbtree - pointer to rbtree control + * the_value - value of the node to search for + * + * Output parameters: + * return_node - pointer to control header of rbtree + * NULL - if there is no control header available (the node is not part + * of a tree) + * + * INTERRUPT LATENCY: + * only case + */ + +RBTree_Node *_RBTree_Find( + RBTree_Control *the_rbtree, + unsigned int the_value +) +{ + ISR_Level level; + RBTree_Node *return_node; + + return_node = NULL; + _ISR_Disable( level ); + return_node = _RBTree_Find_unprotected( the_rbtree, the_value ); + _ISR_Enable( level ); + return return_node; +} |