/* param base XRDC2 peripheral base address. param mem The memory region to operate. retval kStatus_Fail Failed to lock. retval kStatus_Success Locked succussfully.  */
status_t XRDC2_TryLockMemExclAccess(XRDC2_Type *base, xrdc2_mem_t mem)
/* param base XRDC2 peripheral base address. param mem The memory region to operate. retval kStatus_Fail Failed to lock. retval kStatus_Success Locked succussfully.  */
status_t XRDC2_TryLockMemExclAccess(XRDC2_Type *base, xrdc2_mem_t mem)
{
    status_t status;
    uint8_t curDomainID;
    uint32_t mrc               = XRDC2_GET_MRC((uint32_t)mem);
    uint32_t mrgd              = XRDC2_GET_MRGD((uint32_t)mem);
    volatile uint32_t *lockReg = &(base->MRCI_MRGDJ[mrc][mrgd].MRC_MRGD_W6);
    curDomainID = XRDC2_GetCurrentMasterDomainId(base);
    *lockReg = XRDC2_EAL_LOCKED;
    if (curDomainID != XRDC2_GetMemExclAccessLockDomainOwner(base, mem))
    {
        status = kStatus_Fail;
    }
    else
    {
        status = kStatus_Success;
    }
    return status;
}