eRPC API Reference
Rev. 1.7.2
NXP Semiconductors
Main Page
API Reference
Classes
Files
File List
File Members
erpc_config_internal.h
1
/*
2
* Copyright (c) 2016, Freescale Semiconductor, Inc.
3
* Copyright 2016-2017 NXP
4
* All rights reserved.
5
*
6
*
7
* SPDX-License-Identifier: BSD-3-Clause
8
*/
9
10
#ifndef _ERPC_DETECT_H_
11
#define _ERPC_DETECT_H_
12
13
#include "
erpc_config.h
"
14
16
// Declarations
18
/* clang-format off */
19
20
// Determine if this is a POSIX system.
21
#if !defined(ERPC_HAS_POSIX)
22
// Detect Linux, BSD, Cygwin, and Mac OS X.
23
#if defined(__linux__) || defined(__GNU__) || defined(__FreeBSD__) || defined(__NetBSD__) || \
24
defined(__OpenBSD__) || defined(__DragonFly__) || defined(__CYGWIN__) || defined(__MACH__)
25
#define ERPC_HAS_POSIX (1)
26
#else
27
#define ERPC_HAS_POSIX (0)
28
#endif
29
#endif
30
31
// Safely detect FreeRTOSConfig.h.
32
#define ERPC_HAS_FREERTOSCONFIG_H (0)
33
#if defined(__has_include)
34
#if __has_include("FreeRTOSConfig.h")
35
#undef ERPC_HAS_FREERTOSCONFIG_H
36
#define ERPC_HAS_FREERTOSCONFIG_H (1)
37
#endif
38
#endif
39
40
// Detect threading model if not already set.
41
#if !defined(ERPC_THREADS)
42
#if ERPC_HAS_POSIX
43
// Default to pthreads for POSIX systems.
44
#define ERPC_THREADS (ERPC_THREADS_PTHREADS)
45
#elif ERPC_HAS_FREERTOSCONFIG_H
46
// Use FreeRTOS if we can auto detect it.
47
#define ERPC_THREADS (ERPC_THREADS_FREERTOS)
48
#else
49
// Otherwise default to no threads.
50
#define ERPC_THREADS (ERPC_THREADS_NONE)
51
#endif
52
#endif
53
54
// Handy macro to test threading model. You can also ERPC_THREADS directly to test for threading
55
// support, i.e. "#if ERPC_THREADS", because ERPC_THREADS_NONE has a value of 0.
56
#define ERPC_THREADS_IS(_n_) (ERPC_THREADS == (ERPC_THREADS_##_n_))
57
58
// Set default buffer size.
59
#if !defined(ERPC_DEFAULT_BUFFER_SIZE)
60
#define ERPC_DEFAULT_BUFFER_SIZE (256)
62
#endif
63
64
// Set default buffers count.
65
#if !defined(ERPC_DEFAULT_BUFFERS_COUNT)
66
#define ERPC_DEFAULT_BUFFERS_COUNT (2)
68
#endif
69
70
// Disable/enable noexcept.
71
#if !defined(ERPC_NOEXCEPT)
72
#if ERPC_HAS_POSIX
73
#define ERPC_NOEXCEPT (ERPC_NOEXCEPT_ENABLED)
74
#else
75
#define ERPC_NOEXCEPT (ERPC_NOEXCEPT_DISABLED)
76
#endif
77
#endif
78
79
//NOEXCEPT support
80
#if defined(__cplusplus) && __cplusplus >= 201103 && ERPC_NOEXCEPT
81
#define NOEXCEPT noexcept
82
#else
83
#define NOEXCEPT
84
#endif // NOEXCEPT
85
86
// Disabling nesting calls support as default.
87
#if !defined(ERPC_NESTED_CALLS)
88
#define ERPC_NESTED_CALLS (ERPC_NESTED_CALLS_DISABLED)
89
#endif
90
91
#if ERPC_NESTED_CALLS && !ERPC_THREADS
92
#error "Nested calls currently working only with Threads."
93
#endif
94
95
// Enabling nesting calls detection as default for debug.
96
#if !defined(ERPC_NESTED_CALLS_DETECTION)
97
#if defined(NDEBUG) || (ERPC_NESTED_CALLS == ERPC_NESTED_CALLS_ENABLED)
98
#define ERPC_NESTED_CALLS_DETECTION (ERPC_NESTED_CALLS_DETECTION_DISABLED)
99
#else
100
#define ERPC_NESTED_CALLS_DETECTION (ERPC_NESTED_CALLS_DETECTION_ENABLED)
101
#endif
102
#endif
103
104
// Disabling tracing the eRPC.
105
#if !defined(ERPC_MESSAGE_LOGGING)
106
#define ERPC_MESSAGE_LOGGING (ERPC_MESSAGE_LOGGING_DISABLED)
107
#endif
108
109
#if defined(__CC_ARM)
/* Keil MDK */
110
#define THROW_BADALLOC throw(std::bad_alloc)
111
#define THROW throw()
112
#else
113
#define THROW_BADALLOC
114
#define THROW
115
#endif
116
117
#ifndef ERPC_TRANSPORT_MU_USE_MCMGR
118
#if defined(__has_include)
119
#if (__has_include("mcmgr.h"))
120
#define ERPC_TRANSPORT_MU_USE_MCMGR (ERPC_TRANSPORT_MU_USE_MCMGR_ENABLED)
121
#else
122
#define ERPC_TRANSPORT_MU_USE_MCMGR (ERPC_TRANSPORT_MU_USE_MCMGR_DISABLED)
123
#endif
124
#endif
125
#else
126
#if defined(__has_include)
127
#if ((!(__has_include("mcmgr.h"))) && (ERPC_TRANSPORT_MU_USE_MCMGR == ERPC_TRANSPORT_MU_USE_MCMGR_ENABLED))
128
#error "Do not forget to add the MCMGR library into your project!"
129
#endif
130
#endif
131
#endif
132
133
/* clang-format on */
134
#endif // _ERPC_DETECT_H_
135
// EOF
erpc_config.h
© 2016 NXP Semiconductors. All rights reserved.