XilinxProcessorIPLib/drivers/xxvethernet/examples/xxxvethernet_example_intr_mcdma.c
static int XxvEthernetSetupIntrSystem(INTC *IntcInstancePtr,
				      XMcdma *DmaInstancePtr,
				      u8 McdmaIntrId,
				      u8 Direction)
{
	int Status;
#ifdef XPAR_INTC_0_DEVICE_ID
#ifndef TESTAPP_GEN
	/*
	 * Initialize the interrupt controller and connect the ISR
	 */
	Status = XIntc_Initialize(IntcInstancePtr, INTC_DEVICE_ID);
	if (Status != XST_SUCCESS) {
		XxvEthernetUtilErrorTrap("Unable to initialize the interrupt controller");
		return XST_FAILURE;
	}
#endif

	if (Direction == XMCDMA_DEV_TO_MEM)
		Status = XIntc_Connect(IntcInstancePtr, McdmaIntrId,
				       (XInterruptHandler) XMcdma_TxIntrHandler, DmaInstancePtr);
	else
		Status = XIntc_Connect(IntcInstancePtr, McdmaIntrId,
				       (XInterruptHandler) XMcdma_IntrHandler, DmaInstancePtr);

	if (Status != XST_SUCCESS) {
		XxvEthernetUtilErrorTrap("Unable to connect ISR to interrupt controller");
		return XST_FAILURE;
	}

#ifndef TESTAPP_GEN
	/*
	 * Start the interrupt controller
	 */
	Status = XIntc_Start(IntcInstancePtr, XIN_REAL_MODE);
	if (Status != XST_SUCCESS) {
		XxvEthernetUtilErrorTrap("Error starting intc");
		return XST_FAILURE;
	}
#endif

	/*
	 * Enable interrupts from the hardware
	 */
	XIntc_Enable(IntcInstancePtr, McdmaIntrId);
#else
	XScuGic_Config *IntcConfig;


	/*
	 * Initialize the interrupt controller driver so that it is ready to
	 * use.
	 */
	IntcConfig = XScuGic_LookupConfig(INTC_DEVICE_ID);
	if (NULL == IntcConfig) {
		return XST_FAILURE;
	}

	Status = XScuGic_CfgInitialize(IntcInstancePtr, IntcConfig,
					IntcConfig->CpuBaseAddress);
	if (Status != XST_SUCCESS) {
		return XST_FAILURE;
	}


	XScuGic_SetPriorityTriggerType(IntcInstancePtr, McdmaIntrId, 0xA0, 0x3);


	/*
	 * Connect the device driver handler that will be called when an
	 * interrupt for the device occurs, the handler defined above performs
	 * the specific interrupt processing for the device.
	 */
	if (Direction == XMCDMA_DEV_TO_MEM)
		Status = XScuGic_Connect(IntcInstancePtr, McdmaIntrId,
					(Xil_InterruptHandler)XMcdma_TxIntrHandler,
					DmaInstancePtr);
	else
		Status = XScuGic_Connect(IntcInstancePtr, McdmaIntrId,
					(Xil_InterruptHandler)XMcdma_IntrHandler,
					DmaInstancePtr);

	if (Status != XST_SUCCESS) {
		return Status;
	}


	XScuGic_Enable(IntcInstancePtr, McdmaIntrId);
#endif
#ifndef TESTAPP_GEN
	Xil_ExceptionInit();

	Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT,
			(Xil_ExceptionHandler)INTC_HANDLER,
			(void *)(IntcInstancePtr));

	Xil_ExceptionEnable();

#endif

	return XST_SUCCESS;
}
/*****************************************************************************/
/**
*
* This function setups the interrupt system so interrupts can occur for the
* Xxv Ethernet.  This function is application-specific since the actual system
* may or may not have an interrupt controller.  The Xxv Ethernet could be
* directly connected to a processor without an interrupt controller.  The user
* should modify this function to fit the application.
*
* @param	IntcInstancePtr is a pointer to the instance of the Intc
*		component.
* @param	DmaInstancePtr is a pointer to the instance of the AXIMCDMA
*		component.
* @param	DmaRxIntrId is the interrupt id for DMA Rx and is typically
*		taken from XPAR_<XXVETHERNET_instance>_CONNECTED_DMARX_INTR
* @param	DmaTxIntrId is the interrupt id for DMA Tx and is typically
*		taken from XPAR_<XXVETHERNET_instance>_CONNECTED_DMATX_INTR
*
* @return	-XST_SUCCESS to indicate success
*		-XST_FAILURE to indicate failure
*
* @note		None.
*
******************************************************************************/
This function setups the interrupt system so interrupts can occur for the
Xxv Ethernet.  This function is application-specific since the actual system
may or may not have an interrupt controller.  The Xxv Ethernet could be
directly connected to a processor without an interrupt controller.  The user
should modify this function to fit the application.
This function setups the interrupt system so interrupts can occur for the Xxv Ethernet . This function is application - specific since the actual system may or may not have an interrupt controller . The Xxv Ethernet could be directly connected to a processor without an interrupt controller . The user should modify this function to fit the application .
static int XxvEthernetSetupIntrSystem(INTC *IntcInstancePtr,
				      XMcdma *DmaInstancePtr,
				      u8 McdmaIntrId,
				      u8 Direction)
{
	int Status;
#ifdef XPAR_INTC_0_DEVICE_ID
#ifndef TESTAPP_GEN
	Status = XIntc_Initialize(IntcInstancePtr, INTC_DEVICE_ID);
	if (Status != XST_SUCCESS) {
		XxvEthernetUtilErrorTrap("Unable to initialize the interrupt controller");
		return XST_FAILURE;
	}
#endif
	if (Direction == XMCDMA_DEV_TO_MEM)
		Status = XIntc_Connect(IntcInstancePtr, McdmaIntrId,
				       (XInterruptHandler) XMcdma_TxIntrHandler, DmaInstancePtr);
	else
		Status = XIntc_Connect(IntcInstancePtr, McdmaIntrId,
				       (XInterruptHandler) XMcdma_IntrHandler, DmaInstancePtr);
	if (Status != XST_SUCCESS) {
		XxvEthernetUtilErrorTrap("Unable to connect ISR to interrupt controller");
		return XST_FAILURE;
	}
#ifndef TESTAPP_GEN
	Status = XIntc_Start(IntcInstancePtr, XIN_REAL_MODE);
	if (Status != XST_SUCCESS) {
		XxvEthernetUtilErrorTrap("Error starting intc");
		return XST_FAILURE;
	}
#endif
	XIntc_Enable(IntcInstancePtr, McdmaIntrId);
#else
	XScuGic_Config *IntcConfig;
	IntcConfig = XScuGic_LookupConfig(INTC_DEVICE_ID);
	if (NULL == IntcConfig) {
		return XST_FAILURE;
	}
	Status = XScuGic_CfgInitialize(IntcInstancePtr, IntcConfig,
					IntcConfig->CpuBaseAddress);
	if (Status != XST_SUCCESS) {
		return XST_FAILURE;
	}
	XScuGic_SetPriorityTriggerType(IntcInstancePtr, McdmaIntrId, 0xA0, 0x3);
	if (Direction == XMCDMA_DEV_TO_MEM)
		Status = XScuGic_Connect(IntcInstancePtr, McdmaIntrId,
					(Xil_InterruptHandler)XMcdma_TxIntrHandler,
					DmaInstancePtr);
	else
		Status = XScuGic_Connect(IntcInstancePtr, McdmaIntrId,
					(Xil_InterruptHandler)XMcdma_IntrHandler,
					DmaInstancePtr);
	if (Status != XST_SUCCESS) {
		return Status;
	}
	XScuGic_Enable(IntcInstancePtr, McdmaIntrId);
#endif
#ifndef TESTAPP_GEN
	Xil_ExceptionInit();
	Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT,
			(Xil_ExceptionHandler)INTC_HANDLER,
			(void *)(IntcInstancePtr));
	Xil_ExceptionEnable();
#endif
	return XST_SUCCESS;
}
static int XxvEthernetSetupIntrSystem ( INTC * IntcInstancePtr , XMcdma * DmaInstancePtr , u8 McdmaIntrId , u8 Direction ) { int Status ; #ifdef XPAR_INTC_0_DEVICE_ID #ifndef TESTAPP_GEN Status = XIntc_Initialize ( IntcInstancePtr , INTC_DEVICE_ID ) ; if ( Status != XST_SUCCESS ) { XxvEthernetUtilErrorTrap ( " " ) ; return XST_FAILURE ; } #endif if ( Direction == XMCDMA_DEV_TO_MEM ) Status = XIntc_Connect ( IntcInstancePtr , McdmaIntrId , ( XInterruptHandler ) XMcdma_TxIntrHandler , DmaInstancePtr ) ; else Status = XIntc_Connect ( IntcInstancePtr , McdmaIntrId , ( XInterruptHandler ) XMcdma_IntrHandler , DmaInstancePtr ) ; if ( Status != XST_SUCCESS ) { XxvEthernetUtilErrorTrap ( " " ) ; return XST_FAILURE ; } #ifndef TESTAPP_GEN Status = XIntc_Start ( IntcInstancePtr , XIN_REAL_MODE ) ; if ( Status != XST_SUCCESS ) { XxvEthernetUtilErrorTrap ( " " ) ; return XST_FAILURE ; } #endif XIntc_Enable ( IntcInstancePtr , McdmaIntrId ) ; #else XScuGic_Config * IntcConfig ; IntcConfig = XScuGic_LookupConfig ( INTC_DEVICE_ID ) ; if ( NULL == IntcConfig ) { return XST_FAILURE ; } Status = XScuGic_CfgInitialize ( IntcInstancePtr , IntcConfig , IntcConfig -> CpuBaseAddress ) ; if ( Status != XST_SUCCESS ) { return XST_FAILURE ; } XScuGic_SetPriorityTriggerType ( IntcInstancePtr , McdmaIntrId , 0xA0 , 0x3 ) ; if ( Direction == XMCDMA_DEV_TO_MEM ) Status = XScuGic_Connect ( IntcInstancePtr , McdmaIntrId , ( Xil_InterruptHandler ) XMcdma_TxIntrHandler , DmaInstancePtr ) ; else Status = XScuGic_Connect ( IntcInstancePtr , McdmaIntrId , ( Xil_InterruptHandler ) XMcdma_IntrHandler , DmaInstancePtr ) ; if ( Status != XST_SUCCESS ) { return Status ; } XScuGic_Enable ( IntcInstancePtr , McdmaIntrId ) ; #endif #ifndef TESTAPP_GEN Xil_ExceptionInit ( ) ; Xil_ExceptionRegisterHandler ( XIL_EXCEPTION_ID_INT , ( Xil_ExceptionHandler ) INTC_HANDLER , ( void * ) ( IntcInstancePtr ) ) ; Xil_ExceptionEnable ( ) ; #endif return XST_SUCCESS ; }
This function setups the interrupt system so interrupts can occur for the
Xxv Ethernet.
This function setups the interrupt system so interrupts can occur for the Xxv Ethernet .
/*
	 * Initialize the interrupt controller and connect the ISR
	 */ /*
	 * Start the interrupt controller
	 */ /*
	 * Enable interrupts from the hardware
	 */ /*
	 * Initialize the interrupt controller driver so that it is ready to
	 * use.
	 */ /*
	 * Connect the device driver handler that will be called when an
	 * interrupt for the device occurs, the handler defined above performs
	 * the specific interrupt processing for the device.
	 */