|
@ -19,31 +19,27 @@ |
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
* |
|
|
* |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
#ifdef __IMXRT1062__ |
|
|
|
|
|
|
|
|
/**
|
|
|
/**
|
|
|
* HAL Watchdog for Teensy 4.0 (IMXRT1062DVL6A) / 4.1 (IMXRT1062DVJ6A) |
|
|
* HAL Watchdog for Teensy 4.0 (IMXRT1062DVL6A) / 4.1 (IMXRT1062DVJ6A) |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
|
|
|
#ifdef __IMXRT1062__ |
|
|
|
|
|
|
|
|
|
|
|
#include "../../inc/MarlinConfig.h" |
|
|
#include "../../inc/MarlinConfig.h" |
|
|
|
|
|
|
|
|
#if ENABLED(USE_WATCHDOG) |
|
|
#if ENABLED(USE_WATCHDOG) |
|
|
|
|
|
|
|
|
#include "watchdog.h" |
|
|
#include "watchdog.h" |
|
|
|
|
|
|
|
|
// 4 seconds timeout
|
|
|
#define WDT_TIMEOUT TERN(WATCHDOG_DURATION_8S, 8, 4) // 4 or 8 second timeout
|
|
|
#define WDTO 4 //seconds
|
|
|
|
|
|
|
|
|
|
|
|
uint8_t timeoutval = (WDTO - 0.5f) / 0.5f; |
|
|
constexpr uint8_t timeoutval = (WDT_TIMEOUT - 0.5f) / 0.5f; |
|
|
|
|
|
|
|
|
void watchdog_init() { |
|
|
void watchdog_init() { |
|
|
|
|
|
|
|
|
CCM_CCGR3 |= CCM_CCGR3_WDOG1(3); // enable WDOG1 clocks
|
|
|
CCM_CCGR3 |= CCM_CCGR3_WDOG1(3); // enable WDOG1 clocks
|
|
|
WDOG1_WMCR = 0; // disable power down PDE
|
|
|
WDOG1_WMCR = 0; // disable power down PDE
|
|
|
WDOG1_WCR |= WDOG_WCR_SRS | WDOG_WCR_WT(timeoutval); |
|
|
WDOG1_WCR |= WDOG_WCR_SRS | WDOG_WCR_WT(timeoutval); |
|
|
WDOG1_WCR |= WDOG_WCR_WDE | WDOG_WCR_WDT | WDOG_WCR_SRE; |
|
|
WDOG1_WCR |= WDOG_WCR_WDE | WDOG_WCR_WDT | WDOG_WCR_SRE; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void HAL_watchdog_refresh() { |
|
|
void HAL_watchdog_refresh() { |
|
|