diff --git a/doc/spinel-protocol-src/spinel-prop-debug.md b/doc/spinel-protocol-src/spinel-prop-debug.md index d02626131..bb308fc69 100644 --- a/doc/spinel-protocol-src/spinel-prop-debug.md +++ b/doc/spinel-protocol-src/spinel-prop-debug.md @@ -30,3 +30,11 @@ If the NCP supports dynamic log level control, setting this property changes the log level accordingly. Getting the value returns the current log level. If the dynamic log level control is not supported, setting this property returns a `PROP_LAST_STATUS` with `STATUS_INVALID_COMMAND_FOR_PROP`. + +### PROP 16386: PROP_DEBUG_TEST_WATCHDOG {#prop-debug-test-watchdog} +* Type: Read-Only +* Packed-Encoding: Empty + +Reading this property will causes NCP to start `while(true) ;` loop and +thus triggering a watchdog. This is intended for testing the watchdog +functionality on the underlying platform/NCP. \ No newline at end of file diff --git a/src/ncp/ncp_base.cpp b/src/ncp/ncp_base.cpp index d35bf091d..322569f36 100644 --- a/src/ncp/ncp_base.cpp +++ b/src/ncp/ncp_base.cpp @@ -63,6 +63,7 @@ const NcpBase::PropertyHandlerEntry NcpBase::mGetPropertyHandlerTable[] = { NCP_GET_PROP_HANDLER_ENTRY(CAPS), NCP_GET_PROP_HANDLER_ENTRY(DEBUG_TEST_ASSERT), + NCP_GET_PROP_HANDLER_ENTRY(DEBUG_TEST_WATCHDOG), NCP_GET_PROP_HANDLER_ENTRY(DEBUG_NCP_LOG_LEVEL), NCP_GET_PROP_HANDLER_ENTRY(HWADDR), NCP_GET_PROP_HANDLER_ENTRY(HOST_POWER_STATE), @@ -1852,6 +1853,16 @@ otError NcpBase::GetPropertyHandler_DEBUG_TEST_ASSERT(void) ) } +otError NcpBase::GetPropertyHandler_DEBUG_TEST_WATCHDOG(void) +{ + while (true) + ; + + OT_UNREACHABLE_CODE( + return OT_ERROR_NONE; + ) +} + otError NcpBase::GetPropertyHandler_DEBUG_NCP_LOG_LEVEL(void) { uint8_t logLevel = 0; diff --git a/src/ncp/ncp_base.hpp b/src/ncp/ncp_base.hpp index e26927689..86385a8db 100644 --- a/src/ncp/ncp_base.hpp +++ b/src/ncp/ncp_base.hpp @@ -321,6 +321,7 @@ private: NCP_GET_PROP_HANDLER(VENDOR_ID); NCP_GET_PROP_HANDLER(CAPS); NCP_GET_PROP_HANDLER(DEBUG_TEST_ASSERT); + NCP_GET_PROP_HANDLER(DEBUG_TEST_WATCHDOG); NCP_GET_PROP_HANDLER(DEBUG_NCP_LOG_LEVEL); NCP_SET_PROP_HANDLER(DEBUG_NCP_LOG_LEVEL); NCP_GET_PROP_HANDLER(NCP_VERSION); diff --git a/src/ncp/spinel.c b/src/ncp/spinel.c index 4a2b5a6e6..5776503ab 100644 --- a/src/ncp/spinel.c +++ b/src/ncp/spinel.c @@ -1781,6 +1781,10 @@ spinel_prop_key_to_cstr(spinel_prop_key_t prop_key) ret = "PROP_DEBUG_NCP_LOG_LEVEL"; break; + case SPINEL_PROP_DEBUG_TEST_WATCHDOG: + ret = "PROP_DEBUG_TEST_WATCHDOG"; + break; + default: break; } diff --git a/src/ncp/spinel.h b/src/ncp/spinel.h index 6606f8170..479d208fa 100644 --- a/src/ncp/spinel.h +++ b/src/ncp/spinel.h @@ -1555,18 +1555,30 @@ typedef enum SPINEL_PROP_DEBUG__BEGIN = 16384, - /// Reading this property will cause an assert on the NCP. - /// This is intended for testing the assert functionality of - /// underlying platform/NCP. Assert should ideally cause the - /// NCP to reset, but if this is not supported a `false` boolean - /// is returned in response. - /** Format: 'b' (read-only) */ + /// Testing platform assert + /** Format: 'b' (read-only) + * + * Reading this property will cause an assert on the NCP. This is intended for testing the assert functionality of + * underlying platform/NCP. Assert should ideally cause the NCP to reset, but if this is not supported a `false` + * boolean is returned in response. + * + */ SPINEL_PROP_DEBUG_TEST_ASSERT = SPINEL_PROP_DEBUG__BEGIN + 0, /// The NCP log level. /** Format: `C` */ SPINEL_PROP_DEBUG_NCP_LOG_LEVEL = SPINEL_PROP_DEBUG__BEGIN + 1, + /// Testing platform watchdog + /** Format: Empty (read-only) + * + * Reading this property will causes NCP to start a `while(true) ;` loop and thus triggering a watchdog. + * + * This is intended for testing the watchdog functionality on the underlying platform/NCP. + * + */ + SPINEL_PROP_DEBUG_TEST_WATCHDOG = SPINEL_PROP_DEBUG__BEGIN + 2, + SPINEL_PROP_DEBUG__END = 17408, SPINEL_PROP_EXPERIMENTAL__BEGIN = 2000000,