MK64F12_ewm.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430
  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_EWM_REGISTERS_H__
  22. #define __HW_EWM_REGISTERS_H__
  23. #include "regs.h"
  24. /*
  25. * MK64F12 EWM
  26. *
  27. * External Watchdog Monitor
  28. *
  29. * Registers defined in this header file:
  30. * - HW_EWM_CTRL - Control Register
  31. * - HW_EWM_SERV - Service Register
  32. * - HW_EWM_CMPL - Compare Low Register
  33. * - HW_EWM_CMPH - Compare High Register
  34. *
  35. * - hw_ewm_t - Struct containing all module registers.
  36. */
  37. //! @name Module base addresses
  38. //@{
  39. #ifndef REGS_EWM_BASE
  40. #define HW_EWM_INSTANCE_COUNT (1U) //!< Number of instances of the EWM module.
  41. #define REGS_EWM_BASE (0x40061000U) //!< Base address for EWM.
  42. #endif
  43. //@}
  44. //-------------------------------------------------------------------------------------------
  45. // HW_EWM_CTRL - Control Register
  46. //-------------------------------------------------------------------------------------------
  47. #ifndef __LANGUAGE_ASM__
  48. /*!
  49. * @brief HW_EWM_CTRL - Control Register (RW)
  50. *
  51. * Reset value: 0x00U
  52. *
  53. * The CTRL register is cleared by any reset. INEN, ASSIN and EWMEN bits can be
  54. * written once after a CPU reset. Modifying these bits more than once, generates
  55. * a bus transfer error.
  56. */
  57. typedef union _hw_ewm_ctrl
  58. {
  59. uint8_t U;
  60. struct _hw_ewm_ctrl_bitfields
  61. {
  62. uint8_t EWMEN : 1; //!< [0] EWM enable.
  63. uint8_t ASSIN : 1; //!< [1] EWM_in's Assertion State Select.
  64. uint8_t INEN : 1; //!< [2] Input Enable.
  65. uint8_t INTEN : 1; //!< [3] Interrupt Enable.
  66. uint8_t RESERVED0 : 4; //!< [7:4]
  67. } B;
  68. } hw_ewm_ctrl_t;
  69. #endif
  70. /*!
  71. * @name Constants and macros for entire EWM_CTRL register
  72. */
  73. //@{
  74. #define HW_EWM_CTRL_ADDR (REGS_EWM_BASE + 0x0U)
  75. #ifndef __LANGUAGE_ASM__
  76. #define HW_EWM_CTRL (*(__IO hw_ewm_ctrl_t *) HW_EWM_CTRL_ADDR)
  77. #define HW_EWM_CTRL_RD() (HW_EWM_CTRL.U)
  78. #define HW_EWM_CTRL_WR(v) (HW_EWM_CTRL.U = (v))
  79. #define HW_EWM_CTRL_SET(v) (HW_EWM_CTRL_WR(HW_EWM_CTRL_RD() | (v)))
  80. #define HW_EWM_CTRL_CLR(v) (HW_EWM_CTRL_WR(HW_EWM_CTRL_RD() & ~(v)))
  81. #define HW_EWM_CTRL_TOG(v) (HW_EWM_CTRL_WR(HW_EWM_CTRL_RD() ^ (v)))
  82. #endif
  83. //@}
  84. /*
  85. * Constants & macros for individual EWM_CTRL bitfields
  86. */
  87. /*!
  88. * @name Register EWM_CTRL, field EWMEN[0] (RW)
  89. *
  90. * This bit when set, enables the EWM module. This resets the EWM counter to
  91. * zero and deasserts the EWM_out signal. Clearing EWMEN bit disables the EWM, and
  92. * therefore it cannot be enabled until a reset occurs, due to the write-once
  93. * nature of this bit.
  94. */
  95. //@{
  96. #define BP_EWM_CTRL_EWMEN (0U) //!< Bit position for EWM_CTRL_EWMEN.
  97. #define BM_EWM_CTRL_EWMEN (0x01U) //!< Bit mask for EWM_CTRL_EWMEN.
  98. #define BS_EWM_CTRL_EWMEN (1U) //!< Bit field size in bits for EWM_CTRL_EWMEN.
  99. #ifndef __LANGUAGE_ASM__
  100. //! @brief Read current value of the EWM_CTRL_EWMEN field.
  101. #define BR_EWM_CTRL_EWMEN (BITBAND_ACCESS8(HW_EWM_CTRL_ADDR, BP_EWM_CTRL_EWMEN))
  102. #endif
  103. //! @brief Format value for bitfield EWM_CTRL_EWMEN.
  104. #define BF_EWM_CTRL_EWMEN(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_EWM_CTRL_EWMEN), uint8_t) & BM_EWM_CTRL_EWMEN)
  105. #ifndef __LANGUAGE_ASM__
  106. //! @brief Set the EWMEN field to a new value.
  107. #define BW_EWM_CTRL_EWMEN(v) (BITBAND_ACCESS8(HW_EWM_CTRL_ADDR, BP_EWM_CTRL_EWMEN) = (v))
  108. #endif
  109. //@}
  110. /*!
  111. * @name Register EWM_CTRL, field ASSIN[1] (RW)
  112. *
  113. * Default assert state of the EWM_in signal is logic zero. Setting ASSIN bit
  114. * inverts the assert state to a logic one.
  115. */
  116. //@{
  117. #define BP_EWM_CTRL_ASSIN (1U) //!< Bit position for EWM_CTRL_ASSIN.
  118. #define BM_EWM_CTRL_ASSIN (0x02U) //!< Bit mask for EWM_CTRL_ASSIN.
  119. #define BS_EWM_CTRL_ASSIN (1U) //!< Bit field size in bits for EWM_CTRL_ASSIN.
  120. #ifndef __LANGUAGE_ASM__
  121. //! @brief Read current value of the EWM_CTRL_ASSIN field.
  122. #define BR_EWM_CTRL_ASSIN (BITBAND_ACCESS8(HW_EWM_CTRL_ADDR, BP_EWM_CTRL_ASSIN))
  123. #endif
  124. //! @brief Format value for bitfield EWM_CTRL_ASSIN.
  125. #define BF_EWM_CTRL_ASSIN(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_EWM_CTRL_ASSIN), uint8_t) & BM_EWM_CTRL_ASSIN)
  126. #ifndef __LANGUAGE_ASM__
  127. //! @brief Set the ASSIN field to a new value.
  128. #define BW_EWM_CTRL_ASSIN(v) (BITBAND_ACCESS8(HW_EWM_CTRL_ADDR, BP_EWM_CTRL_ASSIN) = (v))
  129. #endif
  130. //@}
  131. /*!
  132. * @name Register EWM_CTRL, field INEN[2] (RW)
  133. *
  134. * This bit when set, enables the EWM_in port.
  135. */
  136. //@{
  137. #define BP_EWM_CTRL_INEN (2U) //!< Bit position for EWM_CTRL_INEN.
  138. #define BM_EWM_CTRL_INEN (0x04U) //!< Bit mask for EWM_CTRL_INEN.
  139. #define BS_EWM_CTRL_INEN (1U) //!< Bit field size in bits for EWM_CTRL_INEN.
  140. #ifndef __LANGUAGE_ASM__
  141. //! @brief Read current value of the EWM_CTRL_INEN field.
  142. #define BR_EWM_CTRL_INEN (BITBAND_ACCESS8(HW_EWM_CTRL_ADDR, BP_EWM_CTRL_INEN))
  143. #endif
  144. //! @brief Format value for bitfield EWM_CTRL_INEN.
  145. #define BF_EWM_CTRL_INEN(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_EWM_CTRL_INEN), uint8_t) & BM_EWM_CTRL_INEN)
  146. #ifndef __LANGUAGE_ASM__
  147. //! @brief Set the INEN field to a new value.
  148. #define BW_EWM_CTRL_INEN(v) (BITBAND_ACCESS8(HW_EWM_CTRL_ADDR, BP_EWM_CTRL_INEN) = (v))
  149. #endif
  150. //@}
  151. /*!
  152. * @name Register EWM_CTRL, field INTEN[3] (RW)
  153. *
  154. * This bit when set and EWM_out is asserted, an interrupt request is generated.
  155. * To de-assert interrupt request, user should clear this bit by writing 0.
  156. */
  157. //@{
  158. #define BP_EWM_CTRL_INTEN (3U) //!< Bit position for EWM_CTRL_INTEN.
  159. #define BM_EWM_CTRL_INTEN (0x08U) //!< Bit mask for EWM_CTRL_INTEN.
  160. #define BS_EWM_CTRL_INTEN (1U) //!< Bit field size in bits for EWM_CTRL_INTEN.
  161. #ifndef __LANGUAGE_ASM__
  162. //! @brief Read current value of the EWM_CTRL_INTEN field.
  163. #define BR_EWM_CTRL_INTEN (BITBAND_ACCESS8(HW_EWM_CTRL_ADDR, BP_EWM_CTRL_INTEN))
  164. #endif
  165. //! @brief Format value for bitfield EWM_CTRL_INTEN.
  166. #define BF_EWM_CTRL_INTEN(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_EWM_CTRL_INTEN), uint8_t) & BM_EWM_CTRL_INTEN)
  167. #ifndef __LANGUAGE_ASM__
  168. //! @brief Set the INTEN field to a new value.
  169. #define BW_EWM_CTRL_INTEN(v) (BITBAND_ACCESS8(HW_EWM_CTRL_ADDR, BP_EWM_CTRL_INTEN) = (v))
  170. #endif
  171. //@}
  172. //-------------------------------------------------------------------------------------------
  173. // HW_EWM_SERV - Service Register
  174. //-------------------------------------------------------------------------------------------
  175. #ifndef __LANGUAGE_ASM__
  176. /*!
  177. * @brief HW_EWM_SERV - Service Register (WORZ)
  178. *
  179. * Reset value: 0x00U
  180. *
  181. * The SERV register provides the interface from the CPU to the EWM module. It
  182. * is write-only and reads of this register return zero.
  183. */
  184. typedef union _hw_ewm_serv
  185. {
  186. uint8_t U;
  187. struct _hw_ewm_serv_bitfields
  188. {
  189. uint8_t SERVICE : 8; //!< [7:0]
  190. } B;
  191. } hw_ewm_serv_t;
  192. #endif
  193. /*!
  194. * @name Constants and macros for entire EWM_SERV register
  195. */
  196. //@{
  197. #define HW_EWM_SERV_ADDR (REGS_EWM_BASE + 0x1U)
  198. #ifndef __LANGUAGE_ASM__
  199. #define HW_EWM_SERV (*(__O hw_ewm_serv_t *) HW_EWM_SERV_ADDR)
  200. #define HW_EWM_SERV_RD() (HW_EWM_SERV.U)
  201. #define HW_EWM_SERV_WR(v) (HW_EWM_SERV.U = (v))
  202. #endif
  203. //@}
  204. /*
  205. * Constants & macros for individual EWM_SERV bitfields
  206. */
  207. /*!
  208. * @name Register EWM_SERV, field SERVICE[7:0] (WORZ)
  209. *
  210. * The EWM service mechanism requires the CPU to write two values to the SERV
  211. * register: a first data byte of 0xB4, followed by a second data byte of 0x2C. The
  212. * EWM service is illegal if either of the following conditions is true. The
  213. * first or second data byte is not written correctly. The second data byte is not
  214. * written within a fixed number of peripheral bus cycles of the first data byte.
  215. * This fixed number of cycles is called EWM_service_time.
  216. */
  217. //@{
  218. #define BP_EWM_SERV_SERVICE (0U) //!< Bit position for EWM_SERV_SERVICE.
  219. #define BM_EWM_SERV_SERVICE (0xFFU) //!< Bit mask for EWM_SERV_SERVICE.
  220. #define BS_EWM_SERV_SERVICE (8U) //!< Bit field size in bits for EWM_SERV_SERVICE.
  221. //! @brief Format value for bitfield EWM_SERV_SERVICE.
  222. #define BF_EWM_SERV_SERVICE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_EWM_SERV_SERVICE), uint8_t) & BM_EWM_SERV_SERVICE)
  223. #ifndef __LANGUAGE_ASM__
  224. //! @brief Set the SERVICE field to a new value.
  225. #define BW_EWM_SERV_SERVICE(v) (HW_EWM_SERV_WR(v))
  226. #endif
  227. //@}
  228. //-------------------------------------------------------------------------------------------
  229. // HW_EWM_CMPL - Compare Low Register
  230. //-------------------------------------------------------------------------------------------
  231. #ifndef __LANGUAGE_ASM__
  232. /*!
  233. * @brief HW_EWM_CMPL - Compare Low Register (RW)
  234. *
  235. * Reset value: 0x00U
  236. *
  237. * The CMPL register is reset to zero after a CPU reset. This provides no
  238. * minimum time for the CPU to service the EWM counter. This register can be written
  239. * only once after a CPU reset. Writing this register more than once generates a
  240. * bus transfer error.
  241. */
  242. typedef union _hw_ewm_cmpl
  243. {
  244. uint8_t U;
  245. struct _hw_ewm_cmpl_bitfields
  246. {
  247. uint8_t COMPAREL : 8; //!< [7:0]
  248. } B;
  249. } hw_ewm_cmpl_t;
  250. #endif
  251. /*!
  252. * @name Constants and macros for entire EWM_CMPL register
  253. */
  254. //@{
  255. #define HW_EWM_CMPL_ADDR (REGS_EWM_BASE + 0x2U)
  256. #ifndef __LANGUAGE_ASM__
  257. #define HW_EWM_CMPL (*(__IO hw_ewm_cmpl_t *) HW_EWM_CMPL_ADDR)
  258. #define HW_EWM_CMPL_RD() (HW_EWM_CMPL.U)
  259. #define HW_EWM_CMPL_WR(v) (HW_EWM_CMPL.U = (v))
  260. #define HW_EWM_CMPL_SET(v) (HW_EWM_CMPL_WR(HW_EWM_CMPL_RD() | (v)))
  261. #define HW_EWM_CMPL_CLR(v) (HW_EWM_CMPL_WR(HW_EWM_CMPL_RD() & ~(v)))
  262. #define HW_EWM_CMPL_TOG(v) (HW_EWM_CMPL_WR(HW_EWM_CMPL_RD() ^ (v)))
  263. #endif
  264. //@}
  265. /*
  266. * Constants & macros for individual EWM_CMPL bitfields
  267. */
  268. /*!
  269. * @name Register EWM_CMPL, field COMPAREL[7:0] (RW)
  270. *
  271. * To prevent runaway code from changing this field, software should write to
  272. * this field after a CPU reset even if the (default) minimum service time is
  273. * required.
  274. */
  275. //@{
  276. #define BP_EWM_CMPL_COMPAREL (0U) //!< Bit position for EWM_CMPL_COMPAREL.
  277. #define BM_EWM_CMPL_COMPAREL (0xFFU) //!< Bit mask for EWM_CMPL_COMPAREL.
  278. #define BS_EWM_CMPL_COMPAREL (8U) //!< Bit field size in bits for EWM_CMPL_COMPAREL.
  279. #ifndef __LANGUAGE_ASM__
  280. //! @brief Read current value of the EWM_CMPL_COMPAREL field.
  281. #define BR_EWM_CMPL_COMPAREL (HW_EWM_CMPL.U)
  282. #endif
  283. //! @brief Format value for bitfield EWM_CMPL_COMPAREL.
  284. #define BF_EWM_CMPL_COMPAREL(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_EWM_CMPL_COMPAREL), uint8_t) & BM_EWM_CMPL_COMPAREL)
  285. #ifndef __LANGUAGE_ASM__
  286. //! @brief Set the COMPAREL field to a new value.
  287. #define BW_EWM_CMPL_COMPAREL(v) (HW_EWM_CMPL_WR(v))
  288. #endif
  289. //@}
  290. //-------------------------------------------------------------------------------------------
  291. // HW_EWM_CMPH - Compare High Register
  292. //-------------------------------------------------------------------------------------------
  293. #ifndef __LANGUAGE_ASM__
  294. /*!
  295. * @brief HW_EWM_CMPH - Compare High Register (RW)
  296. *
  297. * Reset value: 0xFFU
  298. *
  299. * The CMPH register is reset to 0xFF after a CPU reset. This provides a maximum
  300. * of 256 clocks time, for the CPU to service the EWM counter. This register can
  301. * be written only once after a CPU reset. Writing this register more than once
  302. * generates a bus transfer error. The valid values for CMPH are up to 0xFE
  303. * because the EWM counter never expires when CMPH = 0xFF. The expiration happens only
  304. * if EWM counter is greater than CMPH.
  305. */
  306. typedef union _hw_ewm_cmph
  307. {
  308. uint8_t U;
  309. struct _hw_ewm_cmph_bitfields
  310. {
  311. uint8_t COMPAREH : 8; //!< [7:0]
  312. } B;
  313. } hw_ewm_cmph_t;
  314. #endif
  315. /*!
  316. * @name Constants and macros for entire EWM_CMPH register
  317. */
  318. //@{
  319. #define HW_EWM_CMPH_ADDR (REGS_EWM_BASE + 0x3U)
  320. #ifndef __LANGUAGE_ASM__
  321. #define HW_EWM_CMPH (*(__IO hw_ewm_cmph_t *) HW_EWM_CMPH_ADDR)
  322. #define HW_EWM_CMPH_RD() (HW_EWM_CMPH.U)
  323. #define HW_EWM_CMPH_WR(v) (HW_EWM_CMPH.U = (v))
  324. #define HW_EWM_CMPH_SET(v) (HW_EWM_CMPH_WR(HW_EWM_CMPH_RD() | (v)))
  325. #define HW_EWM_CMPH_CLR(v) (HW_EWM_CMPH_WR(HW_EWM_CMPH_RD() & ~(v)))
  326. #define HW_EWM_CMPH_TOG(v) (HW_EWM_CMPH_WR(HW_EWM_CMPH_RD() ^ (v)))
  327. #endif
  328. //@}
  329. /*
  330. * Constants & macros for individual EWM_CMPH bitfields
  331. */
  332. /*!
  333. * @name Register EWM_CMPH, field COMPAREH[7:0] (RW)
  334. *
  335. * To prevent runaway code from changing this field, software should write to
  336. * this field after a CPU reset even if the (default) maximum service time is
  337. * required.
  338. */
  339. //@{
  340. #define BP_EWM_CMPH_COMPAREH (0U) //!< Bit position for EWM_CMPH_COMPAREH.
  341. #define BM_EWM_CMPH_COMPAREH (0xFFU) //!< Bit mask for EWM_CMPH_COMPAREH.
  342. #define BS_EWM_CMPH_COMPAREH (8U) //!< Bit field size in bits for EWM_CMPH_COMPAREH.
  343. #ifndef __LANGUAGE_ASM__
  344. //! @brief Read current value of the EWM_CMPH_COMPAREH field.
  345. #define BR_EWM_CMPH_COMPAREH (HW_EWM_CMPH.U)
  346. #endif
  347. //! @brief Format value for bitfield EWM_CMPH_COMPAREH.
  348. #define BF_EWM_CMPH_COMPAREH(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_EWM_CMPH_COMPAREH), uint8_t) & BM_EWM_CMPH_COMPAREH)
  349. #ifndef __LANGUAGE_ASM__
  350. //! @brief Set the COMPAREH field to a new value.
  351. #define BW_EWM_CMPH_COMPAREH(v) (HW_EWM_CMPH_WR(v))
  352. #endif
  353. //@}
  354. //-------------------------------------------------------------------------------------------
  355. // hw_ewm_t - module struct
  356. //-------------------------------------------------------------------------------------------
  357. /*!
  358. * @brief All EWM module registers.
  359. */
  360. #ifndef __LANGUAGE_ASM__
  361. #pragma pack(1)
  362. typedef struct _hw_ewm
  363. {
  364. __IO hw_ewm_ctrl_t CTRL; //!< [0x0] Control Register
  365. __O hw_ewm_serv_t SERV; //!< [0x1] Service Register
  366. __IO hw_ewm_cmpl_t CMPL; //!< [0x2] Compare Low Register
  367. __IO hw_ewm_cmph_t CMPH; //!< [0x3] Compare High Register
  368. } hw_ewm_t;
  369. #pragma pack()
  370. //! @brief Macro to access all EWM registers.
  371. //! @return Reference (not a pointer) to the registers struct. To get a pointer to the struct,
  372. //! use the '&' operator, like <code>&HW_EWM</code>.
  373. #define HW_EWM (*(hw_ewm_t *) REGS_EWM_BASE)
  374. #endif
  375. #endif // __HW_EWM_REGISTERS_H__
  376. // v22/130726/0.9
  377. // EOF