fsl_pmu.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671
  1. /*
  2. * Copyright (c) 2016, Freescale Semiconductor, Inc.
  3. * Copyright 2016-2019 NXP
  4. * All rights reserved.
  5. *
  6. * SPDX-License-Identifier: BSD-3-Clause
  7. */
  8. #ifndef _FSL_PMU_H_
  9. #define _FSL_PMU_H_
  10. #include "fsl_common.h"
  11. /*! @addtogroup pmu */
  12. /*! @{ */
  13. /*******************************************************************************
  14. * Definitions
  15. ******************************************************************************/
  16. /*! @name Driver version */
  17. /*@{*/
  18. /*! @brief PMU driver version */
  19. #define FSL_PMU_DRIVER_VERSION (MAKE_VERSION(2, 1, 1)) /*!< Version 2.1.1. */
  20. /*@}*/
  21. /*!
  22. * @brief PMU Status flags.
  23. */
  24. enum
  25. {
  26. kPMU_1P1RegulatorOutputOK = (1U << 0U), /*!< Status bit that signals when the 1p1 regulator output
  27. is ok. 1 = regulator output > brownout target. */
  28. kPMU_1P1BrownoutOnOutput = (1U << 1U), /*!< Status bit that signals when a 1p1 brownout is detected
  29. on the regulator output. */
  30. kPMU_3P0RegulatorOutputOK = (1U << 2U), /*!< Status bit that signals when the 3p0 regulator output
  31. is ok. 1 = regulator output > brownout target. */
  32. kPMU_3P0BrownoutOnOutput = (1U << 3U), /*!< Status bit that signals when a 3p0 brownout is detected
  33. on the regulator output. */
  34. kPMU_2P5RegulatorOutputOK = (1U << 4U), /*!< Status bit that signals when the 2p5 regulator output
  35. is ok. 1 = regulator output > brownout target. */
  36. kPMU_2P5BrownoutOnOutput = (1U << 5U), /*!< Status bit that signals when a 2p5 brownout is detected
  37. on the regulator output. */
  38. };
  39. /*!
  40. * @brief The source for the reference voltage of the weak 1P1 regulator.
  41. */
  42. typedef enum _pmu_1p1_weak_reference_source
  43. {
  44. kPMU_1P1WeakReferenceSourceAlt0 = 0U, /*!< Weak-linreg output tracks low-power-bandgap voltage. */
  45. kPMU_1P1WeakReferenceSourceAlt1 = 1U, /*!< Weak-linreg output tracks VDD_SOC_CAP voltage. */
  46. } pmu_1p1_weak_reference_source_t;
  47. /*!
  48. * @brief Input voltage source for LDO_3P0 from USB VBus.
  49. */
  50. typedef enum _pmu_3p0_vbus_voltage_source
  51. {
  52. kPMU_3P0VBusVoltageSourceAlt0 = 0U, /*!< USB_OTG1_VBUS - Utilize VBUS OTG1 for power. */
  53. kPMU_3P0VBusVoltageSourceAlt1 = 1U, /*!< USB_OTG2_VBUS - Utilize VBUS OTG2 for power. */
  54. } pmu_3p0_vbus_voltage_source_t;
  55. /*!
  56. * @brief Regulator voltage ramp rate.
  57. */
  58. typedef enum _pmu_core_reg_voltage_ramp_rate
  59. {
  60. kPMU_CoreRegVoltageRampRateFast = 0U, /*!< Fast. */
  61. kPMU_CoreRegVoltageRampRateMediumFast = 1U, /*!< Medium Fast. */
  62. kPMU_CoreRegVoltageRampRateMediumSlow = 2U, /*!< Medium Slow. */
  63. kPMU_CoreRegVoltageRampRateSlow = 0U, /*!< Slow. */
  64. } pmu_core_reg_voltage_ramp_rate_t;
  65. #if defined(FSL_FEATURE_PMU_HAS_LOWPWR_CTRL) && FSL_FEATURE_PMU_HAS_LOWPWR_CTRL
  66. /*!
  67. * @brief Mask values of power gate.
  68. */
  69. enum _pmu_power_gate
  70. {
  71. kPMU_PowerGateDisplay = PMU_LOWPWR_CTRL_MIX_PWRGATE_MASK, /*!< Display power gate control. */
  72. kPMU_PowerGateDisplayLogic = PMU_LOWPWR_CTRL_DISPLAY_PWRGATE_MASK, /*!< Display logic power gate control. */
  73. kPMU_PowerGateL2 = PMU_LOWPWR_CTRL_L2_PWRGATE_MASK, /*!< L2 power gate control. */
  74. kPMU_PowerGateL1 = PMU_LOWPWR_CTRL_L1_PWRGATE_MASK, /*!< L1 power gate control. */
  75. kPMU_PowerGateRefTopIBias = PMU_LOWPWR_CTRL_REFTOP_IBIAS_OFF_MASK, /*!< Low power reftop ibias disable. */
  76. };
  77. #endif /* FSL_FEATURE_PMU_HAS_LOWPWR_CTRL. */
  78. /*!
  79. * @brief Bandgap select.
  80. */
  81. typedef enum _pmu_power_bandgap
  82. {
  83. kPMU_NormalPowerBandgap = 0U, /*!< Normal power bandgap. */
  84. kPMU_LowPowerBandgap = 1U, /*!< Low power bandgap. */
  85. } pmu_power_bandgap_t;
  86. /*******************************************************************************
  87. * API
  88. ******************************************************************************/
  89. #if defined(__cplusplus)
  90. extern "C" {
  91. #endif /* __cplusplus*/
  92. /*!
  93. * @name Status.
  94. * @{
  95. */
  96. /*!
  97. * @brief Get PMU status flags.
  98. *
  99. * @param base PMU peripheral base address.
  100. * @return PMU status flags.It indicate if regulator output of 1P1,3P0 and 2P5 is ok
  101. * and brownout output of 1P1,3P0 and 2P5 is detected.
  102. */
  103. uint32_t PMU_GetStatusFlags(PMU_Type *base);
  104. /*@}*/
  105. /*!
  106. * @name 1P1 Regular
  107. * @{
  108. */
  109. /*!
  110. * @brief Selects the source for the reference voltage of the weak 1P1 regulator.
  111. *
  112. * @param base PMU peripheral base address.
  113. * @param option The option for reference voltage source, see to #pmu_1p1_weak_reference_source_t.
  114. */
  115. static inline void PMU_1P1SetWeakReferenceSource(PMU_Type *base, pmu_1p1_weak_reference_source_t option)
  116. {
  117. base->REG_1P1 = (base->REG_1P1 & ~PMU_REG_1P1_SELREF_WEAK_LINREG_MASK) | PMU_REG_1P1_SELREF_WEAK_LINREG(option);
  118. }
  119. /*!
  120. * @brief Enables the weak 1P1 regulator.
  121. *
  122. * This regulator can be used when the main 1P1 regulator is disabled, under low-power conditions.
  123. *
  124. * @param base PMU peripheral base address.
  125. * @param enable Enable the feature or not.
  126. */
  127. static inline void PMU_1P1EnableWeakRegulator(PMU_Type *base, bool enable)
  128. {
  129. if (enable)
  130. {
  131. base->REG_1P1 |= PMU_REG_1P1_ENABLE_WEAK_LINREG_MASK;
  132. }
  133. else
  134. {
  135. base->REG_1P1 &= ~PMU_REG_1P1_ENABLE_WEAK_LINREG_MASK;
  136. }
  137. }
  138. /*!
  139. * @brief Adjust the 1P1 regulator output voltage.
  140. *
  141. * Each LSB is worth 25mV. Programming examples are detailed below. Other output target voltages
  142. * may be interpolated from these examples. Choices must be in this range:
  143. * - 0x1b(1.375V) >= output_trg >= 0x04(0.8V)
  144. * - 0x04 : 0.8V
  145. * - 0x10 : 1.1V (typical)
  146. * - 0x1b : 1.375V
  147. * NOTE: There may be reduced chip functionality or reliability at the extremes of the programming range.
  148. *
  149. * @param base PMU peripheral base address.
  150. * @param value Setting value for the output.
  151. */
  152. static inline void PMU_1P1SetRegulatorOutputVoltage(PMU_Type *base, uint32_t value)
  153. {
  154. base->REG_1P1 = (base->REG_1P1 & ~PMU_REG_1P1_OUTPUT_TRG_MASK) | PMU_REG_1P1_OUTPUT_TRG(value);
  155. }
  156. /*!
  157. * @brief Adjust the 1P1 regulator brownout offset voltage.
  158. *
  159. * Control bits to adjust the regulator brownout offset voltage in 25mV steps. The reset
  160. * brown-offset is 175mV below the programmed target code.
  161. * Brownout target = OUTPUT_TRG - BO_OFFSET.
  162. * Some steps may be irrelevant because of input supply limitations or load operation.
  163. *
  164. * @param base PMU peripheral base address.
  165. * @param value Setting value for the brownout offset. The available range is in 3-bit.
  166. */
  167. static inline void PMU_1P1SetBrownoutOffsetVoltage(PMU_Type *base, uint32_t value)
  168. {
  169. base->REG_1P1 = (base->REG_1P1 & ~PMU_REG_1P1_BO_OFFSET_MASK) | PMU_REG_1P1_BO_OFFSET(value);
  170. }
  171. /*!
  172. * @brief Enable the pull-down circuitry in the regulator.
  173. *
  174. * @param base PMU peripheral base address.
  175. * @param enable Enable the feature or not.
  176. */
  177. static inline void PMU_1P1EnablePullDown(PMU_Type *base, bool enable)
  178. {
  179. if (enable)
  180. {
  181. base->REG_1P1 |= PMU_REG_1P1_ENABLE_PULLDOWN_MASK;
  182. }
  183. else
  184. {
  185. base->REG_1P1 &= ~PMU_REG_1P1_ENABLE_PULLDOWN_MASK;
  186. }
  187. }
  188. /*!
  189. * @brief Enable the current-limit circuitry in the regulator.
  190. *
  191. * @param base PMU peripheral base address.
  192. * @param enable Enable the feature or not.
  193. */
  194. static inline void PMU_1P1EnableCurrentLimit(PMU_Type *base, bool enable)
  195. {
  196. if (enable)
  197. {
  198. base->REG_1P1 |= PMU_REG_1P1_ENABLE_ILIMIT_MASK;
  199. }
  200. else
  201. {
  202. base->REG_1P1 &= ~PMU_REG_1P1_ENABLE_ILIMIT_MASK;
  203. }
  204. }
  205. /*!
  206. * @brief Enable the brownout circuitry in the regulator.
  207. *
  208. * @param base PMU peripheral base address.
  209. * @param enable Enable the feature or not.
  210. */
  211. static inline void PMU_1P1EnableBrownout(PMU_Type *base, bool enable)
  212. {
  213. if (enable)
  214. {
  215. base->REG_1P1 |= PMU_REG_1P1_ENABLE_BO_MASK;
  216. }
  217. else
  218. {
  219. base->REG_1P1 &= ~PMU_REG_1P1_ENABLE_BO_MASK;
  220. }
  221. }
  222. /*!
  223. * @brief Enable the regulator output.
  224. *
  225. * @param base PMU peripheral base address.
  226. * @param enable Enable the feature or not.
  227. */
  228. static inline void PMU_1P1EnableOutput(PMU_Type *base, bool enable)
  229. {
  230. if (enable)
  231. {
  232. base->REG_1P1 |= PMU_REG_1P1_ENABLE_LINREG_MASK;
  233. }
  234. else
  235. {
  236. base->REG_1P1 &= ~PMU_REG_1P1_ENABLE_LINREG_MASK;
  237. }
  238. }
  239. /*@}*/
  240. /*!
  241. * @name 3P0 Regular
  242. * @{
  243. */
  244. /*!
  245. * @brief Adjust the 3P0 regulator output voltage.
  246. *
  247. * Each LSB is worth 25mV. Programming examples are detailed below. Other output target voltages
  248. * may be interpolated from these examples. Choices must be in this range:
  249. * - 0x00(2.625V) >= output_trg >= 0x1f(3.4V)
  250. * - 0x00 : 2.625V
  251. * - 0x0f : 3.0V (typical)
  252. * - 0x1f : 3.4V
  253. *
  254. * @param base PMU peripheral base address.
  255. * @param value Setting value for the output.
  256. */
  257. static inline void PMU_3P0SetRegulatorOutputVoltage(PMU_Type *base, uint32_t value)
  258. {
  259. base->REG_3P0 = (base->REG_3P0 & ~PMU_REG_3P0_OUTPUT_TRG_MASK) | PMU_REG_3P0_OUTPUT_TRG(value);
  260. }
  261. /*!
  262. * @brief Select input voltage source for LDO_3P0.
  263. *
  264. * Select input voltage source for LDO_3P0 from either USB_OTG1_VBUS or USB_OTG2_VBUS. If only
  265. * one of the two VBUS voltages is present, it is automatically selected.
  266. *
  267. * @param base PMU peripheral base address.
  268. * @param option User-defined input voltage source for LDO_3P0.
  269. */
  270. static inline void PMU_3P0SetVBusVoltageSource(PMU_Type *base, pmu_3p0_vbus_voltage_source_t option)
  271. {
  272. base->REG_3P0 = (base->REG_3P0 & ~PMU_REG_3P0_VBUS_SEL_MASK) | PMU_REG_3P0_VBUS_SEL(option);
  273. }
  274. /*!
  275. * @brief Adjust the 3P0 regulator brownout offset voltage.
  276. *
  277. * Control bits to adjust the 3P0 regulator brownout offset voltage in 25mV steps. The reset
  278. * brown-offset is 175mV below the programmed target code.
  279. * Brownout target = OUTPUT_TRG - BO_OFFSET.
  280. * Some steps may be irrelevant because of input supply limitations or load operation.
  281. *
  282. * @param base PMU peripheral base address.
  283. * @param value Setting value for the brownout offset. The available range is in 3-bit.
  284. */
  285. static inline void PMU_3P0SetBrownoutOffsetVoltage(PMU_Type *base, uint32_t value)
  286. {
  287. base->REG_3P0 = (base->REG_3P0 & ~PMU_REG_3P0_BO_OFFSET_MASK) | PMU_REG_3P0_BO_OFFSET(value);
  288. }
  289. /*!
  290. * @brief Enable the current-limit circuitry in the 3P0 regulator.
  291. *
  292. * @param base PMU peripheral base address.
  293. * @param enable Enable the feature or not.
  294. */
  295. static inline void PMU_3P0EnableCurrentLimit(PMU_Type *base, bool enable)
  296. {
  297. if (enable)
  298. {
  299. base->REG_3P0 |= PMU_REG_3P0_ENABLE_ILIMIT_MASK;
  300. }
  301. else
  302. {
  303. base->REG_3P0 &= ~PMU_REG_3P0_ENABLE_ILIMIT_MASK;
  304. }
  305. }
  306. /*!
  307. * @brief Enable the brownout circuitry in the 3P0 regulator.
  308. *
  309. * @param base PMU peripheral base address.
  310. * @param enable Enable the feature or not.
  311. */
  312. static inline void PMU_3P0EnableBrownout(PMU_Type *base, bool enable)
  313. {
  314. if (enable)
  315. {
  316. base->REG_3P0 |= PMU_REG_3P0_ENABLE_BO_MASK;
  317. }
  318. else
  319. {
  320. base->REG_3P0 &= ~PMU_REG_3P0_ENABLE_BO_MASK;
  321. }
  322. }
  323. /*!
  324. * @brief Enable the 3P0 regulator output.
  325. *
  326. * @param base PMU peripheral base address.
  327. * @param enable Enable the feature or not.
  328. */
  329. static inline void PMU_3P0EnableOutput(PMU_Type *base, bool enable)
  330. {
  331. if (enable)
  332. {
  333. base->REG_3P0 |= PMU_REG_3P0_ENABLE_LINREG_MASK;
  334. }
  335. else
  336. {
  337. base->REG_3P0 &= ~PMU_REG_3P0_ENABLE_LINREG_MASK;
  338. }
  339. }
  340. /* @} */
  341. /*!
  342. * @name 2P5 Regulator
  343. * @{
  344. */
  345. /*!
  346. * @brief Enables the weak 2P5 regulator.
  347. *
  348. * This low power regulator is used when the main 2P5 regulator is disabled
  349. * to keep the 2.5V output roughly at 2.5V. Scales directly with the value of VDDHIGH_IN.
  350. *
  351. * @param base PMU peripheral base address.
  352. * @param enable Enable the feature or not.
  353. */
  354. static inline void PMU_2P5EnableWeakRegulator(PMU_Type *base, bool enable)
  355. {
  356. if (enable)
  357. {
  358. base->REG_2P5 |= PMU_REG_2P5_ENABLE_WEAK_LINREG_MASK;
  359. }
  360. else
  361. {
  362. base->REG_2P5 &= ~PMU_REG_2P5_ENABLE_WEAK_LINREG_MASK;
  363. }
  364. }
  365. /*!
  366. * @brief Adjust the 1P1 regulator output voltage.
  367. *
  368. * Each LSB is worth 25mV. Programming examples are detailed below. Other output target voltages
  369. * may be interpolated from these examples. Choices must be in this range:
  370. * - 0x00(2.1V) >= output_trg >= 0x1f(2.875V)
  371. * - 0x00 : 2.1V
  372. * - 0x10 : 2.5V (typical)
  373. * - 0x1f : 2.875V
  374. * NOTE: There may be reduced chip functionality or reliability at the extremes of the programming range.
  375. *
  376. * @param base PMU peripheral base address.
  377. * @param value Setting value for the output.
  378. */
  379. static inline void PMU_2P5SetRegulatorOutputVoltage(PMU_Type *base, uint32_t value)
  380. {
  381. base->REG_2P5 = (base->REG_2P5 & ~PMU_REG_2P5_OUTPUT_TRG_MASK) | PMU_REG_2P5_OUTPUT_TRG(value);
  382. }
  383. /*!
  384. * @brief Adjust the 2P5 regulator brownout offset voltage.
  385. *
  386. * Adjust the regulator brownout offset voltage in 25mV steps. The reset
  387. * brown-offset is 175mV below the programmed target code.
  388. * Brownout target = OUTPUT_TRG - BO_OFFSET.
  389. * Some steps may be irrelevant because of input supply limitations or load operation.
  390. *
  391. * @param base PMU peripheral base address.
  392. * @param value Setting value for the brownout offset. The available range is in 3-bit.
  393. */
  394. static inline void PMU_2P5SetBrownoutOffsetVoltage(PMU_Type *base, uint32_t value)
  395. {
  396. base->REG_2P5 = (base->REG_2P5 & ~PMU_REG_2P5_BO_OFFSET_MASK) | PMU_REG_2P5_BO_OFFSET(value);
  397. }
  398. /*!
  399. * @brief Enable the pull-down circuitry in the 2P5 regulator.
  400. *
  401. * @param base PMU peripheral base address.
  402. * @param enable Enable the feature or not.
  403. */
  404. static inline void PMU_2P5EnablePullDown(PMU_Type *base, bool enable)
  405. {
  406. if (enable)
  407. {
  408. base->REG_2P5 |= PMU_REG_2P5_ENABLE_PULLDOWN_MASK;
  409. }
  410. else
  411. {
  412. base->REG_2P5 &= ~PMU_REG_2P5_ENABLE_PULLDOWN_MASK;
  413. }
  414. }
  415. /*!
  416. * @brief Enable the pull-down circuitry in the 2P5 regulator.
  417. * @deprecated Do not use this function. It has been superceded by @ref PMU_2P5EnablePullDown.
  418. */
  419. static inline void PMU_2P1EnablePullDown(PMU_Type *base, bool enable)
  420. {
  421. if (enable)
  422. {
  423. base->REG_2P5 |= PMU_REG_2P5_ENABLE_PULLDOWN_MASK;
  424. }
  425. else
  426. {
  427. base->REG_2P5 &= ~PMU_REG_2P5_ENABLE_PULLDOWN_MASK;
  428. }
  429. }
  430. /*!
  431. * @brief Enable the current-limit circuitry in the 2P5 regulator.
  432. *
  433. * @param base PMU peripheral base address.
  434. * @param enable Enable the feature or not.
  435. */
  436. static inline void PMU_2P5EnableCurrentLimit(PMU_Type *base, bool enable)
  437. {
  438. if (enable)
  439. {
  440. base->REG_2P5 |= PMU_REG_2P5_ENABLE_ILIMIT_MASK;
  441. }
  442. else
  443. {
  444. base->REG_2P5 &= ~PMU_REG_2P5_ENABLE_ILIMIT_MASK;
  445. }
  446. }
  447. /*!
  448. * @brief Enable the brownout circuitry in the 2P5 regulator.
  449. *
  450. * @param base PMU peripheral base address.
  451. * @param enable Enable the feature or not.
  452. */
  453. static inline void PMU_2P5nableBrownout(PMU_Type *base, bool enable)
  454. {
  455. if (enable)
  456. {
  457. base->REG_2P5 |= PMU_REG_2P5_ENABLE_BO_MASK;
  458. }
  459. else
  460. {
  461. base->REG_2P5 &= ~PMU_REG_2P5_ENABLE_BO_MASK;
  462. }
  463. }
  464. /*!
  465. * @brief Enable the 2P5 regulator output.
  466. *
  467. * @param base PMU peripheral base address.
  468. * @param enable Enable the feature or not.
  469. */
  470. static inline void PMU_2P5EnableOutput(PMU_Type *base, bool enable)
  471. {
  472. if (enable)
  473. {
  474. base->REG_2P5 |= PMU_REG_2P5_ENABLE_LINREG_MASK;
  475. }
  476. else
  477. {
  478. base->REG_2P5 &= ~PMU_REG_2P5_ENABLE_LINREG_MASK;
  479. }
  480. }
  481. /* @} */
  482. /*!
  483. * @name Core Regulator
  484. * @{
  485. */
  486. /*!
  487. * @brief Increase the gate drive on power gating FETs.
  488. *
  489. * If set, increases the gate drive on power gating FETs to reduce leakage in the off state.
  490. * Care must be taken to apply this bit only when the input supply voltage to the power FET
  491. * is less than 1.1V.
  492. * NOTE: This bit should only be used in low-power modes where the external input supply voltage
  493. * is nominally 0.9V.
  494. *
  495. * @param base PMU peripheral base address.
  496. * @param enable Enable the feature or not.
  497. */
  498. static inline void PMU_CoreEnableIncreaseGateDrive(PMU_Type *base, bool enable)
  499. {
  500. if (enable)
  501. {
  502. base->REG_CORE |= PMU_REG_CORE_FET_ODRIVE_MASK;
  503. }
  504. else
  505. {
  506. base->REG_CORE &= ~PMU_REG_CORE_FET_ODRIVE_MASK;
  507. }
  508. }
  509. /*!
  510. * @brief Set the CORE regulator voltage ramp rate.
  511. *
  512. * @param base PMU peripheral base address.
  513. * @param option User-defined option for voltage ramp rate, see to #pmu_core_reg_voltage_ramp_rate_t.
  514. */
  515. static inline void PMU_CoreSetRegulatorVoltageRampRate(PMU_Type *base, pmu_core_reg_voltage_ramp_rate_t option)
  516. {
  517. base->REG_CORE = (base->REG_CORE & ~PMU_REG_CORE_RAMP_RATE_MASK) | PMU_REG_CORE_RAMP_RATE(option);
  518. }
  519. /*!
  520. * @brief Define the target voltage for the SOC power domain.
  521. *
  522. * Define the target voltage for the SOC power domain. Single-bit increments reflect 25mV core
  523. * voltage steps. Some steps may not be relevant because of input supply limitations or load operation.
  524. * - 0x00 : Power gated off.
  525. * - 0x01 : Target core voltage = 0.725V
  526. * - 0x02 : Target core voltage = 0.750V
  527. * - ...
  528. * - 0x10 : Target core voltage = 1.100V
  529. * - ...
  530. * - 0x1e : Target core voltage = 1.450V
  531. * - 0x1F : Power FET switched full on. No regulation.
  532. * NOTE: This register is capable of programming an over-voltage condition on the device. Consult the
  533. * datasheet Operating Ranges table for the allowed voltages.
  534. *
  535. * @param base PMU peripheral base address.
  536. * @param value Setting value for target voltage. 5-bit available
  537. */
  538. static inline void PMU_CoreSetSOCDomainVoltage(PMU_Type *base, uint32_t value)
  539. {
  540. base->REG_CORE = (base->REG_CORE & ~PMU_REG_CORE_REG2_TARG_MASK) | PMU_REG_CORE_REG2_TARG(value);
  541. }
  542. /*!
  543. * @brief Define the target voltage for the ARM Core power domain.
  544. *
  545. * Define the target voltage for the ARM Core power domain. Single-bit increments reflect 25mV core
  546. * voltage steps. Some steps may not be relevant because of input supply limitations or load operation.
  547. * - 0x00 : Power gated off.
  548. * - 0x01 : Target core voltage = 0.725V
  549. * - 0x02 : Target core voltage = 0.750V
  550. * - ...
  551. * - 0x10 : Target core voltage = 1.100V
  552. * - ...
  553. * - 0x1e : Target core voltage = 1.450V
  554. * - 0x1F : Power FET switched full on. No regulation.
  555. * NOTE: This register is capable of programming an over-voltage condition on the device. Consult the
  556. * datasheet Operating Ranges table for the allowed voltages.
  557. *
  558. * @param base PMU peripheral base address.
  559. * @param value Setting value for target voltage. 5-bit available
  560. */
  561. static inline void PMU_CoreSetARMCoreDomainVoltage(PMU_Type *base, uint32_t value)
  562. {
  563. base->REG_CORE = (base->REG_CORE & ~PMU_REG_CORE_REG0_TARG_MASK) | PMU_REG_CORE_REG0_TARG(value);
  564. }
  565. /* @} */
  566. #if defined(FSL_FEATURE_PMU_HAS_LOWPWR_CTRL) && FSL_FEATURE_PMU_HAS_LOWPWR_CTRL
  567. /*!
  568. * @name Power Gate Controller & other
  569. * @{
  570. */
  571. /*!
  572. * @brief Gate the power to modules.
  573. *
  574. * @param base PMU peripheral base address.
  575. * @param gates Mask value for the module to be gated. See to #_pmu_power_gate.
  576. */
  577. static inline void PMU_GatePower(PMU_Type *base, uint32_t gates)
  578. {
  579. base->LOWPWR_CTRL_SET = gates;
  580. }
  581. /*!
  582. * @brief Ungate the power to modules.
  583. *
  584. * @param base PMU peripheral base address.
  585. * @param gates Mask value for the module to be gated. See to #_pmu_power_gate.
  586. */
  587. static inline void PMU_UngatePower(PMU_Type *base, uint32_t gates)
  588. {
  589. base->LOWPWR_CTRL_CLR = gates;
  590. }
  591. /*!
  592. * @brief Enable the low power bandgap.
  593. *
  594. * @param base PMU peripheral base address.
  595. * @param enable Enable the low power bandgap or use the normal power bandgap.
  596. * @
  597. */
  598. static inline void PMU_EnableLowPowerBandgap(PMU_Type *base, bool enable)
  599. {
  600. if (enable)
  601. {
  602. base->LOWPWR_CTRL_SET = PMU_LOWPWR_CTRL_LPBG_SEL_MASK; /* Use the low power bandgap. */
  603. }
  604. else
  605. {
  606. base->LOWPWR_CTRL_CLR = PMU_LOWPWR_CTRL_LPBG_SEL_MASK; /* Use the normal power bandgap. */
  607. }
  608. }
  609. #endif /* FSL_FEATURE_PMU_HAS_LOWPWR_CTRL. */
  610. /* @} */
  611. #if defined(__cplusplus)
  612. }
  613. #endif /* __cplusplus*/
  614. /*! @}*/
  615. #endif /* _FSL_PMU_H_*/