iLLD_TC29x
1.0
Assert.c
Go to the documentation of this file.
1
/**
2
* \file Assert.c
3
* \brief Assert functions.
4
*
5
* \version iLLD_1_0_0_11_0
6
* \copyright Copyright (c) 2013 Infineon Technologies AG. All rights reserved.
7
*
8
*
9
* IMPORTANT NOTICE
10
*
11
*
12
* Infineon Technologies AG (Infineon) is supplying this file for use
13
* exclusively with Infineon's microcontroller products. This file can be freely
14
* distributed within development tools that are supporting such microcontroller
15
* products.
16
*
17
* THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
18
* OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
19
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
20
* INFINEON SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL,
21
* OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
22
*
23
*/
24
25
#include "
Assert.h
"
26
27
#if IFX_CFG_ASSERT_STDIO == 1
28
/** Current standard IO used for the IFX_ASSERT and IFX_VALIDATE */
29
IfxStdIf_DPipe
*Assert_io =
NULL_PTR
;
30
#endif
31
32
#if IFX_CFG_ASSERT_VERBOSE_LEVEL_DEFAULT > IFX_VERBOSE_LEVEL_OFF
33
uint32
Assert_verboseLevel =
IFX_CFG_ASSERT_VERBOSE_LEVEL_DEFAULT
;
34
#endif
35
36
#if IFX_CFG_ASSERT_STDIO == 1
37
void
Ifx_Assert_setStandardIo
(
IfxStdIf_DPipe
*standardIo)
38
{
39
Assert_io = standardIo;
40
}
41
42
43
#endif
44
45
/** \internal
46
* Text used to display the king of assertion
47
*/
48
const
pchar
Assert_level
[6] = {
49
"OFF"
,
50
"FAILURE"
,
51
"ERROR"
,
52
"WARNING"
,
53
"INFO"
,
54
"DEBUG"
55
};
56
57
void
Ifx_Assert_doLevel
(
uint8
level,
pchar
__assertion,
pchar
__file,
unsigned
int
__line,
pchar
__function)
58
{
59
#if IFX_CFG_ASSERT_USE_BREAKPOINT == 1
60
61
if
(level <=
IFX_VERBOSE_LEVEL_ERROR
)
62
{
63
__debug
();
64
}
65
66
#endif
67
68
#if IFX_CFG_ASSERT_STDIO == 1
69
70
if
(Assert_io !=
NULL_PTR
)
71
{
72
IfxStdIf_DPipe_print
(Assert_io,
"ASSERTION %s '%s' in %s:%u (function '%s()')"
ENDL
,
Assert_level
[level],
73
__assertion, __file, __line, __function);
74
}
75
76
#endif
77
}
78
79
80
boolean
Ifx_Assert_doValidate
(
boolean
expr,
uint8
level,
pchar
__assertion,
pchar
__file,
unsigned
int
__line,
pchar
__function)
81
{
82
if
(!((expr) || (level > Assert_verboseLevel)))
83
{
84
#if IFX_CFG_ASSERT_USE_BREAKPOINT == 1
85
86
if
(level <=
IFX_VERBOSE_LEVEL_ERROR
)
87
{
88
__debug
();
89
}
90
91
#endif
92
93
#if IFX_CFG_ASSERT_STDIO == 1
94
95
if
(Assert_io !=
NULL_PTR
)
96
{
97
IfxStdIf_DPipe_print
(Assert_io,
"VALIDATION %s '%s' in %s:%u (function '%s()')"
ENDL
,
Assert_level
[level],
98
__assertion, __file, __line, __function);
99
}
100
101
#endif
102
}
103
else
104
{}
105
106
return
expr;
107
}
home
mclld
Libraries
release
iLLD_1_0_0_11_0
src
ifx
SrvSw
SysSe
Bsp
Assert.c
Generated by
1.8.4