![]() |
MCUXpresso SDK API Reference Manual
Rev 2.16.000
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_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.
Enumerations | |
enum | _mu_status_flags { kMU_Tx0EmptyFlag = MU_TX_FLAG(1UL << 0U), kMU_Tx1EmptyFlag = MU_TX_FLAG(1UL << 1U), kMU_Tx2EmptyFlag = MU_TX_FLAG(1UL << 2U), kMU_Tx3EmptyFlag = MU_TX_FLAG(1UL << 3U), kMU_Rx0FullFlag = MU_RX_FLAG(1UL << 0U), kMU_Rx1FullFlag = MU_RX_FLAG(1UL << 1U), kMU_Rx2FullFlag = MU_RX_FLAG(1UL << 2U), kMU_Rx3FullFlag = MU_RX_FLAG(1UL << 3U), kMU_GenInt0Flag = MU_GI_FLAG(1UL << 0U), kMU_GenInt1Flag = MU_GI_FLAG(1UL << 1U), kMU_GenInt2Flag = MU_GI_FLAG(1UL << 2U), kMU_GenInt3Flag = MU_GI_FLAG(1UL << 3U), kMU_RxFullPendingFlag = MU_STAT_FLAG(MU_SR_RFP_MASK), kMU_TxEmptyPendingFlag = MU_STAT_FLAG(MU_SR_TEP_MASK), kMU_GenIntPendingFlag = MU_STAT_FLAG(MU_SR_GIRP_MASK), kMU_EventPendingFlag = MU_STAT_FLAG(MU_SR_EP_MASK), kMU_FlagsUpdatingFlag = MU_STAT_FLAG(MU_SR_FUP_MASK), kMU_MuInResetFlag = MU_STAT_FLAG(MU_SR_MURS_MASK), kMU_MuResetInterruptFlag = MU_STAT_FLAG(MU_SR_MURIP_MASK), kMU_OtherSideEnterRunInterruptFlag = MU_CORE_FLAG(MU_CSSR0_RUN_MASK), kMU_OtherSideEnterHaltInterruptFlag = MU_CORE_FLAG(MU_CSSR0_HALT_MASK), kMU_OtherSideEnterWaitInterruptFlag = MU_CORE_FLAG(MU_CSSR0_WAIT_MASK), kMU_OtherSideEnterStopInterruptFlag = MU_CORE_FLAG(MU_CSSR0_STOP_MASK), kMU_OtherSideEnterPowerDownInterruptFlag = MU_CORE_FLAG(MU_CSSR0_PD_MASK), kMU_ResetAssertInterruptFlag = MU_CORE_FLAG(MU_CSSR0_RAIP_MASK) } |
MU status flags. More... | |
enum | _mu_interrupt_enable { kMU_Tx0EmptyInterruptEnable = MU_TX_INTR(1UL << 0U), kMU_Tx1EmptyInterruptEnable = MU_TX_INTR(1UL << 1U), kMU_Tx2EmptyInterruptEnable = MU_TX_INTR(1UL << 2U), kMU_Tx3EmptyInterruptEnable = MU_TX_INTR(1UL << 3U), kMU_Rx0FullInterruptEnable = MU_RX_INTR(1UL << 0U), kMU_Rx1FullInterruptEnable = MU_RX_INTR(1UL << 1U), kMU_Rx2FullInterruptEnable = MU_RX_INTR(1UL << 2U), kMU_Rx3FullInterruptEnable = MU_RX_INTR(1UL << 3U), kMU_GenInt0InterruptEnable = MU_GI_INTR(1UL << 0U), kMU_GenInt1InterruptEnable = MU_GI_INTR(1UL << 1U), kMU_GenInt2InterruptEnable = MU_GI_INTR(1UL << 2U), kMU_GenInt3InterruptEnable = MU_GI_INTR(1UL << 3U), kMU_OtherSideEnterRunInterruptEnable = MU_CORE_INTR(MU_CIER0_RUNIE_MASK), kMU_OtherSideEnterHaltInterruptEnable = MU_CORE_INTR(MU_CIER0_HALTIE_MASK), kMU_OtherSideEnterWaitInterruptEnable = MU_CORE_INTR(MU_CIER0_WAITIE_MASK), kMU_OtherSideEnterStopInterruptEnable = MU_CORE_INTR(MU_CIER0_STOPIE_MASK), kMU_OtherSideEnterPowerDownInterruptEnable = MU_CORE_INTR(MU_CIER0_PDIE_MASK), kMU_ResetAssertInterruptEnable = MU_CORE_INTR(MU_CIER0_RAIE_MASK), kMU_MuResetInterruptEnable = MU_MISC_INTR(MU_CR_MURIE_MASK) } |
MU interrupt source to enable. More... | |
enum | _mu_interrupt_trigger { kMU_GenInt0InterruptTrigger = MU_GI_INTR(1UL << 0U), kMU_GenInt1InterruptTrigger = MU_GI_INTR(1UL << 1U), kMU_GenInt2InterruptTrigger = MU_GI_INTR(1UL << 2U), kMU_GenInt3InterruptTrigger = MU_GI_INTR(1UL << 3U) } |
MU interrupt that could be triggered to the other core. More... | |
enum | _mu_core_status_flags { kMU_OtherSideEnterRunFlag = MU_CSSR0_RUN_MASK, kMU_OtherSideEnterHaltFlag = MU_CSSR0_HALT_MASK, kMU_OtherSideEnterWaitFlag = MU_CSSR0_WAIT_MASK, kMU_OtherSideEnterStopFlag = MU_CSSR0_STOP_MASK, kMU_OtherSideEnterPowerDownFlag = MU_CSSR0_PD_MASK, kMU_OtherSideEnterResetFlag = MU_CSSR0_RAIP_MASK } |
MU core status flags. More... | |
enum | mu_msg_reg_index_t { kMU_MsgReg0 = 0, kMU_MsgReg1, kMU_MsgReg2, kMU_MsgReg3 } |
MU message register index. More... | |
enum | mu_core_boot_mode_t { kMU_CoreBootModeDummy = 0x0U } |
The other core boot mode. More... | |
enum | mu_general_purpose_interrupt_t { kMU_GeneralPurposeInterrupt0 = 1UL << 0U, kMU_GeneralPurposeInterrupt1 = 1UL << 1U, kMU_GeneralPurposeInterrupt2 = 1UL << 2U, kMU_GeneralPurposeInterrupt3 = 1UL << 3U } |
MU general purpose interrupts. More... | |
Driver version | |
#define | FSL_MU_DRIVER_VERSION (MAKE_VERSION(2, 5, 1)) |
MU driver version. More... | |
MU instance. | |
uint32_t | MU_GetInstance (MU_Type *base) |
Get the MU instance index. 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_GetCoreStatusFlags (MU_Type *base) |
Gets the MU core status flags. More... | |
uint32_t | MU_GetStatusFlags (MU_Type *base) |
Gets the MU status flags. More... | |
static void | MU_ClearStatusFlags (MU_Type *base, uint32_t flags) |
Clears the specific MU status flags. More... | |
static void | MU_EnableInterrupts (MU_Type *base, uint32_t interrupts) |
Enables the specific MU interrupts. More... | |
static void | MU_DisableInterrupts (MU_Type *base, uint32_t interrupts) |
Disables the specific MU interrupts. More... | |
status_t | MU_TriggerInterrupts (MU_Type *base, uint32_t interrupts) |
Triggers interrupts to the other core. More... | |
status_t | MU_TriggerNmi (MU_Type *base) |
Triggers NMI to the other core. More... | |
static void | MU_ClearNmi (MU_Type *base) |
Clear non-maskable interrupt (NMI) sent by the other core. More... | |
MU general purpose interrupt | |
static void | MU_EnableGeneralPurposeInterrupts (MU_Type *base, uint32_t interrupts) |
Enables the MU general purpose interrupts. More... | |
static void | MU_DisableGeneralPurposeInterrupts (MU_Type *base, uint32_t interrupts) |
Disables the MU general purpose interrupts. More... | |
static uint32_t | MU_GetGeneralPurposeStatusFlags (MU_Type *base) |
Gets the MU general purpose interrupt status flags. More... | |
static void | MU_ClearGeneralPurposeStatusFlags (MU_Type *base, uint32_t flags) |
Clear the MU general purpose interrupt status flags. More... | |
status_t | MU_TriggerGeneralPurposeInterrupts (MU_Type *base, uint32_t interrupts) |
Triggers general purpose interrupts to the other core. More... | |
MU misc functions | |
static void | MU_ResetBothSides (MU_Type *base) |
Resets the MU for both A side and B side. More... | |
#define FSL_MU_DRIVER_VERSION (MAKE_VERSION(2, 5, 1)) |
enum _mu_status_flags |
enum _mu_interrupt_enable |
enum mu_msg_reg_index_t |
enum mu_core_boot_mode_t |
uint32_t MU_GetInstance | ( | MU_Type * | base | ) |
base | MU peripheral base address. |
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, see mu_msg_reg_index_t. |
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 | MU message register, see mu_msg_reg_index_t. |
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 | RX register index, see mu_msg_reg_index_t. |
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 | MU message register, see mu_msg_reg_index_t |
|
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 |
base | MU peripheral base address. |
uint32_t MU_GetStatusFlags | ( | MU_Type * | base | ) |
This function returns the bit mask of the MU status flags. See _mu_status_flags.
If there are more than 4 general purpose interrupts, use MU_GetGeneralPurposeStatusFlags.
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.
If there are more than 4 general purpose interrupts, use MU_ClearGeneralPurposeStatusFlags.
base | MU peripheral base address. |
flags | Bit mask of the MU status flags. See _mu_status_flags. Only the following flags can be cleared by software, other flags are cleared by hardware:
|
|
inlinestatic |
This function enables the specific MU interrupts. The interrupts to enable should be passed in as bit mask. See _mu_interrupt_enable.
If there are more than 4 general purpose interrupts, use MU_EnableGeneralPurposeInterrupts.
base | MU peripheral base address. |
interrupts | 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.
If there are more than 4 general purpose interrupts, use MU_DisableGeneralPurposeInterrupts.
base | MU peripheral base address. |
interrupts | Bit mask of the MU interrupts. See _mu_interrupt_enable. |
status_t MU_TriggerInterrupts | ( | MU_Type * | base, |
uint32_t | interrupts | ||
) |
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.
If there are more than 4 general purpose interrupts, use MU_TriggerGeneralPurposeInterrupts.
base | MU peripheral base address. |
interrupts | 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. |
status_t MU_TriggerNmi | ( | MU_Type * | base | ) |
This function triggers the NMI to the other core. The MU should not trigger NMI 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. |
kStatus_Success | Interrupts have been triggered successfully. |
kStatus_Fail | Previous interrupts have not been accepted. |
|
inlinestatic |
This function clears non-maskable interrupt (NMI) sent by the other core.
base | MU peripheral base address. |
|
inlinestatic |
This function enables the MU general purpose interrupts. The interrupts to enable should be passed in as bit mask of mu_general_purpose_interrupt_t. The function MU_EnableInterrupts only support general interrupt 0~3, this function supports all general interrupts.
For example, to enable general purpose interrupt 0 and 3, use like this:
base | MU peripheral base address. |
interrupts | Bit mask of the MU general purpose interrupts, see mu_general_purpose_interrupt_t. |
|
inlinestatic |
This function disables the MU general purpose interrupts. The interrupts to disable should be passed in as bit mask of mu_general_purpose_interrupt_t. The function MU_DisableInterrupts only support general interrupt 0~3, this function supports all general interrupts.
For example, to disable general purpose interrupt 0 and 3, use like this:
base | MU peripheral base address. |
interrupts | Bit mask of the MU general purpose interrupts. see mu_general_purpose_interrupt_t. |
|
inlinestatic |
This function returns the bit mask of the MU general purpose interrupt status flags. MU_GetStatusFlags can only get general purpose interrupt status 0~3, this function can get all general purpose interrupts status.
This example shows to check whether general purpose interrupt 0 and 3 happened.
base | MU peripheral base address. |
|
inlinestatic |
This function clears the specific MU general purpose interrupt status flags. The flags to clear should be passed in as bit mask. mu_general_purpose_interrupt_t_mu_status_flags.
Example to clear general purpose interrupt 0 and general interrupt 1 pending flags.
base | MU peripheral base address. |
flags | Bit mask of the MU general purpose interrupt status flags. See mu_general_purpose_interrupt_t. |
status_t MU_TriggerGeneralPurposeInterrupts | ( | MU_Type * | base, |
uint32_t | interrupts | ||
) |
This function triggers the specific general purpose interrupts to the other core. The interrupts to trigger are passed in as bit mask. See mu_general_purpose_interrupt_t. 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. |
interrupts | Bit mask of the interrupts to trigger. See mu_general_purpose_interrupt_t. |
kStatus_Success | Interrupts have been triggered successfully. |
kStatus_Fail | Previous interrupts have not been accepted. |
|
inlinestatic |
This function resets the MU for both A side and B side. Before reset, it is recommended to interrupt processor B, because this function may affect the ongoing processor B programs.
base | MU peripheral base address. |