Sapphire SoC DS Sapphire SoC UG Sapphire HP SoC DS Sapphire HP SoC UG RISC-V Embedded IDE UG Board Support Package
Loading...
Searching...
No Matches

Overview

Function definitions for Watchdog driver.

Functions

void watchdog_applyConfig (watchdog_instance_t *inst)
 Apply the software configuration to the hardware.

Watchdog (Control Functions)

Control functions for the Watchdog.

void watchdog_lock (watchdog_instance_t *inst)
 Send Lock Heartbeat to Watchdog.
void watchdog_unlock (watchdog_instance_t *inst)
 Send Unlock Heartbeat to Watchdog.
void watchdog_clear (watchdog_instance_t *inst)
 Send Clear Heartbeat to Watchdog.
void watchdog_enable (watchdog_instance_t *inst, u32 mask)
 Enable Watchdog Counters.
void watchdog_disable (watchdog_instance_t *inst, u32 mask)
 Disable Watchdog Counters.

Watchdog (Get Functions)

Read values from the Watchdog hardware registers.

u32 watchdog_getCounterValue (watchdog_instance_t *inst, u32 counterId)
 Get current Counter Value.
u32 watchdog_getEnable (watchdog_instance_t *inst)
 Get Watchdog Enable Register.

Watchdog (Set Functions)

Write values to the Watchdog registers.

Note
Call watchdog_applyConfig() to make these changes effective.
void watchdog_setPrescaler (watchdog_instance_t *inst, u32 value)
 Set Watchdog Prescaler Value.
void watchdog_setHeartBeat (watchdog_instance_t *inst, watchdog_heartbeat_t value)
 Set Watchdog Heartbeat Action.
void watchdog_setCounterLimit (watchdog_instance_t *inst, u32 counterId, u32 value)
 Set Watchdog Counter Limit.

Function Documentation

◆ watchdog_applyConfig()

void watchdog_applyConfig ( watchdog_instance_t * inst)

#include <watchdog.h>

Apply the software configuration to the hardware.

Writes all values stored in the watchdog_instance to the corresponding Watchdog hardware registers.

Parameters
instPointer to Watchdog instance.
Note
Call this function after making any changes to the watchdog_instance structure to apply those changes to the hardware.

Definition at line 81 of file watchdog.c.

◆ watchdog_clear()

void watchdog_clear ( watchdog_instance_t * inst)

#include <watchdog.h>

Send Clear Heartbeat to Watchdog.

Parameters
instPointer to Watchdog instance.
Note
This resets all enabled watchdog counters.

Definition at line 47 of file watchdog.c.

◆ watchdog_disable()

void watchdog_disable ( watchdog_instance_t * inst,
u32 mask )

#include <watchdog.h>

Disable Watchdog Counters.

Parameters
instPointer to Watchdog instance.
maskBitmask of counters to disable.
Note
To disable counter 0, pass bit 0 (0x1). To disable counter 1, pass bit 1 (0x2).

Definition at line 69 of file watchdog.c.

◆ watchdog_enable()

void watchdog_enable ( watchdog_instance_t * inst,
u32 mask )

#include <watchdog.h>

Enable Watchdog Counters.

Parameters
instPointer to Watchdog instance.
maskBitmask of counters to enable.
Note
To enable counter 0, pass bit 0 (0x1). To enable counter 1, pass bit 1 (0x2).

Definition at line 64 of file watchdog.c.

◆ watchdog_getCounterValue()

u32 watchdog_getCounterValue ( watchdog_instance_t * inst,
u32 counterId )

#include <watchdog.h>

Get current Counter Value.

Parameters
instPointer to Watchdog instance.
counterIdCounter index (0 or 1).
Returns
The current counter value.

Definition at line 22 of file watchdog.c.

◆ watchdog_getEnable()

u32 watchdog_getEnable ( watchdog_instance_t * inst)

#include <watchdog.h>

Get Watchdog Enable Register.

Parameters
instPointer to Watchdog instance.
Returns
The current enable register value.

Definition at line 75 of file watchdog.c.

◆ watchdog_lock()

void watchdog_lock ( watchdog_instance_t * inst)

#include <watchdog.h>

Send Lock Heartbeat to Watchdog.

Parameters
instPointer to Watchdog instance.
Note
After locking, the watchdog must be unlocked before it can be cleared again.

Definition at line 53 of file watchdog.c.

◆ watchdog_setCounterLimit()

void watchdog_setCounterLimit ( watchdog_instance_t * inst,
u32 counterId,
u32 value )

#include <watchdog.h>

Set Watchdog Counter Limit.

Parameters
instPointer to Watchdog instance.
counterIdCounter index (0 or 1).
valueCounter limit value.

Definition at line 34 of file watchdog.c.

◆ watchdog_setHeartBeat()

void watchdog_setHeartBeat ( watchdog_instance_t * inst,
watchdog_heartbeat_t value )

#include <watchdog.h>

Set Watchdog Heartbeat Action.

Parameters
instPointer to Watchdog instance.
valueHeartbeat action value.

Definition at line 42 of file watchdog.c.

◆ watchdog_setPrescaler()

void watchdog_setPrescaler ( watchdog_instance_t * inst,
u32 value )

#include <watchdog.h>

Set Watchdog Prescaler Value.

Parameters
instPointer to Watchdog instance.
valueClock divider value.

Definition at line 28 of file watchdog.c.

◆ watchdog_unlock()

void watchdog_unlock ( watchdog_instance_t * inst)

#include <watchdog.h>

Send Unlock Heartbeat to Watchdog.

Parameters
instPointer to Watchdog instance.

Definition at line 58 of file watchdog.c.