From 2e1de19d41931de1c882dbd3bfcac8472e9e9eb1 Mon Sep 17 00:00:00 2001 From: Mason Tran Date: Fri, 2 Feb 2024 16:56:45 -0500 Subject: [PATCH] [spinel] add `SPINEL_CAP_RCP_LOG_CRASH_DUMP` and `SPINEL_PROP_RCP_LOG_CRASH_DUMP` --- src/lib/spinel/radio_spinel.cpp | 2 ++ src/lib/spinel/radio_spinel.hpp | 1 + src/lib/spinel/spinel.c | 2 ++ src/lib/spinel/spinel.h | 13 +++++++++++++ 4 files changed, 18 insertions(+) diff --git a/src/lib/spinel/radio_spinel.cpp b/src/lib/spinel/radio_spinel.cpp index f17e3c70da17..453183981053 100644 --- a/src/lib/spinel/radio_spinel.cpp +++ b/src/lib/spinel/radio_spinel.cpp @@ -64,6 +64,8 @@ bool RadioSpinel::sSupportsLogStream = bool RadioSpinel::sSupportsResetToBootloader = false; ///< RCP supports resetting into bootloader mode. +bool RadioSpinel::sSupportsLogCrashDump = false; ///< RCP supports logging a crash dump. + otRadioCaps RadioSpinel::sRadioCaps = OT_RADIO_CAPS_NONE; RadioSpinel::RadioSpinel(void) diff --git a/src/lib/spinel/radio_spinel.hpp b/src/lib/spinel/radio_spinel.hpp index d053a92966ac..aecb11aa8d01 100644 --- a/src/lib/spinel/radio_spinel.hpp +++ b/src/lib/spinel/radio_spinel.hpp @@ -1247,6 +1247,7 @@ class RadioSpinel : private Logger static bool sIsReady; ///< NCP ready. static bool sSupportsLogStream; ///< RCP supports `LOG_STREAM` property with OpenThread log meta-data format. static bool sSupportsResetToBootloader; ///< RCP supports resetting into bootloader mode. + static bool sSupportsLogCrashDump; ///< RCP supports logging a crash dump. #if OPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT > 0 diff --git a/src/lib/spinel/spinel.c b/src/lib/spinel/spinel.c index c85d2444cf41..683e58fdff5a 100644 --- a/src/lib/spinel/spinel.c +++ b/src/lib/spinel/spinel.c @@ -1427,6 +1427,7 @@ const char *spinel_prop_key_to_cstr(spinel_prop_key_t prop_key) {SPINEL_PROP_SERVER_LEADER_SERVICES, "SERVER_LEADER_SERVICES"}, {SPINEL_PROP_RCP_API_VERSION, "RCP_API_VERSION"}, {SPINEL_PROP_RCP_MIN_HOST_API_VERSION, "RCP_MIN_HOST_API_VERSION"}, + {SPINEL_PROP_RCP_LOG_CRASH_DUMP, "RCP_LOG_CRASH_DUMP"}, {SPINEL_PROP_UART_BITRATE, "UART_BITRATE"}, {SPINEL_PROP_UART_XON_XOFF, "UART_XON_XOFF"}, {SPINEL_PROP_15_4_PIB_PHY_CHANNELS_SUPPORTED, "15_4_PIB_PHY_CHANNELS_SUPPORTED"}, @@ -1608,6 +1609,7 @@ const char *spinel_capability_to_cstr(spinel_capability_t capability) {SPINEL_CAP_RCP_API_VERSION, "RCP_API_VERSION"}, {SPINEL_CAP_RCP_MIN_HOST_API_VERSION, "RCP_MIN_HOST_API_VERSION"}, {SPINEL_CAP_RCP_RESET_TO_BOOTLOADER, "RCP_RESET_TO_BOOTLOADER"}, + {SPINEL_CAP_RCP_LOG_CRASH_DUMP, "RCP_LOG_CRASH_DUMP"}, {SPINEL_CAP_MAC_ALLOWLIST, "MAC_ALLOWLIST"}, {SPINEL_CAP_MAC_RAW, "MAC_RAW"}, {SPINEL_CAP_OOB_STEERING_DATA, "OOB_STEERING_DATA"}, diff --git a/src/lib/spinel/spinel.h b/src/lib/spinel/spinel.h index c1865f373602..4eba6690be93 100644 --- a/src/lib/spinel/spinel.h +++ b/src/lib/spinel/spinel.h @@ -1296,6 +1296,7 @@ enum SPINEL_CAP_RCP_API_VERSION = (SPINEL_CAP_RCP__BEGIN + 0), SPINEL_CAP_RCP_MIN_HOST_API_VERSION = (SPINEL_CAP_RCP__BEGIN + 1), SPINEL_CAP_RCP_RESET_TO_BOOTLOADER = (SPINEL_CAP_RCP__BEGIN + 2), + SPINEL_CAP_RCP_LOG_CRASH_DUMP = (SPINEL_CAP_RCP__BEGIN + 3), SPINEL_CAP_RCP__END = 80, SPINEL_CAP_OPENTHREAD__BEGIN = 512, @@ -4399,6 +4400,18 @@ enum */ SPINEL_PROP_RCP_MIN_HOST_API_VERSION = SPINEL_PROP_RCP__BEGIN + 1, + /// Crash Dump + /** Format: `U` (read-only) + * + * Required capability: SPINEL_CAP_RADIO and SPINEL_CAP_RCP_LOG_CRASH_DUMP. + * + * This property gives the crash dump from the RCP. + * + * Please see "Spinel definition compatibility guideline" section. + * + */ + SPINEL_PROP_RCP_LOG_CRASH_DUMP = SPINEL_PROP_RCP__BEGIN + 2, + SPINEL_PROP_RCP__END = 0xFF, SPINEL_PROP_INTERFACE__BEGIN = 0x100,