| tmr_manager Vitis Drivers API Documentation

- Overview
- Data Structures
- APIs
- File List
- Examples

Data Structures | Macros | Typedefs | Functions | Variables
Overview

## 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...
typedef void(* | Handler )(XTMR_Manager *InstancePtr)
| This function is the handler which performs processing to send data to the TMR_Manager. 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

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

Clear the contents of the first failing register.

Parameters

  BaseAddress | is 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);

Referenced by XTMR_Manager_ResetHandler().

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

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

  BaseAddress | is the base address of the device

Returns
  None.

Note
  C-style Signature: void XTMR_Manager_DisableIntr(u32 BaseAddress);

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

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

  BaseAddress | is the base address of the device

Returns
  None.

Note
  C-style Signature: void XTMR_Manager_EnableIntr(u32 BaseAddress);

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

Get the contents of the first failing register.

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

Parameters

  BaseAddress | is 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().

#define XTMR_Manager_IsLockstepMismatch | ( |  | BaseAddress | ) |

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

Check to see if a lockstep mismatch has occurred.

Parameters

  BaseAddress | is 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);

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

Read a value from a TMRManager register.

A 32 bit read is performed.

Parameters

  BaseAddress | is the base address of the TMRManager device.
  RegOffset | is 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().

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

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

  BaseAddress | is the base address of the device
  Mask | is the 32-bit value to write to the control register

Returns
  None.

Note
  C-style Signature: void XTMR_Manager_SetControlReg(u32 BaseAddress, u32 Mask);

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

Write a value to a TMRManager register.

A 32 bit write is performed.

Parameters

  BaseAddress | is the base address of the TMRManager device.
  RegOffset | is the register offset from the base to write to.
  Data | is 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_CfgInitialize(), XTMR_Manager_DisableInterrupt(), and XTMR_Manager_EnableInterrupt().

## Typedef Documentation

void Handler

This function is the handler which performs processing to send data to the TMR_Manager.

It is called from an interrupt context such that the amount of processing performed should be minimized. It is called when the transmit FIFO of the TMR_Manager is empty and more data can be sent through the TMR_Manager.

This handler provides an example of how to handle data for the TMR_Manager, but is application specific.

Parameters

  CallBackRef | contains a callback reference from the driver. In this case it is the instance pointer for the TMR_Manager driver.

Returns
  None.

Note
  None.

typedef void(* XTMR_Manager_Handler)(void *CallBackRef)

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

void XTMR_Manager_BreakHandler | ( | XTMR_Manager * | InstancePtr | ) |

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

  InstancePtr | is a pointer to the XTMR_Manager instance.

Returns
  None.

Note
  Called from break vector, with interrupts disabled.

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

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

  InstancePtr | is a pointer to the XTMR_Manager instance.
  Config | is 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.
  EffectiveAddr | is 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.

References XTMR_Manager_Config::BrkDelayRstValue, XTMR_Manager_Config::BrkDelayWidth, XTMR_Manager_Config::ComparatorsMask, XTMR_Manager_Config::Magic1, XTMR_Manager_Config::MaskRstValue, XTMR_Manager_Config::SemInterface, XTMR_Manager_Config::TestComparator, XTMR_Manager_ClearStats(), and XTMR_Manager_WriteReg.

Referenced by XTMR_Manager_Initialize().

void XTMR_Manager_ClearStats | ( | XTMR_Manager * | InstancePtr | ) |

This function zeros the statistics for the given instance.

Parameters

  InstancePtr | is a pointer to the XTMR_Manager instance.

Returns
  None.

Note
  None.

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

Referenced by XTMR_Manager_CfgInitialize().

void XTMR_Manager_DisableInterrupt | ( | XTMR_Manager * | InstancePtr | ) |

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

  InstancePtr | is a pointer to the XTMR_Manager instance.

Returns
  None.

Note
  None.

References XTMR_Manager_WriteReg.

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.

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

Parameters

  InstancePtr | is a pointer to the XTMR_Manager instance.
  Mask | is a mask indicating bits that should give an interrupt.

Returns
  None.

Note
  None.

Parameters

  InstancePtr | is a pointer to the XTMR_Manager instance.

Returns
  None.

Note
  None.

References XTMR_Manager_WriteReg.

Referenced by TMR_ManagerIntrExample().

void XTMR_Manager_GetStats | ( | XTMR_Manager * | InstancePtr,
|  | XTMR_Manager_Stats * | StatsPtr
| ) |  |

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

Parameters

  InstancePtr | is a pointer to the XTMR_Manager instance.
  StatsPtr | is 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.

int XTMR_Manager_Initialize | ( | XTMR_Manager * | InstancePtr,
|  | u16 | DeviceId
| ) |  |

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

  InstancePtr | is a pointer to the XTMR_Manager instance.
  DeviceId | is 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.

References XTMR_Manager_Config::RegBaseAddr, and XTMR_Manager_CfgInitialize().

Referenced by TMR_ManagerIntrExample(), TMR_ManagerPolledExample(), TMR_ManagerRecoveryExample(), and TMR_ManagerSelfTestExample().

void XTMR_Manager_InterruptHandler | ( | XTMR_Manager * | InstancePtr | ) |

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

  InstancePtr | contains a pointer to the instance of the core that the interrupt is for.

Returns
  None.

Note
  None.

int XTMR_Manager_ResetHandler | ( | XTMR_Manager * | InstancePtr | ) |

Detect and handle recovery reset or cold reset.

Parameters

  InstancePtr | is 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_Stats::RecoveryCount, XTMR_Manager_ClearFirstFailingReg, and XTMR_Manager_GetFirstFailingReg.

int XTMR_Manager_SelfTest | ( | XTMR_Manager * | InstancePtr | ) |

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

  InstancePtr | is 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_ManagerIntrExample(), TMR_ManagerPolledExample(), TMR_ManagerRecoveryExample(), and TMR_ManagerSelfTestExample().

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.

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

Parameters

  InstancePtr | is a pointer to the XTMR_Manager instance.
  FuncPtr | is the pointer to the callback function.
  CallBackRef | is 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

  InstancePtr | is a pointer to the XTMR_Manager instance .
  FuncPtr | is the pointer to the callback function.
  CallBackRef | is 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)

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.

Parameters

  InstancePtr | is a pointer to the XTMR_Manager instance.

Note
  None.

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.

Parameters

  InstancePtr | is a pointer to the XTMR_Manager instance.

Note
  This function is run in interrupt context.

Referenced by TMR_ManagerRecoveryExample().

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.

Parameters

  InstancePtr | is a pointer to the XTMR_Manager instance.

Note
  This function is run in interrupt context.

## Variable Documentation

XTMR_Manager_Config XTMR_Manager_ConfigTable[XPAR_XTMR_MANAGER_NUM_INSTANCES]

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_Config XTMR_Manager_ConfigTable[]

The configuration table for TMR Manager devices.