eLooM for STM32 application  v3.3.0
A framework for multitasking low power embedded applications powerd by STM32
Loading...
Searching...
No Matches
sysdebug.h
Go to the documentation of this file.
1
24#ifndef SYSDEBUG_H_
25#define SYSDEBUG_H_
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
43#define SYS_DBG_LEVEL_ALL 0x00U
44#define SYS_DBG_LEVEL_VERBOSE 0x01U
45#define SYS_DBG_LEVEL_LLA 0x02U
46#define SYS_DBG_LEVEL_SL 0x03U
47#define SYS_DBG_LEVEL_DEFAULT 0x04U
48#define SYS_DBG_LEVEL_WARNING 0x05U
49#define SYS_DBG_LEVEL_SEVERE 0x06U
50#define SYS_DBG_MASK_LEVEL 0x07U
51
52#define SYS_DBG_ON 0x80U
53#define SYS_DBG_OFF 0x00U
54#define SYS_DBG_HALT 0x08U
55
56
57 /* Debug Configuration options. */
58/********************************/
59
61#include <stdint.h>
62#include "sysdebug_config.h"
63
64
65/* Callback type used to call printf function */
66typedef int (* DebugPrintfFn) (const char *format, ...);
67extern DebugPrintfFn xSysDebugPrintfFn;
68extern uint8_t g_sys_dbg_min_level;
69
70
71#ifdef SYS_DEBUG
72
73typedef void (*xDebugLockUnlockFnType)(void);
74extern xDebugLockUnlockFnType xSysDebugLockFn;
75extern xDebugLockUnlockFnType xSysDebugUnlockFn;
76
87#define SYS_DBG_SET_LEVEL(control_byte, level) (((control_byte) & (~SYS_DBG_MASK_LEVEL)) | (level))
88
94#define _SYS_DEBUGF(debug, message) do { \
95 if ( \
96 ((debug) & SYS_DBG_ON) && \
97 ((int8_t)((debug) & SYS_DBG_MASK_LEVEL) >= g_sys_dbg_min_level)) { \
98 SYS_PLATFORM_DIAG(message); \
99 if ((debug) & SYS_DBG_HALT) { \
100 while(1); \
101 } \
102 } \
103} while(0)
104
105#define SYS_PLATFORM_DIAG(_x_) do { xSysDebugLockFn();xSysDebugPrintfFn _x_;xSysDebugUnlockFn(); } while (0)
106
107//#define SYS_PLATFORM_ASSERT(x) do { assert(x); } while (0)
108
116#define SYS_DEBUGF3(module, level, message) _SYS_DEBUGF(SYS_DBG_SET_LEVEL(module, level), message)
117
125#define SYS_DEBUGF2(level, message) _SYS_DEBUGF(SYS_DBG_SET_LEVEL(SYS_DBG_APP, level), message)
126
127#else /* SYS_DEBUG */
128#define SYS_DEBUGF3(debug, level, message)
129#define SYS_DEBUGF2(level, message)
130#endif /* SYS_DEBUG */
131
138
144int SysDebugInit(void);
145
151
156
157/*forward function declaration*/
158int putChar( int ch );
159
160
161
162#ifdef __cplusplus
163}
164#endif
165
166
167#endif /* SYSDEBUG_H_ */
Umbrella header for the basic system features.
int SysDebugHardwareInit(void)
int SysDebugInit(void)
void SysDebugLogFreeHeapSize(void)
void SysDebugStartRunTimeStatsTimer(void)