Skip to content

Commit

Permalink
[spinel] add SPINEL_CAP_RCP_LOG_CRASH_DUMP and `SPINEL_PROP_RCP_LOG…
Browse files Browse the repository at this point in the history
…_CRASH_DUMP`
  • Loading branch information
lmnotran committed Feb 2, 2024
1 parent 33aa4ac commit bb2abd7
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/lib/spinel/radio_spinel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ bool RadioSpinel::sSupportsLogStream =
false; ///< RCP supports `LOG_STREAM` property with OpenThread log meta-data format.

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;

Expand Down Expand Up @@ -302,6 +303,11 @@ bool RadioSpinel::IsRcp(bool &aSupportsRcpApiVersion, bool &aSupportsRcpMinHostA
sSupportsResetToBootloader = true;
}

if (capability == SPINEL_CAP_RCP_LOG_CRASH_DUMP)
{
sSupportsLogCrashDump = true;
}

if (capability == SPINEL_PROP_RCP_MIN_HOST_API_VERSION)
{
aSupportsRcpMinHostApiVersion = true;
Expand Down Expand Up @@ -2685,6 +2691,15 @@ void RadioSpinel::LogSpinelFrame(const uint8_t *aFrame, uint16_t aLength, bool a
}
break;

case SPINEL_PROP_RCP_LOG_CRASH_DUMP:
{
const char *name;
name = "log-crash-dump";

start += Snprintf(start, static_cast<uint32_t>(end - start), ", %s", name);
}
break;

case SPINEL_PROP_MAC_ENERGY_SCAN_RESULT:
case SPINEL_PROP_PHY_CHAN_MAX_POWER:
{
Expand Down
1 change: 1 addition & 0 deletions src/lib/spinel/radio_spinel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1294,6 +1294,7 @@ class RadioSpinel
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

Expand Down
3 changes: 3 additions & 0 deletions src/lib/spinel/spinel.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
Expand Down Expand Up @@ -1489,6 +1490,7 @@ const char *spinel_prop_key_to_cstr(spinel_prop_key_t prop_key)
{SPINEL_PROP_DEBUG_TEST_WATCHDOG, "DEBUG_TEST_WATCHDOG"},
{SPINEL_PROP_RCP_MAC_FRAME_COUNTER, "RCP_MAC_FRAME_COUNTER"},
{SPINEL_PROP_RCP_MAC_KEY, "RCP_MAC_KEY"},
{SPINEL_PROP_RCP_LOG_CRASH_DUMP, "RCP_LOG_CRASH_DUMP"},
{SPINEL_PROP_DEBUG_LOG_TIMESTAMP_BASE, "DEBUG_LOG_TIMESTAMP_BASE"},
{SPINEL_PROP_DEBUG_TREL_TEST_MODE_ENABLE, "DEBUG_TREL_TEST_MODE_ENABLE"},
{0, NULL},
Expand Down Expand Up @@ -1608,6 +1610,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"},
Expand Down
13 changes: 13 additions & 0 deletions src/lib/spinel/spinel.h
Original file line number Diff line number Diff line change
Expand Up @@ -1295,6 +1295,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,
Expand Down Expand Up @@ -4397,6 +4398,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,
Expand Down

0 comments on commit bb2abd7

Please sign in to comment.