XilinxProcessorIPLib/drivers/aiengine/src/tile/xaietile_lock.c
u8 XAieTile_LockRelease(XAieGbl_Tile *TileInstPtr, u8 LockId, u8 LockVal,
								u32 TimeOut)
{
	u64 RegAddr;
	u8 RelDone = XAIETILE_LOCK_REL_FAILED;
	u8 Lsb;
	u32 Mask, Value;
        XAieGbl_RegLocks *RegPtr;

	XAie_AssertNonvoid(TileInstPtr != XAIE_NULL);
	XAie_AssertNonvoid(LockId < XAIEGBL_TILE_LOCK_NUM_MAX);
	XAie_AssertNonvoid(LockVal == XAIETILE_LOCK_REL_VAL0 ||
				LockVal == XAIETILE_LOCK_REL_VAL1 ||
				LockVal == XAIETILE_LOCK_REL_VALINVALID);

       	if(TileInstPtr->TileType == XAIEGBL_TILE_TYPE_AIETILE) {
                RegPtr = &TileLockRegs[LockId];
        } else {
                RegPtr = &ShimLockRegs[LockId];
        }

	if(LockVal == XAIETILE_LOCK_REL_VAL0) {
		/* Release lock with value 0 register address */
		RegAddr = TileInstPtr->TileAddr + RegPtr->RelV0Off;
		Lsb = RegPtr->RelV0.Lsb;
		Mask = RegPtr->RelV0.Mask;

	} else if(LockVal == XAIETILE_LOCK_REL_VAL1) {
		/* Release lock with value 1 register address */
		RegAddr = TileInstPtr->TileAddr + RegPtr->RelV1Off;
		Lsb = RegPtr->RelV1.Lsb;
		Mask = RegPtr->RelV1.Mask;
	} else {
		/* LockVal == XAIETILE_LOCK_REL_VALINVALID */
		/* Release lock with no value register address */
		RegAddr = TileInstPtr->TileAddr + RegPtr->RelNvOff;
		Lsb = RegPtr->RelNv.Lsb;
		Mask = RegPtr->RelNv.Mask;

	}

	Value = XAIETILE_LOCK_REL_SUCCESS << Lsb;

	if (XAieGbl_MaskPoll(RegAddr, Mask, Value, TimeOut) == XAIE_SUCCESS) {
		RelDone = XAIETILE_LOCK_REL_SUCCESS;
	}

	return RelDone;
}
/*****************************************************************************/
/**
*
* This API is used to release the specified lock with or without value. Lock
* released without value if LockVal==0xFF. This API can be blocking or non-
* blocking based on the TimeOut value. If TimeOut==0, then API behaves in a
* non-blocking fashion and returns immediately after the first read request.
* If TimeOut>0, then API becomes blocking and will issue the read request until
* the release is successful or time out happens, whichever occurs first.
*
* @param	TileInstPtr - Pointer to the Tile instance.
* @param	LockId - Lock value index, ranging from 0-15.
* @param	LockVal - Lock value used for release. If set to 0xFF, lock
*		released with no value.
* @param	TimeOut - Time-out value for which the read request needs to
*		be repeated. Value to be specified in usecs.
*
* @return	1 if release successful, else 0.
*
* @note		None.
*
*******************************************************************************/
This API is used to release the specified lock with or without value. Lock
released without value if LockVal==0xFF. This API can be blocking or non
blocking based on the TimeOut value. If TimeOut==0, then API behaves in a
non-blocking fashion and returns immediately after the first read request.
If TimeOut>0, then API becomes blocking and will issue the read request until
the release is successful or time out happens, whichever occurs first.
This API is used to release the specified lock with or without value . Lock released without value if LockVal == 0xFF . This API can be blocking or non blocking based on the TimeOut value . If TimeOut == 0 then API behaves in a non - blocking fashion and returns immediately after the first read request . If TimeOut > 0 then API becomes blocking and will issue the read request until the release is successful or time out happens whichever occurs first .
u8 XAieTile_LockRelease(XAieGbl_Tile *TileInstPtr, u8 LockId, u8 LockVal,
								u32 TimeOut)
{
	u64 RegAddr;
	u8 RelDone = XAIETILE_LOCK_REL_FAILED;
	u8 Lsb;
	u32 Mask, Value;
        XAieGbl_RegLocks *RegPtr;
	XAie_AssertNonvoid(TileInstPtr != XAIE_NULL);
	XAie_AssertNonvoid(LockId < XAIEGBL_TILE_LOCK_NUM_MAX);
	XAie_AssertNonvoid(LockVal == XAIETILE_LOCK_REL_VAL0 ||
				LockVal == XAIETILE_LOCK_REL_VAL1 ||
				LockVal == XAIETILE_LOCK_REL_VALINVALID);
       	if(TileInstPtr->TileType == XAIEGBL_TILE_TYPE_AIETILE) {
                RegPtr = &TileLockRegs[LockId];
        } else {
                RegPtr = &ShimLockRegs[LockId];
        }
	if(LockVal == XAIETILE_LOCK_REL_VAL0) {
		RegAddr = TileInstPtr->TileAddr + RegPtr->RelV0Off;
		Lsb = RegPtr->RelV0.Lsb;
		Mask = RegPtr->RelV0.Mask;
	} else if(LockVal == XAIETILE_LOCK_REL_VAL1) {
		RegAddr = TileInstPtr->TileAddr + RegPtr->RelV1Off;
		Lsb = RegPtr->RelV1.Lsb;
		Mask = RegPtr->RelV1.Mask;
	} else {
		RegAddr = TileInstPtr->TileAddr + RegPtr->RelNvOff;
		Lsb = RegPtr->RelNv.Lsb;
		Mask = RegPtr->RelNv.Mask;
	}
	Value = XAIETILE_LOCK_REL_SUCCESS << Lsb;
	if (XAieGbl_MaskPoll(RegAddr, Mask, Value, TimeOut) == XAIE_SUCCESS) {
		RelDone = XAIETILE_LOCK_REL_SUCCESS;
	}
	return RelDone;
}
u8 XAieTile_LockRelease ( XAieGbl_Tile * TileInstPtr , u8 LockId , u8 LockVal , u32 TimeOut ) { u64 RegAddr ; u8 RelDone = XAIETILE_LOCK_REL_FAILED ; u8 Lsb ; u32 Mask , Value ; XAieGbl_RegLocks * RegPtr ; XAie_AssertNonvoid ( TileInstPtr != XAIE_NULL ) ; XAie_AssertNonvoid ( LockId < XAIEGBL_TILE_LOCK_NUM_MAX ) ; XAie_AssertNonvoid ( LockVal == XAIETILE_LOCK_REL_VAL0 || LockVal == XAIETILE_LOCK_REL_VAL1 || LockVal == XAIETILE_LOCK_REL_VALINVALID ) ; if ( TileInstPtr -> TileType == XAIEGBL_TILE_TYPE_AIETILE ) { RegPtr = & TileLockRegs [ LockId ] ; } else { RegPtr = & ShimLockRegs [ LockId ] ; } if ( LockVal == XAIETILE_LOCK_REL_VAL0 ) { RegAddr = TileInstPtr -> TileAddr + RegPtr -> RelV0Off ; Lsb = RegPtr -> RelV0 . Lsb ; Mask = RegPtr -> RelV0 . Mask ; } else if ( LockVal == XAIETILE_LOCK_REL_VAL1 ) { RegAddr = TileInstPtr -> TileAddr + RegPtr -> RelV1Off ; Lsb = RegPtr -> RelV1 . Lsb ; Mask = RegPtr -> RelV1 . Mask ; } else { RegAddr = TileInstPtr -> TileAddr + RegPtr -> RelNvOff ; Lsb = RegPtr -> RelNv . Lsb ; Mask = RegPtr -> RelNv . Mask ; } Value = XAIETILE_LOCK_REL_SUCCESS << Lsb ; if ( XAieGbl_MaskPoll ( RegAddr , Mask , Value , TimeOut ) == XAIE_SUCCESS ) { RelDone = XAIETILE_LOCK_REL_SUCCESS ; } return RelDone ; }
This API is used to release the specified lock with or without value.
This API is used to release the specified lock with or without value .
/* Release lock with value 0 register address */ /* Release lock with value 1 register address */ /* LockVal == XAIETILE_LOCK_REL_VALINVALID */ /* Release lock with no value register address */