XilinxProcessorIPLib/drivers/aienginev2/src/dma/xaie_dma_aieml.c
AieRC _XAieMl_DmaGetPendingBdCount(XAie_DevInst *DevInst, XAie_LocType Loc,
		const XAie_DmaMod *DmaMod, u8 ChNum, XAie_DmaDirection Dir,
		u8 *PendingBd)
{
	AieRC RC;
	u64 Addr;
	u32 Mask, StatusReg, TaskQSize;

	Addr = _XAie_GetTileAddr(DevInst, Loc.Row, Loc.Col) +
		DmaMod->ChStatusBase + ChNum * XAIEML_DMA_STATUS_CHNUM_OFFSET +
		Dir * DmaMod->ChStatusOffset;

	RC = XAie_Read32(DevInst, Addr, &StatusReg);
	if(RC != XAIE_OK) {
		return RC;
	}

	TaskQSize = XAie_GetField(StatusReg,
			DmaMod->ChProp->DmaChStatus->AieMlDmaChStatus.TaskQSize.Lsb,
			DmaMod->ChProp->DmaChStatus->AieMlDmaChStatus.TaskQSize.Mask);
	if(TaskQSize > DmaMod->ChProp->StartQSizeMax) {
		XAIE_ERROR("Invalid start queue size from register\n");
		return XAIE_ERR;
	}

	Mask = DmaMod->ChProp->DmaChStatus->AieMlDmaChStatus.Status.Mask |
		DmaMod->ChProp->DmaChStatus->AieMlDmaChStatus.StalledLockAcq.Mask |
		DmaMod->ChProp->DmaChStatus->AieMlDmaChStatus.StalledLockRel.Mask |
		DmaMod->ChProp->DmaChStatus->AieMlDmaChStatus.StalledStreamStarve.Mask |
		DmaMod->ChProp->DmaChStatus->AieMlDmaChStatus.StalledTCT.Mask;

	/* Check if BD is being used by a channel */
	if(StatusReg & Mask) {
		TaskQSize++;
	}

	*PendingBd = TaskQSize;

	return XAIE_OK;
}
/*****************************************************************************/
/**
*
* This API is used to get the count of scheduled BDs in pending.
*
* @param	DevInst: Device Instance
* @param	Loc: Location of AIE Tile
* @param	DmaMod: Dma module pointer
* @param	ChNum: Channel number of the DMA.
* @param	Dir: Direction of the DMA Channel. (MM2S or S2MM)
* @param	PendingBd: Pointer to store the number of pending BDs.
*
* @return	XAIE_OK on success, Error code on failure.
*
* @note		Internal only. For AIEML Tiles only.
*
******************************************************************************/
This API is used to get the count of scheduled BDs in pending.
This API is used to get the count of scheduled BDs in pending .
AieRC _XAieMl_DmaGetPendingBdCount(XAie_DevInst *DevInst, XAie_LocType Loc,
		const XAie_DmaMod *DmaMod, u8 ChNum, XAie_DmaDirection Dir,
		u8 *PendingBd)
{
	AieRC RC;
	u64 Addr;
	u32 Mask, StatusReg, TaskQSize;
	Addr = _XAie_GetTileAddr(DevInst, Loc.Row, Loc.Col) +
		DmaMod->ChStatusBase + ChNum * XAIEML_DMA_STATUS_CHNUM_OFFSET +
		Dir * DmaMod->ChStatusOffset;
	RC = XAie_Read32(DevInst, Addr, &StatusReg);
	if(RC != XAIE_OK) {
		return RC;
	}
	TaskQSize = XAie_GetField(StatusReg,
			DmaMod->ChProp->DmaChStatus->AieMlDmaChStatus.TaskQSize.Lsb,
			DmaMod->ChProp->DmaChStatus->AieMlDmaChStatus.TaskQSize.Mask);
	if(TaskQSize > DmaMod->ChProp->StartQSizeMax) {
		XAIE_ERROR("Invalid start queue size from register\n");
		return XAIE_ERR;
	}
	Mask = DmaMod->ChProp->DmaChStatus->AieMlDmaChStatus.Status.Mask |
		DmaMod->ChProp->DmaChStatus->AieMlDmaChStatus.StalledLockAcq.Mask |
		DmaMod->ChProp->DmaChStatus->AieMlDmaChStatus.StalledLockRel.Mask |
		DmaMod->ChProp->DmaChStatus->AieMlDmaChStatus.StalledStreamStarve.Mask |
		DmaMod->ChProp->DmaChStatus->AieMlDmaChStatus.StalledTCT.Mask;
	if(StatusReg & Mask) {
		TaskQSize++;
	}
	*PendingBd = TaskQSize;
	return XAIE_OK;
}
AieRC _XAieMl_DmaGetPendingBdCount ( XAie_DevInst * DevInst , XAie_LocType Loc , const XAie_DmaMod * DmaMod , u8 ChNum , XAie_DmaDirection Dir , u8 * PendingBd ) { AieRC RC ; u64 Addr ; u32 Mask , StatusReg , TaskQSize ; Addr = _XAie_GetTileAddr ( DevInst , Loc . Row , Loc . Col ) + DmaMod -> ChStatusBase + ChNum * XAIEML_DMA_STATUS_CHNUM_OFFSET + Dir * DmaMod -> ChStatusOffset ; RC = XAie_Read32 ( DevInst , Addr , & StatusReg ) ; if ( RC != XAIE_OK ) { return RC ; } TaskQSize = XAie_GetField ( StatusReg , DmaMod -> ChProp -> DmaChStatus -> AieMlDmaChStatus . TaskQSize . Lsb , DmaMod -> ChProp -> DmaChStatus -> AieMlDmaChStatus . TaskQSize . Mask ) ; if ( TaskQSize > DmaMod -> ChProp -> StartQSizeMax ) { XAIE_ERROR ( " \n " ) ; return XAIE_ERR ; } Mask = DmaMod -> ChProp -> DmaChStatus -> AieMlDmaChStatus . Status . Mask | DmaMod -> ChProp -> DmaChStatus -> AieMlDmaChStatus . StalledLockAcq . Mask | DmaMod -> ChProp -> DmaChStatus -> AieMlDmaChStatus . StalledLockRel . Mask | DmaMod -> ChProp -> DmaChStatus -> AieMlDmaChStatus . StalledStreamStarve . Mask | DmaMod -> ChProp -> DmaChStatus -> AieMlDmaChStatus . StalledTCT . Mask ; if ( StatusReg & Mask ) { TaskQSize ++ ; } * PendingBd = TaskQSize ; return XAIE_OK ; }
This API is used to get the count of scheduled BDs in pending.
This API is used to get the count of scheduled BDs in pending .
/* Check if BD is being used by a channel */