Prusa MINI Firmware overview
Main Page
Modules
Classes
Files
File List
File Members
debug.h
Go to the documentation of this file.
1
/**
2
* @file
3
* Debug messages infrastructure
4
*/
5
6
/*
7
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
8
* All rights reserved.
9
*
10
* Redistribution and use in source and binary forms, with or without modification,
11
* are permitted provided that the following conditions are met:
12
*
13
* 1. Redistributions of source code must retain the above copyright notice,
14
* this list of conditions and the following disclaimer.
15
* 2. Redistributions in binary form must reproduce the above copyright notice,
16
* this list of conditions and the following disclaimer in the documentation
17
* and/or other materials provided with the distribution.
18
* 3. The name of the author may not be used to endorse or promote products
19
* derived from this software without specific prior written permission.
20
*
21
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
22
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
23
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
24
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
26
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
29
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
30
* OF SUCH DAMAGE.
31
*
32
* This file is part of the lwIP TCP/IP stack.
33
*
34
* Author: Adam Dunkels <adam@sics.se>
35
*
36
*/
37
#ifndef LWIP_HDR_DEBUG_H
38
#define LWIP_HDR_DEBUG_H
39
40
#include "
lwip/arch.h
"
41
#include "
lwip/opt.h
"
42
43
/**
44
* @defgroup debugging_levels LWIP_DBG_MIN_LEVEL and LWIP_DBG_TYPES_ON values
45
* @ingroup lwip_opts_debugmsg
46
* @{
47
*/
48
49
/** @name Debug level (LWIP_DBG_MIN_LEVEL)
50
* @{
51
*/
52
/** Debug level: ALL messages*/
53
#define LWIP_DBG_LEVEL_ALL 0x00
54
/** Debug level: Warnings. bad checksums, dropped packets, ... */
55
#define LWIP_DBG_LEVEL_WARNING 0x01
56
/** Debug level: Serious. memory allocation failures, ... */
57
#define LWIP_DBG_LEVEL_SERIOUS 0x02
58
/** Debug level: Severe */
59
#define LWIP_DBG_LEVEL_SEVERE 0x03
60
/**
61
* @}
62
*/
63
64
#define LWIP_DBG_MASK_LEVEL 0x03
65
/* compatibility define only */
66
#define LWIP_DBG_LEVEL_OFF LWIP_DBG_LEVEL_ALL
67
68
/** @name Enable/disable debug messages completely (LWIP_DBG_TYPES_ON)
69
* @{
70
*/
71
/** flag for LWIP_DEBUGF to enable that debug message */
72
#define LWIP_DBG_ON 0x80U
73
/** flag for LWIP_DEBUGF to disable that debug message */
74
#define LWIP_DBG_OFF 0x00U
75
/**
76
* @}
77
*/
78
79
/** @name Debug message types (LWIP_DBG_TYPES_ON)
80
* @{
81
*/
82
/** flag for LWIP_DEBUGF indicating a tracing message (to follow program flow) */
83
#define LWIP_DBG_TRACE 0x40U
84
/** flag for LWIP_DEBUGF indicating a state debug message (to follow module states) */
85
#define LWIP_DBG_STATE 0x20U
86
/** flag for LWIP_DEBUGF indicating newly added code, not thoroughly tested yet */
87
#define LWIP_DBG_FRESH 0x10U
88
/** flag for LWIP_DEBUGF to halt after printing this debug message */
89
#define LWIP_DBG_HALT 0x08U
90
/**
91
* @}
92
*/
93
94
/**
95
* @}
96
*/
97
98
/**
99
* @defgroup lwip_assertions Assertion handling
100
* @ingroup lwip_opts_debug
101
* @{
102
*/
103
/**
104
* LWIP_NOASSERT: Disable LWIP_ASSERT checks:
105
* To disable assertions define LWIP_NOASSERT in arch/cc.h.
106
*/
107
#ifdef __DOXYGEN__
108
#define LWIP_NOASSERT
109
#undef LWIP_NOASSERT
110
#endif
111
/**
112
* @}
113
*/
114
115
#ifndef LWIP_NOASSERT
116
#define LWIP_ASSERT(message, assertion) do { if (!(assertion)) { \
117
LWIP_PLATFORM_ASSERT(message); }} while(0)
118
#ifndef LWIP_PLATFORM_ASSERT
119
#error "If you want to use LWIP_ASSERT, LWIP_PLATFORM_ASSERT(message) needs to be defined in your arch/cc.h"
120
#endif
121
#else
/* LWIP_NOASSERT */
122
#define LWIP_ASSERT(message, assertion)
123
#endif
/* LWIP_NOASSERT */
124
125
#ifndef LWIP_ERROR
126
#ifndef LWIP_NOASSERT
127
#define LWIP_PLATFORM_ERROR(message) LWIP_PLATFORM_ASSERT(message)
128
#elif defined LWIP_DEBUG
129
#define LWIP_PLATFORM_ERROR(message) LWIP_PLATFORM_DIAG((message))
130
#else
131
#define LWIP_PLATFORM_ERROR(message)
132
#endif
133
134
/* if "expression" isn't true, then print "message" and execute "handler" expression */
135
#define LWIP_ERROR(message, expression, handler) do { if (!(expression)) { \
136
LWIP_PLATFORM_ERROR(message); handler;}} while(0)
137
#endif
/* LWIP_ERROR */
138
139
/** Enable debug message printing, but only if debug message type is enabled
140
* AND is of correct type AND is at least LWIP_DBG_LEVEL.
141
*/
142
#ifdef __DOXYGEN__
143
#define LWIP_DEBUG
144
#undef LWIP_DEBUG
145
#endif
146
147
#ifdef LWIP_DEBUG
148
#ifndef LWIP_PLATFORM_DIAG
149
#error "If you want to use LWIP_DEBUG, LWIP_PLATFORM_DIAG(message) needs to be defined in your arch/cc.h"
150
#endif
151
#define LWIP_DEBUGF(debug, message) do { \
152
if ( \
153
((debug) & LWIP_DBG_ON) && \
154
((debug) & LWIP_DBG_TYPES_ON) && \
155
((s16_t)((debug) & LWIP_DBG_MASK_LEVEL) >= LWIP_DBG_MIN_LEVEL)) { \
156
LWIP_PLATFORM_DIAG(message); \
157
if ((debug) & LWIP_DBG_HALT) { \
158
while(1); \
159
} \
160
} \
161
} while(0)
162
163
#else
/* LWIP_DEBUG */
164
#define LWIP_DEBUGF(debug, message)
165
#endif
/* LWIP_DEBUG */
166
167
#endif
/* LWIP_HDR_DEBUG_H */
opt.h
arch.h
Prusa-Firmware-Buddy-Private1
lib
Middlewares
Third_Party
LwIP
src
include
lwip
debug.h
Generated by
1.8.16