tmr_inject: Tmr_inject_v1_1

| tmr_inject Xilinx SDK Drivers API Documentation

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

Data Structures | Macros | Functions | Variables
Tmr_inject_v1_1

## Data Structures
struct | XTMR_Inject_Config
| This typedef contains configuration information for the device. More...
struct | XTMR_Inject
| The XTMR_Inject driver instance data. More...

## Macros
#define | XTMR_Inject_WriteReg(BaseAddress, RegOffset, Data) XTMR_Inject_Out32((BaseAddress) + (RegOffset), (u32)(Data))
| Write a value to a TMRInject register. More...
#define | XTMR_Inject_WriteReg64(BaseAddress, RegOffset, Data) XTMR_Inject_Out64((BaseAddress) + (RegOffset), (UINTPTR)(Data))
| Write a value to a TMRInject register. More...
#define | XTMR_Inject_SetControlReg(BaseAddress, Mask) XTMR_Inject_WriteReg((BaseAddress), XTI_CONTROL_REG_OFFSET, (Mask))
| Set the contents of the control register. More...

## Functions
int | XTMR_Inject_CfgInitialize (XTMR_Inject *InstancePtr, XTMR_Inject_Config *Config, UINTPTR EffectiveAddr)
| Initialize a XTMR_Inject instance. More...
void | XTMR_Inject_Enable (XTMR_Inject *InstancePtr, u8 CpuId)
| This function enables fault injection for the indicated CPU. More...
void | XTMR_Inject_Disable (XTMR_Inject *InstancePtr)
| This function disables fault injection. More...
u32 | XTMR_Inject_InjectBit (XTMR_Inject *InstancePtr, u32 Value, u8 Bit)
| This function can be used to inject a fault in either: More...
u32 | XTMR_Inject_InjectMask (XTMR_Inject *InstancePtr, u32 Value, u32 Mask)
| This function can be used to inject any number of faults defined by the Mask parameter in either: More...
int | XTMR_Inject_Initialize (XTMR_Inject *InstancePtr, u16 DeviceId)
| Initialize a XTMR_Inject instance. More...
int | XTMR_Inject_SelfTest (XTMR_Inject *InstancePtr)
| Runs a self-test on the device hardware. More...

## Variables
XTMR_Inject_Config | XTMR_Inject_ConfigTable [XPAR_XTMR_INJECT_NUM_INSTANCES]
| The configuration table for TMR Inject devices. More...
XTMR_Inject_Config | XTMR_Inject_ConfigTable []
| The configuration table for TMR Inject devices. More...

## Macro Definition Documentation

#define XTMR_Inject_SetControlReg | ( |  | BaseAddress,
|  |  | Mask
| ) |  | XTMR_Inject_WriteReg((BaseAddress), XTI_CONTROL_REG_OFFSET, (Mask))

Set the contents of the control register.

Use the XUL_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_Inject_SetControlReg(u32 BaseAddress, u32 Mask);

#define XTMR_Inject_WriteReg | ( |  | BaseAddress,
|  |  | RegOffset,
|  |  | Data
| ) |  | XTMR_Inject_Out32((BaseAddress) + (RegOffset), (u32)(Data))

Write a value to a TMRInject register.

A 32 bit write is performed.

Parameters

  BaseAddress | is the base address of the TMRInject 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_Inject_WriteReg(u32 BaseAddress, u32 RegOffset, u32 Data)

Referenced by XTMR_Inject_CfgInitialize(), XTMR_Inject_Disable(), and XTMR_Inject_Enable().

#define XTMR_Inject_WriteReg64 | ( |  | BaseAddress,
|  |  | RegOffset,
|  |  | Data
| ) |  | XTMR_Inject_Out64((BaseAddress) + (RegOffset), (UINTPTR)(Data))

Write a value to a TMRInject register.

A 64 bit write is performed.

Parameters

  BaseAddress | is the base address of the TMRInject 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_Inject_WriteReg64(UINTPTR BaseAddress, u32 RegOffset, u64 Data)

Referenced by XTMR_Inject_CfgInitialize().

## Function Documentation

int XTMR_Inject_CfgInitialize | ( | XTMR_Inject * | InstancePtr,
|  | XTMR_Inject_Config * | Config,
|  | UINTPTR | EffectiveAddr
| ) |  |

Initialize a XTMR_Inject 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_Inject instance.
  Config | is a reference to a structure containing information about a specific TMR Inject 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_Inject::Address, XTMR_Inject::CpuId, XTMR_Inject::Inject, XTMR_Inject::Instruction, XTMR_Inject_Config::LMBAddrWidth, XTMR_Inject::Magic, XTMR_Inject_Config::MagicByte, XTMR_Inject::MagicByte, XTMR_Inject_WriteReg, and XTMR_Inject_WriteReg64.

Referenced by XTMR_Inject_Initialize().

void XTMR_Inject_Disable | ( | XTMR_Inject * | InstancePtr | ) |

This function disables fault injection.

Parameters

  InstancePtr | is a pointer to the XTMR_Inject instance.

Note
  None.

References XTMR_Inject::CpuId, XTMR_Inject::Inject, XTMR_Inject::Magic, and XTMR_Inject_WriteReg.

void XTMR_Inject_Enable | ( | XTMR_Inject * | InstancePtr,
|  | u8 | CpuId
| ) |  |

This function enables fault injection for the indicated CPU.

Parameters

  InstancePtr | is a pointer to the XTMR_Inject instance.
  CpuId | is the CPU ID of the CPU where faults are to be injected. Must be 1 to 3.

Note
  None.

References XTMR_Inject::CpuId, XTMR_Inject::Inject, XTMR_Inject::Magic, XTMR_Inject::MagicByte, and XTMR_Inject_WriteReg.

int XTMR_Inject_Initialize | ( | XTMR_Inject * | InstancePtr,
|  | u16 | DeviceId
| ) |  |

Initialize a XTMR_Inject instance.

Parameters

  InstancePtr | is a pointer to the XTMR_Inject instance.
  DeviceId | is the unique id of the device controlled by this XTMR_Inject instance. Passing in a device id associates the generic XTMR_Inject 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_Inject_Config::RegBaseAddr, and XTMR_Inject_CfgInitialize().

Referenced by TMR_InjectSelfTestExample().

u32 XTMR_Inject_InjectBit | ( | XTMR_Inject * | InstancePtr,
|  | u32 | Value,
|  | u8 | Bit
| ) |  |

This function can be used to inject a fault in either:

- An address bit of a memory or memory mapped register address for any read or write access on AXI or LMB.
- A data bit written to memory or a memory mapped register on AXI or LMB, as well as output on an AXI Stream. <

Parameters

  InstancePtr | is a pointer to the XTMR_Inject instance.
  Value | is the memory or register address, oro the data.
  Bit | is the bit where the fault is injected. Must be 0 to 31.

Returns
  Either the unchanged value, or value with the fault injected for the CPU set up for fault injection.

Note
  None.

u32 XTMR_Inject_InjectMask | ( | XTMR_Inject * | InstancePtr,
|  | u32 | Value,
|  | u32 | Mask
| ) |  |

This function can be used to inject any number of faults defined by the Mask parameter in either:

- Any address bits of a memory or memory mapped register address for any read or write access on AXI or LMB.
- Any data bits written to memory or a memory mapped register on AXI or LMB, as well as output on an AXI Stream. <

Parameters

  InstancePtr | is a pointer to the XTMR_Inject instance.
  Value | is the memory or register address, oro the data.
  Mask | defines the bits where faults are injected. A fault is injected for every bit in the mask set to 1.

Returns
  Either the unchanged value, or value with the faults injected for the CPU set up for fault injection.

Note
  None.

int XTMR_Inject_SelfTest | ( | XTMR_Inject * | 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_Inject 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.

Referenced by TMR_InjectSelfTestExample().

## Variable Documentation

XTMR_Inject_Config XTMR_Inject_ConfigTable[]

The configuration table for TMR Inject devices.

XTMR_Inject_Config XTMR_Inject_ConfigTable[XPAR_XTMR_INJECT_NUM_INSTANCES]

Initial value:
=
{
{
XPAR_TMRINJECT_0_DEVICE_ID,
XPAR_TMRINJECT_0_BASEADDR,
XPAR_TMRINJECT_0_MAGIC,
XPAR_TMRINJECT_0_CPU_ID
},
}

The configuration table for TMR Inject devices.