MCUXpresso SDK API Reference Manual
Rev. 0
NXP Semiconductors
|
The MCUXpresso SDK provides a driver for the MU module of MCUXpresso SDK devices.
The MU driver provides these functions:
The function MU_Init() initializes the MU module and enables the MU clock. It should be called before any other MU functions.
The function MU_Deinit() deinitializes the MU module and disables the MU clock. No MU functions can be called after this function.
The MU message must be sent when the transmit register is empty. The MU driver provides blocking API and non-blocking API to send message.
The MU_SendMsgNonBlocking() function writes a message to the MU transmit register without checking the transmit register status. The upper layer should check that the transmit register is empty before calling this function. This function can be used in the ISR for better performance.
The MU_SendMsg() function is a blocking function. It waits until the transmit register is empty and sends the message.
Correspondingly, there are blocking and non-blocking APIs for receiving a message. The MU_ReadMsgNonBlocking() function is a non-blocking API. The MU_ReadMsg() function is the blocking API.
The MU driver provides 3-bit general purpose flags. When the flags are set on one side, they are reflected on the other side.
The MU flags must be set when the previous flags have been updated to the other side. The MU driver provides a non-blocking function and a blocking function. The blocking function MU_SetFlags() waits until previous flags have been updated to the other side and then sets flags. The non-blocking function sets the flags directly. Ensure that the kMU_FlagsUpdatingFlag is not pending before calling this function.
The function MU_GetFlags() gets the MU flags on the current side.
The function MU_GetStatusFlags() returns all MU status flags. Use the _mu_status_flags to check for specific flags, for example, to check RX0 and RX1 register full, use the following code:
Refer to the driver examples codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/mu The receive full flags are cleared automatically after messages are read out. The transmit empty flags are cleared automatically after new messages are written to the transmit register. The general purpose interrupt flags must be cleared manually using the function MU_ClearStatusFlags().
Refer to the driver examples codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/mu To enable or disable a specific interrupt, use MU_EnableInterrupts() and MU_DisableInterrupts() functions. The interrupts to enable or disable should be passed in as a bit mask of the _mu_interrupt_enable.
The MU_TriggerInterrupts() function triggers general purpose interrupts and NMI to the other core. The interrupts to trigger are passed in as a bit mask of the _mu_interrupt_trigger. If previously triggered interrupts have not been processed by the other side, this function returns an error.
The MU_BootCoreB() and MU_HoldCoreBReset() functions should only be used from A side. They are used to boot the core B or to hold core B in reset.
The MU_ResetBothSides() function resets MU at both A and B sides. However, only the A side can call this function.
If a core enters stop mode, the platform clock of this core is disabled by default. The function MU_SetClockOnOtherCoreEnable() forces the other core's platform clock to remain enabled even after that core has entered a stop mode. In this case, the other core's platform clock keeps running until the current core enters stop mode too.
Function MU_GetOtherCorePowerMode() gets the power mode of the other core.
Enumerations | |
enum | _mu_status_flags { kMU_Tx0EmptyFlag = (1U << (MU_SR_TEn_SHIFT + 3U)), kMU_Tx1EmptyFlag = (1U << (MU_SR_TEn_SHIFT + 2U)), kMU_Tx2EmptyFlag = (1U << (MU_SR_TEn_SHIFT + 1U)), kMU_Tx3EmptyFlag = (1U << (MU_SR_TEn_SHIFT + 0U)), kMU_Rx0FullFlag = (1U << (MU_SR_RFn_SHIFT + 3U)), kMU_Rx1FullFlag = (1U << (MU_SR_RFn_SHIFT + 2U)), kMU_Rx2FullFlag = (1U << (MU_SR_RFn_SHIFT + 1U)), kMU_Rx3FullFlag = (1U << (MU_SR_RFn_SHIFT + 0U)), kMU_GenInt0Flag = (1U << (MU_SR_GIPn_SHIFT + 3U)), kMU_GenInt1Flag = (1U << (MU_SR_GIPn_SHIFT + 2U)), kMU_GenInt2Flag = (1U << (MU_SR_GIPn_SHIFT + 1U)), kMU_GenInt3Flag = (1U << (MU_SR_GIPn_SHIFT + 0U)), kMU_EventPendingFlag = MU_SR_EP_MASK, kMU_FlagsUpdatingFlag = MU_SR_FUP_MASK, kMU_OtherSideInResetFlag = MU_SR_RS_MASK } |
MU status flags. More... | |
enum | _mu_interrupt_enable { kMU_Tx0EmptyInterruptEnable = (1U << (MU_CR_TIEn_SHIFT + 3U)), kMU_Tx1EmptyInterruptEnable = (1U << (MU_CR_TIEn_SHIFT + 2U)), kMU_Tx2EmptyInterruptEnable = (1U << (MU_CR_TIEn_SHIFT + 1U)), kMU_Tx3EmptyInterruptEnable = (1U << (MU_CR_TIEn_SHIFT + 0U)), kMU_Rx0FullInterruptEnable = (1U << (MU_CR_RIEn_SHIFT + 3U)), kMU_Rx1FullInterruptEnable = (1U << (MU_CR_RIEn_SHIFT + 2U)), kMU_Rx2FullInterruptEnable = (1U << (MU_CR_RIEn_SHIFT + 1U)), kMU_Rx3FullInterruptEnable = (1U << (MU_CR_RIEn_SHIFT + 0U)), kMU_GenInt0InterruptEnable = (int)(1U << (MU_CR_GIEn_SHIFT + 3U)), kMU_GenInt1InterruptEnable = (1U << (MU_CR_GIEn_SHIFT + 2U)), kMU_GenInt2InterruptEnable = (1U << (MU_CR_GIEn_SHIFT + 1U)), kMU_GenInt3InterruptEnable = (1U << (MU_CR_GIEn_SHIFT + 0U)) } |
MU interrupt source to enable. More... | |
enum | _mu_interrupt_trigger { kMU_GenInt0InterruptTrigger = (1U << (MU_CR_GIRn_SHIFT + 3U)), kMU_GenInt1InterruptTrigger = (1U << (MU_CR_GIRn_SHIFT + 2U)), kMU_GenInt2InterruptTrigger = (1U << (MU_CR_GIRn_SHIFT + 1U)), kMU_GenInt3InterruptTrigger = (1U << (MU_CR_GIRn_SHIFT + 0U)) } |
MU interrupt that could be triggered to the other core. More... | |
Driver version | |
#define | FSL_MU_DRIVER_VERSION (MAKE_VERSION(2, 0, 6)) |
MU driver version. More... | |
MU initialization. | |
void | MU_Init (MU_Type *base) |
Initializes the MU module. More... | |
void | MU_Deinit (MU_Type *base) |
De-initializes the MU module. More... | |
MU Message | |
static void | MU_SendMsgNonBlocking (MU_Type *base, uint32_t regIndex, uint32_t msg) |
Writes a message to the TX register. More... | |
void | MU_SendMsg (MU_Type *base, uint32_t regIndex, uint32_t msg) |
Blocks to send a message. More... | |
static uint32_t | MU_ReceiveMsgNonBlocking (MU_Type *base, uint32_t regIndex) |
Reads a message from the RX register. More... | |
uint32_t | MU_ReceiveMsg (MU_Type *base, uint32_t regIndex) |
Blocks to receive a message. More... | |
MU Flags | |
static void | MU_SetFlagsNonBlocking (MU_Type *base, uint32_t flags) |
Sets the 3-bit MU flags reflect on the other MU side. More... | |
void | MU_SetFlags (MU_Type *base, uint32_t flags) |
Blocks setting the 3-bit MU flags reflect on the other MU side. More... | |
static uint32_t | MU_GetFlags (MU_Type *base) |
Gets the current value of the 3-bit MU flags set by the other side. More... | |
Status and Interrupt. | |
static uint32_t | MU_GetStatusFlags (MU_Type *base) |
Gets the MU status flags. More... | |
static uint32_t | MU_GetInterruptsPending (MU_Type *base) |
Gets the MU IRQ pending status. More... | |
static void | MU_ClearStatusFlags (MU_Type *base, uint32_t mask) |
Clears the specific MU status flags. More... | |
static void | MU_EnableInterrupts (MU_Type *base, uint32_t mask) |
Enables the specific MU interrupts. More... | |
static void | MU_DisableInterrupts (MU_Type *base, uint32_t mask) |
Disables the specific MU interrupts. More... | |
status_t | MU_TriggerInterrupts (MU_Type *base, uint32_t mask) |
Triggers interrupts to the other core. More... | |
#define FSL_MU_DRIVER_VERSION (MAKE_VERSION(2, 0, 6)) |
enum _mu_status_flags |
enum _mu_interrupt_enable |
void MU_Init | ( | MU_Type * | base | ) |
This function enables the MU clock only.
base | MU peripheral base address. |
void MU_Deinit | ( | MU_Type * | base | ) |
This function disables the MU clock only.
base | MU peripheral base address. |
|
inlinestatic |
This function writes a message to the specific TX register. It does not check whether the TX register is empty or not. The upper layer should make sure the TX register is empty before calling this function. This function can be used in ISR for better performance.
base | MU peripheral base address. |
regIndex | TX register index. |
msg | Message to send. |
void MU_SendMsg | ( | MU_Type * | base, |
uint32_t | regIndex, | ||
uint32_t | msg | ||
) |
This function waits until the TX register is empty and sends the message.
base | MU peripheral base address. |
regIndex | TX register index. |
msg | Message to send. |
|
inlinestatic |
This function reads a message from the specific RX register. It does not check whether the RX register is full or not. The upper layer should make sure the RX register is full before calling this function. This function can be used in ISR for better performance.
base | MU peripheral base address. |
regIndex | TX register index. |
uint32_t MU_ReceiveMsg | ( | MU_Type * | base, |
uint32_t | regIndex | ||
) |
This function waits until the RX register is full and receives the message.
base | MU peripheral base address. |
regIndex | RX register index. |
|
inlinestatic |
This function sets the 3-bit MU flags directly. Every time the 3-bit MU flags are changed, the status flag kMU_FlagsUpdatingFlag
asserts indicating the 3-bit MU flags are updating to the other side. After the 3-bit MU flags are updated, the status flag kMU_FlagsUpdatingFlag
is cleared by hardware. During the flags updating period, the flags cannot be changed. The upper layer should make sure the status flag kMU_FlagsUpdatingFlag
is cleared before calling this function.
base | MU peripheral base address. |
flags | The 3-bit MU flags to set. |
void MU_SetFlags | ( | MU_Type * | base, |
uint32_t | flags | ||
) |
This function blocks setting the 3-bit MU flags. Every time the 3-bit MU flags are changed, the status flag kMU_FlagsUpdatingFlag
asserts indicating the 3-bit MU flags are updating to the other side. After the 3-bit MU flags are updated, the status flag kMU_FlagsUpdatingFlag
is cleared by hardware. During the flags updating period, the flags cannot be changed. This function waits for the MU status flag kMU_FlagsUpdatingFlag
cleared and sets the 3-bit MU flags.
base | MU peripheral base address. |
flags | The 3-bit MU flags to set. |
|
inlinestatic |
This function gets the current 3-bit MU flags on the current side.
base | MU peripheral base address. |
|
inlinestatic |
This function returns the bit mask of the MU status flags. See _mu_status_flags.
base | MU peripheral base address. |
|
inlinestatic |
This function returns the bit mask of the pending MU IRQs.
base | MU peripheral base address. |
|
inlinestatic |
This function clears the specific MU status flags. The flags to clear should be passed in as bit mask. See _mu_status_flags.
base | MU peripheral base address. |
mask | Bit mask of the MU status flags. See _mu_status_flags. The following flags are cleared by hardware, this function could not clear them.
|
|
inlinestatic |
This function enables the specific MU interrupts. The interrupts to enable should be passed in as bit mask. See _mu_interrupt_enable.
base | MU peripheral base address. |
mask | Bit mask of the MU interrupts. See _mu_interrupt_enable. |
|
inlinestatic |
This function disables the specific MU interrupts. The interrupts to disable should be passed in as bit mask. See _mu_interrupt_enable.
base | MU peripheral base address. |
mask | Bit mask of the MU interrupts. See _mu_interrupt_enable. |
status_t MU_TriggerInterrupts | ( | MU_Type * | base, |
uint32_t | mask | ||
) |
This function triggers the specific interrupts to the other core. The interrupts to trigger are passed in as bit mask. See _mu_interrupt_trigger. The MU should not trigger an interrupt to the other core when the previous interrupt has not been processed by the other core. This function checks whether the previous interrupts have been processed. If not, it returns an error.
base | MU peripheral base address. |
mask | Bit mask of the interrupts to trigger. See _mu_interrupt_trigger. |
kStatus_Success | Interrupts have been triggered successfully. |
kStatus_Fail | Previous interrupts have not been accepted. |