MK64F12_pmc.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577
  1. /*
  2. * Copyright (c) 2014, Freescale Semiconductor, Inc.
  3. * All rights reserved.
  4. *
  5. * THIS SOFTWARE IS PROVIDED BY FREESCALE "AS IS" AND ANY EXPRESS OR IMPLIED
  6. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  7. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
  8. * SHALL FREESCALE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  9. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
  10. * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  11. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  12. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
  13. * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
  14. * OF SUCH DAMAGE.
  15. */
  16. /*
  17. * WARNING! DO NOT EDIT THIS FILE DIRECTLY!
  18. *
  19. * This file was generated automatically and any changes may be lost.
  20. */
  21. #ifndef __HW_PMC_REGISTERS_H__
  22. #define __HW_PMC_REGISTERS_H__
  23. #include "regs.h"
  24. /*
  25. * MK64F12 PMC
  26. *
  27. * Power Management Controller
  28. *
  29. * Registers defined in this header file:
  30. * - HW_PMC_LVDSC1 - Low Voltage Detect Status And Control 1 register
  31. * - HW_PMC_LVDSC2 - Low Voltage Detect Status And Control 2 register
  32. * - HW_PMC_REGSC - Regulator Status And Control register
  33. *
  34. * - hw_pmc_t - Struct containing all module registers.
  35. */
  36. //! @name Module base addresses
  37. //@{
  38. #ifndef REGS_PMC_BASE
  39. #define HW_PMC_INSTANCE_COUNT (1U) //!< Number of instances of the PMC module.
  40. #define REGS_PMC_BASE (0x4007D000U) //!< Base address for PMC.
  41. #endif
  42. //@}
  43. //-------------------------------------------------------------------------------------------
  44. // HW_PMC_LVDSC1 - Low Voltage Detect Status And Control 1 register
  45. //-------------------------------------------------------------------------------------------
  46. #ifndef __LANGUAGE_ASM__
  47. /*!
  48. * @brief HW_PMC_LVDSC1 - Low Voltage Detect Status And Control 1 register (RW)
  49. *
  50. * Reset value: 0x10U
  51. *
  52. * This register contains status and control bits to support the low voltage
  53. * detect function. This register should be written during the reset initialization
  54. * program to set the desired controls even if the desired settings are the same
  55. * as the reset settings. While the device is in the very low power or low
  56. * leakage modes, the LVD system is disabled regardless of LVDSC1 settings. To protect
  57. * systems that must have LVD always on, configure the Power Mode Protection
  58. * (PMPROT) register of the SMC module (SMC_PMPROT) to disallow any very low power or
  59. * low leakage modes from being enabled. See the device's data sheet for the
  60. * exact LVD trip voltages. The LVDV bits are reset solely on a POR Only event. The
  61. * register's other bits are reset on Chip Reset Not VLLS. For more information
  62. * about these reset types, refer to the Reset section details.
  63. */
  64. typedef union _hw_pmc_lvdsc1
  65. {
  66. uint8_t U;
  67. struct _hw_pmc_lvdsc1_bitfields
  68. {
  69. uint8_t LVDV : 2; //!< [1:0] Low-Voltage Detect Voltage Select
  70. uint8_t RESERVED0 : 2; //!< [3:2]
  71. uint8_t LVDRE : 1; //!< [4] Low-Voltage Detect Reset Enable
  72. uint8_t LVDIE : 1; //!< [5] Low-Voltage Detect Interrupt Enable
  73. uint8_t LVDACK : 1; //!< [6] Low-Voltage Detect Acknowledge
  74. uint8_t LVDF : 1; //!< [7] Low-Voltage Detect Flag
  75. } B;
  76. } hw_pmc_lvdsc1_t;
  77. #endif
  78. /*!
  79. * @name Constants and macros for entire PMC_LVDSC1 register
  80. */
  81. //@{
  82. #define HW_PMC_LVDSC1_ADDR (REGS_PMC_BASE + 0x0U)
  83. #ifndef __LANGUAGE_ASM__
  84. #define HW_PMC_LVDSC1 (*(__IO hw_pmc_lvdsc1_t *) HW_PMC_LVDSC1_ADDR)
  85. #define HW_PMC_LVDSC1_RD() (HW_PMC_LVDSC1.U)
  86. #define HW_PMC_LVDSC1_WR(v) (HW_PMC_LVDSC1.U = (v))
  87. #define HW_PMC_LVDSC1_SET(v) (HW_PMC_LVDSC1_WR(HW_PMC_LVDSC1_RD() | (v)))
  88. #define HW_PMC_LVDSC1_CLR(v) (HW_PMC_LVDSC1_WR(HW_PMC_LVDSC1_RD() & ~(v)))
  89. #define HW_PMC_LVDSC1_TOG(v) (HW_PMC_LVDSC1_WR(HW_PMC_LVDSC1_RD() ^ (v)))
  90. #endif
  91. //@}
  92. /*
  93. * Constants & macros for individual PMC_LVDSC1 bitfields
  94. */
  95. /*!
  96. * @name Register PMC_LVDSC1, field LVDV[1:0] (RW)
  97. *
  98. * Selects the LVD trip point voltage (V LVD ).
  99. *
  100. * Values:
  101. * - 00 - Low trip point selected (V LVD = V LVDL )
  102. * - 01 - High trip point selected (V LVD = V LVDH )
  103. * - 10 - Reserved
  104. * - 11 - Reserved
  105. */
  106. //@{
  107. #define BP_PMC_LVDSC1_LVDV (0U) //!< Bit position for PMC_LVDSC1_LVDV.
  108. #define BM_PMC_LVDSC1_LVDV (0x03U) //!< Bit mask for PMC_LVDSC1_LVDV.
  109. #define BS_PMC_LVDSC1_LVDV (2U) //!< Bit field size in bits for PMC_LVDSC1_LVDV.
  110. #ifndef __LANGUAGE_ASM__
  111. //! @brief Read current value of the PMC_LVDSC1_LVDV field.
  112. #define BR_PMC_LVDSC1_LVDV (HW_PMC_LVDSC1.B.LVDV)
  113. #endif
  114. //! @brief Format value for bitfield PMC_LVDSC1_LVDV.
  115. #define BF_PMC_LVDSC1_LVDV(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_PMC_LVDSC1_LVDV), uint8_t) & BM_PMC_LVDSC1_LVDV)
  116. #ifndef __LANGUAGE_ASM__
  117. //! @brief Set the LVDV field to a new value.
  118. #define BW_PMC_LVDSC1_LVDV(v) (HW_PMC_LVDSC1_WR((HW_PMC_LVDSC1_RD() & ~BM_PMC_LVDSC1_LVDV) | BF_PMC_LVDSC1_LVDV(v)))
  119. #endif
  120. //@}
  121. /*!
  122. * @name Register PMC_LVDSC1, field LVDRE[4] (RW)
  123. *
  124. * This write-once bit enables LVDF events to generate a hardware reset.
  125. * Additional writes are ignored.
  126. *
  127. * Values:
  128. * - 0 - LVDF does not generate hardware resets
  129. * - 1 - Force an MCU reset when LVDF = 1
  130. */
  131. //@{
  132. #define BP_PMC_LVDSC1_LVDRE (4U) //!< Bit position for PMC_LVDSC1_LVDRE.
  133. #define BM_PMC_LVDSC1_LVDRE (0x10U) //!< Bit mask for PMC_LVDSC1_LVDRE.
  134. #define BS_PMC_LVDSC1_LVDRE (1U) //!< Bit field size in bits for PMC_LVDSC1_LVDRE.
  135. #ifndef __LANGUAGE_ASM__
  136. //! @brief Read current value of the PMC_LVDSC1_LVDRE field.
  137. #define BR_PMC_LVDSC1_LVDRE (BITBAND_ACCESS8(HW_PMC_LVDSC1_ADDR, BP_PMC_LVDSC1_LVDRE))
  138. #endif
  139. //! @brief Format value for bitfield PMC_LVDSC1_LVDRE.
  140. #define BF_PMC_LVDSC1_LVDRE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_PMC_LVDSC1_LVDRE), uint8_t) & BM_PMC_LVDSC1_LVDRE)
  141. #ifndef __LANGUAGE_ASM__
  142. //! @brief Set the LVDRE field to a new value.
  143. #define BW_PMC_LVDSC1_LVDRE(v) (BITBAND_ACCESS8(HW_PMC_LVDSC1_ADDR, BP_PMC_LVDSC1_LVDRE) = (v))
  144. #endif
  145. //@}
  146. /*!
  147. * @name Register PMC_LVDSC1, field LVDIE[5] (RW)
  148. *
  149. * Enables hardware interrupt requests for LVDF.
  150. *
  151. * Values:
  152. * - 0 - Hardware interrupt disabled (use polling)
  153. * - 1 - Request a hardware interrupt when LVDF = 1
  154. */
  155. //@{
  156. #define BP_PMC_LVDSC1_LVDIE (5U) //!< Bit position for PMC_LVDSC1_LVDIE.
  157. #define BM_PMC_LVDSC1_LVDIE (0x20U) //!< Bit mask for PMC_LVDSC1_LVDIE.
  158. #define BS_PMC_LVDSC1_LVDIE (1U) //!< Bit field size in bits for PMC_LVDSC1_LVDIE.
  159. #ifndef __LANGUAGE_ASM__
  160. //! @brief Read current value of the PMC_LVDSC1_LVDIE field.
  161. #define BR_PMC_LVDSC1_LVDIE (BITBAND_ACCESS8(HW_PMC_LVDSC1_ADDR, BP_PMC_LVDSC1_LVDIE))
  162. #endif
  163. //! @brief Format value for bitfield PMC_LVDSC1_LVDIE.
  164. #define BF_PMC_LVDSC1_LVDIE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_PMC_LVDSC1_LVDIE), uint8_t) & BM_PMC_LVDSC1_LVDIE)
  165. #ifndef __LANGUAGE_ASM__
  166. //! @brief Set the LVDIE field to a new value.
  167. #define BW_PMC_LVDSC1_LVDIE(v) (BITBAND_ACCESS8(HW_PMC_LVDSC1_ADDR, BP_PMC_LVDSC1_LVDIE) = (v))
  168. #endif
  169. //@}
  170. /*!
  171. * @name Register PMC_LVDSC1, field LVDACK[6] (WORZ)
  172. *
  173. * This write-only field is used to acknowledge low voltage detection errors.
  174. * Write 1 to clear LVDF. Reads always return 0.
  175. */
  176. //@{
  177. #define BP_PMC_LVDSC1_LVDACK (6U) //!< Bit position for PMC_LVDSC1_LVDACK.
  178. #define BM_PMC_LVDSC1_LVDACK (0x40U) //!< Bit mask for PMC_LVDSC1_LVDACK.
  179. #define BS_PMC_LVDSC1_LVDACK (1U) //!< Bit field size in bits for PMC_LVDSC1_LVDACK.
  180. //! @brief Format value for bitfield PMC_LVDSC1_LVDACK.
  181. #define BF_PMC_LVDSC1_LVDACK(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_PMC_LVDSC1_LVDACK), uint8_t) & BM_PMC_LVDSC1_LVDACK)
  182. #ifndef __LANGUAGE_ASM__
  183. //! @brief Set the LVDACK field to a new value.
  184. #define BW_PMC_LVDSC1_LVDACK(v) (BITBAND_ACCESS8(HW_PMC_LVDSC1_ADDR, BP_PMC_LVDSC1_LVDACK) = (v))
  185. #endif
  186. //@}
  187. /*!
  188. * @name Register PMC_LVDSC1, field LVDF[7] (RO)
  189. *
  190. * This read-only status field indicates a low-voltage detect event.
  191. *
  192. * Values:
  193. * - 0 - Low-voltage event not detected
  194. * - 1 - Low-voltage event detected
  195. */
  196. //@{
  197. #define BP_PMC_LVDSC1_LVDF (7U) //!< Bit position for PMC_LVDSC1_LVDF.
  198. #define BM_PMC_LVDSC1_LVDF (0x80U) //!< Bit mask for PMC_LVDSC1_LVDF.
  199. #define BS_PMC_LVDSC1_LVDF (1U) //!< Bit field size in bits for PMC_LVDSC1_LVDF.
  200. #ifndef __LANGUAGE_ASM__
  201. //! @brief Read current value of the PMC_LVDSC1_LVDF field.
  202. #define BR_PMC_LVDSC1_LVDF (BITBAND_ACCESS8(HW_PMC_LVDSC1_ADDR, BP_PMC_LVDSC1_LVDF))
  203. #endif
  204. //@}
  205. //-------------------------------------------------------------------------------------------
  206. // HW_PMC_LVDSC2 - Low Voltage Detect Status And Control 2 register
  207. //-------------------------------------------------------------------------------------------
  208. #ifndef __LANGUAGE_ASM__
  209. /*!
  210. * @brief HW_PMC_LVDSC2 - Low Voltage Detect Status And Control 2 register (RW)
  211. *
  212. * Reset value: 0x00U
  213. *
  214. * This register contains status and control bits to support the low voltage
  215. * warning function. While the device is in the very low power or low leakage modes,
  216. * the LVD system is disabled regardless of LVDSC2 settings. See the device's
  217. * data sheet for the exact LVD trip voltages. The LVW trip voltages depend on LVWV
  218. * and LVDV. LVWV is reset solely on a POR Only event. The other fields of the
  219. * register are reset on Chip Reset Not VLLS. For more information about these
  220. * reset types, refer to the Reset section details.
  221. */
  222. typedef union _hw_pmc_lvdsc2
  223. {
  224. uint8_t U;
  225. struct _hw_pmc_lvdsc2_bitfields
  226. {
  227. uint8_t LVWV : 2; //!< [1:0] Low-Voltage Warning Voltage Select
  228. uint8_t RESERVED0 : 3; //!< [4:2]
  229. uint8_t LVWIE : 1; //!< [5] Low-Voltage Warning Interrupt Enable
  230. uint8_t LVWACK : 1; //!< [6] Low-Voltage Warning Acknowledge
  231. uint8_t LVWF : 1; //!< [7] Low-Voltage Warning Flag
  232. } B;
  233. } hw_pmc_lvdsc2_t;
  234. #endif
  235. /*!
  236. * @name Constants and macros for entire PMC_LVDSC2 register
  237. */
  238. //@{
  239. #define HW_PMC_LVDSC2_ADDR (REGS_PMC_BASE + 0x1U)
  240. #ifndef __LANGUAGE_ASM__
  241. #define HW_PMC_LVDSC2 (*(__IO hw_pmc_lvdsc2_t *) HW_PMC_LVDSC2_ADDR)
  242. #define HW_PMC_LVDSC2_RD() (HW_PMC_LVDSC2.U)
  243. #define HW_PMC_LVDSC2_WR(v) (HW_PMC_LVDSC2.U = (v))
  244. #define HW_PMC_LVDSC2_SET(v) (HW_PMC_LVDSC2_WR(HW_PMC_LVDSC2_RD() | (v)))
  245. #define HW_PMC_LVDSC2_CLR(v) (HW_PMC_LVDSC2_WR(HW_PMC_LVDSC2_RD() & ~(v)))
  246. #define HW_PMC_LVDSC2_TOG(v) (HW_PMC_LVDSC2_WR(HW_PMC_LVDSC2_RD() ^ (v)))
  247. #endif
  248. //@}
  249. /*
  250. * Constants & macros for individual PMC_LVDSC2 bitfields
  251. */
  252. /*!
  253. * @name Register PMC_LVDSC2, field LVWV[1:0] (RW)
  254. *
  255. * Selects the LVW trip point voltage (VLVW). The actual voltage for the warning
  256. * depends on LVDSC1[LVDV].
  257. *
  258. * Values:
  259. * - 00 - Low trip point selected (VLVW = VLVW1)
  260. * - 01 - Mid 1 trip point selected (VLVW = VLVW2)
  261. * - 10 - Mid 2 trip point selected (VLVW = VLVW3)
  262. * - 11 - High trip point selected (VLVW = VLVW4)
  263. */
  264. //@{
  265. #define BP_PMC_LVDSC2_LVWV (0U) //!< Bit position for PMC_LVDSC2_LVWV.
  266. #define BM_PMC_LVDSC2_LVWV (0x03U) //!< Bit mask for PMC_LVDSC2_LVWV.
  267. #define BS_PMC_LVDSC2_LVWV (2U) //!< Bit field size in bits for PMC_LVDSC2_LVWV.
  268. #ifndef __LANGUAGE_ASM__
  269. //! @brief Read current value of the PMC_LVDSC2_LVWV field.
  270. #define BR_PMC_LVDSC2_LVWV (HW_PMC_LVDSC2.B.LVWV)
  271. #endif
  272. //! @brief Format value for bitfield PMC_LVDSC2_LVWV.
  273. #define BF_PMC_LVDSC2_LVWV(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_PMC_LVDSC2_LVWV), uint8_t) & BM_PMC_LVDSC2_LVWV)
  274. #ifndef __LANGUAGE_ASM__
  275. //! @brief Set the LVWV field to a new value.
  276. #define BW_PMC_LVDSC2_LVWV(v) (HW_PMC_LVDSC2_WR((HW_PMC_LVDSC2_RD() & ~BM_PMC_LVDSC2_LVWV) | BF_PMC_LVDSC2_LVWV(v)))
  277. #endif
  278. //@}
  279. /*!
  280. * @name Register PMC_LVDSC2, field LVWIE[5] (RW)
  281. *
  282. * Enables hardware interrupt requests for LVWF.
  283. *
  284. * Values:
  285. * - 0 - Hardware interrupt disabled (use polling)
  286. * - 1 - Request a hardware interrupt when LVWF = 1
  287. */
  288. //@{
  289. #define BP_PMC_LVDSC2_LVWIE (5U) //!< Bit position for PMC_LVDSC2_LVWIE.
  290. #define BM_PMC_LVDSC2_LVWIE (0x20U) //!< Bit mask for PMC_LVDSC2_LVWIE.
  291. #define BS_PMC_LVDSC2_LVWIE (1U) //!< Bit field size in bits for PMC_LVDSC2_LVWIE.
  292. #ifndef __LANGUAGE_ASM__
  293. //! @brief Read current value of the PMC_LVDSC2_LVWIE field.
  294. #define BR_PMC_LVDSC2_LVWIE (BITBAND_ACCESS8(HW_PMC_LVDSC2_ADDR, BP_PMC_LVDSC2_LVWIE))
  295. #endif
  296. //! @brief Format value for bitfield PMC_LVDSC2_LVWIE.
  297. #define BF_PMC_LVDSC2_LVWIE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_PMC_LVDSC2_LVWIE), uint8_t) & BM_PMC_LVDSC2_LVWIE)
  298. #ifndef __LANGUAGE_ASM__
  299. //! @brief Set the LVWIE field to a new value.
  300. #define BW_PMC_LVDSC2_LVWIE(v) (BITBAND_ACCESS8(HW_PMC_LVDSC2_ADDR, BP_PMC_LVDSC2_LVWIE) = (v))
  301. #endif
  302. //@}
  303. /*!
  304. * @name Register PMC_LVDSC2, field LVWACK[6] (WORZ)
  305. *
  306. * This write-only field is used to acknowledge low voltage warning errors.
  307. * Write 1 to clear LVWF. Reads always return 0.
  308. */
  309. //@{
  310. #define BP_PMC_LVDSC2_LVWACK (6U) //!< Bit position for PMC_LVDSC2_LVWACK.
  311. #define BM_PMC_LVDSC2_LVWACK (0x40U) //!< Bit mask for PMC_LVDSC2_LVWACK.
  312. #define BS_PMC_LVDSC2_LVWACK (1U) //!< Bit field size in bits for PMC_LVDSC2_LVWACK.
  313. //! @brief Format value for bitfield PMC_LVDSC2_LVWACK.
  314. #define BF_PMC_LVDSC2_LVWACK(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_PMC_LVDSC2_LVWACK), uint8_t) & BM_PMC_LVDSC2_LVWACK)
  315. #ifndef __LANGUAGE_ASM__
  316. //! @brief Set the LVWACK field to a new value.
  317. #define BW_PMC_LVDSC2_LVWACK(v) (BITBAND_ACCESS8(HW_PMC_LVDSC2_ADDR, BP_PMC_LVDSC2_LVWACK) = (v))
  318. #endif
  319. //@}
  320. /*!
  321. * @name Register PMC_LVDSC2, field LVWF[7] (RO)
  322. *
  323. * This read-only status field indicates a low-voltage warning event. LVWF is
  324. * set when VSupply transitions below the trip point, or after reset and VSupply is
  325. * already below VLVW. LVWF may be 1 after power-on reset, therefore, to use LVW
  326. * interrupt function, before enabling LVWIE, LVWF must be cleared by writing
  327. * LVWACK first.
  328. *
  329. * Values:
  330. * - 0 - Low-voltage warning event not detected
  331. * - 1 - Low-voltage warning event detected
  332. */
  333. //@{
  334. #define BP_PMC_LVDSC2_LVWF (7U) //!< Bit position for PMC_LVDSC2_LVWF.
  335. #define BM_PMC_LVDSC2_LVWF (0x80U) //!< Bit mask for PMC_LVDSC2_LVWF.
  336. #define BS_PMC_LVDSC2_LVWF (1U) //!< Bit field size in bits for PMC_LVDSC2_LVWF.
  337. #ifndef __LANGUAGE_ASM__
  338. //! @brief Read current value of the PMC_LVDSC2_LVWF field.
  339. #define BR_PMC_LVDSC2_LVWF (BITBAND_ACCESS8(HW_PMC_LVDSC2_ADDR, BP_PMC_LVDSC2_LVWF))
  340. #endif
  341. //@}
  342. //-------------------------------------------------------------------------------------------
  343. // HW_PMC_REGSC - Regulator Status And Control register
  344. //-------------------------------------------------------------------------------------------
  345. #ifndef __LANGUAGE_ASM__
  346. /*!
  347. * @brief HW_PMC_REGSC - Regulator Status And Control register (RW)
  348. *
  349. * Reset value: 0x04U
  350. *
  351. * The PMC contains an internal voltage regulator. The voltage regulator design
  352. * uses a bandgap reference that is also available through a buffer as input to
  353. * certain internal peripherals, such as the CMP and ADC. The internal regulator
  354. * provides a status bit (REGONS) indicating the regulator is in run regulation.
  355. * This register is reset on Chip Reset Not VLLS and by reset types that trigger
  356. * Chip Reset not VLLS. See the Reset section details for more information.
  357. */
  358. typedef union _hw_pmc_regsc
  359. {
  360. uint8_t U;
  361. struct _hw_pmc_regsc_bitfields
  362. {
  363. uint8_t BGBE : 1; //!< [0] Bandgap Buffer Enable
  364. uint8_t RESERVED0 : 1; //!< [1]
  365. uint8_t REGONS : 1; //!< [2] Regulator In Run Regulation Status
  366. uint8_t ACKISO : 1; //!< [3] Acknowledge Isolation
  367. uint8_t BGEN : 1; //!< [4] Bandgap Enable In VLPx Operation
  368. uint8_t RESERVED1 : 3; //!< [7:5]
  369. } B;
  370. } hw_pmc_regsc_t;
  371. #endif
  372. /*!
  373. * @name Constants and macros for entire PMC_REGSC register
  374. */
  375. //@{
  376. #define HW_PMC_REGSC_ADDR (REGS_PMC_BASE + 0x2U)
  377. #ifndef __LANGUAGE_ASM__
  378. #define HW_PMC_REGSC (*(__IO hw_pmc_regsc_t *) HW_PMC_REGSC_ADDR)
  379. #define HW_PMC_REGSC_RD() (HW_PMC_REGSC.U)
  380. #define HW_PMC_REGSC_WR(v) (HW_PMC_REGSC.U = (v))
  381. #define HW_PMC_REGSC_SET(v) (HW_PMC_REGSC_WR(HW_PMC_REGSC_RD() | (v)))
  382. #define HW_PMC_REGSC_CLR(v) (HW_PMC_REGSC_WR(HW_PMC_REGSC_RD() & ~(v)))
  383. #define HW_PMC_REGSC_TOG(v) (HW_PMC_REGSC_WR(HW_PMC_REGSC_RD() ^ (v)))
  384. #endif
  385. //@}
  386. /*
  387. * Constants & macros for individual PMC_REGSC bitfields
  388. */
  389. /*!
  390. * @name Register PMC_REGSC, field BGBE[0] (RW)
  391. *
  392. * Enables the bandgap buffer.
  393. *
  394. * Values:
  395. * - 0 - Bandgap buffer not enabled
  396. * - 1 - Bandgap buffer enabled
  397. */
  398. //@{
  399. #define BP_PMC_REGSC_BGBE (0U) //!< Bit position for PMC_REGSC_BGBE.
  400. #define BM_PMC_REGSC_BGBE (0x01U) //!< Bit mask for PMC_REGSC_BGBE.
  401. #define BS_PMC_REGSC_BGBE (1U) //!< Bit field size in bits for PMC_REGSC_BGBE.
  402. #ifndef __LANGUAGE_ASM__
  403. //! @brief Read current value of the PMC_REGSC_BGBE field.
  404. #define BR_PMC_REGSC_BGBE (BITBAND_ACCESS8(HW_PMC_REGSC_ADDR, BP_PMC_REGSC_BGBE))
  405. #endif
  406. //! @brief Format value for bitfield PMC_REGSC_BGBE.
  407. #define BF_PMC_REGSC_BGBE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_PMC_REGSC_BGBE), uint8_t) & BM_PMC_REGSC_BGBE)
  408. #ifndef __LANGUAGE_ASM__
  409. //! @brief Set the BGBE field to a new value.
  410. #define BW_PMC_REGSC_BGBE(v) (BITBAND_ACCESS8(HW_PMC_REGSC_ADDR, BP_PMC_REGSC_BGBE) = (v))
  411. #endif
  412. //@}
  413. /*!
  414. * @name Register PMC_REGSC, field REGONS[2] (RO)
  415. *
  416. * This read-only field provides the current status of the internal voltage
  417. * regulator.
  418. *
  419. * Values:
  420. * - 0 - Regulator is in stop regulation or in transition to/from it
  421. * - 1 - Regulator is in run regulation
  422. */
  423. //@{
  424. #define BP_PMC_REGSC_REGONS (2U) //!< Bit position for PMC_REGSC_REGONS.
  425. #define BM_PMC_REGSC_REGONS (0x04U) //!< Bit mask for PMC_REGSC_REGONS.
  426. #define BS_PMC_REGSC_REGONS (1U) //!< Bit field size in bits for PMC_REGSC_REGONS.
  427. #ifndef __LANGUAGE_ASM__
  428. //! @brief Read current value of the PMC_REGSC_REGONS field.
  429. #define BR_PMC_REGSC_REGONS (BITBAND_ACCESS8(HW_PMC_REGSC_ADDR, BP_PMC_REGSC_REGONS))
  430. #endif
  431. //@}
  432. /*!
  433. * @name Register PMC_REGSC, field ACKISO[3] (W1C)
  434. *
  435. * Reading this field indicates whether certain peripherals and the I/O pads are
  436. * in a latched state as a result of having been in a VLLS mode. Writing 1 to
  437. * this field when it is set releases the I/O pads and certain peripherals to their
  438. * normal run mode state. After recovering from a VLLS mode, user should restore
  439. * chip configuration before clearing ACKISO. In particular, pin configuration
  440. * for enabled LLWU wakeup pins should be restored to avoid any LLWU flag from
  441. * being falsely set when ACKISO is cleared.
  442. *
  443. * Values:
  444. * - 0 - Peripherals and I/O pads are in normal run state.
  445. * - 1 - Certain peripherals and I/O pads are in an isolated and latched state.
  446. */
  447. //@{
  448. #define BP_PMC_REGSC_ACKISO (3U) //!< Bit position for PMC_REGSC_ACKISO.
  449. #define BM_PMC_REGSC_ACKISO (0x08U) //!< Bit mask for PMC_REGSC_ACKISO.
  450. #define BS_PMC_REGSC_ACKISO (1U) //!< Bit field size in bits for PMC_REGSC_ACKISO.
  451. #ifndef __LANGUAGE_ASM__
  452. //! @brief Read current value of the PMC_REGSC_ACKISO field.
  453. #define BR_PMC_REGSC_ACKISO (BITBAND_ACCESS8(HW_PMC_REGSC_ADDR, BP_PMC_REGSC_ACKISO))
  454. #endif
  455. //! @brief Format value for bitfield PMC_REGSC_ACKISO.
  456. #define BF_PMC_REGSC_ACKISO(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_PMC_REGSC_ACKISO), uint8_t) & BM_PMC_REGSC_ACKISO)
  457. #ifndef __LANGUAGE_ASM__
  458. //! @brief Set the ACKISO field to a new value.
  459. #define BW_PMC_REGSC_ACKISO(v) (BITBAND_ACCESS8(HW_PMC_REGSC_ADDR, BP_PMC_REGSC_ACKISO) = (v))
  460. #endif
  461. //@}
  462. /*!
  463. * @name Register PMC_REGSC, field BGEN[4] (RW)
  464. *
  465. * BGEN controls whether the bandgap is enabled in lower power modes of
  466. * operation (VLPx, LLS, and VLLSx). When on-chip peripherals require the bandgap voltage
  467. * reference in low power modes of operation, set BGEN to continue to enable the
  468. * bandgap operation. When the bandgap voltage reference is not needed in low
  469. * power modes, clear BGEN to avoid excess power consumption.
  470. *
  471. * Values:
  472. * - 0 - Bandgap voltage reference is disabled in VLPx , LLS , and VLLSx modes.
  473. * - 1 - Bandgap voltage reference is enabled in VLPx , LLS , and VLLSx modes.
  474. */
  475. //@{
  476. #define BP_PMC_REGSC_BGEN (4U) //!< Bit position for PMC_REGSC_BGEN.
  477. #define BM_PMC_REGSC_BGEN (0x10U) //!< Bit mask for PMC_REGSC_BGEN.
  478. #define BS_PMC_REGSC_BGEN (1U) //!< Bit field size in bits for PMC_REGSC_BGEN.
  479. #ifndef __LANGUAGE_ASM__
  480. //! @brief Read current value of the PMC_REGSC_BGEN field.
  481. #define BR_PMC_REGSC_BGEN (BITBAND_ACCESS8(HW_PMC_REGSC_ADDR, BP_PMC_REGSC_BGEN))
  482. #endif
  483. //! @brief Format value for bitfield PMC_REGSC_BGEN.
  484. #define BF_PMC_REGSC_BGEN(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_PMC_REGSC_BGEN), uint8_t) & BM_PMC_REGSC_BGEN)
  485. #ifndef __LANGUAGE_ASM__
  486. //! @brief Set the BGEN field to a new value.
  487. #define BW_PMC_REGSC_BGEN(v) (BITBAND_ACCESS8(HW_PMC_REGSC_ADDR, BP_PMC_REGSC_BGEN) = (v))
  488. #endif
  489. //@}
  490. //-------------------------------------------------------------------------------------------
  491. // hw_pmc_t - module struct
  492. //-------------------------------------------------------------------------------------------
  493. /*!
  494. * @brief All PMC module registers.
  495. */
  496. #ifndef __LANGUAGE_ASM__
  497. #pragma pack(1)
  498. typedef struct _hw_pmc
  499. {
  500. __IO hw_pmc_lvdsc1_t LVDSC1; //!< [0x0] Low Voltage Detect Status And Control 1 register
  501. __IO hw_pmc_lvdsc2_t LVDSC2; //!< [0x1] Low Voltage Detect Status And Control 2 register
  502. __IO hw_pmc_regsc_t REGSC; //!< [0x2] Regulator Status And Control register
  503. } hw_pmc_t;
  504. #pragma pack()
  505. //! @brief Macro to access all PMC registers.
  506. //! @return Reference (not a pointer) to the registers struct. To get a pointer to the struct,
  507. //! use the '&' operator, like <code>&HW_PMC</code>.
  508. #define HW_PMC (*(hw_pmc_t *) REGS_PMC_BASE)
  509. #endif
  510. #endif // __HW_PMC_REGISTERS_H__
  511. // v22/130726/0.9
  512. // EOF