Software Drivers

xtrafgen.c File Reference

#include "xtrafgen.h"

Defines

#define XTrafGen_GetCmdInfo(InstancePtr)   (&((InstancePtr)->CmdInfo))

Functions

int XTrafGen_CfgInitialize (XTrafGen *InstancePtr, XTrafGen_Config *Config, u32 EffectiveAddress)
int XTrafGen_AddCommand (XTrafGen *InstancePtr, XTrafGen_Cmd *CmdPtr)
int XTrafGen_GetLastValidIndex (XTrafGen *InstancePtr, u32 RdWrFlag)
int XTrafGen_WriteCmdsToHw (XTrafGen *InstancePtr)
int XTrafGen_EraseAllCommands (XTrafGen *InstancePtr)
void XTrafGen_AccessMasterRam (XTrafGen *InstancePtr, u32 Offset, int Length, u8 RdWrFlag, u32 *Data)
void XTrafGen_PrintCmds (XTrafGen *InstancePtr)

Detailed Description

This file implements AXI Traffic Generator device-wise initialization and control functions. For more information on the implementation of this driver, see xtrafgen.h.

 MODIFICATION HISTORY:
 Ver   Who  Date     Changes
 ----- ---- -------- -------------------------------------------------------
 1.00a srt  01/24/13 First release
 1.01a adk  03/09/13 Updated driver to Support Static and Streaming mode.
 2.00a adk  16/09/13 Fixed CR:737291
 

Define Documentation

#define XTrafGen_GetCmdInfo ( InstancePtr   )     (&((InstancePtr)->CmdInfo))

Get Command Info pointer

Parameters:
InstancePtr is a pointer to the Axi TrafGen instance to be worked on.
Returns:
Pointer to the Command Info structure
Note:
C-style signature: XTrafGen_CmdInfo *XTrafGen_GetCmdInfo(XTrafGen *InstancePtr)

Function Documentation

void XTrafGen_AccessMasterRam ( XTrafGen InstancePtr,
u32  Offset,
int  Length,
u8  RdWrFlag,
u32 *  Data 
)

Write or Read Master RAM

The MSTRAM has 8 KB of internal RAM used for the following:

  • Take data from this RAM for write transactions
  • Store data to this RAM for read transaction
Parameters:
InstancePtr is a pointer to the Axi TrafGen instance to be worked on.
Offset is the offset value in Master RAM.
Length is the size of data to write/read.
RdWrFlag specifies whether to write or read
Data is the pointer to array which contains data to write or reads data into.
int XTrafGen_AddCommand ( XTrafGen InstancePtr,
XTrafGen_Cmd CmdPtr 
)

Add a command to the software list of commands.

This function prepares the four Command Words and one Parameter Word from the Command structure passed from the user application. It then adds to a list of commands (maintained in the software). Both CMDRAM and PARAMRAM are divided into two regions, one for reads and one for writes. Each region can hold 256 commands with each entry containing four Command RAM words and one Parameter RAM word.

Parameters:
InstancePtr is a pointer to the Axi TrafGen instance to be worked on.
CmdPtr is a pointer to Command structure.
Returns:
  • XST_SUCCESS if successful
  • XST_FAILURE if reached max number of command entries
int XTrafGen_CfgInitialize ( XTrafGen InstancePtr,
XTrafGen_Config Config,
u32  EffectiveAddress 
)

This function initializes a AXI Traffic Generator device. This function must be called prior to using a AXI Traffic Generator Device. Initializing a engine includes setting up the register base address, setting up the instance data, and ensuring the hardware is in a quiescent state.

Parameters:
InstancePtr is a pointer to the Axi Traffic Generator instance to be worked on.
CfgPtr references the structure holding the hardware configuration for the Axi Traffic Generator core to initialize.
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 for successful initialization
  • XST_INVALID_PARAM if pointer to the configuration structure is NULL
int XTrafGen_EraseAllCommands ( XTrafGen InstancePtr  ) 

Erase all Command Entry values

This function erases all the 256 entries of both write and read regions with each entry containing four command words and parameter word.

Parameters:
InstancePtr is a pointer to the Axi TrafGen instance to be worked on.
Returns:
  • XST_SUCCESS if successful
  • XST_FAILURE if programming internal RAMs failed
int XTrafGen_GetLastValidIndex ( XTrafGen InstancePtr,
u32  RdWrFlag 
)

Get last Valid Command Index of Write/Read region

The last valid command index is used to set 'my_depend' and 'other_depend' fields of the Command RAM (Word 2).

Parameters:
InstancePtr is a pointer to the Axi TrafGen instance to be worked on.
RdWrFlag specifies a Read or Write Region
Returns:
  • Last Valid Command Index
void XTrafGen_PrintCmds ( XTrafGen InstancePtr  ) 

Display Command Entry values

This function prints all the 256 entries of both write and read regions with each entry containing four command words and parameter word.

Parameters:
InstancePtr is a pointer to the Axi TrafGen instance to be worked on.
int XTrafGen_WriteCmdsToHw ( XTrafGen InstancePtr  ) 

Write Commands to internal Command and Parameter RAMs

This function writes all the prepared commands to hardware.

Parameters:
InstancePtr is a pointer to the Axi TrafGen instance to be worked on.
Returns:
  • XST_SUCCESS if successful
  • XST_FAILURE if programming internal RAMs failed