Software Drivers

xwdtps.h File Reference

#include "xil_types.h"
#include "xil_assert.h"
#include "xstatus.h"
#include "xwdtps_hw.h"

Classes

struct  XWdtPs_Config
struct  XWdtPs

Defines

#define XWDTPS_H
#define XWDTPS_RESET_SIGNAL   1
#define XWDTPS_IRQ_SIGNAL   2
#define XWDTPS_CLK_PRESCALE   1
#define XWDTPS_COUNTER_RESET   2
#define XWdtPs_IsWdtExpired(InstancePtr)
#define XWdtPs_RestartWdt(InstancePtr)

Functions

XWdtPs_ConfigXWdtPs_LookupConfig (u16 DeviceId)
int XWdtPs_CfgInitialize (XWdtPs *InstancePtr, XWdtPs_Config *ConfigPtr, u32 EffectiveAddress)
void XWdtPs_Start (XWdtPs *InstancePtr)
void XWdtPs_Stop (XWdtPs *InstancePtr)
void XWdtPs_EnableOutput (XWdtPs *InstancePtr, u8 Signal)
void XWdtPs_DisableOutput (XWdtPs *InstancePtr, u8 Signal)
u32 XWdtPs_GetControlValue (XWdtPs *InstancePtr, u8 Control)
void XWdtPs_SetControlValue (XWdtPs *InstancePtr, u8 Control, u32 Value)
int XWdtPs_SelfTest (XWdtPs *InstancePtr)

Detailed Description


Define Documentation

#define XWDTPS_CLK_PRESCALE   1

Clock Prescale request

#define XWDTPS_COUNTER_RESET   2

Counter Reset request

#define XWDTPS_H
#define XWDTPS_IRQ_SIGNAL   2

IRQ signal request

#define XWdtPs_IsWdtExpired ( InstancePtr   ) 
Value:
((XWdtPs_ReadReg((InstancePtr)->Config.BaseAddress, XWDTPS_SR_OFFSET) & \
   XWDTPS_SR_WDZ_MASK) == XWDTPS_SR_WDZ_MASK)

Check if the watchdog timer has expired. This function is used for polled mode and it is also used to check if the last reset was caused by the watchdog timer.

Parameters:
InstancePtr is a pointer to the XWdtPs instance.
Returns:
  • TRUE if the watchdog has expired.
  • FALSE if the watchdog has not expired.
Note:
C-style signature: int XWdtPs_IsWdtExpired(XWdtPs *InstancePtr)
#define XWDTPS_RESET_SIGNAL   1

Reset signal request

#define XWdtPs_RestartWdt ( InstancePtr   ) 
Value:
XWdtPs_WriteReg((InstancePtr)->Config.BaseAddress,              \
                XWDTPS_RESTART_OFFSET, XWDTPS_RESTART_KEY_VAL)

Restart the watchdog timer. An application needs to call this function periodically to keep the timer from asserting the enabled output.

Parameters:
InstancePtr is a pointer to the XWdtPs instance.
Returns:
None.
Note:
C-style signature: void XWdtPs_RestartWdt(XWdtPs *InstancePtr)

Function Documentation

int XWdtPs_CfgInitialize ( XWdtPs InstancePtr,
XWdtPs_Config ConfigPtr,
u32  EffectiveAddress 
)

Initialize a specific watchdog timer instance/driver. This function must be called before other functions of the driver are called.

Parameters:
InstancePtr is a pointer to the XWdtPs instance.
ConfigPtr is the config structure.
EffectiveAddress is the base address for the device. It could be a virtual address if address translation is supported in the system, otherwise it is the physical address.
Returns:
  • XST_SUCCESS if initialization was successful.
  • XST_DEVICE_IS_STARTED if the device has already been started.
Note:
None.
void XWdtPs_DisableOutput ( XWdtPs InstancePtr,
u8  Signal 
)

Disables the indicated signal/output. Performs a read/modify/write cycle to update the value correctly.

Parameters:
InstancePtr is a pointer to the XWdtPs instance.
Signal is the desired signal/output. Valid Signal Values are XWDTPS_RESET_SIGNAL and XWDTPS_IRQ_SIGNAL Only one of them can be specified at a time.
Returns:
None.
Note:
None.
void XWdtPs_EnableOutput ( XWdtPs InstancePtr,
u8  Signal 
)

Enables the indicated signal/output. Performs a read/modify/write cycle to update the value correctly.

Parameters:
InstancePtr is a pointer to the XWdtPs instance.
Signal is the desired signal/output. Valid Signal Values are XWDTPS_RESET_SIGNAL and XWDTPS_IRQ_SIGNAL. Only one of them can be specified at a time.
Returns:
None.
Note:
None.
u32 XWdtPs_GetControlValue ( XWdtPs InstancePtr,
u8  Control 
)

Returns the current control setting for the indicated signal/output. The register referenced is the Counter Control Register (XWDTPS_CCR_OFFSET)

Parameters:
InstancePtr is a pointer to the XWdtPs instance.
Control is the desired signal/output. Valid Control Values are XWDTPS_CLK_PRESCALE and XWDTPS_COUNTER_RESET. Only one of them can be specified at a time.
Returns:
The contents of the requested control field in the Counter Control Register (XWDTPS_CCR_OFFSET). If the Control is XWDTPS_CLK_PRESCALE then use the defintions XWDTEPB_CCR_PSCALE_XXXX. If the Control is XWDTPS_COUNTER_RESET then the values are 0x0 to 0xFFF. This is the Counter Restart value in the CCR register.
Note:
None.
XWdtPs_Config* XWdtPs_LookupConfig ( u16  DeviceId  ) 

Lookup the device configuration based on the unique device ID. The table contains the configuration info for each device in the system.

Parameters:
DeviceId is the unique device ID of the device being looked up.
Returns:
A pointer to the configuration table entry corresponding to the given device ID, or NULL if no match is found.
Note:
None.
int XWdtPs_SelfTest ( XWdtPs InstancePtr  ) 

Run a self-test on the timebase. This test verifies that the register access locking functions. This is tested by trying to alter a register without setting the key value and verifying that the register contents did not change.

Parameters:
InstancePtr is a pointer to the XWdtPs instance.
Returns:
  • XST_SUCCESS if self-test was successful.
  • XST_FAILURE if self-test was not successful.
Note:
None.
void XWdtPs_SetControlValue ( XWdtPs InstancePtr,
u8  Control,
u32  Value 
)

Updates the current control setting for the indicated signal/output with the provided value.

Performs a read/modify/write cycle to update the value correctly. The register referenced is the Counter Control Register (XWDTPS_CCR_OFFSET)

Parameters:
InstancePtr is a pointer to the XWdtPs instance.
Control is the desired signal/output. Valid Control Values are XWDTPS_CLK_PRESCALE and XWDTPS_COUNTER_RESET. Only one of them can be specified at a time.
Value is the desired control value. If the Control is XWDTPS_CLK_PRESCALE then use the defintions XWDTEPB_CCR_PSCALE_XXXX. If the Control is XWDTPS_COUNTER_RESET then the valid values are 0x0 to 0xFFF, this sets the counter restart value of the CCR register.
Returns:
None.
Note:
None.
void XWdtPs_Start ( XWdtPs InstancePtr  ) 

Start the watchdog timer of the device.

Parameters:
InstancePtr is a pointer to the XWdtPs instance.
Returns:
None.
Note:
None.
void XWdtPs_Stop ( XWdtPs InstancePtr  ) 

Disable the watchdog timer.

It is the caller's responsibility to disconnect the interrupt handler of the watchdog timer from the interrupt source, typically an interrupt controller, and disable the interrupt in the interrupt controller.

Parameters:
InstancePtr is a pointer to the XWdtPs instance.
Returns:
None.
Note:
None.