forked from swissmicros/SDKdemo
-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathrecorder.h
76 lines (65 loc) · 2.46 KB
/
recorder.h
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
#ifndef RECORDER_DB48X_H
#define RECORDER_DB48X_H
// ****************************************************************************
// recorder.h DB48X project
// ****************************************************************************
//
// File Description:
//
// Include the flight recorder when building on simulator
//
//
//
//
//
//
//
//
// ****************************************************************************
// (C) 2022 Christophe de Dinechin <[email protected]>
// This software is licensed under the terms outlined in LICENSE.txt
// ****************************************************************************
// This file is part of DB48X.
//
// DB48X is free software: you can redistribute it and/or modify
// it under the terms outlined in the LICENSE.txt file
//
// DB48X is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// ****************************************************************************
#ifdef SIMULATOR
#include "../recorder/recorder.h"
RECORDER_DECLARE(assert_error);
void assertion_failed(const char *);
#define ASSERT(x) \
do \
{ \
if (!(x)) \
assertion_failed(#x); \
} while(0)
#else
// The DM42 has so little memory (70K) that we can't use it for recorders
#define RECORDER(Name, Size, Info)
#define RECORDER_TRACE(Name) 0
#define RECORDER_ENABLED(Name) 0
#define RECORDER_DEFINE(Name, Size, Info)
#define RECORDER_DECLARE(Name)
#define RECORDER_TWEAK_DECLARE(Name)
#define RECORDER_TWEAK_DEFINE(Name, Value, Info)
#define RECORDER_TWEAK(Name) 0
#define RECORD(rec, fmt, ...) do { recorder_ignore(__VA_ARGS__); } while(0)
#define record(...) RECORD(__VA_ARGS__)
// This is just to avoid warnings about unused parameters
inline void recorder_ignore() {}
template <typename T>
inline void recorder_ignore(const T &) {}
template<typename T, typename ...Args>
inline void recorder_ignore(const T& first, const Args &...rest)
{
recorder_ignore(first); // A lot of work for nothing
recorder_ignore(rest...);
}
#define ASSERT(x)
#endif
#endif // RECORDER_DB48X_H