XilinxProcessorIPLib/drivers/trafgen/examples/xtrafgen_static_mode_example.c
int XTrafGenStaticModeExample(XTrafGen *InstancePtr, u16 DeviceId)
{

	XTrafGen_Config *Config;
	int Status = XST_SUCCESS;
	u32 Count;
	int *Addr = MEM_ADDR;
	Count = 0;
	
        /* Initial setup for Uart16550 */
#ifdef XPAR_UARTNS550_0_BASEADDR

	Uart550_Setup();

#endif

	/* Initialize the Device Configuration Interface driver */
	Config = XTrafGen_LookupConfig(DeviceId);
	if (!Config) {
		xil_printf("No config found for %d\r\n", DeviceId);
		return XST_FAILURE;
	}

	/*
	 * This is where the virtual address would be used, this example
	 * uses physical address.
	 */
	Status = XTrafGen_CfgInitialize(InstancePtr, Config, Config->BaseAddress);
	if (Status != XST_SUCCESS) {
		xil_printf("Initialization failed\n\r");
		return Status;
	}
	
	/* Check for the Static Mode */
	if(InstancePtr->OperatingMode != XTG_MODE_STATIC) {
		return XST_FAILURE;
	}
	
	/* Fill the BRAM with the data */
	for (Count = 0; Count < (5 * BURST_LEN); Count++) {
		*(Addr + Count*4) = 0;
		if(*(Addr + Count*4) != 0x00) {
			xil_printf("ERROR: Memory Addr 0x%x = 0x%x \t"
					"Expected = 0x00\n\r"
					,(Addr+Count*4),(Addr+Count*4));
			return XST_FAILURE;
		}
	}
	
	/* Set the Required Burst length */
	XTrafGen_SetStaticBurstLen(InstancePtr, BURST_LEN);
	
	/* Disable the traffic generation */
	XTrafGen_StaticDisable(InstancePtr);
	
	/* Check for the Static control DONE Bit resets */
	XTrafGen_SetStaticTransferDone(InstancePtr);
	Status = XTrafGen_IsStaticTransferDone(InstancePtr);
	if (Status != TRUE) {
		xil_printf("Static control reset failed failed\n\r");
		return Status;
	}
	
	/* Enable the traffic generation */
	XTrafGen_StaticEnable(InstancePtr);
	
	/* Disable the traffic generation */
	XTrafGen_StaticDisable(InstancePtr);
	
	/* Wait till data transmission completes */
	do {
		Status = XTrafGen_GetStaticTransferDone(InstancePtr);
	}while(Status != XTG_STREAM_CNTL_TD_MASK);

	
	/* Check for the data 
	 * Note:" 0xc0015afe " is the fixed data that has been given by the core
	 * continuously when ATG is configured in STATIC mode and RUN.
	 * There is no way to change this DATA in SW.
	 */
	for (Count = 0; Count < (BURST_LEN + 1); Count++) {
		if(*(u32 *)(MEM_ADDR + Count*4) != DATA) {
			xil_printf("ERROR: Memory Addr 0x%x = 0x%x \t"
					"Expected = 0xc0015afe\n\r"
					,(Addr + Count*4),(Addr + Count*4));
			return XST_FAILURE;
		}
	}

	for (Count = (BURST_LEN+1); Count < (BURST_LEN + 4); Count++) {
		if(*(Addr + Count*4) != 0x00) {
			xil_printf("ERROR: Memory Addr 0x%x = 0x%x \t"
					"Expected = 0x00\n\r"
					,(Addr + Count*4),(Addr + Count*4));
			return XST_FAILURE;
		}
	}

	return XST_SUCCESS;
}
/*****************************************************************************/
/**
*
* This function demonstrates the usage Traffic Generator
* It does the following:
*       - Set up the output terminal if UART16550 is in the hardware build
*       - Initialize the AXI Traffic Generator device
*	- Fill's the Target memory with required data
*	- Enable the Traffic generation
*	- Disable the Traffic generation
*       - Return test status and exit
*
* @param	InstancePtr is a pointer to the instance of the
*		XTrafGen component.
* @param	DeviceId is Device ID of the Axi Traffic Generator Device,
*
*
* @param	InstancePtr is a pointer to the instance of the
*			XTrafGen component.
* @param	DeviceId is Device ID of the Axi Traffic Generator Device,
*			typically XPAR_<TRAFGEN_instance>_DEVICE_ID value from
*			xparameters.h.
*
* @return
*		-XST_SUCCESS to indicate success
*		-XST_FAILURE to indicate failure
*
******************************************************************************/
This function demonstrates the usage Traffic Generator
It does the following:
Set up the output terminal if UART16550 is in the hardware build
Initialize the AXI Traffic Generator device
Fill's the Target memory with required data
Enable the Traffic generation
Disable the Traffic generation
Return test status and exit
This function demonstrates the usage Traffic Generator It does the following : Set up the output terminal if UART16550 is in the hardware build Initialize the AXI Traffic Generator device Fill ' s the Target memory with required data Enable the Traffic generation Disable the Traffic generation Return test status and exit
int XTrafGenStaticModeExample(XTrafGen *InstancePtr, u16 DeviceId)
{
	XTrafGen_Config *Config;
	int Status = XST_SUCCESS;
	u32 Count;
	int *Addr = MEM_ADDR;
	Count = 0;
#ifdef XPAR_UARTNS550_0_BASEADDR
	Uart550_Setup();
#endif
	Config = XTrafGen_LookupConfig(DeviceId);
	if (!Config) {
		xil_printf("No config found for %d\r\n", DeviceId);
		return XST_FAILURE;
	}
	Status = XTrafGen_CfgInitialize(InstancePtr, Config, Config->BaseAddress);
	if (Status != XST_SUCCESS) {
		xil_printf("Initialization failed\n\r");
		return Status;
	}
	if(InstancePtr->OperatingMode != XTG_MODE_STATIC) {
		return XST_FAILURE;
	}
	for (Count = 0; Count < (5 * BURST_LEN); Count++) {
		*(Addr + Count*4) = 0;
		if(*(Addr + Count*4) != 0x00) {
			xil_printf("ERROR: Memory Addr 0x%x = 0x%x \t"
					"Expected = 0x00\n\r"
					,(Addr+Count*4),(Addr+Count*4));
			return XST_FAILURE;
		}
	}
	XTrafGen_SetStaticBurstLen(InstancePtr, BURST_LEN);
	XTrafGen_StaticDisable(InstancePtr);
	XTrafGen_SetStaticTransferDone(InstancePtr);
	Status = XTrafGen_IsStaticTransferDone(InstancePtr);
	if (Status != TRUE) {
		xil_printf("Static control reset failed failed\n\r");
		return Status;
	}
	XTrafGen_StaticEnable(InstancePtr);
	XTrafGen_StaticDisable(InstancePtr);
	do {
		Status = XTrafGen_GetStaticTransferDone(InstancePtr);
	}while(Status != XTG_STREAM_CNTL_TD_MASK);
	for (Count = 0; Count < (BURST_LEN + 1); Count++) {
		if(*(u32 *)(MEM_ADDR + Count*4) != DATA) {
			xil_printf("ERROR: Memory Addr 0x%x = 0x%x \t"
					"Expected = 0xc0015afe\n\r"
					,(Addr + Count*4),(Addr + Count*4));
			return XST_FAILURE;
		}
	}
	for (Count = (BURST_LEN+1); Count < (BURST_LEN + 4); Count++) {
		if(*(Addr + Count*4) != 0x00) {
			xil_printf("ERROR: Memory Addr 0x%x = 0x%x \t"
					"Expected = 0x00\n\r"
					,(Addr + Count*4),(Addr + Count*4));
			return XST_FAILURE;
		}
	}
	return XST_SUCCESS;
}
int XTrafGenStaticModeExample ( XTrafGen * InstancePtr , u16 DeviceId ) { XTrafGen_Config * Config ; int Status = XST_SUCCESS ; u32 Count ; int * Addr = MEM_ADDR ; Count = 0 ; #ifdef XPAR_UARTNS550_0_BASEADDR Uart550_Setup ( ) ; #endif Config = XTrafGen_LookupConfig ( DeviceId ) ; if ( ! Config ) { xil_printf ( " \r \n " , DeviceId ) ; return XST_FAILURE ; } Status = XTrafGen_CfgInitialize ( InstancePtr , Config , Config -> BaseAddress ) ; if ( Status != XST_SUCCESS ) { xil_printf ( " \n \r " ) ; return Status ; } if ( InstancePtr -> OperatingMode != XTG_MODE_STATIC ) { return XST_FAILURE ; } for ( Count = 0 ; Count < ( 5 * BURST_LEN ) ; Count ++ ) { * ( Addr + Count * 4 ) = 0 ; if ( * ( Addr + Count * 4 ) != 0x00 ) { xil_printf ( " \t " " \n \r " , ( Addr + Count * 4 ) , ( Addr + Count * 4 ) ) ; return XST_FAILURE ; } } XTrafGen_SetStaticBurstLen ( InstancePtr , BURST_LEN ) ; XTrafGen_StaticDisable ( InstancePtr ) ; XTrafGen_SetStaticTransferDone ( InstancePtr ) ; Status = XTrafGen_IsStaticTransferDone ( InstancePtr ) ; if ( Status != TRUE ) { xil_printf ( " \n \r " ) ; return Status ; } XTrafGen_StaticEnable ( InstancePtr ) ; XTrafGen_StaticDisable ( InstancePtr ) ; do { Status = XTrafGen_GetStaticTransferDone ( InstancePtr ) ; } while ( Status != XTG_STREAM_CNTL_TD_MASK ) ; for ( Count = 0 ; Count < ( BURST_LEN + 1 ) ; Count ++ ) { if ( * ( u32 * ) ( MEM_ADDR + Count * 4 ) != DATA ) { xil_printf ( " \t " " \n \r " , ( Addr + Count * 4 ) , ( Addr + Count * 4 ) ) ; return XST_FAILURE ; } } for ( Count = ( BURST_LEN + 1 ) ; Count < ( BURST_LEN + 4 ) ; Count ++ ) { if ( * ( Addr + Count * 4 ) != 0x00 ) { xil_printf ( " \t " " \n \r " , ( Addr + Count * 4 ) , ( Addr + Count * 4 ) ) ; return XST_FAILURE ; } } return XST_SUCCESS ; }
This function demonstrates the usage Traffic Generator
It does the following:
 Set up the output terminal if UART16550 is in the hardware build
 Initialize the AXI Traffic Generator device
 Fill's the Target memory with required data
 Enable the Traffic generation
 Disable the Traffic generation
 Return test status and exit
This function demonstrates the usage Traffic Generator It does the following : Set up the output terminal if UART16550 is in the hardware build Initialize the AXI Traffic Generator device Fill ' s the Target memory with required data Enable the Traffic generation Disable the Traffic generation Return test status and exit
/* Initial setup for Uart16550 */ /* Initialize the Device Configuration Interface driver */ /*
	 * This is where the virtual address would be used, this example
	 * uses physical address.
	 */ /* Check for the Static Mode */ /* Fill the BRAM with the data */ /* Set the Required Burst length */ /* Disable the traffic generation */ /* Check for the Static control DONE Bit resets */ /* Enable the traffic generation */ /* Disable the traffic generation */ /* Wait till data transmission completes */ /* Check for the data 
	 * Note:" 0xc0015afe " is the fixed data that has been given by the core
	 * continuously when ATG is configured in STATIC mode and RUN.
	 * There is no way to change this DATA in SW.
	 */