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

	TxBdSpacePtr = (UINTPTR)&TxBdSpace;

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

		XMcdma_IntrDisable(Tx_Chan, XMCDMA_IRQ_ALL_MASK);

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

		TxBdSpacePtr += (TXBD_CNT * sizeof(XMcdma_Bd));
		/* Setup Interrupt System and register callbacks */
		XMcdma_SetCallBack(McDmaInstPtr, XMCDMA_TX_HANDLER_DONE,
				   (void *)TxDoneHandler, McDmaInstPtr);
		XMcdma_SetCallBack(McDmaInstPtr, XMCDMA_TX_HANDLER_ERROR,
				   (void *)TxErrorHandler, McDmaInstPtr);

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

	return XST_SUCCESS;
}
/*****************************************************************************/
/**
*
* This function setup the buffer descriptor chain for the Egress 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 Egress mcdma Channels
This function setup the buffer descriptor chain for the Egress mcdma Channels
static int TxBdSetup(XMcdma *McDmaInstPtr, XAxiEthernet *AxiEthernetInstancePtr,
		     XAxiEthernet_Config *MacCfgPtr, u16 AxiEthernetIntrId)
{
	XMcdma_ChanCtrl  *Tx_Chan;
	u8 ChanId;
	int BdCount = RXBD_CNT;
	int Status;
	UINTPTR TxBdSpacePtr;
	TxBdSpacePtr = (UINTPTR)&TxBdSpace;
	for (ChanId = 1; ChanId <= AxiEthernetInstancePtr->Config.AxiMcDmaChan_Cnt; ChanId++) {
		Tx_Chan = XMcdma_GetMcdmaTxChan(McDmaInstPtr, ChanId);
		XMcdma_IntrDisable(Tx_Chan, XMCDMA_IRQ_ALL_MASK);
		Status = XMcDma_ChanBdCreate(Tx_Chan, (UINTPTR)TxBdSpacePtr, BdCount);
		if (Status != XST_SUCCESS) {
			xil_printf("TX bd create failed with %d\r\n", Status);
			return XST_FAILURE;
		}
		TxBdSpacePtr += (TXBD_CNT * sizeof(XMcdma_Bd));
		XMcdma_SetCallBack(McDmaInstPtr, XMCDMA_TX_HANDLER_DONE,
				   (void *)TxDoneHandler, McDmaInstPtr);
		XMcdma_SetCallBack(McDmaInstPtr, XMCDMA_TX_HANDLER_ERROR,
				   (void *)TxErrorHandler, McDmaInstPtr);
		Status = AxiEthernetSetupIntrSystem(&IntcInstance, AxiEthernetInstancePtr,
						    McDmaInstPtr,
							MacCfgPtr->AxiMcDmaTxIntr[ChanId - 1],
						    AxiEthernetIntrId,
						    XMCDMA_DEV_TO_MEM);
		if (Status != XST_SUCCESS) {
		      xil_printf("Failed TX interrupt setup %d\r\n", ChanId);
		      return XST_FAILURE;
		}
	}
	xil_printf("BD seutp done\n\r");
	return XST_SUCCESS;
}
static int TxBdSetup ( XMcdma * McDmaInstPtr , XAxiEthernet * AxiEthernetInstancePtr , XAxiEthernet_Config * MacCfgPtr , u16 AxiEthernetIntrId ) { XMcdma_ChanCtrl * Tx_Chan ; u8 ChanId ; int BdCount = RXBD_CNT ; int Status ; UINTPTR TxBdSpacePtr ; TxBdSpacePtr = ( UINTPTR ) & TxBdSpace ; for ( ChanId = 1 ; ChanId <= AxiEthernetInstancePtr -> Config . AxiMcDmaChan_Cnt ; ChanId ++ ) { Tx_Chan = XMcdma_GetMcdmaTxChan ( McDmaInstPtr , ChanId ) ; XMcdma_IntrDisable ( Tx_Chan , XMCDMA_IRQ_ALL_MASK ) ; Status = XMcDma_ChanBdCreate ( Tx_Chan , ( UINTPTR ) TxBdSpacePtr , BdCount ) ; if ( Status != XST_SUCCESS ) { xil_printf ( " \r \n " , Status ) ; return XST_FAILURE ; } TxBdSpacePtr += ( TXBD_CNT * sizeof ( XMcdma_Bd ) ) ; XMcdma_SetCallBack ( McDmaInstPtr , XMCDMA_TX_HANDLER_DONE , ( void * ) TxDoneHandler , McDmaInstPtr ) ; XMcdma_SetCallBack ( McDmaInstPtr , XMCDMA_TX_HANDLER_ERROR , ( void * ) TxErrorHandler , McDmaInstPtr ) ; Status = AxiEthernetSetupIntrSystem ( & IntcInstance , AxiEthernetInstancePtr , McDmaInstPtr , MacCfgPtr -> AxiMcDmaTxIntr [ ChanId - 1 ] , AxiEthernetIntrId , XMCDMA_DEV_TO_MEM ) ; if ( Status != XST_SUCCESS ) { xil_printf ( " \r \n " , ChanId ) ; return XST_FAILURE ; } } xil_printf ( " \n \r " ) ; return XST_SUCCESS ; }
This function setup the buffer descriptor chain for the Egress mcdma Channels
This function setup the buffer descriptor chain for the Egress mcdma Channels
/* Setup Interrupt System and register callbacks */