v2.0.0
watchdog.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef _HARDWARE_WATCHDOG_H
8#define _HARDWARE_WATCHDOG_H
9
10#include "pico.h"
11#include "hardware/structs/watchdog.h"
12
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33// PICO_CONFIG: PARAM_ASSERTIONS_ENABLED_HARDWARE_WATCHDOG, Enable/disable assertions in the hardware_watchdog module, type=bool, default=0, group=hardware_watchdog
34#ifndef PARAM_ASSERTIONS_ENABLED_HARDWARE_WATCHDOG
35#ifdef PARAM_ASSERTIONS_ENABLED_WATCHDOG // backwards compatibility with SDK < 2.0.0
36#define PARAM_ASSERTIONS_ENABLED_HARDWARE_WATCHDOG PARAM_ASSERTIONS_ENABLED_WATCHDOG
37#else
38#define PARAM_ASSERTIONS_ENABLED_HARDWARE_WATCHDOG 0
39#endif
40#endif
41
54void watchdog_reboot(uint32_t pc, uint32_t sp, uint32_t delay_ms);
55
62void watchdog_start_tick(uint cycles);
63
68void watchdog_update(void);
69
87void watchdog_enable(uint32_t delay_ms, bool pause_on_debug);
88
93void watchdog_disable(void);
94
102bool watchdog_caused_reboot(void);
103
121bool watchdog_enable_caused_reboot(void);
122
133uint32_t watchdog_get_time_remaining_ms(void);
134
135// backwards compatibility with SDK < 2.0.0
136static inline uint32_t watchdog_get_count(void) {
137 return watchdog_get_time_remaining_ms();
138}
139#ifdef __cplusplus
140}
141#endif
142
143#endif
watchdog_update
void watchdog_update(void)
Reload the watchdog counter with the amount of time set in watchdog_enable.
Definition: watchdog.c:26
watchdog_enable_caused_reboot
bool watchdog_enable_caused_reboot(void)
Did watchdog_enable cause the last reboot?
Definition: watchdog.c:123
watchdog_get_time_remaining_ms
uint32_t watchdog_get_time_remaining_ms(void)
Returns the number of microseconds before the watchdog will reboot the chip.
Definition: watchdog.c:31
watchdog_caused_reboot
bool watchdog_caused_reboot(void)
Did the watchdog cause the last reboot?
Definition: watchdog.c:114
watchdog_enable
void watchdog_enable(uint32_t delay_ms, bool pause_on_debug)
Enable the watchdog.
Definition: watchdog.c:79
watchdog_reboot
void watchdog_reboot(uint32_t pc, uint32_t sp, uint32_t delay_ms)
Define actions to perform at watchdog timeout.
Definition: watchdog.c:90
watchdog_start_tick
void watchdog_start_tick(uint cycles)
Start the watchdog tick.
Definition: watchdog.c:16
watchdog_disable
void watchdog_disable(void)
Disable the watchdog.
Definition: watchdog.c:86
pico.h