mirror of https://github.com/ARMmbed/mbed-os.git
Update Watchdog
- Changed the process into static method - used the singletonptr for creating the low power ticker instance - Added the mbed stub into cmake build for cellularnonipsocket,loramacryptopull/11023/head
parent
0a5ca29273
commit
5150b37aea
|
@ -35,6 +35,7 @@ set(unittest-test-sources
|
||||||
stubs/cipher_stub.c
|
stubs/cipher_stub.c
|
||||||
stubs/aes_stub.c
|
stubs/aes_stub.c
|
||||||
stubs/cmac_stub.c
|
stubs/cmac_stub.c
|
||||||
|
stubs/mbed_assert_stub.c
|
||||||
../features/nanostack/coap-service/test/coap-service/unittest/stub/mbedtls_stub.c
|
../features/nanostack/coap-service/test/coap-service/unittest/stub/mbedtls_stub.c
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
|
@ -20,4 +20,5 @@ set(unittest-test-sources
|
||||||
stubs/EventFlags_stub.cpp
|
stubs/EventFlags_stub.cpp
|
||||||
stubs/Mutex_stub.cpp
|
stubs/Mutex_stub.cpp
|
||||||
stubs/CellularContext_stub.cpp
|
stubs/CellularContext_stub.cpp
|
||||||
|
stubs/mbed_assert_stub.c
|
||||||
)
|
)
|
||||||
|
|
|
@ -92,7 +92,7 @@ public:
|
||||||
*
|
*
|
||||||
* Otherwise, the system is reset.
|
* Otherwise, the system is reset.
|
||||||
*/
|
*/
|
||||||
void process(uint32_t elapsed_ms);
|
static void process(uint32_t elapsed_ms);
|
||||||
protected :
|
protected :
|
||||||
|
|
||||||
/** add_to_list is used to store the registered user into List.
|
/** add_to_list is used to store the registered user into List.
|
||||||
|
|
|
@ -24,18 +24,12 @@ static bool is_watchdog_started = false; //boolean to control watchdog start and
|
||||||
static uint32_t elapsed_ms = (HW_WATCHDOG_TIMEOUT / 2);
|
static uint32_t elapsed_ms = (HW_WATCHDOG_TIMEOUT / 2);
|
||||||
MBED_STATIC_ASSERT((HW_WATCHDOG_TIMEOUT > 0), "Timeout must be greater than zero");
|
MBED_STATIC_ASSERT((HW_WATCHDOG_TIMEOUT > 0), "Timeout must be greater than zero");
|
||||||
|
|
||||||
/** mbed watchdog manager creates watchdog class instance with zero timeout
|
|
||||||
* as mbed watchdog manager is not going to register(not going to call "start" method of Watchdog class)
|
|
||||||
* its only going to call process to verify all registered users/threads in alive state
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
mbed::Watchdog watchdog(0, "Platform Watchdog");
|
|
||||||
/** Create singleton instance of LowPowerTicker for watchdog periodic call back of kick.
|
/** Create singleton instance of LowPowerTicker for watchdog periodic call back of kick.
|
||||||
*/
|
*/
|
||||||
static mbed::LowPowerTicker *get_ticker()
|
static SingletonPtr<mbed::LowPowerTicker> get_ticker()
|
||||||
{
|
{
|
||||||
static mbed::LowPowerTicker ticker;
|
static SingletonPtr<mbed::LowPowerTicker> ticker;
|
||||||
return &ticker;
|
return ticker;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Refreshes the watchdog timer.
|
/** Refreshes the watchdog timer.
|
||||||
|
@ -49,7 +43,9 @@ static void mbed_wdog_manager_kick()
|
||||||
{
|
{
|
||||||
core_util_critical_section_enter();
|
core_util_critical_section_enter();
|
||||||
hal_watchdog_kick();
|
hal_watchdog_kick();
|
||||||
watchdog.process(((elapsed_ms <= 0) ? 1 : elapsed_ms));
|
// mbed watchdog manager will access the watchdog process method to verify
|
||||||
|
// all registered users/threads in alive state */
|
||||||
|
mbed::Watchdog::process(((elapsed_ms <= 0) ? 1 : elapsed_ms));
|
||||||
core_util_critical_section_exit();
|
core_util_critical_section_exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "mbed_error.h"
|
#include "mbed_error.h"
|
||||||
#include "platform/Callback.h"
|
#include "platform/Callback.h"
|
||||||
#include "platform/mbed_critical.h"
|
#include "platform/mbed_critical.h"
|
||||||
|
#include "platform/SingletonPtr.h"
|
||||||
#include "LowPowerTicker.h"
|
#include "LowPowerTicker.h"
|
||||||
#include "Watchdog.h"
|
#include "Watchdog.h"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue