[ncp] new spinel property to trigger/test watchdog (#2374)

This commit is contained in:
Abtin Keshavarzian
2017-11-29 20:57:58 +00:00
committed by Jonathan Hui
parent 5fc97364f3
commit ed2112a19a
5 changed files with 42 additions and 6 deletions
@@ -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.
+11
View File
@@ -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;
+1
View File
@@ -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);
+4
View File
@@ -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;
}
+18 -6
View File
@@ -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,