blob: 9ef5f667f838ac013e07c18ac2ff0b3dbf276cba [file] [log] [blame]
Summer Qin153f3df2022-11-17 15:51:02 +08001/*
2 * Copyright (c) 2016, Freescale Semiconductor, Inc.
3 * Copyright 2016-2020 NXP
4 * Copyright 2020-2021 ACRIOS Systems s.r.o.
5 * Copyright (c) 2023, Arm Limited. All rights reserved.
6 * All rights reserved.
7 *
8 *
9 * SPDX-License-Identifier: BSD-3-Clause
10 */
11
12#ifndef _ERPC_CONFIG_H_
13#define _ERPC_CONFIG_H_
14
15/*!
16 * @addtogroup config
17 * @{
18 * @file
19 */
20
21////////////////////////////////////////////////////////////////////////////////
22// Declarations
23////////////////////////////////////////////////////////////////////////////////
24
25//! @name Threading model options
26//@{
27#define ERPC_ALLOCATION_POLICY_DYNAMIC (0U) //!< Dynamic allocation policy
28#define ERPC_ALLOCATION_POLICY_STATIC (1U) //!< Static allocation policy
29
30#define ERPC_THREADS_NONE (0U) //!< No threads.
31#define ERPC_THREADS_PTHREADS (1U) //!< POSIX pthreads.
32#define ERPC_THREADS_FREERTOS (2U) //!< FreeRTOS.
33#define ERPC_THREADS_ZEPHYR (3U) //!< ZEPHYR.
34#define ERPC_THREADS_MBED (4U) //!< Mbed OS
35#define ERPC_THREADS_WIN32 (5U) //!< WIN32
36#define ERPC_THREADS_THREADX (6U) //!< THREADX
37
38#define ERPC_NOEXCEPT_DISABLED (0U) //!< Disabling noexcept feature.
39#define ERPC_NOEXCEPT_ENABLED (1U) //!< Enabling noexcept feature.
40
41#define ERPC_NESTED_CALLS_DISABLED (0U) //!< No nested calls support.
42#define ERPC_NESTED_CALLS_ENABLED (1U) //!< Nested calls support.
43
44#define ERPC_NESTED_CALLS_DETECTION_DISABLED (0U) //!< Nested calls detection disabled.
45#define ERPC_NESTED_CALLS_DETECTION_ENABLED (1U) //!< Nested calls detection enabled.
46
47#define ERPC_MESSAGE_LOGGING_DISABLED (0U) //!< Trace functions disabled.
48#define ERPC_MESSAGE_LOGGING_ENABLED (1U) //!< Trace functions enabled.
49
50#define ERPC_TRANSPORT_MU_USE_MCMGR_DISABLED (0U) //!< Do not use MCMGR for MU ISR management.
51#define ERPC_TRANSPORT_MU_USE_MCMGR_ENABLED (1U) //!< Use MCMGR for MU ISR management.
52
53#define ERPC_PRE_POST_ACTION_DISABLED (0U) //!< Pre post shim callbacks functions disabled.
54#define ERPC_PRE_POST_ACTION_ENABLED (1U) //!< Pre post shim callback functions enabled.
55
56#define ERPC_PRE_POST_ACTION_DEFAULT_DISABLED (0U) //!< Pre post shim default callbacks functions disabled.
57#define ERPC_PRE_POST_ACTION_DEFAULT_ENABLED (1U) //!< Pre post shim default callback functions enabled.
58//@}
59
60//! @name Configuration options
61//@{
62
63//! @def ERPC_ALLOCATION_POLICY
64//!
65//! @brief Choose which allocation policy should be used.
66//!
67//! Set ERPC_ALLOCATION_POLICY_DYNAMIC if dynamic allocations should be used.
68//! Set ERPC_ALLOCATION_POLICY_STATIC if static allocations should be used.
69//!
70//! Default value is ERPC_ALLOCATION_POLICY_DYNAMIC or in case of FreeRTOS it can be auto-detected if __has_include() is
71//! supported by compiler. Uncomment comment bellow to use static allocation policy. In case of static implementation
72//! user need consider another values to set (ERPC_CODEC_COUNT, ERPC_MESSAGE_LOGGERS_COUNT,
73//! ERPC_CLIENTS_THREADS_AMOUNT).
74// #define ERPC_ALLOCATION_POLICY (ERPC_ALLOCATION_POLICY_STATIC)
75
76//! @def ERPC_CODEC_COUNT
77//!
78//! @brief Set amount of codecs objects used simultaneously in case of ERPC_ALLOCATION_POLICY is set to
79//! ERPC_ALLOCATION_POLICY_STATIC. For example if client or server is used in one thread then 1. If both are used in one
80//! thread per each then 2, ... Default value 2.
81// #define ERPC_CODEC_COUNT (2U)
82
83//! @def ERPC_MESSAGE_LOGGERS_COUNT
84//!
85//! @brief Set amount of message loggers objects used simultaneously in case of ERPC_ALLOCATION_POLICY is set to
86//! ERPC_ALLOCATION_POLICY_STATIC.
87//! For example if client or server is used in one thread then 1. If both are used in one thread per each then 2, ...
88//! For arbitrated client 1 is enough.
89//! Default value 0 (May not be used).
90// #define ERPC_MESSAGE_LOGGERS_COUNT (0U)
91
92//! @def ERPC_CLIENTS_THREADS_AMOUNT
93//!
94//! @brief Set amount of client threads objects used in case of ERPC_ALLOCATION_POLICY is set to
95//! ERPC_ALLOCATION_POLICY_STATIC. Default value 1 (Most of current cases).
96// #define ERPC_CLIENTS_THREADS_AMOUNT (1U)
97
98//! @def ERPC_THREADS
99//!
100//! @brief Select threading model.
101//!
102//! Set to one of the @c ERPC_THREADS_x macros to specify the threading model used by eRPC.
103//!
104//! Leave commented out to attempt to auto-detect. Auto-detection works well for pthreads.
105//! FreeRTOS can be detected when building with compilers that support __has_include().
106//! Otherwise, the default is no threading.
107#define ERPC_THREADS (ERPC_THREADS_NONE)
108
109//! @def ERPC_DEFAULT_BUFFER_SIZE
110//!
111//! Uncomment to change the size of buffers allocated by one of MessageBufferFactory.
112//! (@ref client_setup and @ref server_setup). The default size is set to 256.
113//! For RPMsg transport layer, ERPC_DEFAULT_BUFFER_SIZE must be 2^n - 16.
114//#define ERPC_DEFAULT_BUFFER_SIZE (256U)
115
116//! @def ERPC_DEFAULT_BUFFERS_COUNT
117//!
118//! Uncomment to change the count of buffers allocated by one of statically allocated messages.
119//! Default value is set to 2.
120//#define ERPC_DEFAULT_BUFFERS_COUNT (2U)
121
122//! @def ERPC_NOEXCEPT
123//!
124//! @brief Disable/enable noexcept support.
125//!
126//! Uncomment for using noexcept feature.
127//#define ERPC_NOEXCEPT (ERPC_NOEXCEPT_ENABLED)
128
129//! @def ERPC_NESTED_CALLS
130//!
131//! Default set to ERPC_NESTED_CALLS_DISABLED. Uncomment when callbacks, or other eRPC
132//! functions are called from server implementation of another eRPC call. Nested functions
133//! need to be marked as @nested in IDL.
134//#define ERPC_NESTED_CALLS (ERPC_NESTED_CALLS_ENABLED)
135
136//! @def ERPC_NESTED_CALLS_DETECTION
137//!
138//! Default set to ERPC_NESTED_CALLS_DETECTION_ENABLED when NDEBUG macro is presented.
139//! This serve for locating nested calls in code. Nested calls are calls where inside eRPC function
140//! on server side is called another eRPC function (like callbacks). Code need be a bit changed
141//! to support nested calls. See ERPC_NESTED_CALLS macro.
142//#define ERPC_NESTED_CALLS_DETECTION (ERPC_NESTED_CALLS_DETECTION_DISABLED)
143
144//! @def ERPC_MESSAGE_LOGGING
145//!
146//! Enable eRPC message logging code through the eRPC. Take look into "erpc_message_loggers.h". Can be used for base
147//! printing messages, or sending data to another system for data analysis. Default set to
148//! ERPC_MESSAGE_LOGGING_DISABLED.
149//!
150//! Uncomment for using logging feature.
151//#define ERPC_MESSAGE_LOGGING (ERPC_MESSAGE_LOGGING_ENABLED)
152
153//! @def ERPC_TRANSPORT_MU_USE_MCMGR
154//!
155//! @brief MU transport layer configuration.
156//!
157//! Set to one of the @c ERPC_TRANSPORT_MU_USE_MCMGR_x macros to configure the MCMGR usage in MU transport layer.
158//!
159//! MU transport layer could leverage the Multicore Manager (MCMGR) component for Inter-Core
160//! interrupts / MU interrupts management or the Inter-Core interrupts can be managed by itself (MUX_IRQHandler
161//! overloading). By default, ERPC_TRANSPORT_MU_USE_MCMGR is set to ERPC_TRANSPORT_MU_USE_MCMGR_ENABLED when mcmgr.h
162//! is part of the project, otherwise the ERPC_TRANSPORT_MU_USE_MCMGR_DISABLED option is used. This settings can be
163//! overwritten from the erpc_config.h by uncommenting the ERPC_TRANSPORT_MU_USE_MCMGR macro definition. Do not forget
164//! to add the MCMGR library into your project when ERPC_TRANSPORT_MU_USE_MCMGR_ENABLED option is used! See the
165//! erpc_mu_transport.h for additional MU settings.
166//#define ERPC_TRANSPORT_MU_USE_MCMGR ERPC_TRANSPORT_MU_USE_MCMGR_DISABLED
167//@}
168
169//! @def ERPC_PRE_POST_ACTION
170//!
171//! Enable eRPC pre and post callback functions shim code. Take look into "erpc_pre_post_action.h". Can be used for
172//! detection of eRPC call freeze, ... Default set to ERPC_PRE_POST_ACTION_DISABLED.
173//!
174//! Uncomment for using pre post callback feature.
175//#define ERPC_PRE_POST_ACTION (ERPC_PRE_POST_ACTION_ENABLED)
176
177//! @def ERPC_PRE_POST_ACTION_DEFAULT
178//!
179//! Enable eRPC pre and post default callback functions. Take look into "erpc_setup_extensions.h". Can be used for
180//! detection of eRPC call freeze, ... Default set to ERPC_PRE_POST_ACTION_DEFAULT_DISABLED.
181//!
182//! Uncomment for using pre post default callback feature.
183//#define ERPC_PRE_POST_ACTION_DEFAULT (ERPC_PRE_POST_ACTION_DEFAULT_ENABLED)
184
185//! @name Assert function definition
186//@{
187//! User custom asser defition. Include header file if needed before bellow line. If assert is not enabled, default will
188//! be used.
189// #define erpc_assert(condition)
190//@}
191
192//! @def ENDIANES_HEADER
193//!
194//! Include header file that controls the communication endianness
195//!
196//! Uncomment for example behaviour for endianness agnostic with:
197//! 1. communication in little endian.
198//! 2. current processor is big endian.
199//! 3. pointer size is 32 bit.
200//! 4. float+double scheme not defined, so throws assert if passes.
201//! #define ERPC_PROCESSOR_ENDIANNESS_LITTLE 0
202//! #define ERPC_COMMUNICATION_LITTLE 1
203//! #define ERPC_POINTER_SIZE_16 0
204//! #define ERPC_POINTER_SIZE_32 1
205//! #define ERPC_POINTER_SIZE_64 0
206//! #define ENDIANNESS_HEADER "erpc_endianness_agnostic_example.h"
207
208/*! @} */
209#endif // _ERPC_CONFIG_H_
210////////////////////////////////////////////////////////////////////////////////
211// EOF
212////////////////////////////////////////////////////////////////////////////////