|
| 1 | +/* |
| 2 | + * Copyright 2026 NXP |
| 3 | + * |
| 4 | + * SPDX-License-Identifier: BSD-3-Clause |
| 5 | + */ |
| 6 | + |
| 7 | +#ifndef _ERPC_CONFIG_H_ |
| 8 | +#define _ERPC_CONFIG_H_ |
| 9 | + |
| 10 | +#include <zephyr/autoconf.h> |
| 11 | + |
| 12 | +/*! |
| 13 | + * @addtogroup config |
| 14 | + * @{ |
| 15 | + * @file |
| 16 | + */ |
| 17 | + |
| 18 | +//! @name Configuration options |
| 19 | +//@{ |
| 20 | + |
| 21 | +// ============================================================================ |
| 22 | +// Configuration Value Constants |
| 23 | +// ============================================================================ |
| 24 | + |
| 25 | +//! @name Allocation policy constants |
| 26 | +//@{ |
| 27 | +#define ERPC_ALLOCATION_POLICY_DYNAMIC (0) //!< Use dynamic allocation (malloc/new) |
| 28 | +#define ERPC_ALLOCATION_POLICY_STATIC (1) //!< Use static allocation |
| 29 | +//@} |
| 30 | + |
| 31 | +//! @name Threading model constants |
| 32 | +//@{ |
| 33 | +#define ERPC_THREADS_NONE (0) //!< No threads |
| 34 | +#define ERPC_THREADS_PTHREADS (1) //!< POSIX pthreads |
| 35 | +#define ERPC_THREADS_FREERTOS (2) //!< FreeRTOS |
| 36 | +#define ERPC_THREADS_ZEPHYR (3) //!< Zephyr |
| 37 | +#define ERPC_THREADS_MBED (4) //!< Mbed OS |
| 38 | +#define ERPC_THREADS_WIN32 (5) //!< Win32 threads |
| 39 | +#define ERPC_THREADS_THREADX (6) //!< ThreadX |
| 40 | +//@} |
| 41 | + |
| 42 | +//! @name noexcept constants |
| 43 | +//@{ |
| 44 | +#define ERPC_NOEXCEPT_DISABLED (0) //!< Disabled noexcept |
| 45 | +#define ERPC_NOEXCEPT_ENABLED (1) //!< Enabled noexcept |
| 46 | +//@} |
| 47 | + |
| 48 | +//! @name Nested calls constants |
| 49 | +//@{ |
| 50 | +#define ERPC_NESTED_CALLS_DISABLED (0) //!< Disabled nested calls |
| 51 | +#define ERPC_NESTED_CALLS_ENABLED (1) //!< Enabled nested calls |
| 52 | +#define ERPC_NESTED_CALLS_DETECTION_DISABLED (0) //!< Disabled nested calls detection |
| 53 | +#define ERPC_NESTED_CALLS_DETECTION_ENABLED (1) //!< Enabled nested calls detection |
| 54 | +//@} |
| 55 | + |
| 56 | +//! @name Message logging constants |
| 57 | +//@{ |
| 58 | +#define ERPC_MESSAGE_LOGGING_DISABLED (0) //!< Disabled message logging |
| 59 | +#define ERPC_MESSAGE_LOGGING_ENABLED (1) //!< Enabled message logging |
| 60 | +//@} |
| 61 | + |
| 62 | +//! @name Transport MU MCMGR constants |
| 63 | +//@{ |
| 64 | +#define ERPC_TRANSPORT_MU_USE_MCMGR_DISABLED (0) //!< Disabled MCMGR |
| 65 | +#define ERPC_TRANSPORT_MU_USE_MCMGR_ENABLED (1) //!< Enabled MCMGR |
| 66 | +//@} |
| 67 | + |
| 68 | +//! @name Pre/post action constants |
| 69 | +//@{ |
| 70 | +#define ERPC_PRE_POST_ACTION_DISABLED (0) //!< Disabled pre/post callbacks |
| 71 | +#define ERPC_PRE_POST_ACTION_ENABLED (1) //!< Enabled pre/post callbacks |
| 72 | +#define ERPC_PRE_POST_ACTION_DEFAULT_DISABLED (0) //!< Disabled default callbacks |
| 73 | +#define ERPC_PRE_POST_ACTION_DEFAULT_ENABLED (1) //!< Enabled default callbacks |
| 74 | +//@} |
| 75 | + |
| 76 | +// ============================================================================ |
| 77 | +// Allocation Policy |
| 78 | +// ============================================================================ |
| 79 | + |
| 80 | +//! @def ERPC_ALLOCATION_POLICY |
| 81 | +//! |
| 82 | +//! Allocation policy for eRPC buffers and objects. |
| 83 | +#ifdef CONFIG_ERPC_ALLOCATION_POLICY_STATIC |
| 84 | +#define ERPC_ALLOCATION_POLICY (ERPC_ALLOCATION_POLICY_STATIC) |
| 85 | +#else |
| 86 | +#define ERPC_ALLOCATION_POLICY (ERPC_ALLOCATION_POLICY_DYNAMIC) |
| 87 | +#endif |
| 88 | + |
| 89 | +// ============================================================================ |
| 90 | +// Static Allocation Counts |
| 91 | +// ============================================================================ |
| 92 | + |
| 93 | +//! @def ERPC_CODEC_COUNT |
| 94 | +//! |
| 95 | +//! Number of codec objects for static allocation. |
| 96 | +#ifdef CONFIG_ERPC_CODEC_COUNT |
| 97 | +#define ERPC_CODEC_COUNT (CONFIG_ERPC_CODEC_COUNT) |
| 98 | +#endif |
| 99 | + |
| 100 | +//! @def ERPC_MESSAGE_LOGGERS_COUNT |
| 101 | +//! |
| 102 | +//! Number of message logger objects for static allocation. |
| 103 | +#ifdef CONFIG_ERPC_MESSAGE_LOGGERS_COUNT |
| 104 | +#define ERPC_MESSAGE_LOGGERS_COUNT (CONFIG_ERPC_MESSAGE_LOGGERS_COUNT) |
| 105 | +#endif |
| 106 | + |
| 107 | +//! @def ERPC_CLIENTS_THREADS_AMOUNT |
| 108 | +//! |
| 109 | +//! Number of client thread objects for static allocation. |
| 110 | +#ifdef CONFIG_ERPC_CLIENTS_THREADS_AMOUNT |
| 111 | +#define ERPC_CLIENTS_THREADS_AMOUNT (CONFIG_ERPC_CLIENTS_THREADS_AMOUNT) |
| 112 | +#endif |
| 113 | + |
| 114 | +// ============================================================================ |
| 115 | +// Threading Model |
| 116 | +// ============================================================================ |
| 117 | + |
| 118 | +//! @def ERPC_THREADS |
| 119 | +//! |
| 120 | +//! Threading model used by eRPC. |
| 121 | +#ifdef CONFIG_ERPC_THREADS |
| 122 | +#define ERPC_THREADS (CONFIG_ERPC_THREADS) |
| 123 | +#endif |
| 124 | + |
| 125 | +// ============================================================================ |
| 126 | +// Buffer Configuration |
| 127 | +// ============================================================================ |
| 128 | + |
| 129 | +//! @def ERPC_DEFAULT_BUFFER_SIZE |
| 130 | +//! |
| 131 | +//! Size of buffers allocated by MessageBufferFactory. |
| 132 | +//! For RPMsg transport layer, this must be 2^n - 16. |
| 133 | +#ifdef CONFIG_ERPC_DEFAULT_BUFFER_SIZE |
| 134 | +#define ERPC_DEFAULT_BUFFER_SIZE (CONFIG_ERPC_DEFAULT_BUFFER_SIZE) |
| 135 | +#endif |
| 136 | + |
| 137 | +//! @def ERPC_DEFAULT_BUFFERS_COUNT |
| 138 | +//! |
| 139 | +//! Count of buffers allocated for statically allocated messages. |
| 140 | +#ifdef CONFIG_ERPC_DEFAULT_BUFFERS_COUNT |
| 141 | +#define ERPC_DEFAULT_BUFFERS_COUNT (CONFIG_ERPC_DEFAULT_BUFFERS_COUNT) |
| 142 | +#endif |
| 143 | + |
| 144 | +// ============================================================================ |
| 145 | +// Feature Enables |
| 146 | +// ============================================================================ |
| 147 | + |
| 148 | +//! @def ERPC_NOEXCEPT |
| 149 | +//! |
| 150 | +//! Enable C++ noexcept feature. |
| 151 | +#ifdef CONFIG_ERPC_NOEXCEPT |
| 152 | +#define ERPC_NOEXCEPT (ERPC_NOEXCEPT_ENABLED) |
| 153 | +#else |
| 154 | +#define ERPC_NOEXCEPT (ERPC_NOEXCEPT_DISABLED) |
| 155 | +#endif |
| 156 | + |
| 157 | +//! @def ERPC_NESTED_CALLS |
| 158 | +//! |
| 159 | +//! Enable support for nested eRPC calls. |
| 160 | +#ifdef CONFIG_ERPC_NESTED_CALLS |
| 161 | +#define ERPC_NESTED_CALLS (ERPC_NESTED_CALLS_ENABLED) |
| 162 | +#else |
| 163 | +#define ERPC_NESTED_CALLS (ERPC_NESTED_CALLS_DISABLED) |
| 164 | +#endif |
| 165 | + |
| 166 | +//! @def ERPC_NESTED_CALLS_DETECTION |
| 167 | +//! |
| 168 | +//! Enable detection of nested calls for debugging. |
| 169 | +#ifdef CONFIG_ERPC_NESTED_CALLS_DETECTION |
| 170 | +#define ERPC_NESTED_CALLS_DETECTION (ERPC_NESTED_CALLS_DETECTION_ENABLED) |
| 171 | +#else |
| 172 | +#define ERPC_NESTED_CALLS_DETECTION (ERPC_NESTED_CALLS_DETECTION_DISABLED) |
| 173 | +#endif |
| 174 | + |
| 175 | +//! @def ERPC_MESSAGE_LOGGING |
| 176 | +//! |
| 177 | +//! Enable eRPC message logging for debugging. |
| 178 | +#ifdef CONFIG_ERPC_MESSAGE_LOGGING |
| 179 | +#define ERPC_MESSAGE_LOGGING (ERPC_MESSAGE_LOGGING_ENABLED) |
| 180 | +#else |
| 181 | +#define ERPC_MESSAGE_LOGGING (ERPC_MESSAGE_LOGGING_DISABLED) |
| 182 | +#endif |
| 183 | + |
| 184 | +// ============================================================================ |
| 185 | +// Transport-specific Configuration |
| 186 | +// ============================================================================ |
| 187 | + |
| 188 | +//! @def ERPC_TRANSPORT_MU_USE_MCMGR |
| 189 | +//! |
| 190 | +//! When enabled, MU transport uses Multicore Manager (MCMGR). |
| 191 | +#ifdef CONFIG_ERPC_TRANSPORT_MU_USE_MCMGR |
| 192 | +#define ERPC_TRANSPORT_MU_USE_MCMGR (ERPC_TRANSPORT_MU_USE_MCMGR_ENABLED) |
| 193 | +#else |
| 194 | +#define ERPC_TRANSPORT_MU_USE_MCMGR (ERPC_TRANSPORT_MU_USE_MCMGR_DISABLED) |
| 195 | +#endif |
| 196 | + |
| 197 | +// ============================================================================ |
| 198 | +// Pre/Post Action Callbacks |
| 199 | +// ============================================================================ |
| 200 | + |
| 201 | +//! @def ERPC_PRE_POST_ACTION |
| 202 | +//! |
| 203 | +//! Enable pre and post callback functions for eRPC calls. |
| 204 | +#ifdef CONFIG_ERPC_PRE_POST_ACTION |
| 205 | +#define ERPC_PRE_POST_ACTION (ERPC_PRE_POST_ACTION_ENABLED) |
| 206 | +#else |
| 207 | +#define ERPC_PRE_POST_ACTION (ERPC_PRE_POST_ACTION_DISABLED) |
| 208 | +#endif |
| 209 | + |
| 210 | +//! @def ERPC_PRE_POST_ACTION_DEFAULT |
| 211 | +//! |
| 212 | +//! Enable default pre and post callback functions. |
| 213 | +#ifdef CONFIG_ERPC_PRE_POST_ACTION_DEFAULT |
| 214 | +#define ERPC_PRE_POST_ACTION_DEFAULT (ERPC_PRE_POST_ACTION_DEFAULT_ENABLED) |
| 215 | +#else |
| 216 | +#define ERPC_PRE_POST_ACTION_DEFAULT (ERPC_PRE_POST_ACTION_DEFAULT_DISABLED) |
| 217 | +#endif |
| 218 | + |
| 219 | +//@} |
| 220 | + |
| 221 | +/*! @} */ |
| 222 | + |
| 223 | +#endif /* _ERPC_CONFIG_H_ */ |
0 commit comments