From 742f53f64a3f4400df76c43533528d6054b2f5c6 Mon Sep 17 00:00:00 2001 From: Abtin Keshavarzian Date: Thu, 9 Mar 2023 09:34:19 -0800 Subject: [PATCH] [version] introduce `OT_THREAD_VERSION_1_3_1` (#8849) This commit adds `OT_THREAD_VERSION_1_3_1` constant (equal to `5`) for Thread Version 1.3.1. It also updates the build switch options for CMake `OT_THREAD_VERSION` and autoconfig `THREAD_VERSION` and `BUILD.gn` to support the new version value of "1.3.1". Note that this commit does not change the default config value of `OPENTHREAD_CONFIG_THREAD_VERSION` which is the default version to use if it is not explicitly specified by build switches or in a project config file. --- CMakeLists.txt | 4 +++- examples/common-switches.mk | 2 ++ src/core/BUILD.gn | 2 ++ src/core/openthread-core-config.h | 1 + src/core/thread/version.hpp | 7 ++++--- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 993d886e2..380f0fb8d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -107,13 +107,15 @@ endif() message(STATUS "Package Version: ${OT_PACKAGE_VERSION}") set(OT_THREAD_VERSION "1.3" CACHE STRING "Thread version chosen by the user at configure time") -set_property(CACHE OT_THREAD_VERSION PROPERTY STRINGS "1.1" "1.2" "1.3") +set_property(CACHE OT_THREAD_VERSION PROPERTY STRINGS "1.1" "1.2" "1.3" "1.3.1") if(${OT_THREAD_VERSION} EQUAL "1.1") target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_THREAD_VERSION=OT_THREAD_VERSION_1_1") elseif(${OT_THREAD_VERSION} EQUAL "1.2") target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_THREAD_VERSION=OT_THREAD_VERSION_1_2") elseif(${OT_THREAD_VERSION} EQUAL "1.3") target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_THREAD_VERSION=OT_THREAD_VERSION_1_3") +elseif(${OT_THREAD_VERSION} EQUAL "1.3.1") + target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_THREAD_VERSION=OT_THREAD_VERSION_1_3_1") else() message(FATAL_ERROR "Thread version unknown: ${OT_THREAD_VERSION}") endif() diff --git a/examples/common-switches.mk b/examples/common-switches.mk index afd676f36..0ae683133 100644 --- a/examples/common-switches.mk +++ b/examples/common-switches.mk @@ -345,6 +345,8 @@ else ifeq ($(THREAD_VERSION),1.2) COMMONCFLAGS += -DOPENTHREAD_CONFIG_THREAD_VERSION=3 else ifeq ($(THREAD_VERSION),1.3) COMMONCFLAGS += -DOPENTHREAD_CONFIG_THREAD_VERSION=4 +else ifeq ($(THREAD_VERSION),1.3.1) +COMMONCFLAGS += -DOPENTHREAD_CONFIG_THREAD_VERSION=5 endif ifeq ($(TIME_SYNC),1) diff --git a/src/core/BUILD.gn b/src/core/BUILD.gn index 37bc9c63f..7b2b30e63 100644 --- a/src/core/BUILD.gn +++ b/src/core/BUILD.gn @@ -39,6 +39,8 @@ if (openthread_enable_core_config_args) { defines += [ "OPENTHREAD_CONFIG_THREAD_VERSION=OT_THREAD_VERSION_1_2" ] } else if (openthread_config_thread_version == "1.3") { defines += [ "OPENTHREAD_CONFIG_THREAD_VERSION=OT_THREAD_VERSION_1_3" ] + } else if (openthread_config_thread_version == "1.3.1") { + defines += [ "OPENTHREAD_CONFIG_THREAD_VERSION=OT_THREAD_VERSION_1_3_1" ] } else if (openthread_config_thread_version != "") { assert(false, "Unrecognized Thread version: ${openthread_config_thread_version}") diff --git a/src/core/openthread-core-config.h b/src/core/openthread-core-config.h index 4b6524118..b0362433f 100644 --- a/src/core/openthread-core-config.h +++ b/src/core/openthread-core-config.h @@ -41,6 +41,7 @@ #define OT_THREAD_VERSION_1_1 2 #define OT_THREAD_VERSION_1_2 3 #define OT_THREAD_VERSION_1_3 4 +#define OT_THREAD_VERSION_1_3_1 5 #define OPENTHREAD_CORE_CONFIG_H_IN diff --git a/src/core/thread/version.hpp b/src/core/thread/version.hpp index 7a9c9e8da..c3584aad3 100644 --- a/src/core/thread/version.hpp +++ b/src/core/thread/version.hpp @@ -42,9 +42,10 @@ namespace ot { constexpr uint16_t kThreadVersion = OPENTHREAD_CONFIG_THREAD_VERSION; ///< Thread Version of this device. -constexpr uint16_t kThreadVersion1p1 = OT_THREAD_VERSION_1_1; ///< Thread Version 1.1 -constexpr uint16_t kThreadVersion1p2 = OT_THREAD_VERSION_1_2; ///< Thread Version 1.2 -constexpr uint16_t kThreadVersion1p3 = OT_THREAD_VERSION_1_3; ///< Thread Version 1.3 +constexpr uint16_t kThreadVersion1p1 = OT_THREAD_VERSION_1_1; ///< Thread Version 1.1 +constexpr uint16_t kThreadVersion1p2 = OT_THREAD_VERSION_1_2; ///< Thread Version 1.2 +constexpr uint16_t kThreadVersion1p3 = OT_THREAD_VERSION_1_3; ///< Thread Version 1.3 +constexpr uint16_t kThreadVersion1p3p1 = OT_THREAD_VERSION_1_3_1; ///< Thread Version 1.3.1 } // namespace ot