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.
|
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...
|
|
#define RDC_SEMA42_GATE_NUM_RESET_ALL (64U) |
#define RDC_SEMA42_GATEn |
( |
|
base, |
|
|
|
n |
|
) |
| (((volatile uint8_t *)(&((base)->GATE0)))[(n)]) |
#define RDC_SEMA42_GATE_COUNT (64U) |
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
-
base | RDC_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
-
base | RDC_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
-
base | RDC_SEMA42 peripheral base address. |
gateNum | Gate number to lock. |
masterIndex | Current processor master index. |
domainId | Current processor domain ID. |
- Return values
-
kStatus_Success | Lock the sema42 gate successfully. |
kStatus_Failed | Sema42 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
-
base | RDC_SEMA42 peripheral base address. |
gateNum | Gate number to lock. |
masterIndex | Current processor master index. |
domainId | Current 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
-
base | RDC_SEMA42 peripheral base address. |
gateNum | Gate number to unlock. |
static int32_t RDC_SEMA42_GetLockMasterIndex |
( |
RDC_SEMAPHORE_Type * |
base, |
|
|
uint8_t |
gateNum |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | RDC_SEMA42 peripheral base address. |
gateNum | Gate 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
-
base | RDC_SEMA42 peripheral base address. |
gateNum | Gate 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
-
base | RDC_SEMA42 peripheral base address. |
gateNum | Gate number. |
- Return values
-
kStatus_Success | RDC_SEMA42 gate is reset successfully. |
kStatus_Failed | Some 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
-
base | RDC_SEMA42 peripheral base address. |
- Return values
-
kStatus_Success | RDC_SEMA42 is reset successfully. |
kStatus_RDC_SEMA42_Reseting | Some other reset process is ongoing. |