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,loramacrypto
pull/10645/head
Rajkumar Kanagaraj 2019-03-22 16:59:40 +00:00 committed by Filip Jagodzinski
parent f672974c25
commit dfe4b533c3
5 changed files with 10 additions and 11 deletions

View File

@ -35,6 +35,7 @@ set(unittest-test-sources
stubs/cipher_stub.c
stubs/aes_stub.c
stubs/cmac_stub.c
stubs/mbed_assert_stub.c
../features/nanostack/coap-service/test/coap-service/unittest/stub/mbedtls_stub.c
)

View File

@ -20,4 +20,5 @@ set(unittest-test-sources
stubs/EventFlags_stub.cpp
stubs/Mutex_stub.cpp
stubs/CellularContext_stub.cpp
stubs/mbed_assert_stub.c
)

View File

@ -92,7 +92,7 @@ public:
*
* Otherwise, the system is reset.
*/
void process(uint32_t elapsed_ms);
static void process(uint32_t elapsed_ms);
protected :
/** add_to_list is used to store the registered user into List.

View File

@ -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);
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.
*/
static mbed::LowPowerTicker *get_ticker()
static SingletonPtr<mbed::LowPowerTicker> get_ticker()
{
static mbed::LowPowerTicker ticker;
return &ticker;
static SingletonPtr<mbed::LowPowerTicker> ticker;
return ticker;
}
/** Refreshes the watchdog timer.
@ -49,7 +43,9 @@ static void mbed_wdog_manager_kick()
{
core_util_critical_section_enter();
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();
}

View File

@ -24,6 +24,7 @@
#include "mbed_error.h"
#include "platform/Callback.h"
#include "platform/mbed_critical.h"
#include "platform/SingletonPtr.h"
#include "LowPowerTicker.h"
#include "Watchdog.h"