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

Overview

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

Macros

#define SEMA4_GATE_NUM_RESET_ALL   (64U)
 The number to reset all SEMA4 gates. More...
 
#define SEMA4_GATEn(base, n)   (((volatile uint8_t *)(&((base)->Gate00)))[(n)])
 SEMA4 gate n register address.
 

Functions

void SEMA4_Init (SEMA4_Type *base)
 Initializes the SEMA4 module. More...
 
void SEMA4_Deinit (SEMA4_Type *base)
 De-initializes the SEMA4 module. More...
 
status_t SEMA4_TryLock (SEMA4_Type *base, uint8_t gateNum, uint8_t procNum)
 Tries to lock the SEMA4 gate. More...
 
void SEMA4_Lock (SEMA4_Type *base, uint8_t gateNum, uint8_t procNum)
 Locks the SEMA4 gate. More...
 
static void SEMA4_Unlock (SEMA4_Type *base, uint8_t gateNum)
 Unlocks the SEMA4 gate. More...
 
static int32_t SEMA4_GetLockProc (SEMA4_Type *base, uint8_t gateNum)
 Gets the status of the SEMA4 gate. More...
 
status_t SEMA4_ResetGate (SEMA4_Type *base, uint8_t gateNum)
 Resets the SEMA4 gate to an unlocked status. More...
 
static status_t SEMA4_ResetAllGates (SEMA4_Type *base)
 Resets all SEMA4 gates to an unlocked status. More...
 
static void SEMA4_EnableGateNotifyInterrupt (SEMA4_Type *base, uint8_t procNum, uint32_t mask)
 Enable the gate notification interrupt. More...
 
static void SEMA4_DisableGateNotifyInterrupt (SEMA4_Type *base, uint8_t procNum, uint32_t mask)
 Disable the gate notification interrupt. More...
 
static uint32_t SEMA4_GetGateNotifyStatus (SEMA4_Type *base, uint8_t procNum)
 Get the gate notification flags. More...
 
status_t SEMA4_ResetGateNotify (SEMA4_Type *base, uint8_t gateNum)
 Resets the SEMA4 gate IRQ notification. More...
 
static status_t SEMA4_ResetAllGateNotify (SEMA4_Type *base)
 Resets all SEMA4 gates IRQ notification. More...
 

Driver version

#define FSL_SEMA4_DRIVER_VERSION   (MAKE_VERSION(2, 0, 2))
 SEMA4 driver version.
 

Macro Definition Documentation

#define SEMA4_GATE_NUM_RESET_ALL   (64U)

Function Documentation

void SEMA4_Init ( SEMA4_Type *  base)

This function initializes the SEMA4 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 SEMA4_ResetGate or SEMA4_ResetAllGates function.

Parameters
baseSEMA4 peripheral base address.
void SEMA4_Deinit ( SEMA4_Type *  base)

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

Parameters
baseSEMA4 peripheral base address.
status_t SEMA4_TryLock ( SEMA4_Type *  base,
uint8_t  gateNum,
uint8_t  procNum 
)

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

Parameters
baseSEMA4 peripheral base address.
gateNumGate number to lock.
procNumCurrent processor number.
Return values
kStatus_SuccessLock the sema4 gate successfully.
kStatus_FailSema4 gate has been locked by another processor.
void SEMA4_Lock ( SEMA4_Type *  base,
uint8_t  gateNum,
uint8_t  procNum 
)

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

Parameters
baseSEMA4 peripheral base address.
gateNumGate number to lock.
procNumCurrent processor number.
static void SEMA4_Unlock ( SEMA4_Type *  base,
uint8_t  gateNum 
)
inlinestatic

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

Parameters
baseSEMA4 peripheral base address.
gateNumGate number to unlock.
static int32_t SEMA4_GetLockProc ( SEMA4_Type *  base,
uint8_t  gateNum 
)
inlinestatic

This function checks the lock status of a specific SEMA4 gate.

Parameters
baseSEMA4 peripheral base address.
gateNumGate number.
Returns
Return -1 if the gate is unlocked, otherwise return the processor number which has locked the gate.
status_t SEMA4_ResetGate ( SEMA4_Type *  base,
uint8_t  gateNum 
)

This function resets a SEMA4 gate to an unlocked status.

Parameters
baseSEMA4 peripheral base address.
gateNumGate number.
Return values
kStatus_SuccessSEMA4 gate is reset successfully.
kStatus_FailSome other reset process is ongoing.
static status_t SEMA4_ResetAllGates ( SEMA4_Type *  base)
inlinestatic

This function resets all SEMA4 gate to an unlocked status.

Parameters
baseSEMA4 peripheral base address.
Return values
kStatus_SuccessSEMA4 is reset successfully.
kStatus_FailSome other reset process is ongoing.
static void SEMA4_EnableGateNotifyInterrupt ( SEMA4_Type *  base,
uint8_t  procNum,
uint32_t  mask 
)
inlinestatic

Gate notification provides such feature, when core tried to lock the gate and failed, it could get notification when the gate is idle.

Parameters
baseSEMA4 peripheral base address.
procNumCurrent processor number.
maskOR'ed value of the gate index, for example: (1<<0) | (1<<1) means gate 0 and gate 1.
static void SEMA4_DisableGateNotifyInterrupt ( SEMA4_Type *  base,
uint8_t  procNum,
uint32_t  mask 
)
inlinestatic

Gate notification provides such feature, when core tried to lock the gate and failed, it could get notification when the gate is idle.

Parameters
baseSEMA4 peripheral base address.
procNumCurrent processor number.
maskOR'ed value of the gate index, for example: (1<<0) | (1<<1) means gate 0 and gate 1.
static uint32_t SEMA4_GetGateNotifyStatus ( SEMA4_Type *  base,
uint8_t  procNum 
)
inlinestatic

Gate notification provides such feature, when core tried to lock the gate and failed, it could get notification when the gate is idle. The status flags are cleared automatically when the gate is locked by current core or locked again before the other core.

Parameters
baseSEMA4 peripheral base address.
procNumCurrent processor number.
Returns
OR'ed value of the gate index, for example: (1<<0) | (1<<1) means gate 0 and gate 1 flags are pending.
status_t SEMA4_ResetGateNotify ( SEMA4_Type *  base,
uint8_t  gateNum 
)

This function resets a SEMA4 gate IRQ notification.

Parameters
baseSEMA4 peripheral base address.
gateNumGate number.
Return values
kStatus_SuccessReset successfully.
kStatus_FailSome other reset process is ongoing.
static status_t SEMA4_ResetAllGateNotify ( SEMA4_Type *  base)
inlinestatic

This function resets all SEMA4 gate IRQ notifications.

Parameters
baseSEMA4 peripheral base address.
Return values
kStatus_SuccessReset successfully.
kStatus_FailSome other reset process is ongoing.