tmr_manager
Xilinx SDK Drivers API Documentation
Tmr_manager_v1_0

Data Structures

struct  XTMR_Manager_Stats
 Statistics for the XTMR_Manager driver. More...
 
struct  XTMR_Manager_Config
 This typedef contains configuration information for the device. More...
 
struct  XTMR_Manager
 The XTMR_Manager driver instance data. More...
 

Macros

#define XTMR_Manager_WriteReg(BaseAddress, RegOffset, Data)   XTMR_Manager_Out32((BaseAddress) + (RegOffset), (u32)(Data))
 Write a value to a TMRManager register. More...
 
#define XTMR_Manager_ReadReg(BaseAddress, RegOffset)   XTMR_Manager_In32((BaseAddress) + (RegOffset))
 Read a value from a TMRManager register. More...
 
#define XTMR_Manager_SetControlReg(BaseAddress, Mask)   XTMR_Manager_WriteReg((BaseAddress), XTM_CONTROL_OFFSET, (Mask))
 Set the contents of the control register. More...
 
#define XTMR_Manager_GetFirstFailingReg(BaseAddress)   XTMR_Manager_ReadReg((BaseAddress), XTM_FFR_OFFSET)
 Get the contents of the first failing register. More...
 
#define XTMR_Manager_ClearFirstFailingReg(BaseAddress)   XTMR_Manager_WriteReg((BaseAddress), XTM_FFR_OFFSET, 0)
 Clear the contents of the first failing register. More...
 
#define XTMR_Manager_IsLockstepMismatch(BaseAddress)
 Check to see if a lockstep mismatch has occurred. More...
 
#define XTMR_Manager_EnableIntr(BaseAddress, Mask)   XTMR_Manager_WriteReg((BaseAddress), XTM_SEMIMR_OFFSET, Mask)
 Enable the SEM interrupt. More...
 
#define XTMR_Manager_DisableIntr(BaseAddress)   XTMR_Manager_WriteReg((BaseAddress), XTM_SEMIMR_OFFSET, 0)
 Disable the SEM interrupt. More...
 

Typedefs

typedef void(* XTMR_Manager_Handler) (void *CallBackRef)
 Callback function. More...
 

Functions

int XTMR_Manager_CfgInitialize (XTMR_Manager *InstancePtr, XTMR_Manager_Config *Config, UINTPTR EffectiveAddr)
 Initialize a XTMR_Manager instance. More...
 
int XTMR_Manager_Initialize (XTMR_Manager *InstancePtr, u16 DeviceId)
 Initialize a XTMR_Manager instance. More...
 
void XTMR_Manager_SetRecoveryHandler (XTMR_Manager *InstancePtr, XTMR_Manager_Handler FuncPtr, void *CallBackRef)
 Set the user recovery handler, which can replace the pre-defined handler completely, to do custom recovery. More...
 
void XTMR_Manager_SetPreResetHandler (XTMR_Manager *InstancePtr, XTMR_Manager_Handler FuncPtr, void *CallBackRef)
 Set the user pre-reset handler, which can be used to save context before reset in a recovery sequence. More...
 
void XTMR_Manager_SetPostResetHandler (XTMR_Manager *InstancePtr, XTMR_Manager_Handler FuncPtr, void *CallBackRef)
 Set the user post-reset handler, which can be used to restore context after reset in a recovery sequence. More...
 
void XTMR_Manager_GetStats (XTMR_Manager *InstancePtr, XTMR_Manager_Stats *StatsPtr)
 Returns a snapshot of the current statistics in the structure specified. More...
 
void XTMR_Manager_ClearStats (XTMR_Manager *InstancePtr)
 This function zeros the statistics for the given instance. More...
 
void XTMR_Manager_EnableInterrupt (XTMR_Manager *InstancePtr, u32 Mask)
 This function enables the core interrupt such that an interrupt will occur when any of the SEM status signals indicated by the mask are changed. More...
 
void XTMR_Manager_DisableInterrupt (XTMR_Manager *InstancePtr)
 This function disables the core interrupt. More...
 
void XTMR_Manager_SetHandler (XTMR_Manager *InstancePtr, XTMR_Manager_Handler FuncPtr, void *CallBackRef)
 This function sets the handler that will be called when an event (interrupt) occurs in the driver. More...
 
int XTMR_Manager_SelfTest (XTMR_Manager *InstancePtr)
 Runs a self-test on the device hardware. More...
 
void XTMR_Manager_InterruptHandler (XTMR_Manager *InstancePtr)
 This function is the interrupt handler for the TMR Manager driver. More...
 
void XTMR_Manager_BreakHandler (XTMR_Manager *InstancePtr)
 Break occurred signalling that a recovery should be performed. More...
 
int XTMR_Manager_ResetHandler (XTMR_Manager *InstancePtr)
 Detect and handle recovery reset or cold reset. More...
 

Variables

XTMR_Manager_Config XTMR_Manager_ConfigTable [XPAR_XTMR_MANAGER_NUM_INSTANCES]
 The configuration table for TMR Manager devices. More...
 
XTMR_Manager_Config XTMR_Manager_ConfigTable []
 The configuration table for TMR Manager devices. More...
 

Macro Definition Documentation

◆ XTMR_Manager_ClearFirstFailingReg

#define XTMR_Manager_ClearFirstFailingReg (   BaseAddress)    XTMR_Manager_WriteReg((BaseAddress), XTM_FFR_OFFSET, 0)

#include <xtmr_manager_l.h>

Clear the contents of the first failing register.

Parameters
BaseAddressis the base address of the device
Returns
A 32-bit value representing the contents of the status register.
Note
C-style Signature: u32 XTMR_Manager_ClearFirstFailingReg(u32 BaseAddress);

◆ XTMR_Manager_DisableIntr

#define XTMR_Manager_DisableIntr (   BaseAddress)    XTMR_Manager_WriteReg((BaseAddress), XTM_SEMIMR_OFFSET, 0)

#include <xtmr_manager_l.h>

Disable the SEM interrupt.

We cannot read the SEM Interrupt Mask Register, so we just clear all bits. Since the register only defines the interrupt mask, this works without side effects.

Parameters
BaseAddressis the base address of the device
Returns
None.
Note
C-style Signature: void XTMR_Manager_DisableIntr(u32 BaseAddress);

◆ XTMR_Manager_EnableIntr

#define XTMR_Manager_EnableIntr (   BaseAddress,
  Mask 
)    XTMR_Manager_WriteReg((BaseAddress), XTM_SEMIMR_OFFSET, Mask)

#include <xtmr_manager_l.h>

Enable the SEM interrupt.

We cannot read the SEM Interrupt Mask Register, so we just write the enabled interrupt bits and clear all others. Since the register only defines the interrupt mask, this works without side effects.

Parameters
BaseAddressis the base address of the device
Returns
None.
Note
C-style Signature: void XTMR_Manager_EnableIntr(u32 BaseAddress);

◆ XTMR_Manager_GetFirstFailingReg

#define XTMR_Manager_GetFirstFailingReg (   BaseAddress)    XTMR_Manager_ReadReg((BaseAddress), XTM_FFR_OFFSET)

#include <xtmr_manager_l.h>

Get the contents of the first failing register.

Use the XTM_FFR_* constants defined above to interpret the bit-mask returned.

Parameters
BaseAddressis the base address of the device
Returns
A 32-bit value representing the contents of the status register.
Note
C-style Signature: u32 XTMR_Manager_GetFirstFailingReg(u32 BaseAddress);

Referenced by XTMR_Manager_ResetHandler().

◆ XTMR_Manager_IsLockstepMismatch

#define XTMR_Manager_IsLockstepMismatch (   BaseAddress)

#include <xtmr_manager_l.h>

Value:
((XTMR_Manager_GetFirstFailingReg((BaseAddress)) & \
((1 << XTM_FFR_LM12) | (1 << XTM_FFR_LM13)| (1 << XTM_FFR_LM23)) != 0)
#define XTMR_Manager_GetFirstFailingReg(BaseAddress)
Get the contents of the first failing register.
Definition: xtmr_manager_l.h:212

Check to see if a lockstep mismatch has occurred.

Parameters
BaseAddressis the base address of the device
Returns
TRUE if a lockstep mismatch has occurred, FALSE otherwise.
Note
C-style Signature: int XTMR_Manager_IsLockstepMismatch(u32 BaseAddress);

◆ XTMR_Manager_ReadReg

#define XTMR_Manager_ReadReg (   BaseAddress,
  RegOffset 
)    XTMR_Manager_In32((BaseAddress) + (RegOffset))

#include <xtmr_manager_l.h>

Read a value from a TMRManager register.

A 32 bit read is performed.

Parameters
BaseAddressis the base address of the TMRManager device.
RegOffsetis the register offset from the base to read from.
Returns
Data read from the register.
Note
C-style signature: u32 XTMR_Manager_ReadReg(u32 BaseAddress, u32 RegOffset)

Referenced by XTMR_Manager_SelfTest().

◆ XTMR_Manager_SetControlReg

#define XTMR_Manager_SetControlReg (   BaseAddress,
  Mask 
)    XTMR_Manager_WriteReg((BaseAddress), XTM_CONTROL_OFFSET, (Mask))

#include <xtmr_manager_l.h>

Set the contents of the control register.

Use the XTM_CR_* constants defined above to create the bit-mask to be written to the register.

Parameters
BaseAddressis the base address of the device
Maskis the 32-bit value to write to the control register
Returns
None.
Note
C-style Signature: void XTMR_Manager_SetControlReg(u32 BaseAddress, u32 Mask);

◆ XTMR_Manager_WriteReg

#define XTMR_Manager_WriteReg (   BaseAddress,
  RegOffset,
  Data 
)    XTMR_Manager_Out32((BaseAddress) + (RegOffset), (u32)(Data))

#include <xtmr_manager_l.h>

Write a value to a TMRManager register.

A 32 bit write is performed.

Parameters
BaseAddressis the base address of the TMRManager device.
RegOffsetis the register offset from the base to write to.
Datais the data written to the register.
Returns
None.
Note
C-style signature: void XTMR_Manager_WriteReg(u32 BaseAddress, u32 RegOffset, u32 Data)

Referenced by XTMR_Manager_DisableInterrupt(), and XTMR_Manager_EnableInterrupt().

Typedef Documentation

◆ XTMR_Manager_Handler

typedef void(* XTMR_Manager_Handler) (void *CallBackRef)

#include <xtmr_manager.h>

Callback function.

The first argument is a callback reference passed in by the upper layer when setting the callback functions, and passed back to the upper layer when the callback is invoked.

Function Documentation

◆ XTMR_Manager_BreakHandler()

void XTMR_Manager_BreakHandler ( XTMR_Manager InstancePtr)

#include <xtmr_manager_recover.c>

Break occurred signalling that a recovery should be performed.

Call the prerecovery user handler, and then suspend the processor, to signal to the TMR Manager hardware that it should reset the TMR sub-system.

Parameters
InstancePtris a pointer to the XTMR_Manager instance.
Returns
None.
Note
Called from break vector, with interrupts disabled.

◆ XTMR_Manager_CfgInitialize()

int XTMR_Manager_CfgInitialize ( XTMR_Manager InstancePtr,
XTMR_Manager_Config Config,
UINTPTR  EffectiveAddr 
)

#include <xtmr_manager.c>

Initialize a XTMR_Manager instance.

The receive and transmit FIFOs of the core are not flushed, so the user may want to flush them. The hardware device does not have any way to disable the receiver such that any valid data may be present in the receive FIFO. This function disables the core interrupt. The baudrate and format of the data are fixed in the hardware at hardware build time.

Parameters
InstancePtris a pointer to the XTMR_Manager instance.
Configis a reference to a structure containing information about a specific TMR Manager device. This function initializes an InstancePtr object for a specific device specified by the contents of Config. This function can initialize multiple instance objects with the use of multiple calls giving different Config information on each call.
EffectiveAddris the device base address in the virtual memory address space. The caller is responsible for keeping the address mapping from EffectiveAddr to the device physical base address unchanged once this function is invoked. Unexpected errors may occur if the address mapping changes after this function is called. If address translation is not used, use Config->BaseAddress for this parameters, passing the physical address instead.
Returns
  • XST_SUCCESS if everything starts up as expected.
Note
The Config pointer argument is not used by this function, but is provided to keep the function signature consistent with other drivers.

◆ XTMR_Manager_ClearStats()

void XTMR_Manager_ClearStats ( XTMR_Manager InstancePtr)

#include <xtmr_manager.h>

This function zeros the statistics for the given instance.

Parameters
InstancePtris a pointer to the XTMR_Manager instance.
Returns
None.
Note
None.

References XTMR_Manager_Stats::InterruptCount, and XTMR_Manager_Stats::RecoveryCount.

◆ XTMR_Manager_DisableInterrupt()

void XTMR_Manager_DisableInterrupt ( XTMR_Manager InstancePtr)

#include <xtmr_manager.h>

This function disables the core interrupt.

After calling this function, data may still be received by the core but no interrupt will be generated since the hardware device has no way to disable the receiver.

Parameters
InstancePtris a pointer to the XTMR_Manager instance.
Returns
None.
Note
None.

References XTMR_Manager_WriteReg.

◆ XTMR_Manager_EnableInterrupt()

void XTMR_Manager_EnableInterrupt ( XTMR_Manager InstancePtr,
u32  mask 
)

#include <xtmr_manager.h>

This function enables the core interrupt such that an interrupt will occur when any of the SEM status signals indicated by the mask are changed.

This function enables the core interrupt such that an interrupt will occur when an unmasked SEM status input changes value.

Parameters
InstancePtris a pointer to the XTMR_Manager instance.
Maskis a mask indicating bits that should give an interrupt.
Returns
None.
Note
None.
Parameters
InstancePtris a pointer to the XTMR_Manager instance.
Returns
None.
Note
None.

References XTMR_Manager_WriteReg.

◆ XTMR_Manager_GetStats()

void XTMR_Manager_GetStats ( XTMR_Manager InstancePtr,
XTMR_Manager_Stats StatsPtr 
)

#include <xtmr_manager.h>

Returns a snapshot of the current statistics in the structure specified.

Parameters
InstancePtris a pointer to the XTMR_Manager instance.
StatsPtris a pointer to a XTMR_ManagerStats structure to where the statistics are to be copied.
Returns
None.
Note
None.

References XTMR_Manager_Stats::InterruptCount, and XTMR_Manager_Stats::RecoveryCount.

◆ XTMR_Manager_Initialize()

int XTMR_Manager_Initialize ( XTMR_Manager InstancePtr,
u16  DeviceId 
)

#include <xtmr_manager.h>

Initialize a XTMR_Manager instance.

The receive and transmit FIFOs of the core are not flushed, so the user may want to flush them. The hardware device does not have any way to disable the receiver such that any valid data may be present in the receive FIFO. This function disables the core interrupt. The baudrate and format of the data are fixed in the hardware at hardware build time.

Parameters
InstancePtris a pointer to the XTMR_Manager instance.
DeviceIdis the unique id of the device controlled by this XTMR_Manager instance. Passing in a device id associates the generic XTMR_Manager instance to a specific device, as chosen by the caller or application developer.
Returns
  • XST_SUCCESS if everything starts up as expected.
  • XST_DEVICE_NOT_FOUND if the device is not found in the configuration table.
Note
None.

Referenced by TMR_ManagerPolledExample(), and TMR_ManagerSelfTestExample().

◆ XTMR_Manager_InterruptHandler()

void XTMR_Manager_InterruptHandler ( XTMR_Manager InstancePtr)

#include <xtmr_manager_intr.c>

This function is the interrupt handler for the TMR Manager driver.

It must be connected to an interrupt system by the user such that it is called when an interrupt for any TMR Manager occurs. This function does not save or restore the processor context such that the user must ensure this occurs.

Parameters
InstancePtrcontains a pointer to the instance of the core that the interrupt is for.
Returns
None.
Note
None.

◆ XTMR_Manager_ResetHandler()

int XTMR_Manager_ResetHandler ( XTMR_Manager InstancePtr)

#include <xtmr_manager_recover.c>

Detect and handle recovery reset or cold reset.

Parameters
InstancePtris a pointer to the XTMR_Manager instance.
Returns
Whether the reset was recovery reset (1) or cold reset (0).
Note
Called from assembler context. The assembler routine ensures that the context is restored when doing a recovery reset.

References XTMR_Manager_GetFirstFailingReg.

◆ XTMR_Manager_SelfTest()

int XTMR_Manager_SelfTest ( XTMR_Manager InstancePtr)

#include <xtmr_manager.h>

Runs a self-test on the device hardware.

Since there is no way to perform a loopback in the hardware, this test can only check the state of the status register to verify it is correct. This test assumes that the hardware device is still in its reset state, but has been initialized with the Initialize function.

Parameters
InstancePtris a pointer to the XTMR_Manager instance.
Returns
  • XST_SUCCESS if the self-test was successful.
  • XST_FAILURE if the self-test failed, the status register value was not correct
Note
None.

References XTMR_Manager_ReadReg.

Referenced by TMR_ManagerPolledExample(), and TMR_ManagerSelfTestExample().

◆ XTMR_Manager_SetHandler()

void XTMR_Manager_SetHandler ( XTMR_Manager InstancePtr,
XTMR_Manager_Handler  FuncPtr,
void *  CallBackRef 
)

#include <xtmr_manager.h>

This function sets the handler that will be called when an event (interrupt) occurs in the driver.

The purpose of the handler is to allow application specific processing to be performed.

Parameters
InstancePtris a pointer to the XTMR_Manager instance.
FuncPtris the pointer to the callback function.
CallBackRefis the upper layer callback reference passed back when the callback function is invoked.
Returns
None.
Note
There is no assert on the CallBackRef since the driver doesn't know what it is (nor should it)

The purpose of the handler is to allow application specific processing to be performed.

Parameters
InstancePtris a pointer to the XTMR_Manager instance .
FuncPtris the pointer to the callback function.
CallBackRefis the upper layer callback reference passed back when the callback function is invoked.
Returns
None.
Note
There is no assert on the CallBackRef since the driver doesn't know what it is (nor should it)

◆ XTMR_Manager_SetPostResetHandler()

void XTMR_Manager_SetPostResetHandler ( XTMR_Manager InstancePtr,
XTMR_Manager_Handler  FuncPtr,
void *  CallBackRef 
)

#include <xtmr_manager.h>

Set the user post-reset handler, which can be used to restore context after reset in a recovery sequence.

Parameters
InstancePtris a pointer to the XTMR_Manager instance.
Note
None.

◆ XTMR_Manager_SetPreResetHandler()

void XTMR_Manager_SetPreResetHandler ( XTMR_Manager InstancePtr,
XTMR_Manager_Handler  FuncPtr,
void *  CallBackRef 
)

#include <xtmr_manager.h>

Set the user pre-reset handler, which can be used to save context before reset in a recovery sequence.

Parameters
InstancePtris a pointer to the XTMR_Manager instance.
Note
This function is run in interrupt context.

◆ XTMR_Manager_SetRecoveryHandler()

void XTMR_Manager_SetRecoveryHandler ( XTMR_Manager InstancePtr,
XTMR_Manager_Handler  FuncPtr,
void *  CallBackRef 
)

#include <xtmr_manager.h>

Set the user recovery handler, which can replace the pre-defined handler completely, to do custom recovery.

Parameters
InstancePtris a pointer to the XTMR_Manager instance.
Note
This function is run in interrupt context.

Variable Documentation

◆ XTMR_Manager_ConfigTable [1/2]

XTMR_Manager_Config XTMR_Manager_ConfigTable[XPAR_XTMR_MANAGER_NUM_INSTANCES]

#include <xtmr_manager_g.c>

Initial value:
=
{
{
XPAR_TMRMANAGER_0_DEVICE_ID,
XPAR_TMRMANAGER_0_BASEADDR,
XPAR_TMRMANAGER_0_BRK_DELAY_RST_VALUE,
XPAR_TMRMANAGER_0_MASK_RST_VALUE,
XPAR_TMRMANAGER_0_MAGIC1,
XPAR_TMRMANAGER_0_MAGIC2,
XPAR_TMRMANAGER_0_UE_IS_FATAL,
XPAR_TMRMANAGER_0_UE_WIDTH,
XPAR_TMRMANAGER_0_NO_OF_COMPARATORS,
XPAR_TMRMANAGER_0_COMPARATORS_MASK,
XPAR_TMRMANAGER_0_WATCHDOG,
XPAR_TMRMANAGER_0_WATCHDOG_WIDTH,
XPAR_TMRMANAGER_0_SEM_INTERFACE,
XPAR_TMRMANAGER_0_SEM_HEARTBEAT_WATCHDOG,
XPAR_TMRMANAGER_0_SEM_HEARTBEAT_WATCHDOG_WIDTH,
XPAR_TMRMANAGER_0_BRK_DELAY_WIDTH,
XPAR_TMRMANAGER_0_TMR,
XPAR_TMRMANAGER_0_TEST_COMPARATOR,
XPAR_TMRMANAGER_0_STRICT_MISCOMPARE,
XPAR_TMRMANAGER_0_USE_DEBUG_DISABLE,
XPAR_TMRMANAGER_0_USE_TMR_DISABLE
},
}

The configuration table for TMR Manager devices.

◆ XTMR_Manager_ConfigTable [2/2]

XTMR_Manager_Config XTMR_Manager_ConfigTable[]

#include <xtmr_manager_i.h>

The configuration table for TMR Manager devices.