From 5a9c768d4489c1a95ac59f994179f703cb184c7f Mon Sep 17 00:00:00 2001 From: Li Cao Date: Thu, 4 Jul 2024 02:23:00 +0800 Subject: [PATCH] [spinel] merge spinel config files (#10468) This commit removes `spinel-config.h` and moves the configs to `openthread-spinel-config.h` so that the definitions can also be overridden by definitions in customized lib config file. --- src/lib/spinel/logger.cpp | 3 +- src/lib/spinel/openthread-spinel-config.h | 31 +++++++++++ src/lib/spinel/spinel-config.h | 68 ----------------------- src/lib/spinel/spinel_interface.hpp | 2 +- 4 files changed, 34 insertions(+), 70 deletions(-) delete mode 100644 src/lib/spinel/spinel-config.h diff --git a/src/lib/spinel/logger.cpp b/src/lib/spinel/logger.cpp index 07b358f94..4ed74cf13 100644 --- a/src/lib/spinel/logger.cpp +++ b/src/lib/spinel/logger.cpp @@ -28,6 +28,8 @@ #include "logger.hpp" +#include "openthread-spinel-config.h" + #include #include #include @@ -36,7 +38,6 @@ #include #include -#include "lib/spinel/spinel-config.h" #include "lib/spinel/spinel.h" #include "lib/utils/math.hpp" #include "lib/utils/utils.hpp" diff --git a/src/lib/spinel/openthread-spinel-config.h b/src/lib/spinel/openthread-spinel-config.h index b49bfc96f..0669de27e 100644 --- a/src/lib/spinel/openthread-spinel-config.h +++ b/src/lib/spinel/openthread-spinel-config.h @@ -42,6 +42,37 @@ #include OPENTHREAD_PROJECT_LIB_CONFIG_FILE #endif +/** + * @def OPENTHREAD_LIB_SPINEL_RX_FRAME_BUFFER_SIZE + * + * Specifies the rx frame buffer size used by `SpinelInterface` in RCP host (posix) code. This is applicable/used when + * `RadioSpinel` platform is used. + * + */ +#ifndef OPENTHREAD_LIB_SPINEL_RX_FRAME_BUFFER_SIZE +#define OPENTHREAD_LIB_SPINEL_RX_FRAME_BUFFER_SIZE 8192 +#endif + +/** + * @def OPENTHREAD_LIB_SPINEL_LOG_MAX_SIZE + * + * The maximum log string size (number of chars). + * + */ +#ifndef OPENTHREAD_LIB_SPINEL_LOG_MAX_SIZE +#define OPENTHREAD_LIB_SPINEL_LOG_MAX_SIZE 1024 +#endif + +/** + * @def OPENTHREAD_LIB_SPINEL_NCP_LOG_MAX_SIZE + * + * The maximum OpenThread log string size (number of chars) supported by NCP using Spinel `StreamWrite`. + * + */ +#ifndef OPENTHREAD_LIB_SPINEL_NCP_LOG_MAX_SIZE +#define OPENTHREAD_LIB_SPINEL_NCP_LOG_MAX_SIZE 150 +#endif + /** * @def OPENTHREAD_SPINEL_CONFIG_OPENTHREAD_MESSAGE_ENABLE * diff --git a/src/lib/spinel/spinel-config.h b/src/lib/spinel/spinel-config.h deleted file mode 100644 index 253b6e916..000000000 --- a/src/lib/spinel/spinel-config.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2024, The OpenThread Authors. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the copyright holder nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/** - * @file - * This file includes compile-time configuration constants for lib spinel. - */ - -#ifndef SPINEL_CONFIG_H_ -#define SPINEL_CONFIG_H_ - -/** - * @def OPENTHREAD_LIB_SPINEL_RX_FRAME_BUFFER_SIZE - * - * Specifies the rx frame buffer size used by `SpinelInterface` in RCP host (posix) code. This is applicable/used when - * `RadioSpinel` platform is used. - * - */ -#ifndef OPENTHREAD_LIB_SPINEL_RX_FRAME_BUFFER_SIZE -#define OPENTHREAD_LIB_SPINEL_RX_FRAME_BUFFER_SIZE 8192 -#endif - -/** - * @def OPENTHREAD_LIB_SPINEL_LOG_MAX_SIZE - * - * The maximum log string size (number of chars). - * - */ -#ifndef OPENTHREAD_LIB_SPINEL_LOG_MAX_SIZE -#define OPENTHREAD_LIB_SPINEL_LOG_MAX_SIZE 1024 -#endif - -/** - * @def OPENTHREAD_LIB_SPINEL_NCP_LOG_MAX_SIZE - * - * The maximum OpenThread log string size (number of chars) supported by NCP using Spinel `StreamWrite`. - * - */ -#ifndef OPENTHREAD_LIB_SPINEL_NCP_LOG_MAX_SIZE -#define OPENTHREAD_LIB_SPINEL_NCP_LOG_MAX_SIZE 150 -#endif - -#endif // SPINEL_CONFIG_H_ diff --git a/src/lib/spinel/spinel_interface.hpp b/src/lib/spinel/spinel_interface.hpp index c2dfae349..4a110fb0a 100644 --- a/src/lib/spinel/spinel_interface.hpp +++ b/src/lib/spinel/spinel_interface.hpp @@ -35,7 +35,7 @@ #ifndef SPINEL_SPINEL_INTERFACE_HPP_ #define SPINEL_SPINEL_INTERFACE_HPP_ -#include "spinel-config.h" +#include "openthread-spinel-config.h" #include "lib/spinel/multi_frame_buffer.hpp" #include "lib/spinel/radio_spinel_metrics.h"