XilinxProcessorIPLib/drivers/pmonpsv/examples/xpmonpsv_selftest_example.c
static u32 XPmonPsv_SelfTest(XPmonPsv *InstancePtr)
{
	u32 Status = XST_FAILURE;
	u32 Regval = 0;
	u32 WriteRequestValue;
	u32 WriteRespValue;
	u32 ReadRequestValue;
	u32 ReadRespValue;
	u32 TestAddress;
	u32 CounterNum;

	Xil_AssertNonvoid(InstancePtr != NULL);
	Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);

	XPmonPsv_Unlock(InstancePtr);
	XPmonPsv_RequestCounter(InstancePtr,XPMONPSV_R5_DOMAIN, &CounterNum);
	XPmonPsv_ResetCounter(InstancePtr, XPMONPSV_R5_DOMAIN, CounterNum);
	XPmonPsv_SetSrc(InstancePtr, 0x6, XPMONPSV_R5_DOMAIN, CounterNum);
	XPmonPsv_SetPort(InstancePtr, 0x0, XPMONPSV_R5_DOMAIN, CounterNum);
	XPmonPsv_SetMetrics(InstancePtr, 0x1F, XPMONPSV_R5_DOMAIN, CounterNum);
	XPmonPsv_EnableCounters(InstancePtr, XPMONPSV_R5_DOMAIN, CounterNum);

	TestAddress =  TESTADDRESS;
	Xil_Out32( TestAddress, 0x0); /* lpd_afifs_axi_wr_req */
	Xil_Out32( TestAddress, 0x0); /* lpd_afifs_axi_wr_req */

	sleep(1);

	XPmonPsv_GetWriteCounter(InstancePtr,&WriteRequestValue, &WriteRespValue, XPMONPSV_R5_DOMAIN, CounterNum);

	xil_printf("\r\n TestAddress: %x \n", TestAddress);
	xil_printf("\r\n WriteRequestValue: %d WriteRespValue:%d\n", WriteRequestValue, WriteRespValue);

	if (WriteRequestValue == WriteRespValue) {
		Status = XST_SUCCESS;
	}

	XPmonPsv_Lock(InstancePtr);
	return Status;
}
/*****************************************************************************/
/**
*
* Run a self-test on the driver/device. The test
*	- Resets the device,
*	- Writes a value into the Range Registers of Incrementer 0 and reads
*	  it back for comparison.
*	- Resets the device again.
*
*
* @param	InstancePtr is a pointer to the XPmonPsv instance.
*
* @return
*		- XST_SUCCESS if the value read from the Range Register of
*		  Incrementer 0 is the same as the value written.
*		- XST_FAILURE Otherwise
*
* @note		This is a destructive test in that resets of the device are
*		performed. Refer to the device specification for the
*		device status after the reset operation.
*
******************************************************************************/
Run a self-test on the driver/device. The test
Resets the device,
Writes a value into the Range Registers of Incrementer 0 and reads
it back for comparison.
Resets the device again.
Run a self - test on the driver / device . The test Resets the device Writes a value into the Range Registers of Incrementer 0 and reads it back for comparison . Resets the device again .
static u32 XPmonPsv_SelfTest(XPmonPsv *InstancePtr)
{
	u32 Status = XST_FAILURE;
	u32 Regval = 0;
	u32 WriteRequestValue;
	u32 WriteRespValue;
	u32 ReadRequestValue;
	u32 ReadRespValue;
	u32 TestAddress;
	u32 CounterNum;
	Xil_AssertNonvoid(InstancePtr != NULL);
	Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
	XPmonPsv_Unlock(InstancePtr);
	XPmonPsv_RequestCounter(InstancePtr,XPMONPSV_R5_DOMAIN, &CounterNum);
	XPmonPsv_ResetCounter(InstancePtr, XPMONPSV_R5_DOMAIN, CounterNum);
	XPmonPsv_SetSrc(InstancePtr, 0x6, XPMONPSV_R5_DOMAIN, CounterNum);
	XPmonPsv_SetPort(InstancePtr, 0x0, XPMONPSV_R5_DOMAIN, CounterNum);
	XPmonPsv_SetMetrics(InstancePtr, 0x1F, XPMONPSV_R5_DOMAIN, CounterNum);
	XPmonPsv_EnableCounters(InstancePtr, XPMONPSV_R5_DOMAIN, CounterNum);
	TestAddress =  TESTADDRESS;
	Xil_Out32( TestAddress, 0x0); 
	Xil_Out32( TestAddress, 0x0); 
	sleep(1);
	XPmonPsv_GetWriteCounter(InstancePtr,&WriteRequestValue, &WriteRespValue, XPMONPSV_R5_DOMAIN, CounterNum);
	xil_printf("\r\n TestAddress: %x \n", TestAddress);
	xil_printf("\r\n WriteRequestValue: %d WriteRespValue:%d\n", WriteRequestValue, WriteRespValue);
	if (WriteRequestValue == WriteRespValue) {
		Status = XST_SUCCESS;
	}
	XPmonPsv_Lock(InstancePtr);
	return Status;
}
static u32 XPmonPsv_SelfTest ( XPmonPsv * InstancePtr ) { u32 Status = XST_FAILURE ; u32 Regval = 0 ; u32 WriteRequestValue ; u32 WriteRespValue ; u32 ReadRequestValue ; u32 ReadRespValue ; u32 TestAddress ; u32 CounterNum ; Xil_AssertNonvoid ( InstancePtr != NULL ) ; Xil_AssertNonvoid ( InstancePtr -> IsReady == XIL_COMPONENT_IS_READY ) ; XPmonPsv_Unlock ( InstancePtr ) ; XPmonPsv_RequestCounter ( InstancePtr , XPMONPSV_R5_DOMAIN , & CounterNum ) ; XPmonPsv_ResetCounter ( InstancePtr , XPMONPSV_R5_DOMAIN , CounterNum ) ; XPmonPsv_SetSrc ( InstancePtr , 0x6 , XPMONPSV_R5_DOMAIN , CounterNum ) ; XPmonPsv_SetPort ( InstancePtr , 0x0 , XPMONPSV_R5_DOMAIN , CounterNum ) ; XPmonPsv_SetMetrics ( InstancePtr , 0x1F , XPMONPSV_R5_DOMAIN , CounterNum ) ; XPmonPsv_EnableCounters ( InstancePtr , XPMONPSV_R5_DOMAIN , CounterNum ) ; TestAddress = TESTADDRESS ; Xil_Out32 ( TestAddress , 0x0 ) ; Xil_Out32 ( TestAddress , 0x0 ) ; sleep ( 1 ) ; XPmonPsv_GetWriteCounter ( InstancePtr , & WriteRequestValue , & WriteRespValue , XPMONPSV_R5_DOMAIN , CounterNum ) ; xil_printf ( " \r \n \n " , TestAddress ) ; xil_printf ( " \r \n \n " , WriteRequestValue , WriteRespValue ) ; if ( WriteRequestValue == WriteRespValue ) { Status = XST_SUCCESS ; } XPmonPsv_Lock ( InstancePtr ) ; return Status ; }
Run a self-test on the driver/device.
Run a self - test on the driver / device .
/* lpd_afifs_axi_wr_req */ /* lpd_afifs_axi_wr_req */