/*FUNCTION**********************************************************************
 *
 * Function Name : CLOCK_SYS_OscDeinit
 * Description   : Deinitialize OSC.
 *
 *END**************************************************************************/
void CLOCK_SYS_OscDeinit(uint32_t instance)
{
    assert(instance < OSC_INSTANCE_COUNT);
    OSC_HAL_SetExternalRefClkInStopModeCmd(g_oscBase[instance], false);
    OSC_HAL_SetExternalRefClkCmd(g_oscBase[instance], false);

#if (defined(FSL_FEATURE_MCG_HAS_OSC1) && (1U == FSL_FEATURE_MCG_HAS_OSC1))
    if (0U == instance)
    {
#endif
        CLOCK_HAL_SetOsc0Mode(MCG,
                              kOscRangeLow,
                              kOscGainLow,
                              kOscSrcExt);
        g_xtal0ClkFreq = 0U;
#if (defined(FSL_FEATURE_MCG_HAS_OSC1) && (1U == FSL_FEATURE_MCG_HAS_OSC1))
    }
    else
    {
        CLOCK_HAL_SetOsc1Mode(MCG,
                              kOscRangeLow,
                              kOscGainLow,
                              kOscSrcExt);
        g_xtal1ClkFreq = 0U;
    }
#endif
}
/*FUNCTION**********************************************************************
 *
 * Function Name : CLOCK_SYS_SetOscerConfigration
 * Description   : This funtion sets the OSCERCLK for clock transition.
 *
 *END**************************************************************************/
static void CLOCK_SYS_SetOscerConfigration(uint32_t instance,
                                           oscer_config_t const *oscerConfig)
{
    OSC_HAL_SetExternalRefClkCmd(g_oscBaseAddr[instance],
                                 oscerConfig->Enable);

    OSC_HAL_SetExternalRefClkInStopModeCmd(g_oscBaseAddr[instance],
                                           oscerConfig->EnableInStop);
}
Beispiel #3
0
void enable_unused_pins(void)
{
  /* Enable debug pins when MCU sleeps */
  setup_debug_pins(kPortMuxAlt7);

  /* Enable uart pins */
   setup_uart_pins(kPortMuxAlt3);

   OSC_HAL_SetExternalRefClkInStopModeCmd(OSC_BASE_PTR, true);

}
/*FUNCTION**********************************************************************
 *
 * Function Name : CLOCK_SYS_SetOscerConfigration
 * Description   : This funtion sets the OSCERCLK for clock transition.
 *
 *END**************************************************************************/
void CLOCK_SYS_SetOscerConfigration(uint32_t instance, oscer_config_t const *config)
{
#if FSL_FEATURE_OSC_HAS_EXT_REF_CLOCK_DIVIDER
    OSC_HAL_SetExternalRefClkDiv(g_oscBase[instance],
                                 config->erclkDiv);
#endif

    OSC_HAL_SetExternalRefClkCmd(g_oscBase[instance],
                                 config->enable);

    OSC_HAL_SetExternalRefClkInStopModeCmd(g_oscBase[instance],
                                           config->enableInStop);
}
/*FUNCTION**********************************************************************
 *
 * Function Name : CLOCK_SYS_OscDeinit
 * Description   : Deinitialize OSC.
 *
 *END**************************************************************************/
void CLOCK_SYS_OscDeinit(uint32_t instance)
{
    assert(instance < OSC_INSTANCE_COUNT);

    OSC_HAL_SetExternalRefClkInStopModeCmd(g_oscBase[instance], false);
    OSC_HAL_SetExternalRefClkCmd(g_oscBase[instance], false);
    CLOCK_HAL_SetExtRefSelMode0(MCG, kOscSrcExt);
#if FSL_FEATURE_MCGLITE_HAS_RANGE0
    CLOCK_HAL_SetRange0Mode(MCG, kOscRangeLow);
#endif
#if FSL_FEATURE_MCGLITE_HAS_HGO0
    CLOCK_HAL_SetHighGainOsc0Mode(MCG, kOscGainLow);
#endif

    g_xtal0ClkFreq = 0U;
}
Beispiel #6
0
void disable_unused_pins(void)
{
  /* Disable debug pins when MCU sleeps */
   setup_debug_pins(kPortPinDisabled);

  /* Disable uart pins */
    setup_uart_pins(kPortMuxAsGpio);

    GPIO_HAL_SetPinDir(GPIOE, 0, kGpioDigitalInput);
    PORT_HAL_SetPullCmd(PORTE, 0, true);
    PORT_HAL_SetPullMode(PORTE, 0, kPortPullUp);

    GPIO_HAL_SetPinDir(GPIOE, 1, kGpioDigitalInput);
    PORT_HAL_SetPullCmd(PORTE, 1, true);
    PORT_HAL_SetPullMode(PORTE, 1, kPortPullUp);

    OSC_HAL_SetExternalRefClkInStopModeCmd(OSC_BASE_PTR, false);
}