11#include "fsl_common.h"
24#define MU_CR_NMI_MASK 0U
27#if (defined(FSL_FEATURE_MU_HAS_RESET_INT) && FSL_FEATURE_MU_HAS_RESET_INT)
29#ifndef FSL_FEATURE_MU_HAS_RESET_ASSERT_INT
30#define FSL_FEATURE_MU_HAS_RESET_ASSERT_INT 1
33#ifndef FSL_FEATURE_MU_HAS_RESET_DEASSERT_INT
34#define FSL_FEATURE_MU_HAS_RESET_DEASSERT_INT 1
42#define FSL_MU_DRIVER_VERSION (MAKE_VERSION(2, 1, 1))
68#if (defined(FSL_FEATURE_MU_HAS_RESET_ASSERT_INT) && FSL_FEATURE_MU_HAS_RESET_ASSERT_INT)
69 kMU_ResetAssertInterruptFlag = MU_SR_RAIP_MASK,
71#if (defined(FSL_FEATURE_MU_HAS_RESET_DEASSERT_INT) && FSL_FEATURE_MU_HAS_RESET_DEASSERT_INT)
72 kMU_ResetDeassertInterruptFlag = MU_SR_RDIP_MASK,
75#if (defined(FSL_FEATURE_MU_HAS_SR_RS) && FSL_FEATURE_MU_HAS_SR_RS)
76 kMU_OtherSideInResetFlag = MU_SR_RS_MASK,
79#if (defined(FSL_FEATURE_MU_HAS_SR_MURIP) && FSL_FEATURE_MU_HAS_SR_MURIP)
80 kMU_MuResetInterruptFlag = MU_SR_MURIP_MASK,
82#if (defined(FSL_FEATURE_MU_HAS_SR_HRIP) && FSL_FEATURE_MU_HAS_SR_HRIP)
83 kMU_HardwareResetInterruptFlag = MU_SR_HRIP_MASK,
107#
if (defined(FSL_FEATURE_MU_HAS_RESET_ASSERT_INT) && FSL_FEATURE_MU_HAS_RESET_ASSERT_INT)
108 kMU_ResetAssertInterruptEnable = MU_CR_RAIE_MASK,
110#
if (defined(FSL_FEATURE_MU_HAS_RESET_DEASSERT_INT) && FSL_FEATURE_MU_HAS_RESET_ASSERT_INT)
111 kMU_ResetDeassertInterruptEnable = MU_CR_RDIE_MASK,
113#
if (defined(FSL_FEATURE_MU_HAS_SR_MURIP) && FSL_FEATURE_MU_HAS_SR_MURIP)
114 kMU_MuResetInterruptEnable = MU_CR_MURIE_MASK,
119#
if (defined(FSL_FEATURE_MU_HAS_SR_HRIP) && FSL_FEATURE_MU_HAS_SR_HRIP)
120 kMU_HardwareResetInterruptEnable = MU_CR_HRIE_MASK,
129#if !(defined(FSL_FEATURE_MU_NO_NMI) && FSL_FEATURE_MU_NO_NMI)
153#if defined(__cplusplus)
203static inline void MU_SendMsgNonBlocking(
MU_Type *base, uint32_t regIndex, uint32_t
msg)
205 assert(regIndex < MU_TR_COUNT);
207 base->TR[regIndex] =
msg;
242static inline uint32_t MU_ReceiveMsgNonBlocking(
MU_Type *base, uint32_t regIndex)
244 assert(regIndex < MU_TR_COUNT);
246 return base->RR[regIndex];
288static inline void MU_SetFlagsNonBlocking(
MU_Type *base, uint32_t flags)
290 uint32_t reg = base->CR;
291 reg = (reg & ~((MU_CR_GIRn_MASK | MU_CR_NMI_MASK) | MU_CR_Fn_MASK)) |
MU_CR_Fn(flags);
318static inline uint32_t MU_GetFlags(
MU_Type *base)
320 return (base->SR & MU_SR_Fn_MASK) >> MU_SR_Fn_SHIFT;
353static inline uint32_t MU_GetStatusFlags(
MU_Type *base)
355 return (base->SR & (MU_SR_TEn_MASK | MU_SR_RFn_MASK | MU_SR_GIPn_MASK | MU_SR_EP_MASK | MU_SR_FUP_MASK
356#if (defined(FSL_FEATURE_MU_HAS_SR_RS) && FSL_FEATURE_MU_HAS_SR_RS)
359#
if (defined(FSL_FEATURE_MU_HAS_RESET_ASSERT_INT) && FSL_FEATURE_MU_HAS_RESET_ASSERT_INT)
362#
if (defined(FSL_FEATURE_MU_HAS_RESET_DEASSERT_INT) && FSL_FEATURE_MU_HAS_RESET_ASSERT_INT)
365#
if (defined(FSL_FEATURE_MU_HAS_SR_MURIP) && FSL_FEATURE_MU_HAS_SR_MURIP)
368#
if (defined(FSL_FEATURE_MU_HAS_SR_HRIP) && FSL_FEATURE_MU_HAS_SR_HRIP)
382static inline uint32_t MU_GetInterruptsPending(
MU_Type *base)
384 uint32_t irqMask = base->CR & (MU_CR_GIEn_MASK | MU_CR_TIEn_MASK | MU_CR_RIEn_MASK);
385 return (base->SR & irqMask);
414static inline void MU_ClearStatusFlags(
MU_Type *base, uint32_t mask)
417 uint32_t regMask = MU_SR_GIPn_MASK;
419#if (defined(FSL_FEATURE_MU_HAS_RESET_ASSERT_INT) && FSL_FEATURE_MU_HAS_RESET_ASSERT_INT)
420 regMask |= MU_SR_RAIP_MASK;
422#if (defined(FSL_FEATURE_MU_HAS_RESET_DEASSERT_INT) && FSL_FEATURE_MU_HAS_RESET_ASSERT_INT)
423 regMask |= MU_SR_RDIP_MASK;
426#if (defined(FSL_FEATURE_MU_HAS_SR_MURIP) && FSL_FEATURE_MU_HAS_SR_MURIP)
427 regMask |= MU_SR_MURIP_MASK;
430#if (defined(FSL_FEATURE_MU_HAS_SR_HRIP) && FSL_FEATURE_MU_HAS_SR_HRIP)
431 regMask |= MU_SR_HRIP_MASK;
434 base->SR = (mask & regMask);
451static inline void MU_EnableInterrupts(
MU_Type *base, uint32_t mask)
453 uint32_t reg = base->CR;
454 reg = (reg & ~(MU_CR_GIRn_MASK | MU_CR_NMI_MASK)) | mask;
472static inline void MU_DisableInterrupts(
MU_Type *base, uint32_t mask)
474 uint32_t reg = base->CR;
475 reg &= ~((MU_CR_GIRn_MASK | MU_CR_NMI_MASK) | mask);
503#if !(defined(FSL_FEATURE_MU_NO_NMI) && FSL_FEATURE_MU_NO_NMI)
511static inline void MU_ClearNmi(
MU_Type *base)
513 base->SR = MU_SR_NMIC_MASK;
524#if !(defined(FSL_FEATURE_MU_NO_RSTH) && FSL_FEATURE_MU_NO_RSTH)
545static inline void MU_HoldCoreBReset(
MU_Type *base)
547#if (defined(FSL_FEATURE_MU_HAS_CCR) && FSL_FEATURE_MU_HAS_CCR)
548 base->CCR |= MU_CCR_RSTH_MASK;
550 uint32_t reg = base->CR;
551 reg = (reg & ~(MU_CR_GIRn_MASK | MU_CR_NMI_MASK)) | MU_CR_RSTH_MASK;
573static inline void MU_HoldOtherCoreReset(
MU_Type *base)
579 MU_HoldCoreBReset(base);
583#if !(defined(FSL_FEATURE_MU_NO_MUR) && FSL_FEATURE_MU_NO_MUR)
595static inline void MU_ResetBothSides(
MU_Type *base)
597 uint32_t reg = base->CR;
598 reg = (reg & ~(MU_CR_GIRn_MASK | MU_CR_NMI_MASK)) | MU_CR_MUR_MASK;
601#if (defined(FSL_FEATURE_MU_HAS_SR_RS) && FSL_FEATURE_MU_HAS_SR_RS)
603 while (0U != (base->SR & MU_SR_RS_MASK))
610#if (defined(FSL_FEATURE_MU_HAS_HRM) && FSL_FEATURE_MU_HAS_HRM)
620static inline void MU_MaskHardwareReset(
MU_Type *base,
bool mask)
622#if (defined(FSL_FEATURE_MU_HAS_CCR) && FSL_FEATURE_MU_HAS_CCR)
625 base->CCR |= MU_CCR_HRM_MASK;
629 base->CCR &= ~MU_CCR_HRM_MASK;
634 base->CR |= MU_CR_HRM_MASK;
638 base->CR &= ~MU_CR_HRM_MASK;
644#if !(defined(FSL_FEATURE_MU_NO_HR) && FSL_FEATURE_MU_NO_HR)
685#if !(defined(FSL_FEATURE_MU_NO_CLKE) && FSL_FEATURE_MU_NO_CLKE)
698static inline void MU_SetClockOnOtherCoreEnable(
MU_Type *base,
bool enable)
700#if (defined(FSL_FEATURE_MU_HAS_CCR) && FSL_FEATURE_MU_HAS_CCR)
703 base->CCR |= MU_CCR_CLKE_MASK;
707 base->CCR &= ~MU_CCR_CLKE_MASK;
710 uint32_t reg = base->CR;
712 reg &= ~(MU_CR_GIRn_MASK | MU_CR_NMI_MASK);
716 reg |= MU_CR_CLKE_MASK;
720 reg &= ~MU_CR_CLKE_MASK;
728#if !(defined(FSL_FEATURE_MU_NO_PM) && FSL_FEATURE_MU_NO_PM)
737static inline mu_power_mode_t MU_GetOtherCorePowerMode(
MU_Type *base)
739 uint32_t ret = (base->SR & MU_SR_PM_MASK) >> MU_SR_PM_SHIFT;
741 return (mu_power_mode_t)ret;
747#if defined(__cplusplus)
#define MU_CR_Fn(x)
Definition: MIMXRT1166_cm4.h:64115
int32_t status_t
Type used for all status and error return values.
Definition: fsl_common.h:225
void MU_HardwareResetOtherCore(MU_Type *base, bool waitReset, bool holdReset, mu_core_boot_mode_t bootMode)
Hardware reset the other core.
Definition: fsl_mu.c:358
status_t MU_TriggerInterrupts(MU_Type *base, uint32_t mask)
Triggers interrupts to the other core.
Definition: fsl_mu.c:165
uint32_t MU_ReceiveMsg(MU_Type *base, uint32_t regIndex)
Blocks to receive a message.
Definition: fsl_mu.c:106
void MU_SetFlags(MU_Type *base, uint32_t flags)
Blocks setting the 3-bit MU flags reflect on the other MU side.
Definition: fsl_mu.c:132
_mu_interrupt_trigger
MU interrupt that could be triggered to the other core.
Definition: fsl_mu.h:128
void MU_Init(MU_Type *base)
Initializes the MU module.
Definition: fsl_mu.c:54
void MU_BootCoreB(MU_Type *base, mu_core_boot_mode_t mode)
Boots the core at B side.
Definition: fsl_mu.c:197
void MU_BootOtherCore(MU_Type *base, mu_core_boot_mode_t mode)
Boots the other core.
Definition: fsl_mu.c:228
_mu_msg_reg_index
MU message register.
Definition: fsl_mu.h:142
void MU_Deinit(MU_Type *base)
De-initializes the MU module.
Definition: fsl_mu.c:68
_mu_interrupt_enable
MU interrupt source to enable.
Definition: fsl_mu.h:91
enum _mu_msg_reg_index mu_msg_reg_index_t
MU message register.
_mu_status_flags
MU status flags.
Definition: fsl_mu.h:49
void MU_SendMsg(MU_Type *base, uint32_t regIndex, uint32_t msg)
Blocks to send a message.
Definition: fsl_mu.c:84
@ kMU_GenInt2InterruptTrigger
Definition: fsl_mu.h:134
@ kMU_GenInt0InterruptTrigger
Definition: fsl_mu.h:132
@ kMU_NmiInterruptTrigger
Definition: fsl_mu.h:130
@ kMU_GenInt3InterruptTrigger
Definition: fsl_mu.h:135
@ kMU_GenInt1InterruptTrigger
Definition: fsl_mu.h:133
@ kMU_GenInt1InterruptEnable
Definition: fsl_mu.h:103
@ kMU_Tx0EmptyInterruptEnable
Definition: fsl_mu.h:92
@ kMU_Rx2FullInterruptEnable
Definition: fsl_mu.h:99
@ kMU_Rx3FullInterruptEnable
Definition: fsl_mu.h:100
@ kMU_Rx0FullInterruptEnable
Definition: fsl_mu.h:97
@ kMU_Tx2EmptyInterruptEnable
Definition: fsl_mu.h:94
@ kMU_Tx3EmptyInterruptEnable
Definition: fsl_mu.h:95
@ kMU_Tx1EmptyInterruptEnable
Definition: fsl_mu.h:93
@ kMU_GenInt2InterruptEnable
Definition: fsl_mu.h:104
@ kMU_GenInt3InterruptEnable
Definition: fsl_mu.h:105
@ kMU_Rx1FullInterruptEnable
Definition: fsl_mu.h:98
@ kMU_GenInt0InterruptEnable
Definition: fsl_mu.h:102
@ kMU_Tx1EmptyFlag
Definition: fsl_mu.h:51
@ kMU_GenInt2Flag
Definition: fsl_mu.h:62
@ kMU_FlagsUpdatingFlag
Definition: fsl_mu.h:66
@ kMU_Rx0FullFlag
Definition: fsl_mu.h:55
@ kMU_Rx2FullFlag
Definition: fsl_mu.h:57
@ kMU_GenInt0Flag
Definition: fsl_mu.h:60
@ kMU_Rx3FullFlag
Definition: fsl_mu.h:58
@ kMU_Tx2EmptyFlag
Definition: fsl_mu.h:52
@ kMU_GenInt1Flag
Definition: fsl_mu.h:61
@ kMU_GenInt3Flag
Definition: fsl_mu.h:63
@ kMU_Tx0EmptyFlag
Definition: fsl_mu.h:50
@ kMU_Tx3EmptyFlag
Definition: fsl_mu.h:53
@ kMU_EventPendingFlag
Definition: fsl_mu.h:65
@ kMU_Rx1FullFlag
Definition: fsl_mu.h:56
Definition: MIMXRT1166_cm4.h:64004
Definition: b1553brm.c:94