MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / CMU_ClockEnable

Function CMU_ClockEnable

bsp/efm32/Libraries/emlib/src/em_cmu.c:936–987  ·  view source on GitHub ↗

/ * @brief * Enable/disable a clock. * * @details * In general, module clocking is disabled after a reset. If a module * clock is disabled, the registers of that module are not accessible and * reading from such registers may return undefined values. Writing to * registers of clock disabled modules have no effect. One should normally * avoid accessing module registers of a modu

Source from the content-addressed store, hash-verified

934 * @li false - disable specified clock.
935 ******************************************************************************/
936void CMU_ClockEnable(CMU_Clock_TypeDef clock, bool enable)
937{
938 volatile uint32_t *reg;
939 uint32_t bit;
940 uint32_t sync = 0;
941
942 /* Identify enable register */
943 switch ((clock >> CMU_EN_REG_POS) & CMU_EN_REG_MASK)
944 {
945 case CMU_HFPERCLKDIV_EN_REG:
946 reg = &(CMU->HFPERCLKDIV);
947 break;
948
949 case CMU_HFPERCLKEN0_EN_REG:
950 reg = &(CMU->HFPERCLKEN0);
951 break;
952
953 case CMU_HFCORECLKEN0_EN_REG:
954 reg = &(CMU->HFCORECLKEN0);
955 break;
956
957 case CMU_LFACLKEN0_EN_REG:
958 reg = &(CMU->LFACLKEN0);
959 sync = CMU_SYNCBUSY_LFACLKEN0;
960 break;
961
962 case CMU_LFBCLKEN0_EN_REG:
963 reg = &(CMU->LFBCLKEN0);
964 sync = CMU_SYNCBUSY_LFBCLKEN0;
965 break;
966
967 case CMU_PCNT_EN_REG:
968 reg = &(CMU->PCNTCTRL);
969 break;
970
971 default: /* Cannot enable/disable clock point */
972 EFM_ASSERT(0);
973 return;
974 }
975
976 /* Get bit position used to enable/disable */
977 bit = (clock >> CMU_EN_BIT_POS) & CMU_EN_BIT_MASK;
978
979 /* LF synchronization required? */
980 if (sync)
981 {
982 CMU_Sync(sync);
983 }
984
985 /* Set/clear bit as requested */
986 BITBAND_Peripheral(reg, bit, (unsigned int)enable);
987}
988
989
990/***************************************************************************//**

Callers 15

drv_usart.cFile · 0.85
rt_hw_acmp_unit_initFunction · 0.85
rt_hw_iic_unit_initFunction · 0.85
rt_hw_timer_unit_initFunction · 0.85
SysTick_ConfigurationFunction · 0.85
rt_hw_board_initFunction · 0.85
rt_hw_leuart_unit_initFunction · 0.85
rt_hw_adc_unit_initFunction · 0.85
rt_hw_rtc_initFunction · 0.85
DVK_EBI_initFunction · 0.85
DVK_EBI_disableFunction · 0.85
DVK_busControlModeFunction · 0.85

Calls 2

CMU_SyncFunction · 0.85
BITBAND_PeripheralFunction · 0.85

Tested by

no test coverage detected