XilinxProcessorIPLib/drivers/mcdma/src/xmcdma_intr.c
void XMcdma_TxIntrHandler(void *Instance)
{
	XMcdma *InstancePtr = (XMcdma *)((void *)Instance);
	u32 IrqStatus;
	u16 Chan_id = 1;
	XMcdma_ChanCtrl *Chan = NULL;
	u32 i;
	u32 Chan_SerMask;

	/* Serviced Channel Numbers */
	while(1) {
		Chan_SerMask = XMcdma_ReadReg(InstancePtr->Config.BaseAddress,
						XMCDMA_TXINT_SER_OFFSET);

		if (!Chan_SerMask)
			goto out;

		for (i = 1, Chan_id = 1; i != 0 && i <= Chan_SerMask;
			i <<= 1, Chan_id++) {
			if (Chan_SerMask & i) {
				Chan = XMcdma_GetMcdmaTxChan(InstancePtr, Chan_id);

				IrqStatus = XMcdma_ChanGetIrq(Chan);

				/* Acknowledge pending interrupts */
				XMcdma_ChanAckIrq(Chan, IrqStatus);

				 /*
				  * If no interrupt is asserted, we do not do anything
				  */
				 if (!(IrqStatus & XMCDMA_IRQ_ALL_MASK)) {
					 return;
				 }

				 if ((IrqStatus & (XMCDMA_IRQ_DELAY_MASK | XMCDMA_IRQ_IOC_MASK))) {
					 Chan->ChanState = XMCDMA_CHAN_IDLE;
					 InstancePtr->TxDoneHandler(InstancePtr->TxDoneRef, Chan_id);
				 }

				 /* In Case of errors Channel Service Register
				  * will provide the Channel ID that caused error
				  */
				 if ((IrqStatus & XMCDMA_IRQ_ERROR_MASK)) {
					Chan->ChanState = XMCDMA_CHAN_PAUSE;
					InstancePtr->TxErrorHandler(InstancePtr->TxErrorRef, Chan_id, IrqStatus);
				 }
			}
		}
	}

out:
	return;
}
/*****************************************************************************/
/**
*
* This function is the MM2S interrupt handler for the MCDMA core.
*
* This handler reads the pending interrupt from Status register, determines the
* source of the interrupts and calls the respective callbacks for the
* interrupts that are enabled in global control register, and finally clears the
* interrupts.
*
* The application is responsible for connecting this function to the interrupt
* system. Application beyond this driver is also responsible for providing
* callbacks to handle interrupts and installing the callbacks using
* XMcdma_SetCallBack() during initialization phase.
*
* @param	Instance is a pointer to the XMcdma instance to be worked on.
*
* @return	None.
*
* @note		To generate interrupt required interrupts should be enabled.
*
******************************************************************************/
This function is the MM2S interrupt handler for the MCDMA core.
This handler reads the pending interrupt from Status register, determines the
source of the interrupts and calls the respective callbacks for the
interrupts that are enabled in global control register, and finally clears the
interrupts.

The application is responsible for connecting this function to the interrupt
system. Application beyond this driver is also responsible for providing
callbacks to handle interrupts and installing the callbacks using
XMcdma_SetCallBack() during initialization phase.
This function is the MM2S interrupt handler for the MCDMA core . This handler reads the pending interrupt from Status register determines the source of the interrupts and calls the respective callbacks for the interrupts that are enabled in global control register and finally clears the interrupts . The application is responsible for connecting this function to the interrupt system . Application beyond this driver is also responsible for providing callbacks to handle interrupts and installing the callbacks using XMcdma_SetCallBack () during initialization phase .
void XMcdma_TxIntrHandler(void *Instance)
{
	XMcdma *InstancePtr = (XMcdma *)((void *)Instance);
	u32 IrqStatus;
	u16 Chan_id = 1;
	XMcdma_ChanCtrl *Chan = NULL;
	u32 i;
	u32 Chan_SerMask;
	while(1) {
		Chan_SerMask = XMcdma_ReadReg(InstancePtr->Config.BaseAddress,
						XMCDMA_TXINT_SER_OFFSET);
		if (!Chan_SerMask)
			goto out;
		for (i = 1, Chan_id = 1; i != 0 && i <= Chan_SerMask;
			i <<= 1, Chan_id++) {
			if (Chan_SerMask & i) {
				Chan = XMcdma_GetMcdmaTxChan(InstancePtr, Chan_id);
				IrqStatus = XMcdma_ChanGetIrq(Chan);
				XMcdma_ChanAckIrq(Chan, IrqStatus);
				 if (!(IrqStatus & XMCDMA_IRQ_ALL_MASK)) {
					 return;
				 }
				 if ((IrqStatus & (XMCDMA_IRQ_DELAY_MASK | XMCDMA_IRQ_IOC_MASK))) {
					 Chan->ChanState = XMCDMA_CHAN_IDLE;
					 InstancePtr->TxDoneHandler(InstancePtr->TxDoneRef, Chan_id);
				 }
				 if ((IrqStatus & XMCDMA_IRQ_ERROR_MASK)) {
					Chan->ChanState = XMCDMA_CHAN_PAUSE;
					InstancePtr->TxErrorHandler(InstancePtr->TxErrorRef, Chan_id, IrqStatus);
				 }
			}
		}
	}
out:
	return;
}
void XMcdma_TxIntrHandler ( void * Instance ) { XMcdma * InstancePtr = ( XMcdma * ) ( ( void * ) Instance ) ; u32 IrqStatus ; u16 Chan_id = 1 ; XMcdma_ChanCtrl * Chan = NULL ; u32 i ; u32 Chan_SerMask ; while ( 1 ) { Chan_SerMask = XMcdma_ReadReg ( InstancePtr -> Config . BaseAddress , XMCDMA_TXINT_SER_OFFSET ) ; if ( ! Chan_SerMask ) goto out ; for ( i = 1 , Chan_id = 1 ; i != 0 && i <= Chan_SerMask ; i <<= 1 , Chan_id ++ ) { if ( Chan_SerMask & i ) { Chan = XMcdma_GetMcdmaTxChan ( InstancePtr , Chan_id ) ; IrqStatus = XMcdma_ChanGetIrq ( Chan ) ; XMcdma_ChanAckIrq ( Chan , IrqStatus ) ; if ( ! ( IrqStatus & XMCDMA_IRQ_ALL_MASK ) ) { return ; } if ( ( IrqStatus & ( XMCDMA_IRQ_DELAY_MASK | XMCDMA_IRQ_IOC_MASK ) ) ) { Chan -> ChanState = XMCDMA_CHAN_IDLE ; InstancePtr -> TxDoneHandler ( InstancePtr -> TxDoneRef , Chan_id ) ; } if ( ( IrqStatus & XMCDMA_IRQ_ERROR_MASK ) ) { Chan -> ChanState = XMCDMA_CHAN_PAUSE ; InstancePtr -> TxErrorHandler ( InstancePtr -> TxErrorRef , Chan_id , IrqStatus ) ; } } } } out : return ; }
This function is the MM2S interrupt handler for the MCDMA core.
This function is the MM2S interrupt handler for the MCDMA core .
/* Serviced Channel Numbers */ /* Acknowledge pending interrupts */ /*
				  * If no interrupt is asserted, we do not do anything
				  */ /* In Case of errors Channel Service Register
				  * will provide the Channel ID that caused error
				  */