2019-10-25 22:44:08 -03:00
|
|
|
#pragma once
|
2019-04-11 05:01:49 -03:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
setup the watchdog
|
|
|
|
*/
|
|
|
|
void stm32_watchdog_init(void);
|
|
|
|
|
|
|
|
/*
|
|
|
|
pat the dog, to prevent a reset. If not called for 1s
|
|
|
|
after stm32_watchdog_init() then MCU will reset
|
|
|
|
*/
|
|
|
|
void stm32_watchdog_pat(void);
|
|
|
|
|
2019-04-11 06:50:46 -03:00
|
|
|
/*
|
|
|
|
return true if reboot was from a watchdog reset
|
|
|
|
*/
|
|
|
|
bool stm32_was_watchdog_reset(void);
|
|
|
|
|
2022-02-04 21:41:54 -04:00
|
|
|
/*
|
|
|
|
return true if reboot was from a software reset
|
|
|
|
*/
|
|
|
|
bool stm32_was_software_reset(void);
|
|
|
|
|
2019-04-11 06:50:46 -03:00
|
|
|
/*
|
|
|
|
save the reset reason code
|
|
|
|
*/
|
|
|
|
void stm32_watchdog_save_reason(void);
|
2019-04-11 08:12:03 -03:00
|
|
|
|
|
|
|
/*
|
|
|
|
clear reset reason code
|
|
|
|
*/
|
|
|
|
void stm32_watchdog_clear_reason(void);
|
2019-04-19 21:28:15 -03:00
|
|
|
|
|
|
|
/*
|
2019-05-09 04:49:32 -03:00
|
|
|
save persistent watchdog data
|
2019-04-19 21:28:15 -03:00
|
|
|
*/
|
2019-05-09 04:49:32 -03:00
|
|
|
void stm32_watchdog_save(const uint32_t *data, uint32_t nwords);
|
2019-04-19 21:28:15 -03:00
|
|
|
|
|
|
|
/*
|
2019-05-09 04:49:32 -03:00
|
|
|
load persistent watchdog data
|
2019-04-21 00:08:29 -03:00
|
|
|
*/
|
2019-05-09 04:49:32 -03:00
|
|
|
void stm32_watchdog_load(uint32_t *data, uint32_t nwords);
|
2019-04-11 06:50:46 -03:00
|
|
|
|
2019-04-11 05:01:49 -03:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|