MCUXpresso SDK API Reference Manual  Rev. 0
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
RDC_SEMA42: Hardware Semaphores Driver

Overview

The MCUXpresso SDK provides a driver for the RDC_SEMA42 module of MCUXpresso SDK devices.

The RDC_SEMA42 driver should be used together with RDC driver.
Before using the RDC_SEMA42, call the RDC_SEMA42_Init() function to initialize the module. Note that this function only enables the clock but does not reset the gates because the module might be used by other processors at the same time. To reset the gates, call either the RDC_SEMA42_ResetGate() or RDC_SEMA42_ResetAllGates() functions. The function RDC_SEMA42_Deinit() deinitializes the RDC_SEMA42.
The RDC_SEMA42 provides two functions to lock the RDC_SEMA42 gate. The function RDC_SEMA42_TryLock() tries to lock the gate. If the gate has been locked by another processor, this function returns an error immediately. The function RDC_SEMA42_Lock() is a blocking method, which waits until the gate is free and locks it.
The RDC_SEMA42_Unlock() unlocks the RDC_SEMA42 gate. The gate can only be unlocked by the processor which locked it. If the gate is not locked by the current processor, this function takes no effect. The function RDC_SEMA42_GetGateStatus() returns a status whether the gate is unlocked and which processor locks the gate. The function RDC_SEMA42_GetLockDomainID() returns the ID of the domain which has locked the gate.
The RDC_SEMA42 gate can be reset to unlock forcefully. The function RDC_SEMA42_ResetGate() resets a specific gate. The function RDC_SEMA42_ResetAllGates() resets all gates.

Macros

#define RDC_SEMA42_GATE_NUM_RESET_ALL   (64U)
 The number to reset all RDC_SEMA42 gates. More...
 
#define RDC_SEMA42_GATEn(base, n)   (((volatile uint8_t *)(&((base)->GATE0)))[(n)])
 RDC_SEMA42 gate n register address. More...
 
#define RDC_SEMA42_GATE_COUNT   (64U)
 RDC_SEMA42 gate count. More...
 

Functions

void RDC_SEMA42_Init (RDC_SEMAPHORE_Type *base)
 Initializes the RDC_SEMA42 module. More...
 
void RDC_SEMA42_Deinit (RDC_SEMAPHORE_Type *base)
 De-initializes the RDC_SEMA42 module. More...
 
status_t RDC_SEMA42_TryLock (RDC_SEMAPHORE_Type *base, uint8_t gateNum, uint8_t masterIndex, uint8_t domainId)
 Tries to lock the RDC_SEMA42 gate. More...
 
void RDC_SEMA42_Lock (RDC_SEMAPHORE_Type *base, uint8_t gateNum, uint8_t masterIndex, uint8_t domainId)
 Locks the RDC_SEMA42 gate. More...
 
static void RDC_SEMA42_Unlock (RDC_SEMAPHORE_Type *base, uint8_t gateNum)
 Unlocks the RDC_SEMA42 gate. More...
 
static int32_t RDC_SEMA42_GetLockMasterIndex (RDC_SEMAPHORE_Type *base, uint8_t gateNum)
 Gets which master has currently locked the gate. More...
 
int32_t RDC_SEMA42_GetLockDomainID (RDC_SEMAPHORE_Type *base, uint8_t gateNum)
 Gets which domain has currently locked the gate. More...
 
status_t RDC_SEMA42_ResetGate (RDC_SEMAPHORE_Type *base, uint8_t gateNum)
 Resets the RDC_SEMA42 gate to an unlocked status. More...
 
static status_t RDC_SEMA42_ResetAllGates (RDC_SEMAPHORE_Type *base)
 Resets all RDC_SEMA42 gates to an unlocked status. More...
 

Driver version

#define FSL_RDC_SEMA42_DRIVER_VERSION   (MAKE_VERSION(2, 0, 3))
 RDC_SEMA42 driver version.
 

Macro Definition Documentation

#define RDC_SEMA42_GATE_NUM_RESET_ALL   (64U)
#define RDC_SEMA42_GATEn (   base,
 
)    (((volatile uint8_t *)(&((base)->GATE0)))[(n)])
#define RDC_SEMA42_GATE_COUNT   (64U)

Function Documentation

void RDC_SEMA42_Init ( RDC_SEMAPHORE_Type *  base)

This function initializes the RDC_SEMA42 module. It only enables the clock but does not reset the gates because the module might be used by other processors at the same time. To reset the gates, call either RDC_SEMA42_ResetGate or RDC_SEMA42_ResetAllGates function.

Parameters
baseRDC_SEMA42 peripheral base address.
void RDC_SEMA42_Deinit ( RDC_SEMAPHORE_Type *  base)

This function de-initializes the RDC_SEMA42 module. It only disables the clock.

Parameters
baseRDC_SEMA42 peripheral base address.
status_t RDC_SEMA42_TryLock ( RDC_SEMAPHORE_Type *  base,
uint8_t  gateNum,
uint8_t  masterIndex,
uint8_t  domainId 
)

This function tries to lock the specific RDC_SEMA42 gate. If the gate has been locked by another processor, this function returns an error code.

Parameters
baseRDC_SEMA42 peripheral base address.
gateNumGate number to lock.
masterIndexCurrent processor master index.
domainIdCurrent processor domain ID.
Return values
kStatus_SuccessLock the sema42 gate successfully.
kStatus_FailedSema42 gate has been locked by another processor.
void RDC_SEMA42_Lock ( RDC_SEMAPHORE_Type *  base,
uint8_t  gateNum,
uint8_t  masterIndex,
uint8_t  domainId 
)

This function locks the specific RDC_SEMA42 gate. If the gate has been locked by other processors, this function waits until it is unlocked and then lock it.

Parameters
baseRDC_SEMA42 peripheral base address.
gateNumGate number to lock.
masterIndexCurrent processor master index.
domainIdCurrent processor domain ID.
static void RDC_SEMA42_Unlock ( RDC_SEMAPHORE_Type *  base,
uint8_t  gateNum 
)
inlinestatic

This function unlocks the specific RDC_SEMA42 gate. It only writes unlock value to the RDC_SEMA42 gate register. However, it does not check whether the RDC_SEMA42 gate is locked by the current processor or not. As a result, if the RDC_SEMA42 gate is not locked by the current processor, this function has no effect.

Parameters
baseRDC_SEMA42 peripheral base address.
gateNumGate number to unlock.
static int32_t RDC_SEMA42_GetLockMasterIndex ( RDC_SEMAPHORE_Type *  base,
uint8_t  gateNum 
)
inlinestatic
Parameters
baseRDC_SEMA42 peripheral base address.
gateNumGate number.
Returns
Return -1 if the gate is not locked by any master, otherwise return the master index.
int32_t RDC_SEMA42_GetLockDomainID ( RDC_SEMAPHORE_Type *  base,
uint8_t  gateNum 
)
Parameters
baseRDC_SEMA42 peripheral base address.
gateNumGate number.
Returns
Return -1 if the gate is not locked by any domain, otherwise return the domain ID.
status_t RDC_SEMA42_ResetGate ( RDC_SEMAPHORE_Type *  base,
uint8_t  gateNum 
)

This function resets a RDC_SEMA42 gate to an unlocked status.

Parameters
baseRDC_SEMA42 peripheral base address.
gateNumGate number.
Return values
kStatus_SuccessRDC_SEMA42 gate is reset successfully.
kStatus_FailedSome other reset process is ongoing.
static status_t RDC_SEMA42_ResetAllGates ( RDC_SEMAPHORE_Type *  base)
inlinestatic

This function resets all RDC_SEMA42 gate to an unlocked status.

Parameters
baseRDC_SEMA42 peripheral base address.
Return values
kStatus_SuccessRDC_SEMA42 is reset successfully.
kStatus_RDC_SEMA42_ResetingSome other reset process is ongoing.