emlib/src/em_cmu.c
void CMU_HFXOAutostartEnable(uint32_t userSel,
                             bool enEM0EM1Start,
                             bool enEM0EM1StartSel)
{
  uint32_t hfxoFreq;
  uint32_t hfxoCtrl;

  /* Mask supported enable bits. */
#if defined(_CMU_HFXOCTRL_AUTOSTARTRDYSELRAC_MASK)
  userSel &= _CMU_HFXOCTRL_AUTOSTARTRDYSELRAC_MASK;
#else
  userSel = 0;
#endif

  hfxoCtrl = CMU->HFXOCTRL & ~(userSel
                               | _CMU_HFXOCTRL_AUTOSTARTEM0EM1_MASK
                               | _CMU_HFXOCTRL_AUTOSTARTSELEM0EM1_MASK);

  hfxoCtrl |= userSel
              | (enEM0EM1Start ? CMU_HFXOCTRL_AUTOSTARTEM0EM1 : 0)
              | (enEM0EM1StartSel ? CMU_HFXOCTRL_AUTOSTARTSELEM0EM1 : 0);

  /* Set wait-states for HFXO if automatic start and select is configured. */
  if (userSel || enEM0EM1StartSel) {
    hfxoFreq = SystemHFXOClockGet();
    CMU_UpdateWaitStates(hfxoFreq, VSCALE_DEFAULT);
    setHfLeConfig(hfxoFreq);
  }

  /* Update HFXOCTRL after wait-states are updated as HF may automatically switch
     to HFXO when automatic select is enabled . */
  CMU->HFXOCTRL = hfxoCtrl;
}
/***************************************************************************/
/**
 * @brief
 *   Enable or disable HFXO autostart
 *
 * @param[in] userSel
 *   Additional user specified enable bit.
 *
 * @param[in] enEM0EM1Start
 *   If true, HFXO is automatically started upon entering EM0/EM1 entry from
 *   EM2/EM3. HFXO selection has to be handled by the user.
 *   If false, HFXO is not started automatically when entering EM0/EM1.
 *
 * @param[in] enEM0EM1StartSel
 *   If true, HFXO is automatically started and immediately selected upon
 *   entering EM0/EM1 entry from EM2/EM3. Note that this option stalls the use of
 *   HFSRCCLK until HFXO becomes ready.
 *   If false, HFXO is not started or selected automatically when entering
 *   EM0/EM1.
 ******************************************************************************/
@brief
Enable or disable HFXO autostart

@param[in] userSel
Additional user specified enable bit.

@param[in] enEM0EM1Start
If true, HFXO is automatically started upon entering EM0/EM1 entry from
EM2/EM3. HFXO selection has to be handled by the user.
If false, HFXO is not started automatically when entering EM0/EM1.

@param[in] enEM0EM1StartSel
If true, HFXO is automatically started and immediately selected upon
entering EM0/EM1 entry from EM2/EM3. Note that this option stalls the use of
HFSRCCLK until HFXO becomes ready.
If false, HFXO is not started or selected automatically when entering
EM0/EM1.
@brief Enable or disable HFXO autostart @param [ in ] userSel Additional user specified enable bit . @param [ in ] enEM0EM1Start If true HFXO is automatically started upon entering EM0 / EM1 entry from EM2 / EM3 . HFXO selection has to be handled by the user . If false HFXO is not started automatically when entering EM0 / EM1 . @param [ in ] enEM0EM1StartSel If true HFXO is automatically started and immediately selected upon entering EM0 / EM1 entry from EM2 / EM3 . Note that this option stalls the use of HFSRCCLK until HFXO becomes ready . If false HFXO is not started or selected automatically when entering EM0 / EM1 .
void CMU_HFXOAutostartEnable(uint32_t userSel,
                             bool enEM0EM1Start,
                             bool enEM0EM1StartSel)
{
  uint32_t hfxoFreq;
  uint32_t hfxoCtrl;
#if defined(_CMU_HFXOCTRL_AUTOSTARTRDYSELRAC_MASK)
  userSel &= _CMU_HFXOCTRL_AUTOSTARTRDYSELRAC_MASK;
#else
  userSel = 0;
#endif
  hfxoCtrl = CMU->HFXOCTRL & ~(userSel
                               | _CMU_HFXOCTRL_AUTOSTARTEM0EM1_MASK
                               | _CMU_HFXOCTRL_AUTOSTARTSELEM0EM1_MASK);
  hfxoCtrl |= userSel
              | (enEM0EM1Start ? CMU_HFXOCTRL_AUTOSTARTEM0EM1 : 0)
              | (enEM0EM1StartSel ? CMU_HFXOCTRL_AUTOSTARTSELEM0EM1 : 0);
  if (userSel || enEM0EM1StartSel) {
    hfxoFreq = SystemHFXOClockGet();
    CMU_UpdateWaitStates(hfxoFreq, VSCALE_DEFAULT);
    setHfLeConfig(hfxoFreq);
  }
  CMU->HFXOCTRL = hfxoCtrl;
}
void CMU_HFXOAutostartEnable ( uint32_t userSel , bool enEM0EM1Start , bool enEM0EM1StartSel ) { uint32_t hfxoFreq ; uint32_t hfxoCtrl ; #if defined ( _CMU_HFXOCTRL_AUTOSTARTRDYSELRAC_MASK ) userSel &= _CMU_HFXOCTRL_AUTOSTARTRDYSELRAC_MASK ; #else userSel = 0 ; #endif hfxoCtrl = CMU -> HFXOCTRL & ~ ( userSel | _CMU_HFXOCTRL_AUTOSTARTEM0EM1_MASK | _CMU_HFXOCTRL_AUTOSTARTSELEM0EM1_MASK ) ; hfxoCtrl |= userSel | ( enEM0EM1Start ? CMU_HFXOCTRL_AUTOSTARTEM0EM1 : 0 ) | ( enEM0EM1StartSel ? CMU_HFXOCTRL_AUTOSTARTSELEM0EM1 : 0 ) ; if ( userSel || enEM0EM1StartSel ) { hfxoFreq = SystemHFXOClockGet ( ) ; CMU_UpdateWaitStates ( hfxoFreq , VSCALE_DEFAULT ) ; setHfLeConfig ( hfxoFreq ) ; } CMU -> HFXOCTRL = hfxoCtrl ; }
@brief
   Enable or disable HFXO autostart
@brief Enable or disable HFXO autostart
/* Mask supported enable bits. */ /* Set wait-states for HFXO if automatic start and select is configured. */ /* Update HFXOCTRL after wait-states are updated as HF may automatically switch
     to HFXO when automatic select is enabled . */