[PATCH 3/4] score: Add _Assert_Thread_dispatching_repressed()
Sebastian Huber
sebastian.huber at embedded-brains.de
Fri Jul 26 12:48:43 UTC 2013
---
cpukit/score/Makefile.am | 1 +
cpukit/score/include/rtems/score/assert.h | 12 ++++++++
.../score/src/assertthreaddispatchingrepressed.c | 28 ++++++++++++++++++++
3 files changed, 41 insertions(+), 0 deletions(-)
create mode 100644 cpukit/score/src/assertthreaddispatchingrepressed.c
diff --git a/cpukit/score/Makefile.am b/cpukit/score/Makefile.am
index b623732..67d4b5e 100644
--- a/cpukit/score/Makefile.am
+++ b/cpukit/score/Makefile.am
@@ -316,6 +316,7 @@ libscore_a_SOURCES += src/apiext.c src/chain.c src/chainappend.c \
src/chainextract.c src/chainget.c src/chaininsert.c \
src/chainappendempty.c src/chainprependempty.c src/chaingetempty.c \
src/chainnodecount.c \
+ src/assertthreaddispatchingrepressed.c \
src/interr.c src/isr.c src/wkspace.c src/wkstringduplicate.c
EXTRA_DIST = src/Unlimited.txt
diff --git a/cpukit/score/include/rtems/score/assert.h b/cpukit/score/include/rtems/score/assert.h
index 205515d..174676e 100644
--- a/cpukit/score/include/rtems/score/assert.h
+++ b/cpukit/score/include/rtems/score/assert.h
@@ -38,6 +38,18 @@ extern "C" {
#define _Assert( _e ) ( ( void ) 0 )
#endif
+/**
+ * @brief Asserts that thread dispatching is repressed.
+ *
+ * Thread dispatching can be repressed via _Thread_Disable_dispatch() or
+ * _ISR_Disable().
+ */
+#if defined( RTEMS_DEBUG )
+ void _Assert_Thread_dispatching_repressed( void );
+#else
+ #define _Assert_Thread_dispatching_repressed() ( ( void ) 0 )
+#endif
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/cpukit/score/src/assertthreaddispatchingrepressed.c b/cpukit/score/src/assertthreaddispatchingrepressed.c
new file mode 100644
index 0000000..44907f6
--- /dev/null
+++ b/cpukit/score/src/assertthreaddispatchingrepressed.c
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2013 embedded brains GmbH. All rights reserved.
+ *
+ * embedded brains GmbH
+ * Dornierstr. 4
+ * 82178 Puchheim
+ * Germany
+ * <rtems at 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.com/license/LICENSE.
+ */
+
+#if HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
+#include <rtems/score/assert.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/threaddispatch.h>
+
+#if defined( RTEMS_DEBUG )
+ void _Assert_Thread_dispatching_repressed( void )
+ {
+ _Assert( !_Thread_Dispatch_is_enabled() || _ISR_Get_level() != 0 );
+ }
+#endif
--
1.7.7
More information about the devel
mailing list