fsl_dcdc.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518
  1. /*
  2. * Copyright 2020-2021 NXP
  3. * All rights reserved.
  4. *
  5. *
  6. * SPDX-License-Identifier: BSD-3-Clause
  7. */
  8. #include "fsl_dcdc.h"
  9. /* Component ID definition, used by tools. */
  10. #ifndef FSL_COMPONENT_ID
  11. #define FSL_COMPONENT_ID "platform.drivers.dcdc_soc"
  12. #endif
  13. /*******************************************************************************
  14. * Prototypes
  15. ******************************************************************************/
  16. /*!
  17. * brief Gets instance number for DCDC module.
  18. *
  19. * param base DCDC peripheral base address
  20. */
  21. static uint32_t DCDC_GetInstance(DCDC_Type *base);
  22. /*!
  23. * brief Converts the byte array to word.
  24. *
  25. * param ptrArray Pointer to the byte array.
  26. * return The converted result.
  27. */
  28. static uint32_t DCDC_ConvertByteArrayToWord(uint8_t *ptrArray);
  29. /*******************************************************************************
  30. * Variables
  31. ******************************************************************************/
  32. /*! brief Pointers to DCDC bases for each instance. */
  33. static DCDC_Type *const s_dcdcBases[] = DCDC_BASE_PTRS;
  34. #if !(defined(FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) && FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL)
  35. /*! brief Pointers to DCDC clocks for each instance. */
  36. static const clock_ip_name_t s_dcdcClocks[] = DCDC_CLOCKS;
  37. #endif /* FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL */
  38. /*******************************************************************************
  39. * CodDCDC_GetstatusFlagse
  40. ******************************************************************************/
  41. static uint32_t DCDC_GetInstance(DCDC_Type *base)
  42. {
  43. uint32_t instance;
  44. /* Find the instance index from base address mappings. */
  45. for (instance = 0; instance < ARRAY_SIZE(s_dcdcBases); instance++)
  46. {
  47. if (s_dcdcBases[instance] == base)
  48. {
  49. break;
  50. }
  51. }
  52. assert(instance < ARRAY_SIZE(s_dcdcBases));
  53. return instance;
  54. }
  55. static uint32_t DCDC_ConvertByteArrayToWord(uint8_t *ptrArray)
  56. {
  57. assert(ptrArray != NULL);
  58. uint32_t temp32 = 0UL;
  59. uint32_t index;
  60. for (index = 0U; index < 4U; index++)
  61. {
  62. temp32 |= (uint32_t)ptrArray[index] << ((index % 4UL) * 8UL);
  63. }
  64. return temp32;
  65. }
  66. /*!
  67. * brief Initializes the basic resource of DCDC module, such as control mode, etc.
  68. *
  69. * param base DCDC peripheral base address.
  70. * param config Pointer to the configuration structure.
  71. */
  72. void DCDC_Init(DCDC_Type *base, const dcdc_config_t *config)
  73. {
  74. #if !(defined(FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) && FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL)
  75. /* Enable the clock. */
  76. CLOCK_EnableClock(s_dcdcClocks[DCDC_GetInstance(base)]);
  77. #endif /* FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL */
  78. uint32_t tmp32 = base->CTRL0;
  79. tmp32 |= DCDC_CTRL0_CONTROL_MODE(config->controlMode) | DCDC_CTRL0_TRIM_HOLD(config->trimInputMode);
  80. if (config->enableDcdcTimeout)
  81. {
  82. tmp32 |= DCDC_CTRL0_ENABLE_DCDC_CNT_MASK;
  83. }
  84. if (config->enableSwitchingConverterOutput)
  85. {
  86. tmp32 |= DCDC_CTRL0_DIG_EN_MASK;
  87. }
  88. tmp32 |= DCDC_CTRL0_ENABLE_MASK;
  89. base->CTRL0 = tmp32;
  90. }
  91. /*!
  92. * brief De-initializes the DCDC module.
  93. *
  94. * param base DCDC peripheral base address.
  95. */
  96. void DCDC_Deinit(DCDC_Type *base)
  97. {
  98. /* Disables DCDC. */
  99. base->CTRL0 &= ~DCDC_CTRL0_ENABLE_MASK;
  100. #if !(defined(FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) && FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL)
  101. /* Disable the clock. */
  102. CLOCK_DisableClock(s_dcdcClocks[DCDC_GetInstance(base)]);
  103. #endif /* FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL */
  104. }
  105. /*!
  106. * brief Gets the default setting for DCDC, such as control mode, etc.
  107. *
  108. * This function initializes the user configuration structure to a default value. The default values are:
  109. * code
  110. * config->controlMode = kDCDC_StaticControl;
  111. * config->trimInputMode = kDCDC_SampleTrimInput;
  112. * config->enableDcdcTimeout = false;
  113. * config->enableSwitchingConverterOutput = false;
  114. * endcode
  115. *
  116. * param config Pointer to configuration structure. See to dcdc_config_t.
  117. */
  118. void DCDC_GetDefaultConfig(dcdc_config_t *config)
  119. {
  120. assert(NULL != config);
  121. /* Initializes the configure structure to zero. */
  122. (void)memset(config, 0, sizeof(*config));
  123. config->controlMode = kDCDC_StaticControl;
  124. config->trimInputMode = kDCDC_SampleTrimInput;
  125. config->enableDcdcTimeout = false;
  126. config->enableSwitchingConverterOutput = false;
  127. }
  128. /*!
  129. * brief Gets the default setting for detection configuration.
  130. *
  131. * The default configuration are set according to responding registers' setting when powered on.
  132. * They are:
  133. * code
  134. * config->enableXtalokDetection = false;
  135. * config->powerDownOverVoltageVdd1P8Detection = true;
  136. * config->powerDownOverVoltageVdd1P0Detection = true;
  137. * config->powerDownLowVoltageDetection = false;
  138. * config->powerDownOverCurrentDetection = true;
  139. * config->powerDownPeakCurrentDetection = true;
  140. * config->powerDownZeroCrossDetection = true;
  141. * config->PeakCurrentThreshold = kDCDC_PeakCurrentRunMode250mALPMode1P5A;
  142. * endcode
  143. *
  144. * param config Pointer to configuration structure. See to "dcdc_detection_config_t"
  145. */
  146. void DCDC_GetDefaultDetectionConfig(dcdc_detection_config_t *config)
  147. {
  148. assert(NULL != config);
  149. /* Initializes the configure structure to zero. */
  150. (void)memset(config, 0, sizeof(*config));
  151. config->enableXtalokDetection = false;
  152. config->powerDownOverVoltageVdd1P8Detection = true;
  153. config->powerDownOverVoltageVdd1P0Detection = true;
  154. config->powerDownLowVoltageDetection = false;
  155. config->powerDownOverCurrentDetection = true;
  156. config->powerDownPeakCurrentDetection = true;
  157. config->powerDownZeroCrossDetection = true;
  158. config->PeakCurrentThreshold = kDCDC_PeakCurrentRunMode250mALPMode1P5A;
  159. }
  160. /*!
  161. * breif Configures the DCDC detection.
  162. *
  163. * param base DCDC peripheral base address.
  164. * param config Pointer to configuration structure. See to "dcdc_detection_config_t"
  165. */
  166. void DCDC_SetDetectionConfig(DCDC_Type *base, const dcdc_detection_config_t *config)
  167. {
  168. assert(NULL != config);
  169. uint32_t tmp32;
  170. /* Configure the DCDC_REG0 register. */
  171. tmp32 = base->REG0 &
  172. ~(DCDC_REG0_XTALOK_DISABLE_MASK | DCDC_REG0_PWD_HIGH_VDD1P8_DET_MASK | DCDC_REG0_PWD_HIGH_VDD1P0_DET_MASK |
  173. DCDC_REG0_PWD_CMP_DCDC_IN_DET_MASK | DCDC_REG0_PWD_OVERCUR_DET_MASK | DCDC_REG0_PWD_CUR_SNS_CMP_MASK |
  174. DCDC_REG0_PWD_ZCD_MASK | DCDC_REG0_CUR_SNS_THRSH_MASK);
  175. tmp32 |= DCDC_REG0_CUR_SNS_THRSH(config->PeakCurrentThreshold);
  176. if (false == config->enableXtalokDetection)
  177. {
  178. tmp32 |= DCDC_REG0_XTALOK_DISABLE_MASK;
  179. }
  180. if (config->powerDownOverVoltageVdd1P8Detection)
  181. {
  182. tmp32 |= DCDC_REG0_PWD_HIGH_VDD1P8_DET_MASK;
  183. }
  184. if (config->powerDownOverVoltageVdd1P0Detection)
  185. {
  186. tmp32 |= DCDC_REG0_PWD_HIGH_VDD1P0_DET_MASK;
  187. }
  188. if (config->powerDownLowVoltageDetection)
  189. {
  190. tmp32 |= DCDC_REG0_PWD_CMP_DCDC_IN_DET_MASK;
  191. }
  192. if (config->powerDownOverCurrentDetection)
  193. {
  194. tmp32 |= DCDC_REG0_PWD_OVERCUR_DET_MASK;
  195. }
  196. if (config->powerDownPeakCurrentDetection)
  197. {
  198. tmp32 |= DCDC_REG0_PWD_CUR_SNS_CMP_MASK;
  199. }
  200. if (config->powerDownZeroCrossDetection)
  201. {
  202. tmp32 |= DCDC_REG0_PWD_ZCD_MASK;
  203. }
  204. base->REG0 = tmp32;
  205. }
  206. /*!
  207. * brief Configures the DCDC clock source.
  208. *
  209. * param base DCDC peripheral base address.
  210. * param clockSource Clock source for DCDC. See to "dcdc_clock_source_t".
  211. */
  212. void DCDC_SetClockSource(DCDC_Type *base, dcdc_clock_source_t clockSource)
  213. {
  214. uint32_t tmp32;
  215. /* Configure the DCDC_REG0 register. */
  216. tmp32 = base->REG0 & ~(DCDC_REG0_XTAL_24M_OK_MASK | DCDC_REG0_DISABLE_AUTO_CLK_SWITCH_MASK |
  217. DCDC_REG0_SEL_CLK_MASK | DCDC_REG0_PWD_OSC_INT_MASK);
  218. switch (clockSource)
  219. {
  220. case kDCDC_ClockInternalOsc:
  221. tmp32 |= DCDC_REG0_DISABLE_AUTO_CLK_SWITCH_MASK;
  222. break;
  223. case kDCDC_ClockExternalOsc:
  224. /* Choose the external clock and disable the internal clock. */
  225. tmp32 |= DCDC_REG0_DISABLE_AUTO_CLK_SWITCH_MASK | DCDC_REG0_SEL_CLK_MASK | DCDC_REG0_PWD_OSC_INT_MASK;
  226. break;
  227. case kDCDC_ClockAutoSwitch:
  228. /* Set to switch from internal ring osc to xtal 24M if auto mode is enabled. */
  229. tmp32 |= DCDC_REG0_XTAL_24M_OK_MASK;
  230. break;
  231. default:
  232. assert(false);
  233. break;
  234. }
  235. base->REG0 = tmp32;
  236. }
  237. /*!
  238. * brief Gets the default setting for low power configuration.
  239. *
  240. * The default configuration are set according to responding registers' setting when powered on.
  241. * They are:
  242. * code
  243. * config->enableAdjustHystereticValue = false;
  244. * endcode
  245. *
  246. * param config Pointer to configuration structure. See to "dcdc_low_power_config_t"
  247. */
  248. void DCDC_GetDefaultLowPowerConfig(dcdc_low_power_config_t *config)
  249. {
  250. assert(NULL != config);
  251. /* Initializes the configure structure to zero. */
  252. (void)memset(config, 0, sizeof(*config));
  253. config->enableAdjustHystereticValue = false;
  254. }
  255. /*!
  256. * brief Configures the DCDC low power.
  257. *
  258. * param base DCDC peripheral base address.
  259. * param config Pointer to configuration structure. See to "dcdc_low_power_config_t".
  260. */
  261. void DCDC_SetLowPowerConfig(DCDC_Type *base, const dcdc_low_power_config_t *config)
  262. {
  263. assert(NULL != config);
  264. uint32_t tmp32;
  265. /* Configure the DCDC_REG0 register. */
  266. tmp32 = base->REG0 & ~(DCDC_REG0_LP_HIGH_HYS_MASK);
  267. if (config->enableAdjustHystereticValue)
  268. {
  269. tmp32 |= DCDC_REG0_LP_HIGH_HYS_MASK;
  270. }
  271. base->REG0 = tmp32;
  272. }
  273. /*!
  274. * brief Gets the default setting for loop control configuration.
  275. *
  276. * The default configuration are set according to responding registers' setting when powered on.
  277. * They are:
  278. * code
  279. * config->enableCommonHysteresis = false;
  280. * config->enableCommonThresholdDetection = false;
  281. * config->enableInvertHysteresisSign = false;
  282. * config->enableRCThresholdDetection = false;
  283. * config->enableRCScaleCircuit = 0U;
  284. * config->complementFeedForwardStep = 0U;
  285. * config->controlParameterMagnitude = 2U;
  286. * config->integralProportionalRatio = 2U;
  287. * endcode
  288. *
  289. * param config Pointer to configuration structure. See to "dcdc_loop_control_config_t"
  290. */
  291. void DCDC_GetDefaultLoopControlConfig(dcdc_loop_control_config_t *config)
  292. {
  293. assert(NULL != config);
  294. /* Initializes the configure structure to zero. */
  295. (void)memset(config, 0, sizeof(*config));
  296. config->enableCommonHysteresis = false;
  297. config->enableCommonThresholdDetection = false;
  298. config->enableInvertHysteresisSign = false;
  299. config->enableRCThresholdDetection = false;
  300. config->enableRCScaleCircuit = 0U;
  301. config->complementFeedForwardStep = 0U;
  302. config->controlParameterMagnitude = 2U;
  303. config->integralProportionalRatio = 2U;
  304. }
  305. /*!
  306. * brief Configures the DCDC loop control.
  307. *
  308. * param base DCDC peripheral base address.
  309. * param config Pointer to configuration structure. See to "dcdc_loop_control_config_t".
  310. */
  311. void DCDC_SetLoopControlConfig(DCDC_Type *base, const dcdc_loop_control_config_t *config)
  312. {
  313. assert(NULL != config);
  314. uint32_t tmp32;
  315. /* Configure the DCDC_REG1 register. */
  316. tmp32 = base->REG1 & ~(DCDC_REG1_LOOPCTRL_EN_DF_HYST_MASK | DCDC_REG1_LOOPCTRL_EN_CM_HYST_MASK |
  317. DCDC_REG1_LOOPCTRL_DF_HST_THRESH_MASK | DCDC_REG1_LOOPCTRL_CM_HST_THRESH_MASK);
  318. if (config->enableCommonHysteresis)
  319. {
  320. tmp32 |= DCDC_REG1_LOOPCTRL_EN_CM_HYST_MASK;
  321. }
  322. if (config->enableCommonThresholdDetection)
  323. {
  324. tmp32 |= DCDC_REG1_LOOPCTRL_CM_HST_THRESH_MASK;
  325. }
  326. if (config->enableDifferentialHysteresis)
  327. {
  328. tmp32 |= DCDC_REG1_LOOPCTRL_EN_DF_HYST_MASK;
  329. }
  330. if (config->enableDifferentialThresholdDetection)
  331. {
  332. tmp32 |= DCDC_REG1_LOOPCTRL_DF_HST_THRESH_MASK;
  333. }
  334. base->REG1 = tmp32;
  335. /* configure the DCDC_REG2 register. */
  336. tmp32 = base->REG2 & ~(DCDC_REG2_LOOPCTRL_HYST_SIGN_MASK | DCDC_REG2_LOOPCTRL_RCSCALE_THRSH_MASK |
  337. DCDC_REG2_LOOPCTRL_EN_RCSCALE_MASK | DCDC_REG2_LOOPCTRL_DC_FF_MASK |
  338. DCDC_REG2_LOOPCTRL_DC_R_MASK | DCDC_REG2_LOOPCTRL_DC_C_MASK);
  339. tmp32 |= DCDC_REG2_LOOPCTRL_DC_FF(config->complementFeedForwardStep) |
  340. DCDC_REG2_LOOPCTRL_DC_R(config->controlParameterMagnitude) |
  341. DCDC_REG2_LOOPCTRL_DC_C(config->integralProportionalRatio) |
  342. DCDC_REG2_LOOPCTRL_EN_RCSCALE(config->enableRCScaleCircuit);
  343. if (config->enableInvertHysteresisSign)
  344. {
  345. tmp32 |= DCDC_REG2_LOOPCTRL_HYST_SIGN_MASK;
  346. }
  347. if (config->enableRCThresholdDetection)
  348. {
  349. tmp32 |= DCDC_REG2_LOOPCTRL_RCSCALE_THRSH_MASK;
  350. }
  351. base->REG2 = tmp32;
  352. }
  353. /*!
  354. * brief Configures for the min power.
  355. *
  356. * param base DCDC peripheral base address.
  357. * param config Pointer to configuration structure. See to "dcdc_min_power_config_t".
  358. */
  359. void DCDC_SetMinPowerConfig(DCDC_Type *base, const dcdc_min_power_config_t *config)
  360. {
  361. assert(NULL != config);
  362. uint32_t tmp32;
  363. tmp32 = base->REG3 & ~DCDC_REG3_MINPWR_DC_HALFCLK_MASK;
  364. if (config->enableUseHalfFreqForContinuous)
  365. {
  366. tmp32 |= DCDC_REG3_MINPWR_DC_HALFCLK_MASK;
  367. }
  368. base->REG3 = tmp32;
  369. }
  370. /*!
  371. * brief Configures the DCDC internal regulator.
  372. *
  373. * param base DCDC peripheral base address.
  374. * param config Pointer to configuration structure. See to "dcdc_internal_regulator_config_t".
  375. */
  376. void DCDC_SetInternalRegulatorConfig(DCDC_Type *base, const dcdc_internal_regulator_config_t *config)
  377. {
  378. assert(NULL != config);
  379. uint32_t tmp32;
  380. tmp32 = base->REG3 & ~DCDC_REG3_REG_FBK_SEL_MASK;
  381. tmp32 |= DCDC_REG3_REG_FBK_SEL(config->feedbackPoint);
  382. base->REG3 = tmp32;
  383. }
  384. /*!
  385. * brief Initializes DCDC module when the control mode selected as setpoint mode.
  386. *
  387. * note The function should be invoked in the initial step to config the
  388. * DCDC via setpoint control mode.
  389. *
  390. * param base DCDC peripheral base address.
  391. * param config The pointer to the structure dcdc_setpoint_config_t.
  392. */
  393. void DCDC_SetPointInit(DCDC_Type *base, const dcdc_setpoint_config_t *config)
  394. {
  395. assert(config != NULL);
  396. /* Enable DCDC Dig Logic. */
  397. base->REG5 = config->enableDigLogicMap;
  398. /* Set DCDC power mode. */
  399. base->REG6 = config->lowpowerMap;
  400. base->REG7 = config->standbyMap;
  401. base->REG7P = config->standbyLowpowerMap;
  402. /* Set target voltage of VDD1P8 in buck mode. */
  403. base->REG8 = DCDC_ConvertByteArrayToWord((uint8_t *)config->buckVDD1P8TargetVoltage);
  404. base->REG9 = DCDC_ConvertByteArrayToWord((uint8_t *)config->buckVDD1P8TargetVoltage + 4U);
  405. base->REG10 = DCDC_ConvertByteArrayToWord((uint8_t *)config->buckVDD1P8TargetVoltage + 8U);
  406. base->REG11 = DCDC_ConvertByteArrayToWord((uint8_t *)config->buckVDD1P8TargetVoltage + 12U);
  407. /* Set target voltage of VDD1P0 in buck mode. */
  408. base->REG12 = DCDC_ConvertByteArrayToWord((uint8_t *)config->buckVDD1P0TargetVoltage);
  409. base->REG13 = DCDC_ConvertByteArrayToWord((uint8_t *)config->buckVDD1P0TargetVoltage + 4U);
  410. base->REG14 = DCDC_ConvertByteArrayToWord((uint8_t *)config->buckVDD1P0TargetVoltage + 8U);
  411. base->REG15 = DCDC_ConvertByteArrayToWord((uint8_t *)config->buckVDD1P0TargetVoltage + 12U);
  412. /* Set target voltage of VDD1P8 in low power mode. */
  413. base->REG16 = DCDC_ConvertByteArrayToWord((uint8_t *)config->standbyVDD1P8TargetVoltage);
  414. base->REG17 = DCDC_ConvertByteArrayToWord((uint8_t *)config->standbyVDD1P8TargetVoltage + 4U);
  415. base->REG18 = DCDC_ConvertByteArrayToWord((uint8_t *)config->standbyVDD1P8TargetVoltage + 8U);
  416. base->REG19 = DCDC_ConvertByteArrayToWord((uint8_t *)config->standbyVDD1P8TargetVoltage + 12U);
  417. /* Set target voltage of VDD1P0 in low power mode. */
  418. base->REG20 = DCDC_ConvertByteArrayToWord((uint8_t *)config->standbyVDD1P0TargetVoltage);
  419. base->REG21 = DCDC_ConvertByteArrayToWord((uint8_t *)config->standbyVDD1P0TargetVoltage + 4U);
  420. base->REG22 = DCDC_ConvertByteArrayToWord((uint8_t *)config->standbyVDD1P0TargetVoltage + 8U);
  421. base->REG23 = DCDC_ConvertByteArrayToWord((uint8_t *)config->standbyVDD1P0TargetVoltage + 12U);
  422. /* Enable DCDC module. */
  423. base->REG4 = config->enableDCDCMap;
  424. }
  425. /*!
  426. * brief Boots DCDC into DCM(discontinous conduction mode).
  427. *
  428. * pwd_zcd=0x0;
  429. * DM_CTRL = 1'b1;
  430. * pwd_cmp_offset=0x0;
  431. * dcdc_loopctrl_en_rcscale=0x3 or 0x5;
  432. * DCM_set_ctrl=1'b1;
  433. *
  434. * param base DCDC peripheral base address.
  435. */
  436. void DCDC_BootIntoDCM(DCDC_Type *base)
  437. {
  438. base->REG0 &= ~(DCDC_REG0_PWD_ZCD_MASK | DCDC_REG0_PWD_CMP_OFFSET_MASK);
  439. base->REG1 &= ~DCDC_REG1_RLOAD_REG_EN_LPSR_MASK;
  440. base->REG1 |= DCDC_REG1_DM_CTRL_MASK;
  441. base->REG2 = (~DCDC_REG2_LOOPCTRL_EN_RCSCALE_MASK & base->REG2) | DCDC_REG2_LOOPCTRL_EN_RCSCALE(0x5U);
  442. base->REG3 &= ~(DCDC_REG3_DISABLE_IDLE_SKIP_MASK | DCDC_REG3_DISABLE_PULSE_SKIP_MASK);
  443. base->REG3 |= DCDC_REG3_ENABLE_FF_MASK;
  444. }
  445. /*!
  446. * brief Boots DCDC into CCM(continous conduction mode).
  447. *
  448. * pwd_zcd=0x1;
  449. * pwd_cmp_offset=0x0;
  450. * dcdc_loopctrl_en_rcscale=0x3;
  451. *
  452. * param base DCDC peripheral base address.
  453. */
  454. void DCDC_BootIntoCCM(DCDC_Type *base)
  455. {
  456. base->REG0 = (~DCDC_REG0_PWD_CMP_OFFSET_MASK & base->REG0) | DCDC_REG0_PWD_ZCD_MASK;
  457. base->REG2 = (~DCDC_REG2_LOOPCTRL_EN_RCSCALE_MASK & base->REG2) | DCDC_REG2_LOOPCTRL_EN_RCSCALE(0x3U);
  458. }