eRPC API Reference
Rev. 1.7.0
NXP Semiconductors
Main Page
API Reference
Classes
Files
File List
File Members
erpc_config_internal.h
1
/*
2
* The Clear BSD License
3
* Copyright (c) 2016, Freescale Semiconductor, Inc.
4
* Copyright 2016-2017 NXP
5
* All rights reserved.
6
*
7
*
8
* Redistribution and use in source and binary forms, with or without modification,
9
* are permitted (subject to the limitations in the disclaimer below) provided
10
* that the following conditions are met:
11
*
12
* o Redistributions of source code must retain the above copyright notice, this list
13
* of conditions and the following disclaimer.
14
*
15
* o Redistributions in binary form must reproduce the above copyright notice, this
16
* list of conditions and the following disclaimer in the documentation and/or
17
* other materials provided with the distribution.
18
*
19
* o Neither the name of the copyright holder nor the names of its
20
* contributors may be used to endorse or promote products derived from this
21
* software without specific prior written permission.
22
*
23
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE.
24
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
25
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
26
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
28
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
29
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
31
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
*/
35
36
#ifndef _ERPC_DETECT_H_
37
#define _ERPC_DETECT_H_
38
39
#include "
erpc_config.h
"
40
42
// Declarations
44
/* clang-format off */
45
46
// Determine if this is a POSIX system.
47
#if !defined(ERPC_HAS_POSIX)
48
// Detect Linux, BSD, Cygwin, and Mac OS X.
49
#if defined(__linux__) || defined(__GNU__) || defined(__FreeBSD__) || defined(__NetBSD__) || \
50
defined(__OpenBSD__) || defined(__DragonFly__) || defined(__CYGWIN__) || defined(__MACH__)
51
#define ERPC_HAS_POSIX (1)
52
#else
53
#define ERPC_HAS_POSIX (0)
54
#endif
55
#endif
56
57
// Safely detect FreeRTOSConfig.h.
58
#define ERPC_HAS_FREERTOSCONFIG_H (0)
59
#if defined(__has_include)
60
#if __has_include("FreeRTOSConfig.h")
61
#undef ERPC_HAS_FREERTOSCONFIG_H
62
#define ERPC_HAS_FREERTOSCONFIG_H (1)
63
#endif
64
#endif
65
66
// Detect threading model if not already set.
67
#if !defined(ERPC_THREADS)
68
#if ERPC_HAS_POSIX
69
// Default to pthreads for POSIX systems.
70
#define ERPC_THREADS (ERPC_THREADS_PTHREADS)
71
#elif ERPC_HAS_FREERTOSCONFIG_H
72
// Use FreeRTOS if we can auto detect it.
73
#define ERPC_THREADS (ERPC_THREADS_FREERTOS)
74
#else
75
// Otherwise default to no threads.
76
#define ERPC_THREADS (ERPC_THREADS_NONE)
77
#endif
78
#endif
79
80
// Handy macro to test threading model. You can also ERPC_THREADS directly to test for threading
81
// support, i.e. "#if ERPC_THREADS", because ERPC_THREADS_NONE has a value of 0.
82
#define ERPC_THREADS_IS(_n_) (ERPC_THREADS == (ERPC_THREADS_##_n_))
83
84
// Set default buffer size.
85
#if !defined(ERPC_DEFAULT_BUFFER_SIZE)
86
#define ERPC_DEFAULT_BUFFER_SIZE (256)
88
#endif
89
90
// Set default buffers count.
91
#if !defined(ERPC_DEFAULT_BUFFERS_COUNT)
92
#define ERPC_DEFAULT_BUFFERS_COUNT (2)
94
#endif
95
96
// Disable/enable noexcept.
97
#if !defined(ERPC_NOEXCEPT)
98
#if ERPC_HAS_POSIX
99
#define ERPC_NOEXCEPT (ERPC_NOEXCEPT_ENABLED)
100
#else
101
#define ERPC_NOEXCEPT (ERPC_NOEXCEPT_DISABLED)
102
#endif
103
#endif
104
105
//NOEXCEPT support
106
#if defined(__cplusplus) && __cplusplus >= 201103 && ERPC_NOEXCEPT
107
#define NOEXCEPT noexcept
108
#else
109
#define NOEXCEPT
110
#endif // NOEXCEPT
111
112
// Disabling nesting calls support as default.
113
#if !defined(ERPC_NESTED_CALLS)
114
#define ERPC_NESTED_CALLS (ERPC_NESTED_CALLS_DISABLED)
115
#endif
116
117
#if ERPC_NESTED_CALLS && !ERPC_THREADS
118
#error "Nested calls currently working only with Threads."
119
#endif
120
121
// Enabling nesting calls detection as default for debug.
122
#if !defined(ERPC_NESTED_CALLS_DETECTION)
123
#if defined(NDEBUG) || (ERPC_NESTED_CALLS == ERPC_NESTED_CALLS_ENABLED)
124
#define ERPC_NESTED_CALLS_DETECTION (ERPC_NESTED_CALLS_DETECTION_DISABLED)
125
#else
126
#define ERPC_NESTED_CALLS_DETECTION (ERPC_NESTED_CALLS_DETECTION_ENABLED)
127
#endif
128
#endif
129
130
// Disabling tracing the eRPC.
131
#if !defined(ERPC_MESSAGE_LOGGING)
132
#define ERPC_MESSAGE_LOGGING (ERPC_MESSAGE_LOGGING_DISABLED)
133
#endif
134
135
#if defined(__CC_ARM)
/* Keil MDK */
136
#define THROW_BADALLOC throw(std::bad_alloc)
137
#define THROW throw()
138
#else
139
#define THROW_BADALLOC
140
#define THROW
141
#endif
142
143
#ifndef ERPC_TRANSPORT_MU_USE_MCMGR
144
#if defined(__has_include)
145
#if (__has_include("mcmgr.h"))
146
#define ERPC_TRANSPORT_MU_USE_MCMGR (ERPC_TRANSPORT_MU_USE_MCMGR_ENABLED)
147
#else
148
#define ERPC_TRANSPORT_MU_USE_MCMGR (ERPC_TRANSPORT_MU_USE_MCMGR_DISABLED)
149
#endif
150
#endif
151
#else
152
#if defined(__has_include)
153
#if ((!(__has_include("mcmgr.h"))) && (ERPC_TRANSPORT_MU_USE_MCMGR == ERPC_TRANSPORT_MU_USE_MCMGR_ENABLED))
154
#error "Do not forget to add the MCMGR library into your project!"
155
#endif
156
#endif
157
#endif
158
159
/* clang-format on */
160
#endif // _ERPC_DETECT_H_
161
// EOF
erpc_config.h
© 2016 NXP Semiconductors. All rights reserved.