NEORV32 - Software Framework Documentation
Loading...
Searching...
No Matches
Functions
neorv32_wdt.c File Reference

Watchdog Timer (WDT) HW driver source file. More...

#include "neorv32.h"
#include "neorv32_wdt.h"

Functions

int neorv32_wdt_available (void)
 
void neorv32_wdt_setup (uint32_t timeout, int lock, int debug_en, int sleep_en)
 
int neorv32_wdt_disable (void)
 
void neorv32_wdt_feed (void)
 
int neorv32_wdt_get_cause (void)
 

Detailed Description

Watchdog Timer (WDT) HW driver source file.

Note
These functions should only be used if the WDT unit was synthesized (IO_WDT_EN = true).

Function Documentation

◆ neorv32_wdt_available()

int neorv32_wdt_available ( void  )

Check if WDT unit was synthesized.

Returns
0 if WDT was not synthesized, 1 if WDT is available.

◆ neorv32_wdt_disable()

int neorv32_wdt_disable ( void  )

Disable watchdog timer.

Returns
Returns 0 if WDT is really deactivated, -1 otherwise.

◆ neorv32_wdt_feed()

void neorv32_wdt_feed ( void  )

Feed watchdog (reset timeout counter).

◆ neorv32_wdt_get_cause()

int neorv32_wdt_get_cause ( void  )

Get cause of last system reset.

Returns
Cause of last reset (0: system reset - OCD or external, 1: watchdog timeout).

◆ neorv32_wdt_setup()

void neorv32_wdt_setup ( uint32_t  timeout,
int  lock,
int  debug_en,
int  sleep_en 
)

Configure and enable watchdog timer. The WDT control register bits are listed in NEORV32_WDT_CTRL_enum.

Warning
Once the lock bit is set it can only be removed by a hardware reset!
Parameters
[in]timeout24-bit timeout value. A WDT IRQ is triggered when the internal counter reaches 'timeout/2'. A system hardware reset is triggered when the internal counter reaches 'timeout'.
[in]lockControl register will be locked when 1 (until next reset).
[in]debug_enAllow watchdog to continue operation even when CPU is in debug mode.
[in]sleep_enAllow watchdog to continue operation even when CPU is in sleep mode.