Skip to main content

leodos_libcfs/psp/
watchdog.rs

1//! Wrappers for PSP watchdog timer functions.
2
3use crate::ffi;
4
5/// Initializes the watchdog timer, configuring resolution and
6/// platform-specific settings.
7pub fn init() {
8    unsafe { ffi::CFE_PSP_WatchdogInit() };
9}
10
11/// Enables the watchdog timer.
12pub fn enable() {
13    unsafe { ffi::CFE_PSP_WatchdogEnable() };
14}
15
16/// Disables the watchdog timer.
17pub fn disable() {
18    unsafe { ffi::CFE_PSP_WatchdogDisable() };
19}
20
21/// Services (i.e., "pets") the watchdog timer to prevent it from
22/// expiring.
23///
24/// Reloads the timer with the value last set by [`set`].
25pub fn service() {
26    unsafe { ffi::CFE_PSP_WatchdogService() };
27}
28
29/// Sets the watchdog timeout period in milliseconds.
30pub fn set(value_ms: u32) {
31    unsafe { ffi::CFE_PSP_WatchdogSet(value_ms) };
32}
33
34/// Gets the current watchdog timeout period in milliseconds.
35pub fn get() -> u32 {
36    unsafe { ffi::CFE_PSP_WatchdogGet() }
37}