Statistics
| Branch: | Tag: | Revision:

amiro-os / os / core / inc / aos_debug.h @ e545e620

History | View | Annotate | Download (2.527 KB)

1 e545e620 Thomas Schöpping
/*
2
AMiRo-OS is an operating system designed for the Autonomous Mini Robot (AMiRo) platform.
3
Copyright (C) 2016..2018  Thomas Schöpping et al.
4

5
This program is free software: you can redistribute it and/or modify
6
it under the terms of the GNU General Public License as published by
7
the Free Software Foundation, either version 3 of the License, or
8
(at your option) any later version.
9

10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
GNU General Public License for more details.
14

15
You should have received a copy of the GNU General Public License
16
along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
*/
18
19
#ifndef _AMIROOS_DEBUG_H_
20
#define _AMIROOS_DEBUG_H_
21
22
#include <aosconf.h>
23
#include <ch.h>
24
25
#if (AMIROOS_CFG_DBG == true) || defined(__DOXYGEN__)
26
27
/**
28
 * @brief   Function parameters check.
29
 * @details If the condition check fails, the kernel panics and halts.
30
 *
31
 * @param[in] c The condition to be verified to be true.
32
 */
33
#define aosDbgCheck(c)                chDbgCheck(c)
34
35
/**
36
 * @brief   Condition assertion.
37
 * @details If the condition check fails, the kernel panics with a message and halts.
38
 * @note    As a limitation of ChibiOS, the remark string is not currently used.
39
 *
40
 * @param[in] c The condition to be verified to be true.
41
 */
42
#define aosDbgAssert(c)               chDbgAssert(c, "__FILE__(__LINE__): aosDbgAssert failed")
43
44
/**
45
 * @brief   Condition assertion.
46
 * @details If the condition check fails, the kernel panics with a message and halts.
47
 * @note    As a limitation of ChibiOS, the remark string is not currently used.
48
 *
49
 * @param[in] c The condition to be verified to be true.
50
 * @param[in] r A custom remark string.
51
 */
52
#define aosDbgAssertMsg(c, r) {                           \
53
  (void)r;                                                \
54
  chDbgAssert(c, r);                                      \
55
}
56
57
#else
58
59
#define aosDbgCheck(c) {                                  \
60
  (void)(c);                                              \
61
  }
62
63
#define aosDbgAssert(c) {                                 \
64
  (void)(c);                                              \
65
}
66
67
#define aosDbgAssertMsg(c, r) {                           \
68
  (void)(c);                                              \
69
  (void)(r);                                              \
70
}
71
72
#endif
73
74
#ifdef __cplusplus
75
extern "C" {
76
#endif
77
  void aosPrintHaltErrorCode(const char* reason);
78
#ifdef __cplusplus
79
}
80
#endif
81
82
#endif /* _AMIROOS_DEBUG_H_ */