XilinxProcessorIPLib/drivers/intc/src/xintc.c
int XIntc_Connect(XIntc * InstancePtr, u8 Id,
		  XInterruptHandler Handler, void *CallBackRef)
{
	XIntc_Config *CfgPtr;
	/*
	 * Assert the arguments
	 */
	Xil_AssertNonvoid(InstancePtr != NULL);
	Xil_AssertNonvoid(Id < XPAR_INTC_MAX_NUM_INTR_INPUTS);
	Xil_AssertNonvoid(Handler != NULL);
	Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);

	/* Connect Handlers for Slave controllers in Cascade Mode */
	if (Id > 31) {

		CfgPtr = XIntc_LookupConfig(Id/32);
		if (CfgPtr == NULL) {
			return XST_FAILURE;
		}

		CfgPtr->HandlerTable[Id%32].Handler = Handler;
		CfgPtr->HandlerTable[Id%32].CallBackRef = CallBackRef;
	}
	/* Connect Handlers for Master/primary controller */
	else {
		/*
		 * The Id is used as an index into the table to select the
		 * proper handler
		 */
		InstancePtr->CfgPtr->HandlerTable[Id].Handler = Handler;
		InstancePtr->CfgPtr->HandlerTable[Id].CallBackRef =
								CallBackRef;
	}

	return XST_SUCCESS;
}
/*****************************************************************************/
/**
*
* Makes the connection between the Id of the interrupt source and the
* associated handler that is to run when the interrupt is recognized. The
* argument provided in this call as the Callbackref is used as the argument
* for the handler when it is called. In Cascade mode, connects handler to
* Slave controller handler table depending on the interrupt Id.
*
* @param	InstancePtr is a pointer to the XIntc instance to be worked on.
* @param	Id contains the ID of the interrupt source and should be in the
*		range of 0 to XPAR_INTC_MAX_NUM_INTR_INPUTS - 1 with 0 being
*   		the highest priority interrupt.
* @param	Handler to the handler for that interrupt.
* @param	CallBackRef is the callback reference, usually the instance
*		pointer of the connecting driver.
*
* @return
*
* 		- XST_SUCCESS if the handler was connected correctly.
*
* @note
*
* WARNING: The handler provided as an argument will overwrite any handler
* that was previously connected.
*
****************************************************************************/
Makes the connection between the Id of the interrupt source and the
associated handler that is to run when the interrupt is recognized. The
argument provided in this call as the Callbackref is used as the argument
for the handler when it is called. In Cascade mode, connects handler to
Slave controller handler table depending on the interrupt Id.
Makes the connection between the Id of the interrupt source and the associated handler that is to run when the interrupt is recognized . The argument provided in this call as the Callbackref is used as the argument for the handler when it is called . In Cascade mode connects handler to Slave controller handler table depending on the interrupt Id .
int XIntc_Connect(XIntc * InstancePtr, u8 Id,
		  XInterruptHandler Handler, void *CallBackRef)
{
	XIntc_Config *CfgPtr;
	Xil_AssertNonvoid(InstancePtr != NULL);
	Xil_AssertNonvoid(Id < XPAR_INTC_MAX_NUM_INTR_INPUTS);
	Xil_AssertNonvoid(Handler != NULL);
	Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
	if (Id > 31) {
		CfgPtr = XIntc_LookupConfig(Id/32);
		if (CfgPtr == NULL) {
			return XST_FAILURE;
		}
		CfgPtr->HandlerTable[Id%32].Handler = Handler;
		CfgPtr->HandlerTable[Id%32].CallBackRef = CallBackRef;
	}
	else {
		InstancePtr->CfgPtr->HandlerTable[Id].Handler = Handler;
		InstancePtr->CfgPtr->HandlerTable[Id].CallBackRef =
								CallBackRef;
	}
	return XST_SUCCESS;
}
int XIntc_Connect ( XIntc * InstancePtr , u8 Id , XInterruptHandler Handler , void * CallBackRef ) { XIntc_Config * CfgPtr ; Xil_AssertNonvoid ( InstancePtr != NULL ) ; Xil_AssertNonvoid ( Id < XPAR_INTC_MAX_NUM_INTR_INPUTS ) ; Xil_AssertNonvoid ( Handler != NULL ) ; Xil_AssertNonvoid ( InstancePtr -> IsReady == XIL_COMPONENT_IS_READY ) ; if ( Id > 31 ) { CfgPtr = XIntc_LookupConfig ( Id / 32 ) ; if ( CfgPtr == NULL ) { return XST_FAILURE ; } CfgPtr -> HandlerTable [ Id % 32 ] . Handler = Handler ; CfgPtr -> HandlerTable [ Id % 32 ] . CallBackRef = CallBackRef ; } else { InstancePtr -> CfgPtr -> HandlerTable [ Id ] . Handler = Handler ; InstancePtr -> CfgPtr -> HandlerTable [ Id ] . CallBackRef = CallBackRef ; } return XST_SUCCESS ; }
Makes the connection between the Id of the interrupt source and the
associated handler that is to run when the interrupt is recognized.
Makes the connection between the Id of the interrupt source and the associated handler that is to run when the interrupt is recognized .
/*
	 * Assert the arguments
	 */ /* Connect Handlers for Slave controllers in Cascade Mode */ /* Connect Handlers for Master/primary controller */ /*
		 * The Id is used as an index into the table to select the
		 * proper handler
		 */