/* retval kStatus_Success Lock the sema42 gate successfully. retval kStatus_Failed Sema42 gate has been locked by another processor.  */
status_t RDC_SEMA42_TryLock(RDC_SEMAPHORE_Type *base, uint8_t gateNum, uint8_t masterIndex, uint8_t domainId)
/* retval kStatus_Success Lock the sema42 gate successfully. retval kStatus_Failed Sema42 gate has been locked by another processor.  */
status_t RDC_SEMA42_TryLock(RDC_SEMAPHORE_Type *base, uint8_t gateNum, uint8_t masterIndex, uint8_t domainId)
{
    assert(gateNum < RDC_SEMA42_GATE_COUNT);
    status_t status = kStatus_Success;
    uint8_t regGate;
    ++masterIndex;
    regGate = (uint8_t)(RDC_SEMAPHORE_GATE_LDOM(domainId) | RDC_SEMAPHORE_GATE_GTFSM(masterIndex));
    RDC_SEMA42_GATEn(base, gateNum) = masterIndex;
    if (regGate != RDC_SEMA42_GATEn(base, gateNum))
    {
        status = kStatus_Fail;
    }
    return status;
}