blob: 41ef1aeaa11802c8e3ae7d4d1a223937cb62f5e5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
/*
* Copyright (c) 2013-2014 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.
*/
#ifndef _RTEMS_SCORE_ASSERT_H
#define _RTEMS_SCORE_ASSERT_H
#include <rtems/score/basedefs.h>
#if defined( RTEMS_DEBUG )
#include <assert.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/**
* @brief Assertion similar to assert() controlled via RTEMS_DEBUG instead of
* NDEBUG.
*/
#if defined( RTEMS_DEBUG )
#define _Assert( _e ) \
( ( _e ) ? \
( void ) 0 : \
__assert_func( __FILE__, __LINE__, __ASSERT_FUNC, #_e ) )
#else
#define _Assert( _e ) ( ( void ) 0 )
#endif
/**
* @brief Returns true if thread dispatching is allowed.
*
* Thread dispatching can be repressed via _Thread_Disable_dispatch() or
* _ISR_Disable().
*/
#if defined( RTEMS_DEBUG )
bool _Debug_Is_thread_dispatching_allowed( void );
#endif
/**
* @brief Returns true if the current thread of execution owns the giant lock.
*/
#if defined( RTEMS_DEBUG )
#if defined( RTEMS_SMP )
bool _Debug_Is_owner_of_giant( void );
#else
#define _Debug_Is_owner_of_giant() (true)
#endif
#endif
/**
* @brief Returns true if the current thread of execution owns the allocator
* mutex.
*/
#if defined( RTEMS_DEBUG )
bool _Debug_Is_owner_of_allocator( void );
#endif
/**
* @brief Asserts that this point is not reached during run-time.
*/
#define _Assert_Not_reached() _Assert( 0 )
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* _RTEMS_SCORE_ASSERT_H */
|