XilinxProcessorIPLib/drivers/mcdma/src/xmcdma.c
s32 XMcDma_Initialize(XMcdma *InstancePtr, XMcdma_Config *CfgPtr)
{
	int i;

	/* Verify arguments. */
	Xil_AssertNonvoid(InstancePtr != NULL);
	Xil_AssertNonvoid(CfgPtr != NULL);

	memset(InstancePtr, 0, sizeof(XMcdma));

	InstancePtr->Config.BaseAddress = CfgPtr->BaseAddress;
	InstancePtr->Config.DeviceId = CfgPtr->DeviceId;
	InstancePtr->Config.AddrWidth = CfgPtr->AddrWidth;
	InstancePtr->Config.Has_SingleIntr = CfgPtr->Has_SingleIntr;
	InstancePtr->Config.HasMM2S = CfgPtr->HasMM2S;
	InstancePtr->Config.HasS2MM = CfgPtr->HasS2MM;
	InstancePtr->Config.MaxTransferlen = CfgPtr->MaxTransferlen;
	InstancePtr->Config.HasStsCntrlStrm = CfgPtr->HasStsCntrlStrm;
	InstancePtr->Config.HasRxLength = CfgPtr->HasRxLength;
	InstancePtr->Config.IsTxCacheCoherent = CfgPtr->IsTxCacheCoherent;
	InstancePtr->Config.IsRxCacheCoherent = CfgPtr->IsRxCacheCoherent;

	InstancePtr->IsReady = (u32)(XIL_COMPONENT_IS_READY);

	if (InstancePtr->Config.HasMM2S) {
		InstancePtr->Config.HasMM2SDRE = CfgPtr->HasMM2SDRE;
		InstancePtr->Config.TxNumChannels = CfgPtr->TxNumChannels;
		for (i = 1; i <= InstancePtr->Config.TxNumChannels; i++) {
			InstancePtr->Tx_Chan[i].ChanBase = CfgPtr->BaseAddress;
			InstancePtr->Tx_Chan[i].Chan_id = i;
			InstancePtr->Tx_Chan[i].Has_Txdre = CfgPtr->HasMM2SDRE;
			InstancePtr->Tx_Chan[i].TxDataWidth =
				((unsigned int)CfgPtr->MM2SDataWidth >> 3);
			InstancePtr->Tx_Chan[i].HasStsCntrlStrm = CfgPtr->HasStsCntrlStrm;
			InstancePtr->Tx_Chan[i].MaxTransferLen =
					MAX_TRANSFER_LEN(CfgPtr->MaxTransferlen - 1);
			InstancePtr->Tx_Chan[i].IsRxChan = 0;
			if (InstancePtr->Config.AddrWidth > 32)
				InstancePtr->Tx_Chan[i].ext_addr = 1;
		}
	}

	if (InstancePtr->Config.HasS2MM) {
		InstancePtr->Config.HasS2MMDRE = CfgPtr->HasS2MMDRE;
		InstancePtr->Config.RxNumChannels = CfgPtr->RxNumChannels;
		for (i = 1; i <= InstancePtr->Config.RxNumChannels; i++) {
			InstancePtr->Rx_Chan[i].ChanBase = CfgPtr->BaseAddress +
							XMCDMA_RX_OFFSET;
			InstancePtr->Rx_Chan[i].Has_Rxdre = CfgPtr->HasS2MMDRE;
			InstancePtr->Rx_Chan[i].HasStsCntrlStrm = CfgPtr->HasStsCntrlStrm;
			InstancePtr->Rx_Chan[i].HasRxLength = CfgPtr->HasRxLength;
			InstancePtr->Rx_Chan[i].RxDataWidth =
				((unsigned int)CfgPtr->S2MMDataWidth >> 3);
			InstancePtr->Rx_Chan[i].Chan_id = i;

			InstancePtr->Rx_Chan[i].MaxTransferLen =
				   MAX_TRANSFER_LEN(CfgPtr->MaxTransferlen - 1);

			InstancePtr->Rx_Chan[i].IsRxChan = 1;
			if (InstancePtr->Config.AddrWidth > 32)
				InstancePtr->Rx_Chan[i].ext_addr = 1;
		}
	}

	return (XST_SUCCESS);
}
/*****************************************************************************/
/**
*
* This function initializes an MCDMA core. This function must be called
* prior to using an MCDMA core. Initialization of an MCDMA includes setting
* up the instance data and updating the driver filed with a proper values.
*
* @param	InstancePtr is a pointer to the XMcdma instance.
* @param	CfgPtr is a reference to a structure containing information
*		about a specific XMcdma instance.
*
* @return
*		- XST_SUCCESS if initialization was successful.
*
* @note		When user calls this function he should ensure the hardware
*		is in a quiescent state by resetting all the hardware
*		Configurations.
*
******************************************************************************/
This function initializes an MCDMA core. This function must be called
prior to using an MCDMA core. Initialization of an MCDMA includes setting
up the instance data and updating the driver filed with a proper values.
This function initializes an MCDMA core . This function must be called prior to using an MCDMA core . Initialization of an MCDMA includes setting up the instance data and updating the driver filed with a proper values .
s32 XMcDma_Initialize(XMcdma *InstancePtr, XMcdma_Config *CfgPtr)
{
	int i;
	Xil_AssertNonvoid(InstancePtr != NULL);
	Xil_AssertNonvoid(CfgPtr != NULL);
	memset(InstancePtr, 0, sizeof(XMcdma));
	InstancePtr->Config.BaseAddress = CfgPtr->BaseAddress;
	InstancePtr->Config.DeviceId = CfgPtr->DeviceId;
	InstancePtr->Config.AddrWidth = CfgPtr->AddrWidth;
	InstancePtr->Config.Has_SingleIntr = CfgPtr->Has_SingleIntr;
	InstancePtr->Config.HasMM2S = CfgPtr->HasMM2S;
	InstancePtr->Config.HasS2MM = CfgPtr->HasS2MM;
	InstancePtr->Config.MaxTransferlen = CfgPtr->MaxTransferlen;
	InstancePtr->Config.HasStsCntrlStrm = CfgPtr->HasStsCntrlStrm;
	InstancePtr->Config.HasRxLength = CfgPtr->HasRxLength;
	InstancePtr->Config.IsTxCacheCoherent = CfgPtr->IsTxCacheCoherent;
	InstancePtr->Config.IsRxCacheCoherent = CfgPtr->IsRxCacheCoherent;
	InstancePtr->IsReady = (u32)(XIL_COMPONENT_IS_READY);
	if (InstancePtr->Config.HasMM2S) {
		InstancePtr->Config.HasMM2SDRE = CfgPtr->HasMM2SDRE;
		InstancePtr->Config.TxNumChannels = CfgPtr->TxNumChannels;
		for (i = 1; i <= InstancePtr->Config.TxNumChannels; i++) {
			InstancePtr->Tx_Chan[i].ChanBase = CfgPtr->BaseAddress;
			InstancePtr->Tx_Chan[i].Chan_id = i;
			InstancePtr->Tx_Chan[i].Has_Txdre = CfgPtr->HasMM2SDRE;
			InstancePtr->Tx_Chan[i].TxDataWidth =
				((unsigned int)CfgPtr->MM2SDataWidth >> 3);
			InstancePtr->Tx_Chan[i].HasStsCntrlStrm = CfgPtr->HasStsCntrlStrm;
			InstancePtr->Tx_Chan[i].MaxTransferLen =
					MAX_TRANSFER_LEN(CfgPtr->MaxTransferlen - 1);
			InstancePtr->Tx_Chan[i].IsRxChan = 0;
			if (InstancePtr->Config.AddrWidth > 32)
				InstancePtr->Tx_Chan[i].ext_addr = 1;
		}
	}
	if (InstancePtr->Config.HasS2MM) {
		InstancePtr->Config.HasS2MMDRE = CfgPtr->HasS2MMDRE;
		InstancePtr->Config.RxNumChannels = CfgPtr->RxNumChannels;
		for (i = 1; i <= InstancePtr->Config.RxNumChannels; i++) {
			InstancePtr->Rx_Chan[i].ChanBase = CfgPtr->BaseAddress +
							XMCDMA_RX_OFFSET;
			InstancePtr->Rx_Chan[i].Has_Rxdre = CfgPtr->HasS2MMDRE;
			InstancePtr->Rx_Chan[i].HasStsCntrlStrm = CfgPtr->HasStsCntrlStrm;
			InstancePtr->Rx_Chan[i].HasRxLength = CfgPtr->HasRxLength;
			InstancePtr->Rx_Chan[i].RxDataWidth =
				((unsigned int)CfgPtr->S2MMDataWidth >> 3);
			InstancePtr->Rx_Chan[i].Chan_id = i;
			InstancePtr->Rx_Chan[i].MaxTransferLen =
				   MAX_TRANSFER_LEN(CfgPtr->MaxTransferlen - 1);
			InstancePtr->Rx_Chan[i].IsRxChan = 1;
			if (InstancePtr->Config.AddrWidth > 32)
				InstancePtr->Rx_Chan[i].ext_addr = 1;
		}
	}
	return (XST_SUCCESS);
}
s32 XMcDma_Initialize ( XMcdma * InstancePtr , XMcdma_Config * CfgPtr ) { int i ; Xil_AssertNonvoid ( InstancePtr != NULL ) ; Xil_AssertNonvoid ( CfgPtr != NULL ) ; memset ( InstancePtr , 0 , sizeof ( XMcdma ) ) ; InstancePtr -> Config . BaseAddress = CfgPtr -> BaseAddress ; InstancePtr -> Config . DeviceId = CfgPtr -> DeviceId ; InstancePtr -> Config . AddrWidth = CfgPtr -> AddrWidth ; InstancePtr -> Config . Has_SingleIntr = CfgPtr -> Has_SingleIntr ; InstancePtr -> Config . HasMM2S = CfgPtr -> HasMM2S ; InstancePtr -> Config . HasS2MM = CfgPtr -> HasS2MM ; InstancePtr -> Config . MaxTransferlen = CfgPtr -> MaxTransferlen ; InstancePtr -> Config . HasStsCntrlStrm = CfgPtr -> HasStsCntrlStrm ; InstancePtr -> Config . HasRxLength = CfgPtr -> HasRxLength ; InstancePtr -> Config . IsTxCacheCoherent = CfgPtr -> IsTxCacheCoherent ; InstancePtr -> Config . IsRxCacheCoherent = CfgPtr -> IsRxCacheCoherent ; InstancePtr -> IsReady = ( u32 ) ( XIL_COMPONENT_IS_READY ) ; if ( InstancePtr -> Config . HasMM2S ) { InstancePtr -> Config . HasMM2SDRE = CfgPtr -> HasMM2SDRE ; InstancePtr -> Config . TxNumChannels = CfgPtr -> TxNumChannels ; for ( i = 1 ; i <= InstancePtr -> Config . TxNumChannels ; i ++ ) { InstancePtr -> Tx_Chan [ i ] . ChanBase = CfgPtr -> BaseAddress ; InstancePtr -> Tx_Chan [ i ] . Chan_id = i ; InstancePtr -> Tx_Chan [ i ] . Has_Txdre = CfgPtr -> HasMM2SDRE ; InstancePtr -> Tx_Chan [ i ] . TxDataWidth = ( ( unsigned int ) CfgPtr -> MM2SDataWidth >> 3 ) ; InstancePtr -> Tx_Chan [ i ] . HasStsCntrlStrm = CfgPtr -> HasStsCntrlStrm ; InstancePtr -> Tx_Chan [ i ] . MaxTransferLen = MAX_TRANSFER_LEN ( CfgPtr -> MaxTransferlen - 1 ) ; InstancePtr -> Tx_Chan [ i ] . IsRxChan = 0 ; if ( InstancePtr -> Config . AddrWidth > 32 ) InstancePtr -> Tx_Chan [ i ] . ext_addr = 1 ; } } if ( InstancePtr -> Config . HasS2MM ) { InstancePtr -> Config . HasS2MMDRE = CfgPtr -> HasS2MMDRE ; InstancePtr -> Config . RxNumChannels = CfgPtr -> RxNumChannels ; for ( i = 1 ; i <= InstancePtr -> Config . RxNumChannels ; i ++ ) { InstancePtr -> Rx_Chan [ i ] . ChanBase = CfgPtr -> BaseAddress + XMCDMA_RX_OFFSET ; InstancePtr -> Rx_Chan [ i ] . Has_Rxdre = CfgPtr -> HasS2MMDRE ; InstancePtr -> Rx_Chan [ i ] . HasStsCntrlStrm = CfgPtr -> HasStsCntrlStrm ; InstancePtr -> Rx_Chan [ i ] . HasRxLength = CfgPtr -> HasRxLength ; InstancePtr -> Rx_Chan [ i ] . RxDataWidth = ( ( unsigned int ) CfgPtr -> S2MMDataWidth >> 3 ) ; InstancePtr -> Rx_Chan [ i ] . Chan_id = i ; InstancePtr -> Rx_Chan [ i ] . MaxTransferLen = MAX_TRANSFER_LEN ( CfgPtr -> MaxTransferlen - 1 ) ; InstancePtr -> Rx_Chan [ i ] . IsRxChan = 1 ; if ( InstancePtr -> Config . AddrWidth > 32 ) InstancePtr -> Rx_Chan [ i ] . ext_addr = 1 ; } } return ( XST_SUCCESS ) ; }
This function initializes an MCDMA core.
This function initializes an MCDMA core .
/* Verify arguments. */