XilinxProcessorIPLib/drivers/hwicap/src/xhwicap_selftest.c
int XHwIcap_SelfTest(XHwIcap *InstancePtr)
{
	int Status = XST_SUCCESS;
	u32 IeRegister;
	u32 DgieRegister;


	/*
	 * Assert the argument
	 */
	Xil_AssertNonvoid(InstancePtr != NULL);
	Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);


	/*
	 * Save a copy of the Global Interrupt Enable Register and Interrupt
	 * Enable Register before writing them so that they can be restored.
	 */
	DgieRegister = XHwIcap_ReadReg(InstancePtr->HwIcapConfig.BaseAddress,
						XHI_GIER_OFFSET);
	IeRegister = XHwIcap_IntrGetEnabled(InstancePtr);

	/*
	 * Disable the Global Interrupt
	 */
	XHwIcap_IntrGlobalDisable(InstancePtr);


	/*
	 * Disable/Enable the interrupts and then verify that the register
	 * is read back correct.
	 */
	XHwIcap_IntrDisable(InstancePtr, XHI_IPIXR_ALL_MASK);
	if (XHwIcap_IntrGetEnabled(InstancePtr) != 0x0) {
		Status = XST_FAILURE;
	}

	XHwIcap_IntrEnable(InstancePtr, (XHI_IPIXR_WEMPTY_MASK |
					XHI_IPIXR_RDP_MASK));
	if (XHwIcap_IntrGetEnabled(InstancePtr) !=
			(XHI_IPIXR_WEMPTY_MASK | XHI_IPIXR_RDP_MASK)) {
		Status |= XST_FAILURE;
	}

	/*
	 * Restore the Interrupt Enable Register to the value before the
	 * test.
	 */
	XHwIcap_IntrDisable(InstancePtr, XHI_IPIXR_ALL_MASK);
	if (IeRegister != 0) {
		XHwIcap_IntrEnable(InstancePtr, IeRegister);
	}


	/*
	 * Restore the Global Interrupt Enable Register to the value
	 * before the test.
	 */
	XHwIcap_WriteReg(InstancePtr->HwIcapConfig.BaseAddress,
				XHI_GIER_OFFSET, DgieRegister);
	if (Status != XST_SUCCESS) {
		return XST_FAILURE;
	}

	return XST_SUCCESS;
}
/*****************************************************************************/
/**
*
* Run a self-test on the driver/device. The test
*	- Writes to the Interrupt Enable Register and reads it back
*	for comparison.
*
* @param	InstancePtr is a pointer to the XHwIcap instance.
*
* @return
*		- XST_SUCCESS if the value read from the register
*		is the same as the value written.
*		- XST_FAILURE otherwise
*
* @note		None.
*
******************************************************************************/
Run a self-test on the driver/device. The test
Writes to the Interrupt Enable Register and reads it back
for comparison.
Run a self - test on the driver / device . The test Writes to the Interrupt Enable Register and reads it back for comparison .
int XHwIcap_SelfTest(XHwIcap *InstancePtr)
{
	int Status = XST_SUCCESS;
	u32 IeRegister;
	u32 DgieRegister;
	Xil_AssertNonvoid(InstancePtr != NULL);
	Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
	DgieRegister = XHwIcap_ReadReg(InstancePtr->HwIcapConfig.BaseAddress,
						XHI_GIER_OFFSET);
	IeRegister = XHwIcap_IntrGetEnabled(InstancePtr);
	XHwIcap_IntrGlobalDisable(InstancePtr);
	XHwIcap_IntrDisable(InstancePtr, XHI_IPIXR_ALL_MASK);
	if (XHwIcap_IntrGetEnabled(InstancePtr) != 0x0) {
		Status = XST_FAILURE;
	}
	XHwIcap_IntrEnable(InstancePtr, (XHI_IPIXR_WEMPTY_MASK |
					XHI_IPIXR_RDP_MASK));
	if (XHwIcap_IntrGetEnabled(InstancePtr) !=
			(XHI_IPIXR_WEMPTY_MASK | XHI_IPIXR_RDP_MASK)) {
		Status |= XST_FAILURE;
	}
	XHwIcap_IntrDisable(InstancePtr, XHI_IPIXR_ALL_MASK);
	if (IeRegister != 0) {
		XHwIcap_IntrEnable(InstancePtr, IeRegister);
	}
	XHwIcap_WriteReg(InstancePtr->HwIcapConfig.BaseAddress,
				XHI_GIER_OFFSET, DgieRegister);
	if (Status != XST_SUCCESS) {
		return XST_FAILURE;
	}
	return XST_SUCCESS;
}
int XHwIcap_SelfTest ( XHwIcap * InstancePtr ) { int Status = XST_SUCCESS ; u32 IeRegister ; u32 DgieRegister ; Xil_AssertNonvoid ( InstancePtr != NULL ) ; Xil_AssertNonvoid ( InstancePtr -> IsReady == XIL_COMPONENT_IS_READY ) ; DgieRegister = XHwIcap_ReadReg ( InstancePtr -> HwIcapConfig . BaseAddress , XHI_GIER_OFFSET ) ; IeRegister = XHwIcap_IntrGetEnabled ( InstancePtr ) ; XHwIcap_IntrGlobalDisable ( InstancePtr ) ; XHwIcap_IntrDisable ( InstancePtr , XHI_IPIXR_ALL_MASK ) ; if ( XHwIcap_IntrGetEnabled ( InstancePtr ) != 0x0 ) { Status = XST_FAILURE ; } XHwIcap_IntrEnable ( InstancePtr , ( XHI_IPIXR_WEMPTY_MASK | XHI_IPIXR_RDP_MASK ) ) ; if ( XHwIcap_IntrGetEnabled ( InstancePtr ) != ( XHI_IPIXR_WEMPTY_MASK | XHI_IPIXR_RDP_MASK ) ) { Status |= XST_FAILURE ; } XHwIcap_IntrDisable ( InstancePtr , XHI_IPIXR_ALL_MASK ) ; if ( IeRegister != 0 ) { XHwIcap_IntrEnable ( InstancePtr , IeRegister ) ; } XHwIcap_WriteReg ( InstancePtr -> HwIcapConfig . BaseAddress , XHI_GIER_OFFSET , DgieRegister ) ; if ( Status != XST_SUCCESS ) { return XST_FAILURE ; } return XST_SUCCESS ; }
Run a self-test on the driver/device.
Run a self - test on the driver / device .
/*
	 * Assert the argument
	 */ /*
	 * Save a copy of the Global Interrupt Enable Register and Interrupt
	 * Enable Register before writing them so that they can be restored.
	 */ /*
	 * Disable the Global Interrupt
	 */ /*
	 * Disable/Enable the interrupts and then verify that the register
	 * is read back correct.
	 */ /*
	 * Restore the Interrupt Enable Register to the value before the
	 * test.
	 */ /*
	 * Restore the Global Interrupt Enable Register to the value
	 * before the test.
	 */