/**
*
* This is the Receive handler function for examples 1 and 2.
* It will increment a shared  counter, receive and validate the frame.
*
* @param    RxRingPtr is a pointer to the DMA ring instance.
*
* @return   None.
*
* @note     None.
*
******************************************************************************/
static void RxIntrHandler(XLlDma_BdRing * RxRingPtr)
{
	u32 IrqStatus;

	/* Read pending interrupts */
	IrqStatus = XLlDma_BdRingGetIrq(RxRingPtr);

	/* Acknowledge pending interrupts */
	XLlDma_BdRingAckIrq(RxRingPtr, IrqStatus);

	/* If error interrupt is asserted, raise error flag, reset the
	 * hardware to recover from the error, and return with no further
	 * processing.
	 */
	if ((IrqStatus & XLLDMA_IRQ_ALL_ERR_MASK)) {
		DeviceErrors++;
		TemacUtilErrorTrap ("LlDma: Error: IrqStatus & XLLDMA_IRQ_ALL_ERR_MASK");
		XLlDma_Reset(&DmaInstance);
		return;
	}

	/*
	 * If Reception done interrupt is asserted, call RX call back function
	 * to handle the processed BDs and then raise the according flag.
	 */
	if ((IrqStatus & (XLLDMA_IRQ_DELAY_MASK | XLLDMA_IRQ_COALESCE_MASK))) {
		RxCallBack(RxRingPtr);
	}
}
Пример #2
0
/**
 * This function initializes a DMA engine.  This function must be called
 * prior to using a DMA engine. Initialization of a engine includes setting
 * up the register base address, setting up the instance data, and ensuring the
 * hardware is in a quiescent state.
 *
 * @param  InstancePtr is a pointer to the DMA engine instance to be worked on.
 * @param  BaseAddress is where the registers for this engine can be found.
 *         If address translation is being used, then this parameter must
 *         reflect the virtual base address.
 * @return None.
 *
 *****************************************************************************/
void XLlDma_Initialize(XLlDma * InstancePtr, u32 BaseAddress)
{
	/* Setup the instance */
	memset(InstancePtr, 0, sizeof(XLlDma));
	InstancePtr->RegBase = BaseAddress;

	/* Initialize the ring structures */
	InstancePtr->TxBdRing.RunState = XST_DMA_SG_IS_STOPPED;
	InstancePtr->TxBdRing.ChanBase = BaseAddress + XLLDMA_TX_OFFSET;
	InstancePtr->TxBdRing.IsRxChannel = 0;
	InstancePtr->RxBdRing.RunState = XST_DMA_SG_IS_STOPPED;
	InstancePtr->RxBdRing.ChanBase = BaseAddress + XLLDMA_RX_OFFSET;
	InstancePtr->RxBdRing.IsRxChannel = 1;

	/* Reset the device and return */
	XLlDma_Reset(InstancePtr);
}