summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/objectgetlocal.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-03-07 16:01:57 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-03-14 09:06:27 +0100
commit77e6eba7146ba2e2074b719eec01cc7c40bbe98b (patch)
treeec87c51ccd9c53cb65067a2a06a75d29b32387f3 /cpukit/score/src/objectgetlocal.c
parentpc386: Fix linker usage issues with -r and function sections (diff)
downloadrtems-77e6eba7146ba2e2074b719eec01cc7c40bbe98b.tar.bz2
score: Add and use _Objects_Get_local()
This simplifies the handling with local-only objects. Update #2555.
Diffstat (limited to 'cpukit/score/src/objectgetlocal.c')
-rw-r--r--cpukit/score/src/objectgetlocal.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/cpukit/score/src/objectgetlocal.c b/cpukit/score/src/objectgetlocal.c
new file mode 100644
index 0000000000..8a93a765c9
--- /dev/null
+++ b/cpukit/score/src/objectgetlocal.c
@@ -0,0 +1,53 @@
+/**
+ * @file
+ *
+ * @brief Object Get Local
+ * @ingroup ScoreObject
+ */
+
+/*
+ * Copyright (c) 2016 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.
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/score/objectimpl.h>
+
+Objects_Control *_Objects_Get_local(
+ const Objects_Information *information,
+ Objects_Id id,
+ ISR_lock_Context *lock_context
+)
+{
+ uint32_t index;
+
+ index = id - information->minimum_id + 1;
+
+ if ( information->maximum >= index ) {
+ Objects_Control *the_object;
+
+ _ISR_lock_ISR_disable( lock_context );
+
+ the_object = information->local_table[ index ];
+ if ( the_object != NULL ) {
+ /* ISR disabled on behalf of caller */
+ return the_object;
+ }
+
+ _ISR_lock_ISR_enable( lock_context );
+ }
+
+ return NULL;
+}