MCUXpresso SDK API Reference Manual
Rev 2.12.1
NXP Semiconductors
|
The MCUXpresso SDK provides a driver for the SEMA42 module of MCUXpresso SDK devices.
The SEMA42 driver is used for multicore platforms. Before using the SEMA42, call the 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 SEMA42_ResetGate() or SEMA42_ResetAllGates() functions. The function SEMA42_Deinit() deinitializes the SEMA42.
The SEMA42 provides two functions to lock the SEMA42 gate. The function SEMA42_TryLock() tries to lock the gate. If the gate has been locked by another processor, this function returns an error immediately. The function SEMA42_Lock() is a blocking method, which waits until the gate is free and locks it.
The SEMA42_Unlock() unlocks the 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 SEMA42_GetGateStatus() returns a status whether the gate is unlocked and which processor locks the gate.
The SEMA42 gate can be reset to unlock forcefully. The function SEMA42_ResetGate() resets a specific gate. The function SEMA42_ResetAllGates() resets all gates.
Refer to the driver examples codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/sema42
Macros | |
#define | SEMA42_GATE_NUM_RESET_ALL (64U) |
The number to reset all SEMA42 gates. More... | |
#define | SEMA42_GATEn(base, n) (((volatile uint8_t *)(&((base)->GATE3)))[(n) ^ 3U]) |
SEMA42 gate n register address. More... | |
Enumerations | |
enum | { kStatus_SEMA42_Busy = MAKE_STATUS(kStatusGroup_SEMA42, 0), kStatus_SEMA42_Reseting = MAKE_STATUS(kStatusGroup_SEMA42, 1) } |
SEMA42 status return codes. More... | |
enum | sema42_gate_status_t { kSEMA42_Unlocked = 0U, kSEMA42_LockedByProc0 = 1U, kSEMA42_LockedByProc1 = 2U, kSEMA42_LockedByProc2 = 3U, kSEMA42_LockedByProc3 = 4U, kSEMA42_LockedByProc4 = 5U, kSEMA42_LockedByProc5 = 6U, kSEMA42_LockedByProc6 = 7U, kSEMA42_LockedByProc7 = 8U, kSEMA42_LockedByProc8 = 9U, kSEMA42_LockedByProc9 = 10U, kSEMA42_LockedByProc10 = 11U, kSEMA42_LockedByProc11 = 12U, kSEMA42_LockedByProc12 = 13U, kSEMA42_LockedByProc13 = 14U, kSEMA42_LockedByProc14 = 15U } |
SEMA42 gate lock status. More... | |
Functions | |
void | SEMA42_Init (SEMA42_Type *base) |
Initializes the SEMA42 module. More... | |
void | SEMA42_Deinit (SEMA42_Type *base) |
De-initializes the SEMA42 module. More... | |
status_t | SEMA42_TryLock (SEMA42_Type *base, uint8_t gateNum, uint8_t procNum) |
Tries to lock the SEMA42 gate. More... | |
void | SEMA42_Lock (SEMA42_Type *base, uint8_t gateNum, uint8_t procNum) |
Locks the SEMA42 gate. More... | |
static void | SEMA42_Unlock (SEMA42_Type *base, uint8_t gateNum) |
Unlocks the SEMA42 gate. More... | |
static sema42_gate_status_t | SEMA42_GetGateStatus (SEMA42_Type *base, uint8_t gateNum) |
Gets the status of the SEMA42 gate. More... | |
status_t | SEMA42_ResetGate (SEMA42_Type *base, uint8_t gateNum) |
Resets the SEMA42 gate to an unlocked status. More... | |
static status_t | SEMA42_ResetAllGates (SEMA42_Type *base) |
Resets all SEMA42 gates to an unlocked status. More... | |
Driver version | |
#define | FSL_SEMA42_DRIVER_VERSION (MAKE_VERSION(2, 0, 3)) |
SEMA42 driver version. | |
#define SEMA42_GATE_NUM_RESET_ALL (64U) |
#define SEMA42_GATEn | ( | base, | |
n | |||
) | (((volatile uint8_t *)(&((base)->GATE3)))[(n) ^ 3U]) |
The SEMA42 gates are sorted in the order 3, 2, 1, 0, 7, 6, 5, 4, ... not in the order 0, 1, 2, 3, 4, 5, 6, 7, ... The macro SEMA42_GATEn gets the SEMA42 gate based on the gate index.
The input gate index is XOR'ed with 3U: 0 ^ 3 = 3 1 ^ 3 = 2 2 ^ 3 = 1 3 ^ 3 = 0 4 ^ 3 = 7 5 ^ 3 = 6 6 ^ 3 = 5 7 ^ 3 = 4 ...
anonymous enum |
enum sema42_gate_status_t |
void SEMA42_Init | ( | SEMA42_Type * | base | ) |
This function initializes the 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 SEMA42_ResetGate or SEMA42_ResetAllGates function.
base | SEMA42 peripheral base address. |
void SEMA42_Deinit | ( | SEMA42_Type * | base | ) |
This function de-initializes the SEMA42 module. It only disables the clock.
base | SEMA42 peripheral base address. |
status_t SEMA42_TryLock | ( | SEMA42_Type * | base, |
uint8_t | gateNum, | ||
uint8_t | procNum | ||
) |
This function tries to lock the specific SEMA42 gate. If the gate has been locked by another processor, this function returns an error code.
base | SEMA42 peripheral base address. |
gateNum | Gate number to lock. |
procNum | Current processor number. |
kStatus_Success | Lock the sema42 gate successfully. |
kStatus_SEMA42_Busy | Sema42 gate has been locked by another processor. |
void SEMA42_Lock | ( | SEMA42_Type * | base, |
uint8_t | gateNum, | ||
uint8_t | procNum | ||
) |
This function locks the specific SEMA42 gate. If the gate has been locked by other processors, this function waits until it is unlocked and then lock it.
base | SEMA42 peripheral base address. |
gateNum | Gate number to lock. |
procNum | Current processor number. |
|
inlinestatic |
This function unlocks the specific SEMA42 gate. It only writes unlock value to the SEMA42 gate register. However, it does not check whether the SEMA42 gate is locked by the current processor or not. As a result, if the SEMA42 gate is not locked by the current processor, this function has no effect.
base | SEMA42 peripheral base address. |
gateNum | Gate number to unlock. |
|
inlinestatic |
This function checks the lock status of a specific SEMA42 gate.
base | SEMA42 peripheral base address. |
gateNum | Gate number. |
status_t SEMA42_ResetGate | ( | SEMA42_Type * | base, |
uint8_t | gateNum | ||
) |
This function resets a SEMA42 gate to an unlocked status.
base | SEMA42 peripheral base address. |
gateNum | Gate number. |
kStatus_Success | SEMA42 gate is reset successfully. |
kStatus_SEMA42_Reseting | Some other reset process is ongoing. |
|
inlinestatic |
This function resets all SEMA42 gate to an unlocked status.
base | SEMA42 peripheral base address. |
kStatus_Success | SEMA42 is reset successfully. |
kStatus_SEMA42_Reseting | Some other reset process is ongoing. |