XilinxProcessorIPLib/drivers/axiethernet/examples/xaxiethernet_example_intr_mcdma.c
static int RxBdSetup(XMcdma *McDmaInstPtr, XAxiEthernet *AxiEthernetInstancePtr,
		     XAxiEthernet_Config *MacCfgPtr, u16 AxiEthernetIntrId)
{
	XMcdma_ChanCtrl *Rx_Chan;
	u8 ChanId;
	int BdCount = RXBD_CNT;
	int Status;
	UINTPTR RxBdSpacePtr;


	RxBdSpacePtr = (UINTPTR)&RxBdSpace;

	for (ChanId = 1; ChanId <= AxiEthernetInstancePtr->Config.AxiMcDmaChan_Cnt; ChanId++) {
		Rx_Chan = XMcdma_GetMcdmaRxChan(McDmaInstPtr, ChanId);

		/* Disable all interrupts */
		XMcdma_IntrDisable(Rx_Chan, XMCDMA_IRQ_ALL_MASK);

		Status = XMcDma_ChanBdCreate(Rx_Chan, (UINTPTR)RxBdSpacePtr, BdCount);
		if (Status != XST_SUCCESS) {
			xil_printf("Rx bd create failed with %d\r\n", Status);
			return XST_FAILURE;
		}

		RxBdSpacePtr += (RXBD_CNT * sizeof(XMcdma_Bd));
		/* Setup Interrupt System and register callbacks */
		XMcdma_SetCallBack(McDmaInstPtr, XMCDMA_HANDLER_DONE,
		                          (void *)DoneHandler, McDmaInstPtr);
		XMcdma_SetCallBack(McDmaInstPtr, XMCDMA_HANDLER_ERROR,
		                          (void *)ErrorHandler, McDmaInstPtr);

		Status = AxiEthernetSetupIntrSystem(&IntcInstance, AxiEthernetInstancePtr,
						    McDmaInstPtr,
							MacCfgPtr->AxiMcDmaRxIntr[ChanId - 1],
						    AxiEthernetIntrId,
						    XMCDMA_MEM_TO_DEV);
		if (Status != XST_SUCCESS) {
		      xil_printf("Failed RX interrupt setup %d\r\n", ChanId);
		      return XST_FAILURE;
		}
	 }

	return XST_SUCCESS;
}
/*****************************************************************************/
/**
*
* This function setup the buffer descriptor chain for the Ingress mcdma Channels
*
* @param	McDmaInstancePtr is a pointer to the instance of the Dma
*		component.
* @param	AxiEthernetInstancePtr is a pointer to the instance of the
*		Axi Ethernet component.
* @param	MacCfgPtr is a pointer to the config instance of the Axi Ethernet
*		component.
* @param	AxiEthernetIntrId is interrupt Id of the MAC instance.
*
* @return	-XST_SUCCESS to indicate success
*		-XST_FAILURE to indicate failure
*
******************************************************************************/
This function setup the buffer descriptor chain for the Ingress mcdma Channels
This function setup the buffer descriptor chain for the Ingress mcdma Channels
static int RxBdSetup(XMcdma *McDmaInstPtr, XAxiEthernet *AxiEthernetInstancePtr,
		     XAxiEthernet_Config *MacCfgPtr, u16 AxiEthernetIntrId)
{
	XMcdma_ChanCtrl *Rx_Chan;
	u8 ChanId;
	int BdCount = RXBD_CNT;
	int Status;
	UINTPTR RxBdSpacePtr;
	RxBdSpacePtr = (UINTPTR)&RxBdSpace;
	for (ChanId = 1; ChanId <= AxiEthernetInstancePtr->Config.AxiMcDmaChan_Cnt; ChanId++) {
		Rx_Chan = XMcdma_GetMcdmaRxChan(McDmaInstPtr, ChanId);
		XMcdma_IntrDisable(Rx_Chan, XMCDMA_IRQ_ALL_MASK);
		Status = XMcDma_ChanBdCreate(Rx_Chan, (UINTPTR)RxBdSpacePtr, BdCount);
		if (Status != XST_SUCCESS) {
			xil_printf("Rx bd create failed with %d\r\n", Status);
			return XST_FAILURE;
		}
		RxBdSpacePtr += (RXBD_CNT * sizeof(XMcdma_Bd));
		XMcdma_SetCallBack(McDmaInstPtr, XMCDMA_HANDLER_DONE,
		                          (void *)DoneHandler, McDmaInstPtr);
		XMcdma_SetCallBack(McDmaInstPtr, XMCDMA_HANDLER_ERROR,
		                          (void *)ErrorHandler, McDmaInstPtr);
		Status = AxiEthernetSetupIntrSystem(&IntcInstance, AxiEthernetInstancePtr,
						    McDmaInstPtr,
							MacCfgPtr->AxiMcDmaRxIntr[ChanId - 1],
						    AxiEthernetIntrId,
						    XMCDMA_MEM_TO_DEV);
		if (Status != XST_SUCCESS) {
		      xil_printf("Failed RX interrupt setup %d\r\n", ChanId);
		      return XST_FAILURE;
		}
	 }
	return XST_SUCCESS;
}
static int RxBdSetup ( XMcdma * McDmaInstPtr , XAxiEthernet * AxiEthernetInstancePtr , XAxiEthernet_Config * MacCfgPtr , u16 AxiEthernetIntrId ) { XMcdma_ChanCtrl * Rx_Chan ; u8 ChanId ; int BdCount = RXBD_CNT ; int Status ; UINTPTR RxBdSpacePtr ; RxBdSpacePtr = ( UINTPTR ) & RxBdSpace ; for ( ChanId = 1 ; ChanId <= AxiEthernetInstancePtr -> Config . AxiMcDmaChan_Cnt ; ChanId ++ ) { Rx_Chan = XMcdma_GetMcdmaRxChan ( McDmaInstPtr , ChanId ) ; XMcdma_IntrDisable ( Rx_Chan , XMCDMA_IRQ_ALL_MASK ) ; Status = XMcDma_ChanBdCreate ( Rx_Chan , ( UINTPTR ) RxBdSpacePtr , BdCount ) ; if ( Status != XST_SUCCESS ) { xil_printf ( " \r \n " , Status ) ; return XST_FAILURE ; } RxBdSpacePtr += ( RXBD_CNT * sizeof ( XMcdma_Bd ) ) ; XMcdma_SetCallBack ( McDmaInstPtr , XMCDMA_HANDLER_DONE , ( void * ) DoneHandler , McDmaInstPtr ) ; XMcdma_SetCallBack ( McDmaInstPtr , XMCDMA_HANDLER_ERROR , ( void * ) ErrorHandler , McDmaInstPtr ) ; Status = AxiEthernetSetupIntrSystem ( & IntcInstance , AxiEthernetInstancePtr , McDmaInstPtr , MacCfgPtr -> AxiMcDmaRxIntr [ ChanId - 1 ] , AxiEthernetIntrId , XMCDMA_MEM_TO_DEV ) ; if ( Status != XST_SUCCESS ) { xil_printf ( " \r \n " , ChanId ) ; return XST_FAILURE ; } } return XST_SUCCESS ; }
This function setup the buffer descriptor chain for the Ingress mcdma Channels
This function setup the buffer descriptor chain for the Ingress mcdma Channels
/* Disable all interrupts */ /* Setup Interrupt System and register callbacks */