Menu Toggle
v2.3.1 (RP2350)
Toggle main menu visibility
Loading...
Searching...
No Matches
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
28
29
#ifdef __cplusplus
30
extern
"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
54
void
watchdog_reboot
(uint32_t pc, uint32_t sp, uint32_t delay_ms);
55
62
void
watchdog_start_tick
(uint cycles);
63
68
void
watchdog_update
(
void
);
69
94
void
watchdog_enable
(uint32_t delay_ms,
bool
pause_on_debug);
95
100
void
watchdog_disable
(
void
);
101
109
bool
watchdog_caused_reboot
(
void
);
110
128
bool
watchdog_enable_caused_reboot
(
void
);
129
140
uint32_t
watchdog_get_time_remaining_us
(
void
);
141
152
uint32_t
watchdog_get_time_remaining_ms
(
void
);
153
154
// backwards compatibility with SDK < 2.0.0
155
static
inline
uint32_t watchdog_get_count(
void
) {
156
return
watchdog_get_time_remaining_us
();
157
}
158
#ifdef __cplusplus
159
}
160
#endif
161
162
#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:125
watchdog_get_time_remaining_ms
uint32_t watchdog_get_time_remaining_ms(void)
Returns the number of milliseconds before the watchdog will reboot the chip.
Definition
watchdog.c:42
watchdog_caused_reboot
bool watchdog_caused_reboot(void)
Did the watchdog cause the last reboot?
Definition
watchdog.c:116
watchdog_enable
void watchdog_enable(uint32_t delay_ms, bool pause_on_debug)
Enable the watchdog.
Definition
watchdog.c:81
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:92
watchdog_start_tick
void watchdog_start_tick(uint cycles)
Start the watchdog tick.
Definition
watchdog.c:16
watchdog_get_time_remaining_us
uint32_t watchdog_get_time_remaining_us(void)
Returns the number of microseconds before the watchdog will reboot the chip.
Definition
watchdog.c:38
watchdog_disable
void watchdog_disable(void)
Disable the watchdog.
Definition
watchdog.c:88
pico.h