regsgpt.h 51 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416
  1. /*
  2. * Copyright (c) 2012, 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_GPT_REGISTERS_H__
  22. #define __HW_GPT_REGISTERS_H__
  23. #include "regs.h"
  24. /*
  25. * i.MX6UL GPT
  26. *
  27. * GPT
  28. *
  29. * Registers defined in this header file:
  30. * - HW_GPT_CR - GPT Control Register
  31. * - HW_GPT_PR - GPT Prescaler Register
  32. * - HW_GPT_SR - GPT Status Register
  33. * - HW_GPT_IR - GPT Interrupt Register
  34. * - HW_GPT_OCR1 - GPT Output Compare Register 1
  35. * - HW_GPT_OCR2 - GPT Output Compare Register 2
  36. * - HW_GPT_OCR3 - GPT Output Compare Register 3
  37. * - HW_GPT_ICR1 - GPT Input Capture Register 1
  38. * - HW_GPT_ICR2 - GPT Input Capture Register 2
  39. * - HW_GPT_CNT - GPT Counter Register
  40. *
  41. * - hw_gpt_t - Struct containing all module registers.
  42. */
  43. //! @name Module base addresses
  44. //@{
  45. #ifndef REGS_GPT_BASE
  46. #define HW_GPT_INSTANCE_COUNT (2) //!< Number of instances of the GPT module.
  47. #define REGS_GPT1_BASE (0x02098000) //!< Base address for GPT.
  48. #define REGS_GPT2_BASE (0x20E8000U) /*!< Base address for GPT2. */
  49. #define REGS_GPT_BASE REGS_GPT1_BASE
  50. #define IMX_INT_GPT IMX_INT_GPT1
  51. #define GPT_BASE_ADDR REGS_GPT1_BASE
  52. #endif
  53. //@}
  54. //-------------------------------------------------------------------------------------------
  55. // HW_GPT_CR - GPT Control Register
  56. //-------------------------------------------------------------------------------------------
  57. #ifndef __LANGUAGE_ASM__
  58. /*!
  59. * @brief HW_GPT_CR - GPT Control Register (RW)
  60. *
  61. * Reset value: 0x00000000
  62. *
  63. * The GPT Control Register (GPT_CR) is used to program and configure GPT operations. An IP Bus
  64. * Write to the GPT Control Register occurs after one cycle of wait state, while an IP Bus Read
  65. * occurs after 0 wait states.
  66. */
  67. typedef union _hw_gpt_cr
  68. {
  69. reg32_t U;
  70. struct _hw_gpt_cr_bitfields
  71. {
  72. unsigned EN : 1; //!< [0] GPT Enable.
  73. unsigned ENMOD : 1; //!< [1] GPT Enable mode.
  74. unsigned DBGEN : 1; //!< [2] GPT debug mode enable.
  75. unsigned WAITEN : 1; //!< [3] GPT Wait Mode enable.
  76. unsigned DOZEEN : 1; //!< [4] GPT Doze Mode Enable.
  77. unsigned STOPEN : 1; //!< [5] GPT Stop Mode enable.
  78. unsigned CLKSRC : 3; //!< [8:6] Clock Source select.
  79. unsigned FRR : 1; //!< [9] Free-Run or Restart mode.
  80. unsigned _24MEN : 1; //!< [10] Enable 24MHz clock input from crystal.
  81. unsigned RESERVED0 : 4; //!< [14:11] Reserved bits.
  82. unsigned SWR : 1; //!< [15] Software reset.
  83. unsigned IM1 : 2; //!< [17:16] See IM2
  84. unsigned IM2 : 2; //!< [19:18] IM2 (bits 19-18, Input Capture Channel 2 operating mode)
  85. unsigned OM1 : 3; //!< [22:20] See OM3
  86. unsigned OM2 : 3; //!< [25:23] See OM3
  87. unsigned OM3 : 3; //!< [28:26] OM3 (bits 28-26) controls the Output Compare Channel 3 operating mode.
  88. unsigned FO1 : 1; //!< [29] See F03
  89. unsigned FO2 : 1; //!< [30] See F03
  90. unsigned FO3 : 1; //!< [31] FO3 Force Output Compare Channel 3
  91. } B;
  92. } hw_gpt_cr_t;
  93. #endif
  94. /*!
  95. * @name Constants and macros for entire GPT_CR register
  96. */
  97. //@{
  98. #define HW_GPT_CR_ADDR (REGS_GPT_BASE + 0x0)
  99. #ifndef __LANGUAGE_ASM__
  100. #define HW_GPT_CR (*(volatile hw_gpt_cr_t *) HW_GPT_CR_ADDR)
  101. #define HW_GPT_CR_RD() (HW_GPT_CR.U)
  102. #define HW_GPT_CR_WR(v) (HW_GPT_CR.U = (v))
  103. #define HW_GPT_CR_SET(v) (HW_GPT_CR_WR(HW_GPT_CR_RD() | (v)))
  104. #define HW_GPT_CR_CLR(v) (HW_GPT_CR_WR(HW_GPT_CR_RD() & ~(v)))
  105. #define HW_GPT_CR_TOG(v) (HW_GPT_CR_WR(HW_GPT_CR_RD() ^ (v)))
  106. #endif
  107. //@}
  108. /*
  109. * constants & macros for individual GPT_CR bitfields
  110. */
  111. /*! @name Register GPT_CR, field EN[0] (RW)
  112. *
  113. * GPT Enable. The EN bit is the GPT module enable bit. Before setting the EN bit , we recommend
  114. * that all registers be properly programmed . A hardware reset resets the EN bit. A software reset
  115. * does not affect the EN bit.
  116. *
  117. * Values:
  118. * - 0 - GPT is disabled.
  119. * - 1 - GPT is enabled.
  120. */
  121. //@{
  122. #define BP_GPT_CR_EN (0) //!< Bit position for GPT_CR_EN.
  123. #define BM_GPT_CR_EN (0x00000001) //!< Bit mask for GPT_CR_EN.
  124. //! @brief Get value of GPT_CR_EN from a register value.
  125. #define BG_GPT_CR_EN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_GPT_CR_EN) >> BP_GPT_CR_EN)
  126. //! @brief Format value for bitfield GPT_CR_EN.
  127. #define BF_GPT_CR_EN(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_GPT_CR_EN) & BM_GPT_CR_EN)
  128. #ifndef __LANGUAGE_ASM__
  129. //! @brief Set the EN field to a new value.
  130. #define BW_GPT_CR_EN(v) (HW_GPT_CR_WR((HW_GPT_CR_RD() & ~BM_GPT_CR_EN) | BF_GPT_CR_EN(v)))
  131. #endif
  132. //@}
  133. /*! @name Register GPT_CR, field ENMOD[1] (RW)
  134. *
  135. * GPT Enable mode. When the GPT is disabled (EN=0), then both the Main Counter and Prescaler
  136. * Counter freeze their current count values . The ENMOD bit determines the value of the GPT counter
  137. * when Counter is enabled again (if the EN bit is set). If the ENMOD bit is 1, then the Main
  138. * Counter and Prescaler Counter values are reset to 0 after GPT is enabled (EN=1). If the ENMOD bit
  139. * is 0, then the Main Counter and Prescaler Counter restart counting from their frozen values after
  140. * GPT is enabled (EN=1). If GPT is programmed to be disabled in a low power mode (STOP/WAIT), then
  141. * the Main Counter and Prescaler Counter freeze at their current count values when the GPT enters
  142. * low power mode. When GPT exits low power mode, the Main Counter and Prescaler Counter start
  143. * counting from their frozen values, regardless of the ENMOD bit value. Setting the SWR bit will
  144. * clear the Main Counter and Prescaler Counter values, regardless of the value of EN or ENMOD bits.
  145. * A hardware reset resets the ENMOD bit. A software reset does not affect the ENMOD bit.
  146. *
  147. * Values:
  148. * - 0 - GPT counter will retain its value when it is disabled.
  149. * - 1 - GPT counter value is reset to 0 when it is disabled.
  150. */
  151. //@{
  152. #define BP_GPT_CR_ENMOD (1) //!< Bit position for GPT_CR_ENMOD.
  153. #define BM_GPT_CR_ENMOD (0x00000002) //!< Bit mask for GPT_CR_ENMOD.
  154. //! @brief Get value of GPT_CR_ENMOD from a register value.
  155. #define BG_GPT_CR_ENMOD(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_GPT_CR_ENMOD) >> BP_GPT_CR_ENMOD)
  156. //! @brief Format value for bitfield GPT_CR_ENMOD.
  157. #define BF_GPT_CR_ENMOD(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_GPT_CR_ENMOD) & BM_GPT_CR_ENMOD)
  158. #ifndef __LANGUAGE_ASM__
  159. //! @brief Set the ENMOD field to a new value.
  160. #define BW_GPT_CR_ENMOD(v) (HW_GPT_CR_WR((HW_GPT_CR_RD() & ~BM_GPT_CR_ENMOD) | BF_GPT_CR_ENMOD(v)))
  161. #endif
  162. //@}
  163. /*! @name Register GPT_CR, field DBGEN[2] (RW)
  164. *
  165. * GPT debug mode enable. The DBGEN read/write control bit enables GPT operation during Debug mode .
  166. * A hardware reset resets the DBGEN bit. A software reset does not affect the DBGEN bit.
  167. *
  168. * Values:
  169. * - 0 - GPT is disabled in debug mode.
  170. * - 1 - GPT is enabled in debug mode.
  171. */
  172. //@{
  173. #define BP_GPT_CR_DBGEN (2) //!< Bit position for GPT_CR_DBGEN.
  174. #define BM_GPT_CR_DBGEN (0x00000004) //!< Bit mask for GPT_CR_DBGEN.
  175. //! @brief Get value of GPT_CR_DBGEN from a register value.
  176. #define BG_GPT_CR_DBGEN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_GPT_CR_DBGEN) >> BP_GPT_CR_DBGEN)
  177. //! @brief Format value for bitfield GPT_CR_DBGEN.
  178. #define BF_GPT_CR_DBGEN(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_GPT_CR_DBGEN) & BM_GPT_CR_DBGEN)
  179. #ifndef __LANGUAGE_ASM__
  180. //! @brief Set the DBGEN field to a new value.
  181. #define BW_GPT_CR_DBGEN(v) (HW_GPT_CR_WR((HW_GPT_CR_RD() & ~BM_GPT_CR_DBGEN) | BF_GPT_CR_DBGEN(v)))
  182. #endif
  183. //@}
  184. /*! @name Register GPT_CR, field WAITEN[3] (RW)
  185. *
  186. * GPT Wait Mode enable. The WAITEN read/write control bit enables GPT operation during Wait mode .
  187. * A hardware reset resets the WAITEN bit. A software reset does not affect the WAITEN bit.
  188. *
  189. * Values:
  190. * - 0 - GPT is disabled in wait mode.
  191. * - 1 - GPT is enabled in wait mode.
  192. */
  193. //@{
  194. #define BP_GPT_CR_WAITEN (3) //!< Bit position for GPT_CR_WAITEN.
  195. #define BM_GPT_CR_WAITEN (0x00000008) //!< Bit mask for GPT_CR_WAITEN.
  196. //! @brief Get value of GPT_CR_WAITEN from a register value.
  197. #define BG_GPT_CR_WAITEN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_GPT_CR_WAITEN) >> BP_GPT_CR_WAITEN)
  198. //! @brief Format value for bitfield GPT_CR_WAITEN.
  199. #define BF_GPT_CR_WAITEN(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_GPT_CR_WAITEN) & BM_GPT_CR_WAITEN)
  200. #ifndef __LANGUAGE_ASM__
  201. //! @brief Set the WAITEN field to a new value.
  202. #define BW_GPT_CR_WAITEN(v) (HW_GPT_CR_WR((HW_GPT_CR_RD() & ~BM_GPT_CR_WAITEN) | BF_GPT_CR_WAITEN(v)))
  203. #endif
  204. //@}
  205. /*! @name Register GPT_CR, field DOZEEN[4] (RW)
  206. *
  207. * GPT Doze Mode Enable. A hardware reset resets the DOZEEN bit. A software reset does not affect
  208. * the DOZEEN bit.
  209. *
  210. * Values:
  211. * - 0 - GPT is disabled in doze mode.
  212. * - 1 - GPT is enabled in doze mode.
  213. */
  214. //@{
  215. #define BP_GPT_CR_DOZEEN (4) //!< Bit position for GPT_CR_DOZEEN.
  216. #define BM_GPT_CR_DOZEEN (0x00000010) //!< Bit mask for GPT_CR_DOZEEN.
  217. //! @brief Get value of GPT_CR_DOZEEN from a register value.
  218. #define BG_GPT_CR_DOZEEN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_GPT_CR_DOZEEN) >> BP_GPT_CR_DOZEEN)
  219. //! @brief Format value for bitfield GPT_CR_DOZEEN.
  220. #define BF_GPT_CR_DOZEEN(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_GPT_CR_DOZEEN) & BM_GPT_CR_DOZEEN)
  221. #ifndef __LANGUAGE_ASM__
  222. //! @brief Set the DOZEEN field to a new value.
  223. #define BW_GPT_CR_DOZEEN(v) (HW_GPT_CR_WR((HW_GPT_CR_RD() & ~BM_GPT_CR_DOZEEN) | BF_GPT_CR_DOZEEN(v)))
  224. #endif
  225. //@}
  226. /*! @name Register GPT_CR, field STOPEN[5] (RW)
  227. *
  228. * GPT Stop Mode enable. The STOPEN read/write control bit enables GPT operation during Stop mode .
  229. * A hardware reset resets the STOPEN bit. A software reset does not affect the STOPEN bit.
  230. *
  231. * Values:
  232. * - 0 - GPT is disabled in Stop mode.
  233. * - 1 - GPT is enabled in Stop mode.
  234. */
  235. //@{
  236. #define BP_GPT_CR_STOPEN (5) //!< Bit position for GPT_CR_STOPEN.
  237. #define BM_GPT_CR_STOPEN (0x00000020) //!< Bit mask for GPT_CR_STOPEN.
  238. //! @brief Get value of GPT_CR_STOPEN from a register value.
  239. #define BG_GPT_CR_STOPEN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_GPT_CR_STOPEN) >> BP_GPT_CR_STOPEN)
  240. //! @brief Format value for bitfield GPT_CR_STOPEN.
  241. #define BF_GPT_CR_STOPEN(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_GPT_CR_STOPEN) & BM_GPT_CR_STOPEN)
  242. #ifndef __LANGUAGE_ASM__
  243. //! @brief Set the STOPEN field to a new value.
  244. #define BW_GPT_CR_STOPEN(v) (HW_GPT_CR_WR((HW_GPT_CR_RD() & ~BM_GPT_CR_STOPEN) | BF_GPT_CR_STOPEN(v)))
  245. #endif
  246. //@}
  247. /*! @name Register GPT_CR, field CLKSRC[8:6] (RW)
  248. *
  249. * Clock Source select. The CLKSRC bits select which clock will go to the prescaler (and
  250. * subsequently be used to run the GPT counter). The CLKSRC bit field value should only be changed
  251. * after disabling the GPT by clearing the EN bit in this register (GPT_CR). A software reset does
  252. * not affect the CLKSRC bit.
  253. *
  254. * Values:
  255. * - 000 - No clock
  256. * - 001 - Peripheral Clock
  257. * - 010 - High Frequency Reference Clock
  258. * - 011 - External Clock (CLKIN)
  259. * - 100 - Low Frequency Reference Clock
  260. * - 101 - Crystal oscillator as Reference Clock
  261. * - others - Reserved
  262. */
  263. //@{
  264. #define BP_GPT_CR_CLKSRC (6) //!< Bit position for GPT_CR_CLKSRC.
  265. #define BM_GPT_CR_CLKSRC (0x000001c0) //!< Bit mask for GPT_CR_CLKSRC.
  266. //! @brief Get value of GPT_CR_CLKSRC from a register value.
  267. #define BG_GPT_CR_CLKSRC(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_GPT_CR_CLKSRC) >> BP_GPT_CR_CLKSRC)
  268. //! @brief Format value for bitfield GPT_CR_CLKSRC.
  269. #define BF_GPT_CR_CLKSRC(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_GPT_CR_CLKSRC) & BM_GPT_CR_CLKSRC)
  270. #ifndef __LANGUAGE_ASM__
  271. //! @brief Set the CLKSRC field to a new value.
  272. #define BW_GPT_CR_CLKSRC(v) (HW_GPT_CR_WR((HW_GPT_CR_RD() & ~BM_GPT_CR_CLKSRC) | BF_GPT_CR_CLKSRC(v)))
  273. #endif
  274. //@}
  275. /*! @name Register GPT_CR, field FRR[9] (RW)
  276. *
  277. * Free-Run or Restart mode. The FFR bit determines the behavior of the GPT when a compare event in
  278. * channel 1 occurs. In Restart mode, after a compare event, the counter resets to 0x00000000 and
  279. * resumes counting (after the occurrence of a compare event). In Free-Run mode, after a compare
  280. * event, the counter continues counting until 0xFFFFFFFF and then rolls over to 0.
  281. *
  282. * Values:
  283. * - 0 - Restart mode
  284. * - 1 - Free-Run mode
  285. */
  286. //@{
  287. #define BP_GPT_CR_FRR (9) //!< Bit position for GPT_CR_FRR.
  288. #define BM_GPT_CR_FRR (0x00000200) //!< Bit mask for GPT_CR_FRR.
  289. //! @brief Get value of GPT_CR_FRR from a register value.
  290. #define BG_GPT_CR_FRR(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_GPT_CR_FRR) >> BP_GPT_CR_FRR)
  291. //! @brief Format value for bitfield GPT_CR_FRR.
  292. #define BF_GPT_CR_FRR(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_GPT_CR_FRR) & BM_GPT_CR_FRR)
  293. #ifndef __LANGUAGE_ASM__
  294. //! @brief Set the FRR field to a new value.
  295. #define BW_GPT_CR_FRR(v) (HW_GPT_CR_WR((HW_GPT_CR_RD() & ~BM_GPT_CR_FRR) | BF_GPT_CR_FRR(v)))
  296. #endif
  297. //@}
  298. /*! @name Register GPT_CR, field _24MEN[10] (RW)
  299. *
  300. * Enable 24MHz clock input from crystal. A hardware reset resets the 24MEN bit. A software reset
  301. * does not affect the 24MEN bit.
  302. *
  303. * Values:
  304. * - 0 - 24M clock disabled
  305. * - 1 - 24M clock enabled
  306. */
  307. //@{
  308. #define BP_GPT_CR__24MEN (10) //!< Bit position for GPT_CR__24MEN.
  309. #define BM_GPT_CR__24MEN (0x00000400) //!< Bit mask for GPT_CR__24MEN.
  310. //! @brief Get value of GPT_CR__24MEN from a register value.
  311. #define BG_GPT_CR__24MEN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_GPT_CR__24MEN) >> BP_GPT_CR__24MEN)
  312. //! @brief Format value for bitfield GPT_CR__24MEN.
  313. #define BF_GPT_CR__24MEN(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_GPT_CR__24MEN) & BM_GPT_CR__24MEN)
  314. #ifndef __LANGUAGE_ASM__
  315. //! @brief Set the _24MEN field to a new value.
  316. #define BW_GPT_CR__24MEN(v) (HW_GPT_CR_WR((HW_GPT_CR_RD() & ~BM_GPT_CR__24MEN) | BF_GPT_CR__24MEN(v)))
  317. #endif
  318. //@}
  319. /*! @name Register GPT_CR, field SWR[15] (RW)
  320. *
  321. * Software reset. This is the software reset of the GPT module. It is a self-clearing bit. The SWR
  322. * bit is set when the module is in reset state. The SWR bit is cleared when the reset procedure
  323. * finishes. Setting the SWR bit resets all of the registers to their default reset values, except
  324. * for the CLKSRC, EN, ENMOD, STOPEN, WAITEN, and DBGEN bits in the GPT Control Register (this
  325. * control register).
  326. *
  327. * Values:
  328. * - 0 - GPT is not in reset state
  329. * - 1 - GPT is in reset state
  330. */
  331. //@{
  332. #define BP_GPT_CR_SWR (15) //!< Bit position for GPT_CR_SWR.
  333. #define BM_GPT_CR_SWR (0x00008000) //!< Bit mask for GPT_CR_SWR.
  334. //! @brief Get value of GPT_CR_SWR from a register value.
  335. #define BG_GPT_CR_SWR(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_GPT_CR_SWR) >> BP_GPT_CR_SWR)
  336. //! @brief Format value for bitfield GPT_CR_SWR.
  337. #define BF_GPT_CR_SWR(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_GPT_CR_SWR) & BM_GPT_CR_SWR)
  338. #ifndef __LANGUAGE_ASM__
  339. //! @brief Set the SWR field to a new value.
  340. #define BW_GPT_CR_SWR(v) (HW_GPT_CR_WR((HW_GPT_CR_RD() & ~BM_GPT_CR_SWR) | BF_GPT_CR_SWR(v)))
  341. #endif
  342. //@}
  343. /*! @name Register GPT_CR, field IM1[17:16] (RW)
  344. *
  345. * See IM2
  346. */
  347. //@{
  348. #define BP_GPT_CR_IM1 (16) //!< Bit position for GPT_CR_IM1.
  349. #define BM_GPT_CR_IM1 (0x00030000) //!< Bit mask for GPT_CR_IM1.
  350. //! @brief Get value of GPT_CR_IM1 from a register value.
  351. #define BG_GPT_CR_IM1(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_GPT_CR_IM1) >> BP_GPT_CR_IM1)
  352. //! @brief Format value for bitfield GPT_CR_IM1.
  353. #define BF_GPT_CR_IM1(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_GPT_CR_IM1) & BM_GPT_CR_IM1)
  354. #ifndef __LANGUAGE_ASM__
  355. //! @brief Set the IM1 field to a new value.
  356. #define BW_GPT_CR_IM1(v) (HW_GPT_CR_WR((HW_GPT_CR_RD() & ~BM_GPT_CR_IM1) | BF_GPT_CR_IM1(v)))
  357. #endif
  358. //@}
  359. /*! @name Register GPT_CR, field IM2[19:18] (RW)
  360. *
  361. * IM2 (bits 19-18, Input Capture Channel 2 operating mode) IM1 (bits 17-16, Input Capture Channel 1
  362. * operating mode) The IM n bit field determines the transition on the input pin (for Input capture
  363. * channel n ), which will trigger a capture event.
  364. *
  365. * Values:
  366. * - 00 - capture disabled
  367. * - 01 - capture on rising edge only
  368. * - 10 - capture on falling edge only
  369. * - 11 - capture on both edges
  370. */
  371. //@{
  372. #define BP_GPT_CR_IM2 (18) //!< Bit position for GPT_CR_IM2.
  373. #define BM_GPT_CR_IM2 (0x000c0000) //!< Bit mask for GPT_CR_IM2.
  374. //! @brief Get value of GPT_CR_IM2 from a register value.
  375. #define BG_GPT_CR_IM2(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_GPT_CR_IM2) >> BP_GPT_CR_IM2)
  376. //! @brief Format value for bitfield GPT_CR_IM2.
  377. #define BF_GPT_CR_IM2(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_GPT_CR_IM2) & BM_GPT_CR_IM2)
  378. #ifndef __LANGUAGE_ASM__
  379. //! @brief Set the IM2 field to a new value.
  380. #define BW_GPT_CR_IM2(v) (HW_GPT_CR_WR((HW_GPT_CR_RD() & ~BM_GPT_CR_IM2) | BF_GPT_CR_IM2(v)))
  381. #endif
  382. //@}
  383. /*! @name Register GPT_CR, field OM1[22:20] (RW)
  384. *
  385. * See OM3
  386. */
  387. //@{
  388. #define BP_GPT_CR_OM1 (20) //!< Bit position for GPT_CR_OM1.
  389. #define BM_GPT_CR_OM1 (0x00700000) //!< Bit mask for GPT_CR_OM1.
  390. //! @brief Get value of GPT_CR_OM1 from a register value.
  391. #define BG_GPT_CR_OM1(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_GPT_CR_OM1) >> BP_GPT_CR_OM1)
  392. //! @brief Format value for bitfield GPT_CR_OM1.
  393. #define BF_GPT_CR_OM1(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_GPT_CR_OM1) & BM_GPT_CR_OM1)
  394. #ifndef __LANGUAGE_ASM__
  395. //! @brief Set the OM1 field to a new value.
  396. #define BW_GPT_CR_OM1(v) (HW_GPT_CR_WR((HW_GPT_CR_RD() & ~BM_GPT_CR_OM1) | BF_GPT_CR_OM1(v)))
  397. #endif
  398. //@}
  399. /*! @name Register GPT_CR, field OM2[25:23] (RW)
  400. *
  401. * See OM3
  402. */
  403. //@{
  404. #define BP_GPT_CR_OM2 (23) //!< Bit position for GPT_CR_OM2.
  405. #define BM_GPT_CR_OM2 (0x03800000) //!< Bit mask for GPT_CR_OM2.
  406. //! @brief Get value of GPT_CR_OM2 from a register value.
  407. #define BG_GPT_CR_OM2(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_GPT_CR_OM2) >> BP_GPT_CR_OM2)
  408. //! @brief Format value for bitfield GPT_CR_OM2.
  409. #define BF_GPT_CR_OM2(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_GPT_CR_OM2) & BM_GPT_CR_OM2)
  410. #ifndef __LANGUAGE_ASM__
  411. //! @brief Set the OM2 field to a new value.
  412. #define BW_GPT_CR_OM2(v) (HW_GPT_CR_WR((HW_GPT_CR_RD() & ~BM_GPT_CR_OM2) | BF_GPT_CR_OM2(v)))
  413. #endif
  414. //@}
  415. /*! @name Register GPT_CR, field OM3[28:26] (RW)
  416. *
  417. * OM3 (bits 28-26) controls the Output Compare Channel 3 operating mode. OM2 (bits 25-23) controls
  418. * the Output Compare Channel 2 operating mode. OM1 (bits 22-20) controls the Output Compare Channel
  419. * 1 operating mode. The OM n bits specify the response that a compare event will generate on the
  420. * output pin of Output Compare Channel n . The toggle, clear, and set options cause a change on the
  421. * output pin only if a compare event occurs. When OM n is programmed as 1xx (active low pulse), the
  422. * output pin is set to one immediately on the next input clock; a low pulse (that is an input clock
  423. * in width) occurs when there is a compare event. Note that here, "input clock" refers to the clock
  424. * selected by the CLKSRC bits of the GPT Control Register.
  425. *
  426. * Values:
  427. * - 000 - Output disconnected. No response on pin.
  428. * - 001 - Toggle output pin
  429. * - 010 - Clear output pin
  430. * - 011 - Set output pin
  431. * - 1xx - Generate an active low pulse (that is one input clock wide) on the output pin.
  432. */
  433. //@{
  434. #define BP_GPT_CR_OM3 (26) //!< Bit position for GPT_CR_OM3.
  435. #define BM_GPT_CR_OM3 (0x1c000000) //!< Bit mask for GPT_CR_OM3.
  436. //! @brief Get value of GPT_CR_OM3 from a register value.
  437. #define BG_GPT_CR_OM3(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_GPT_CR_OM3) >> BP_GPT_CR_OM3)
  438. //! @brief Format value for bitfield GPT_CR_OM3.
  439. #define BF_GPT_CR_OM3(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_GPT_CR_OM3) & BM_GPT_CR_OM3)
  440. #ifndef __LANGUAGE_ASM__
  441. //! @brief Set the OM3 field to a new value.
  442. #define BW_GPT_CR_OM3(v) (HW_GPT_CR_WR((HW_GPT_CR_RD() & ~BM_GPT_CR_OM3) | BF_GPT_CR_OM3(v)))
  443. #endif
  444. //@}
  445. /*! @name Register GPT_CR, field FO1[29] (WORZ)
  446. *
  447. * See F03
  448. */
  449. //@{
  450. #define BP_GPT_CR_FO1 (29) //!< Bit position for GPT_CR_FO1.
  451. #define BM_GPT_CR_FO1 (0x20000000) //!< Bit mask for GPT_CR_FO1.
  452. //! @brief Get value of GPT_CR_FO1 from a register value.
  453. #define BG_GPT_CR_FO1(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_GPT_CR_FO1) >> BP_GPT_CR_FO1)
  454. //! @brief Format value for bitfield GPT_CR_FO1.
  455. #define BF_GPT_CR_FO1(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_GPT_CR_FO1) & BM_GPT_CR_FO1)
  456. //@}
  457. /*! @name Register GPT_CR, field FO2[30] (WORZ)
  458. *
  459. * See F03
  460. */
  461. //@{
  462. #define BP_GPT_CR_FO2 (30) //!< Bit position for GPT_CR_FO2.
  463. #define BM_GPT_CR_FO2 (0x40000000) //!< Bit mask for GPT_CR_FO2.
  464. //! @brief Get value of GPT_CR_FO2 from a register value.
  465. #define BG_GPT_CR_FO2(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_GPT_CR_FO2) >> BP_GPT_CR_FO2)
  466. //! @brief Format value for bitfield GPT_CR_FO2.
  467. #define BF_GPT_CR_FO2(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_GPT_CR_FO2) & BM_GPT_CR_FO2)
  468. //@}
  469. /*! @name Register GPT_CR, field FO3[31] (WORZ)
  470. *
  471. * FO3 Force Output Compare Channel 3 FO2 Force Output Compare Channel 2 FO1 Force Output Compare
  472. * Channel 1 The FO n bit causes the pin action programmed for the timer Output Compare n pin
  473. * (according to the OM n bits in this register). The OF n flag (OF3, OF2, OF1) in the status
  474. * register is not affected . This bit is self-negating and always read as zero.
  475. *
  476. * Values:
  477. * - 0 - Writing a 0 has no effect.
  478. * - 1 - Causes the programmed pin action on the timer Output Compare n pin; the OF n flag is not set.
  479. */
  480. //@{
  481. #define BP_GPT_CR_FO3 (31) //!< Bit position for GPT_CR_FO3.
  482. #define BM_GPT_CR_FO3 (0x80000000) //!< Bit mask for GPT_CR_FO3.
  483. //! @brief Get value of GPT_CR_FO3 from a register value.
  484. #define BG_GPT_CR_FO3(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_GPT_CR_FO3) >> BP_GPT_CR_FO3)
  485. //! @brief Format value for bitfield GPT_CR_FO3.
  486. #define BF_GPT_CR_FO3(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_GPT_CR_FO3) & BM_GPT_CR_FO3)
  487. //@}
  488. //-------------------------------------------------------------------------------------------
  489. // HW_GPT_PR - GPT Prescaler Register
  490. //-------------------------------------------------------------------------------------------
  491. #ifndef __LANGUAGE_ASM__
  492. /*!
  493. * @brief HW_GPT_PR - GPT Prescaler Register (RW)
  494. *
  495. * Reset value: 0x00000000
  496. *
  497. * The GPT Prescaler Register (GPT_PR) contains bits that determine the divide value of the clock
  498. * that runs the counter.
  499. */
  500. typedef union _hw_gpt_pr
  501. {
  502. reg32_t U;
  503. struct _hw_gpt_pr_bitfields
  504. {
  505. unsigned PRESCALER : 12; //!< [11:0] Prescaler bits.
  506. unsigned PRESCALER24M : 4; //!< [15:12] Prescaler bits.
  507. unsigned RESERVED0 : 16; //!< [31:16] Reserved bits.
  508. } B;
  509. } hw_gpt_pr_t;
  510. #endif
  511. /*!
  512. * @name Constants and macros for entire GPT_PR register
  513. */
  514. //@{
  515. #define HW_GPT_PR_ADDR (REGS_GPT_BASE + 0x4)
  516. #ifndef __LANGUAGE_ASM__
  517. #define HW_GPT_PR (*(volatile hw_gpt_pr_t *) HW_GPT_PR_ADDR)
  518. #define HW_GPT_PR_RD() (HW_GPT_PR.U)
  519. #define HW_GPT_PR_WR(v) (HW_GPT_PR.U = (v))
  520. #define HW_GPT_PR_SET(v) (HW_GPT_PR_WR(HW_GPT_PR_RD() | (v)))
  521. #define HW_GPT_PR_CLR(v) (HW_GPT_PR_WR(HW_GPT_PR_RD() & ~(v)))
  522. #define HW_GPT_PR_TOG(v) (HW_GPT_PR_WR(HW_GPT_PR_RD() ^ (v)))
  523. #endif
  524. //@}
  525. /*
  526. * constants & macros for individual GPT_PR bitfields
  527. */
  528. /*! @name Register GPT_PR, field PRESCALER[11:0] (RW)
  529. *
  530. * Prescaler bits. The clock selected by the CLKSRC field is divided by [PRESCALER + 1], and then
  531. * used to run the counter. A change in the value of the PRESCALER bits cause the Prescaler counter
  532. * to reset and a new count period to start immediately. See for the timing diagram.
  533. *
  534. * Values:
  535. * - 0x000 - Divide by 1
  536. * - ... - ...
  537. * - 0x001 - Divide by 2
  538. * - 0xFFF - Divide by 4096
  539. */
  540. //@{
  541. #define BP_GPT_PR_PRESCALER (0) //!< Bit position for GPT_PR_PRESCALER.
  542. #define BM_GPT_PR_PRESCALER (0x00000fff) //!< Bit mask for GPT_PR_PRESCALER.
  543. //! @brief Get value of GPT_PR_PRESCALER from a register value.
  544. #define BG_GPT_PR_PRESCALER(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_GPT_PR_PRESCALER) >> BP_GPT_PR_PRESCALER)
  545. //! @brief Format value for bitfield GPT_PR_PRESCALER.
  546. #define BF_GPT_PR_PRESCALER(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_GPT_PR_PRESCALER) & BM_GPT_PR_PRESCALER)
  547. #ifndef __LANGUAGE_ASM__
  548. //! @brief Set the PRESCALER field to a new value.
  549. #define BW_GPT_PR_PRESCALER(v) (HW_GPT_PR_WR((HW_GPT_PR_RD() & ~BM_GPT_PR_PRESCALER) | BF_GPT_PR_PRESCALER(v)))
  550. #endif
  551. //@}
  552. /*! @name Register GPT_PR, field PRESCALER24M[15:12] (RW)
  553. *
  554. * Prescaler bits. 24M crystal clock is divided by [PRESCALER24M + 1] before selected by the CLKSRC
  555. * field. If 24M crystal clock is not selected, this feild takes no effect.
  556. *
  557. * Values:
  558. * - 0x0 - Divide by 1
  559. * - ... - ...
  560. * - 0x1 - Divide by 2
  561. * - 0xF - Divide by 16
  562. */
  563. //@{
  564. #define BP_GPT_PR_PRESCALER24M (12) //!< Bit position for GPT_PR_PRESCALER24M.
  565. #define BM_GPT_PR_PRESCALER24M (0x0000f000) //!< Bit mask for GPT_PR_PRESCALER24M.
  566. //! @brief Get value of GPT_PR_PRESCALER24M from a register value.
  567. #define BG_GPT_PR_PRESCALER24M(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_GPT_PR_PRESCALER24M) >> BP_GPT_PR_PRESCALER24M)
  568. //! @brief Format value for bitfield GPT_PR_PRESCALER24M.
  569. #define BF_GPT_PR_PRESCALER24M(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_GPT_PR_PRESCALER24M) & BM_GPT_PR_PRESCALER24M)
  570. #ifndef __LANGUAGE_ASM__
  571. //! @brief Set the PRESCALER24M field to a new value.
  572. #define BW_GPT_PR_PRESCALER24M(v) (HW_GPT_PR_WR((HW_GPT_PR_RD() & ~BM_GPT_PR_PRESCALER24M) | BF_GPT_PR_PRESCALER24M(v)))
  573. #endif
  574. //@}
  575. //-------------------------------------------------------------------------------------------
  576. // HW_GPT_SR - GPT Status Register
  577. //-------------------------------------------------------------------------------------------
  578. #ifndef __LANGUAGE_ASM__
  579. /*!
  580. * @brief HW_GPT_SR - GPT Status Register (RW)
  581. *
  582. * Reset value: 0x00000000
  583. *
  584. * The GPT Status Register (GPT_SR) contains bits that indicate that a counter has rolled over, and
  585. * if any event has occurred on the Input Capture and Output Compare channels. The bits are cleared
  586. * by writing a 1 to them.
  587. */
  588. typedef union _hw_gpt_sr
  589. {
  590. reg32_t U;
  591. struct _hw_gpt_sr_bitfields
  592. {
  593. unsigned OF1 : 1; //!< [0] See OF3
  594. unsigned OF2 : 1; //!< [1] See OF3
  595. unsigned OF3 : 1; //!< [2] OF3 Output Compare 3 Flag
  596. unsigned IF1 : 1; //!< [3] See IF2
  597. unsigned IF2 : 1; //!< [4] IF2 Input capture 2 Flag
  598. unsigned ROV : 1; //!< [5] Rollover Flag.
  599. unsigned RESERVED0 : 26; //!< [31:6] Reserved bits.
  600. } B;
  601. } hw_gpt_sr_t;
  602. #endif
  603. /*!
  604. * @name Constants and macros for entire GPT_SR register
  605. */
  606. //@{
  607. #define HW_GPT_SR_ADDR (REGS_GPT_BASE + 0x8)
  608. #ifndef __LANGUAGE_ASM__
  609. #define HW_GPT_SR (*(volatile hw_gpt_sr_t *) HW_GPT_SR_ADDR)
  610. #define HW_GPT_SR_RD() (HW_GPT_SR.U)
  611. #define HW_GPT_SR_WR(v) (HW_GPT_SR.U = (v))
  612. #define HW_GPT_SR_SET(v) (HW_GPT_SR_WR(HW_GPT_SR_RD() | (v)))
  613. #define HW_GPT_SR_CLR(v) (HW_GPT_SR_WR(HW_GPT_SR_RD() & ~(v)))
  614. #define HW_GPT_SR_TOG(v) (HW_GPT_SR_WR(HW_GPT_SR_RD() ^ (v)))
  615. #endif
  616. //@}
  617. /*
  618. * constants & macros for individual GPT_SR bitfields
  619. */
  620. /*! @name Register GPT_SR, field OF1[0] (W1C)
  621. *
  622. * See OF3
  623. */
  624. //@{
  625. #define BP_GPT_SR_OF1 (0) //!< Bit position for GPT_SR_OF1.
  626. #define BM_GPT_SR_OF1 (0x00000001) //!< Bit mask for GPT_SR_OF1.
  627. //! @brief Get value of GPT_SR_OF1 from a register value.
  628. #define BG_GPT_SR_OF1(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_GPT_SR_OF1) >> BP_GPT_SR_OF1)
  629. //! @brief Format value for bitfield GPT_SR_OF1.
  630. #define BF_GPT_SR_OF1(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_GPT_SR_OF1) & BM_GPT_SR_OF1)
  631. #ifndef __LANGUAGE_ASM__
  632. //! @brief Set the OF1 field to a new value.
  633. #define BW_GPT_SR_OF1(v) (HW_GPT_SR_WR((HW_GPT_SR_RD() & ~BM_GPT_SR_OF1) | BF_GPT_SR_OF1(v)))
  634. #endif
  635. //@}
  636. /*! @name Register GPT_SR, field OF2[1] (W1C)
  637. *
  638. * See OF3
  639. */
  640. //@{
  641. #define BP_GPT_SR_OF2 (1) //!< Bit position for GPT_SR_OF2.
  642. #define BM_GPT_SR_OF2 (0x00000002) //!< Bit mask for GPT_SR_OF2.
  643. //! @brief Get value of GPT_SR_OF2 from a register value.
  644. #define BG_GPT_SR_OF2(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_GPT_SR_OF2) >> BP_GPT_SR_OF2)
  645. //! @brief Format value for bitfield GPT_SR_OF2.
  646. #define BF_GPT_SR_OF2(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_GPT_SR_OF2) & BM_GPT_SR_OF2)
  647. #ifndef __LANGUAGE_ASM__
  648. //! @brief Set the OF2 field to a new value.
  649. #define BW_GPT_SR_OF2(v) (HW_GPT_SR_WR((HW_GPT_SR_RD() & ~BM_GPT_SR_OF2) | BF_GPT_SR_OF2(v)))
  650. #endif
  651. //@}
  652. /*! @name Register GPT_SR, field OF3[2] (W1C)
  653. *
  654. * OF3 Output Compare 3 Flag OF2 Output Compare 2 Flag OF1 Output Compare 1 Flag The OF n bit
  655. * indicates that a compare event has occurred on Output Compare channel n .
  656. *
  657. * Values:
  658. * - 0 - Compare event has not occurred.
  659. * - 1 - Compare event has occurred.
  660. */
  661. //@{
  662. #define BP_GPT_SR_OF3 (2) //!< Bit position for GPT_SR_OF3.
  663. #define BM_GPT_SR_OF3 (0x00000004) //!< Bit mask for GPT_SR_OF3.
  664. //! @brief Get value of GPT_SR_OF3 from a register value.
  665. #define BG_GPT_SR_OF3(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_GPT_SR_OF3) >> BP_GPT_SR_OF3)
  666. //! @brief Format value for bitfield GPT_SR_OF3.
  667. #define BF_GPT_SR_OF3(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_GPT_SR_OF3) & BM_GPT_SR_OF3)
  668. #ifndef __LANGUAGE_ASM__
  669. //! @brief Set the OF3 field to a new value.
  670. #define BW_GPT_SR_OF3(v) (HW_GPT_SR_WR((HW_GPT_SR_RD() & ~BM_GPT_SR_OF3) | BF_GPT_SR_OF3(v)))
  671. #endif
  672. //@}
  673. /*! @name Register GPT_SR, field IF1[3] (W1C)
  674. *
  675. * See IF2
  676. */
  677. //@{
  678. #define BP_GPT_SR_IF1 (3) //!< Bit position for GPT_SR_IF1.
  679. #define BM_GPT_SR_IF1 (0x00000008) //!< Bit mask for GPT_SR_IF1.
  680. //! @brief Get value of GPT_SR_IF1 from a register value.
  681. #define BG_GPT_SR_IF1(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_GPT_SR_IF1) >> BP_GPT_SR_IF1)
  682. //! @brief Format value for bitfield GPT_SR_IF1.
  683. #define BF_GPT_SR_IF1(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_GPT_SR_IF1) & BM_GPT_SR_IF1)
  684. #ifndef __LANGUAGE_ASM__
  685. //! @brief Set the IF1 field to a new value.
  686. #define BW_GPT_SR_IF1(v) (HW_GPT_SR_WR((HW_GPT_SR_RD() & ~BM_GPT_SR_IF1) | BF_GPT_SR_IF1(v)))
  687. #endif
  688. //@}
  689. /*! @name Register GPT_SR, field IF2[4] (W1C)
  690. *
  691. * IF2 Input capture 2 Flag IF1 Input capture 1 Flag The IF n bit indicates that a capture event has
  692. * occurred on Input Capture channel n .
  693. *
  694. * Values:
  695. * - 0 - Capture event has not occurred.
  696. * - 1 - Capture event has occurred.
  697. */
  698. //@{
  699. #define BP_GPT_SR_IF2 (4) //!< Bit position for GPT_SR_IF2.
  700. #define BM_GPT_SR_IF2 (0x00000010) //!< Bit mask for GPT_SR_IF2.
  701. //! @brief Get value of GPT_SR_IF2 from a register value.
  702. #define BG_GPT_SR_IF2(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_GPT_SR_IF2) >> BP_GPT_SR_IF2)
  703. //! @brief Format value for bitfield GPT_SR_IF2.
  704. #define BF_GPT_SR_IF2(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_GPT_SR_IF2) & BM_GPT_SR_IF2)
  705. #ifndef __LANGUAGE_ASM__
  706. //! @brief Set the IF2 field to a new value.
  707. #define BW_GPT_SR_IF2(v) (HW_GPT_SR_WR((HW_GPT_SR_RD() & ~BM_GPT_SR_IF2) | BF_GPT_SR_IF2(v)))
  708. #endif
  709. //@}
  710. /*! @name Register GPT_SR, field ROV[5] (W1C)
  711. *
  712. * Rollover Flag. The ROV bit indicates that the counter has reached its maximum possible value and
  713. * rolled over to 0 (from which the counter continues counting). The ROV bit is only set if the
  714. * counter has reached 0xFFFFFFFF in both Restart and Free-Run modes.
  715. *
  716. * Values:
  717. * - 0 - Rollover has not occurred.
  718. * - 1 - Rollover has occurred.
  719. */
  720. //@{
  721. #define BP_GPT_SR_ROV (5) //!< Bit position for GPT_SR_ROV.
  722. #define BM_GPT_SR_ROV (0x00000020) //!< Bit mask for GPT_SR_ROV.
  723. //! @brief Get value of GPT_SR_ROV from a register value.
  724. #define BG_GPT_SR_ROV(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_GPT_SR_ROV) >> BP_GPT_SR_ROV)
  725. //! @brief Format value for bitfield GPT_SR_ROV.
  726. #define BF_GPT_SR_ROV(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_GPT_SR_ROV) & BM_GPT_SR_ROV)
  727. #ifndef __LANGUAGE_ASM__
  728. //! @brief Set the ROV field to a new value.
  729. #define BW_GPT_SR_ROV(v) (HW_GPT_SR_WR((HW_GPT_SR_RD() & ~BM_GPT_SR_ROV) | BF_GPT_SR_ROV(v)))
  730. #endif
  731. //@}
  732. //-------------------------------------------------------------------------------------------
  733. // HW_GPT_IR - GPT Interrupt Register
  734. //-------------------------------------------------------------------------------------------
  735. #ifndef __LANGUAGE_ASM__
  736. /*!
  737. * @brief HW_GPT_IR - GPT Interrupt Register (RW)
  738. *
  739. * Reset value: 0x00000000
  740. *
  741. * The GPT Interrupt Register (GPT_IR) contains bits that control whether interrupts are generated
  742. * after rollover, input capture and output compare events.
  743. */
  744. typedef union _hw_gpt_ir
  745. {
  746. reg32_t U;
  747. struct _hw_gpt_ir_bitfields
  748. {
  749. unsigned OF1IE : 1; //!< [0] See OF3IE
  750. unsigned OF2IE : 1; //!< [1] See OF3IE
  751. unsigned OF3IE : 1; //!< [2] OF3IE Output Compare 3 Interrupt Enable
  752. unsigned IF1IE : 1; //!< [3] See IF2IE
  753. unsigned IF2IE : 1; //!< [4] IF2IE Input capture 2 Interrupt Enable
  754. unsigned ROVIE : 1; //!< [5] Rollover Interrupt Enable.
  755. unsigned RESERVED0 : 26; //!< [31:6] Reserved bits.
  756. } B;
  757. } hw_gpt_ir_t;
  758. #endif
  759. /*!
  760. * @name Constants and macros for entire GPT_IR register
  761. */
  762. //@{
  763. #define HW_GPT_IR_ADDR (REGS_GPT_BASE + 0xc)
  764. #ifndef __LANGUAGE_ASM__
  765. #define HW_GPT_IR (*(volatile hw_gpt_ir_t *) HW_GPT_IR_ADDR)
  766. #define HW_GPT_IR_RD() (HW_GPT_IR.U)
  767. #define HW_GPT_IR_WR(v) (HW_GPT_IR.U = (v))
  768. #define HW_GPT_IR_SET(v) (HW_GPT_IR_WR(HW_GPT_IR_RD() | (v)))
  769. #define HW_GPT_IR_CLR(v) (HW_GPT_IR_WR(HW_GPT_IR_RD() & ~(v)))
  770. #define HW_GPT_IR_TOG(v) (HW_GPT_IR_WR(HW_GPT_IR_RD() ^ (v)))
  771. #endif
  772. //@}
  773. /*
  774. * constants & macros for individual GPT_IR bitfields
  775. */
  776. /*! @name Register GPT_IR, field OF1IE[0] (RW)
  777. *
  778. * See OF3IE
  779. */
  780. //@{
  781. #define BP_GPT_IR_OF1IE (0) //!< Bit position for GPT_IR_OF1IE.
  782. #define BM_GPT_IR_OF1IE (0x00000001) //!< Bit mask for GPT_IR_OF1IE.
  783. //! @brief Get value of GPT_IR_OF1IE from a register value.
  784. #define BG_GPT_IR_OF1IE(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_GPT_IR_OF1IE) >> BP_GPT_IR_OF1IE)
  785. //! @brief Format value for bitfield GPT_IR_OF1IE.
  786. #define BF_GPT_IR_OF1IE(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_GPT_IR_OF1IE) & BM_GPT_IR_OF1IE)
  787. #ifndef __LANGUAGE_ASM__
  788. //! @brief Set the OF1IE field to a new value.
  789. #define BW_GPT_IR_OF1IE(v) (HW_GPT_IR_WR((HW_GPT_IR_RD() & ~BM_GPT_IR_OF1IE) | BF_GPT_IR_OF1IE(v)))
  790. #endif
  791. //@}
  792. /*! @name Register GPT_IR, field OF2IE[1] (RW)
  793. *
  794. * See OF3IE
  795. */
  796. //@{
  797. #define BP_GPT_IR_OF2IE (1) //!< Bit position for GPT_IR_OF2IE.
  798. #define BM_GPT_IR_OF2IE (0x00000002) //!< Bit mask for GPT_IR_OF2IE.
  799. //! @brief Get value of GPT_IR_OF2IE from a register value.
  800. #define BG_GPT_IR_OF2IE(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_GPT_IR_OF2IE) >> BP_GPT_IR_OF2IE)
  801. //! @brief Format value for bitfield GPT_IR_OF2IE.
  802. #define BF_GPT_IR_OF2IE(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_GPT_IR_OF2IE) & BM_GPT_IR_OF2IE)
  803. #ifndef __LANGUAGE_ASM__
  804. //! @brief Set the OF2IE field to a new value.
  805. #define BW_GPT_IR_OF2IE(v) (HW_GPT_IR_WR((HW_GPT_IR_RD() & ~BM_GPT_IR_OF2IE) | BF_GPT_IR_OF2IE(v)))
  806. #endif
  807. //@}
  808. /*! @name Register GPT_IR, field OF3IE[2] (RW)
  809. *
  810. * OF3IE Output Compare 3 Interrupt Enable OF2IE Output Compare 2 Interrupt Enable OF1IE Output
  811. * Compare 1 Interrupt Enable The OF n IE bit controls the Output Compare Channel n interrupt.
  812. *
  813. * Values:
  814. * - 0 - Output Compare Channel n interrupt is disabled.
  815. * - 1 - Output Compare Channel n interrupt is enabled.
  816. */
  817. //@{
  818. #define BP_GPT_IR_OF3IE (2) //!< Bit position for GPT_IR_OF3IE.
  819. #define BM_GPT_IR_OF3IE (0x00000004) //!< Bit mask for GPT_IR_OF3IE.
  820. //! @brief Get value of GPT_IR_OF3IE from a register value.
  821. #define BG_GPT_IR_OF3IE(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_GPT_IR_OF3IE) >> BP_GPT_IR_OF3IE)
  822. //! @brief Format value for bitfield GPT_IR_OF3IE.
  823. #define BF_GPT_IR_OF3IE(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_GPT_IR_OF3IE) & BM_GPT_IR_OF3IE)
  824. #ifndef __LANGUAGE_ASM__
  825. //! @brief Set the OF3IE field to a new value.
  826. #define BW_GPT_IR_OF3IE(v) (HW_GPT_IR_WR((HW_GPT_IR_RD() & ~BM_GPT_IR_OF3IE) | BF_GPT_IR_OF3IE(v)))
  827. #endif
  828. //@}
  829. /*! @name Register GPT_IR, field IF1IE[3] (RW)
  830. *
  831. * See IF2IE
  832. */
  833. //@{
  834. #define BP_GPT_IR_IF1IE (3) //!< Bit position for GPT_IR_IF1IE.
  835. #define BM_GPT_IR_IF1IE (0x00000008) //!< Bit mask for GPT_IR_IF1IE.
  836. //! @brief Get value of GPT_IR_IF1IE from a register value.
  837. #define BG_GPT_IR_IF1IE(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_GPT_IR_IF1IE) >> BP_GPT_IR_IF1IE)
  838. //! @brief Format value for bitfield GPT_IR_IF1IE.
  839. #define BF_GPT_IR_IF1IE(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_GPT_IR_IF1IE) & BM_GPT_IR_IF1IE)
  840. #ifndef __LANGUAGE_ASM__
  841. //! @brief Set the IF1IE field to a new value.
  842. #define BW_GPT_IR_IF1IE(v) (HW_GPT_IR_WR((HW_GPT_IR_RD() & ~BM_GPT_IR_IF1IE) | BF_GPT_IR_IF1IE(v)))
  843. #endif
  844. //@}
  845. /*! @name Register GPT_IR, field IF2IE[4] (RW)
  846. *
  847. * IF2IE Input capture 2 Interrupt Enable IF1IE Input capture 1 Interrupt Enable The IF n IE bit
  848. * controls the IF n IE Input Capture n Interrupt Enable.
  849. *
  850. * Values:
  851. * - 0 - IF2IE Input Capture n Interrupt Enable is disabled.
  852. * - 1 - IF2IE Input Capture n Interrupt Enable is enabled.
  853. */
  854. //@{
  855. #define BP_GPT_IR_IF2IE (4) //!< Bit position for GPT_IR_IF2IE.
  856. #define BM_GPT_IR_IF2IE (0x00000010) //!< Bit mask for GPT_IR_IF2IE.
  857. //! @brief Get value of GPT_IR_IF2IE from a register value.
  858. #define BG_GPT_IR_IF2IE(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_GPT_IR_IF2IE) >> BP_GPT_IR_IF2IE)
  859. //! @brief Format value for bitfield GPT_IR_IF2IE.
  860. #define BF_GPT_IR_IF2IE(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_GPT_IR_IF2IE) & BM_GPT_IR_IF2IE)
  861. #ifndef __LANGUAGE_ASM__
  862. //! @brief Set the IF2IE field to a new value.
  863. #define BW_GPT_IR_IF2IE(v) (HW_GPT_IR_WR((HW_GPT_IR_RD() & ~BM_GPT_IR_IF2IE) | BF_GPT_IR_IF2IE(v)))
  864. #endif
  865. //@}
  866. /*! @name Register GPT_IR, field ROVIE[5] (RW)
  867. *
  868. * Rollover Interrupt Enable. The ROVIE bit controls the Rollover interrupt.
  869. *
  870. * Values:
  871. * - 0 - Rollover interrupt is disabled.
  872. * - 1 - Rollover interrupt enabled.
  873. */
  874. //@{
  875. #define BP_GPT_IR_ROVIE (5) //!< Bit position for GPT_IR_ROVIE.
  876. #define BM_GPT_IR_ROVIE (0x00000020) //!< Bit mask for GPT_IR_ROVIE.
  877. //! @brief Get value of GPT_IR_ROVIE from a register value.
  878. #define BG_GPT_IR_ROVIE(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_GPT_IR_ROVIE) >> BP_GPT_IR_ROVIE)
  879. //! @brief Format value for bitfield GPT_IR_ROVIE.
  880. #define BF_GPT_IR_ROVIE(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_GPT_IR_ROVIE) & BM_GPT_IR_ROVIE)
  881. #ifndef __LANGUAGE_ASM__
  882. //! @brief Set the ROVIE field to a new value.
  883. #define BW_GPT_IR_ROVIE(v) (HW_GPT_IR_WR((HW_GPT_IR_RD() & ~BM_GPT_IR_ROVIE) | BF_GPT_IR_ROVIE(v)))
  884. #endif
  885. //@}
  886. //-------------------------------------------------------------------------------------------
  887. // HW_GPT_OCR1 - GPT Output Compare Register 1
  888. //-------------------------------------------------------------------------------------------
  889. #ifndef __LANGUAGE_ASM__
  890. /*!
  891. * @brief HW_GPT_OCR1 - GPT Output Compare Register 1 (RW)
  892. *
  893. * Reset value: 0xffffffff
  894. *
  895. * The GPT Compare Register 1 (GPT_OCR1) holds the value that determines when a compare event will
  896. * be generated on Output Compare Channel 1. Any write access to the Compare register of Channel 1
  897. * while in Restart mode (FRR=0) will reset the GPT counter. An IP Bus Write access to the GPT
  898. * Output Compare Register1 (GPT_OCR1) occurs after one cycle of wait state; an IP Bus Read access
  899. * occurs immediately (0 wait states).
  900. */
  901. typedef union _hw_gpt_ocr1
  902. {
  903. reg32_t U;
  904. struct _hw_gpt_ocr1_bitfields
  905. {
  906. unsigned COMP : 32; //!< [31:0] Compare Value.
  907. } B;
  908. } hw_gpt_ocr1_t;
  909. #endif
  910. /*!
  911. * @name Constants and macros for entire GPT_OCR1 register
  912. */
  913. //@{
  914. #define HW_GPT_OCR1_ADDR (REGS_GPT_BASE + 0x10)
  915. #ifndef __LANGUAGE_ASM__
  916. #define HW_GPT_OCR1 (*(volatile hw_gpt_ocr1_t *) HW_GPT_OCR1_ADDR)
  917. #define HW_GPT_OCR1_RD() (HW_GPT_OCR1.U)
  918. #define HW_GPT_OCR1_WR(v) (HW_GPT_OCR1.U = (v))
  919. #define HW_GPT_OCR1_SET(v) (HW_GPT_OCR1_WR(HW_GPT_OCR1_RD() | (v)))
  920. #define HW_GPT_OCR1_CLR(v) (HW_GPT_OCR1_WR(HW_GPT_OCR1_RD() & ~(v)))
  921. #define HW_GPT_OCR1_TOG(v) (HW_GPT_OCR1_WR(HW_GPT_OCR1_RD() ^ (v)))
  922. #endif
  923. //@}
  924. /*
  925. * constants & macros for individual GPT_OCR1 bitfields
  926. */
  927. /*! @name Register GPT_OCR1, field COMP[31:0] (RW)
  928. *
  929. * Compare Value. When the counter value equals the COMP bit field value, a compare event is
  930. * generated on Output Compare Channel 1.
  931. */
  932. //@{
  933. #define BP_GPT_OCR1_COMP (0) //!< Bit position for GPT_OCR1_COMP.
  934. #define BM_GPT_OCR1_COMP (0xffffffff) //!< Bit mask for GPT_OCR1_COMP.
  935. //! @brief Get value of GPT_OCR1_COMP from a register value.
  936. #define BG_GPT_OCR1_COMP(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_GPT_OCR1_COMP) >> BP_GPT_OCR1_COMP)
  937. //! @brief Format value for bitfield GPT_OCR1_COMP.
  938. #define BF_GPT_OCR1_COMP(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_GPT_OCR1_COMP) & BM_GPT_OCR1_COMP)
  939. #ifndef __LANGUAGE_ASM__
  940. //! @brief Set the COMP field to a new value.
  941. #define BW_GPT_OCR1_COMP(v) (HW_GPT_OCR1_WR((HW_GPT_OCR1_RD() & ~BM_GPT_OCR1_COMP) | BF_GPT_OCR1_COMP(v)))
  942. #endif
  943. //@}
  944. //-------------------------------------------------------------------------------------------
  945. // HW_GPT_OCR2 - GPT Output Compare Register 2
  946. //-------------------------------------------------------------------------------------------
  947. #ifndef __LANGUAGE_ASM__
  948. /*!
  949. * @brief HW_GPT_OCR2 - GPT Output Compare Register 2 (RW)
  950. *
  951. * Reset value: 0xffffffff
  952. *
  953. * The GPT Compare Register 2 (GPT_OCR2) holds the value that determines when a compare event will
  954. * be generated on Output Compare Channel 2.
  955. */
  956. typedef union _hw_gpt_ocr2
  957. {
  958. reg32_t U;
  959. struct _hw_gpt_ocr2_bitfields
  960. {
  961. unsigned COMP : 32; //!< [31:0] Compare Value.
  962. } B;
  963. } hw_gpt_ocr2_t;
  964. #endif
  965. /*!
  966. * @name Constants and macros for entire GPT_OCR2 register
  967. */
  968. //@{
  969. #define HW_GPT_OCR2_ADDR (REGS_GPT_BASE + 0x14)
  970. #ifndef __LANGUAGE_ASM__
  971. #define HW_GPT_OCR2 (*(volatile hw_gpt_ocr2_t *) HW_GPT_OCR2_ADDR)
  972. #define HW_GPT_OCR2_RD() (HW_GPT_OCR2.U)
  973. #define HW_GPT_OCR2_WR(v) (HW_GPT_OCR2.U = (v))
  974. #define HW_GPT_OCR2_SET(v) (HW_GPT_OCR2_WR(HW_GPT_OCR2_RD() | (v)))
  975. #define HW_GPT_OCR2_CLR(v) (HW_GPT_OCR2_WR(HW_GPT_OCR2_RD() & ~(v)))
  976. #define HW_GPT_OCR2_TOG(v) (HW_GPT_OCR2_WR(HW_GPT_OCR2_RD() ^ (v)))
  977. #endif
  978. //@}
  979. /*
  980. * constants & macros for individual GPT_OCR2 bitfields
  981. */
  982. /*! @name Register GPT_OCR2, field COMP[31:0] (RW)
  983. *
  984. * Compare Value. When the counter value equals the COMP bit field value, a compare event is
  985. * generated on Output Compare Channel 2.
  986. */
  987. //@{
  988. #define BP_GPT_OCR2_COMP (0) //!< Bit position for GPT_OCR2_COMP.
  989. #define BM_GPT_OCR2_COMP (0xffffffff) //!< Bit mask for GPT_OCR2_COMP.
  990. //! @brief Get value of GPT_OCR2_COMP from a register value.
  991. #define BG_GPT_OCR2_COMP(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_GPT_OCR2_COMP) >> BP_GPT_OCR2_COMP)
  992. //! @brief Format value for bitfield GPT_OCR2_COMP.
  993. #define BF_GPT_OCR2_COMP(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_GPT_OCR2_COMP) & BM_GPT_OCR2_COMP)
  994. #ifndef __LANGUAGE_ASM__
  995. //! @brief Set the COMP field to a new value.
  996. #define BW_GPT_OCR2_COMP(v) (HW_GPT_OCR2_WR((HW_GPT_OCR2_RD() & ~BM_GPT_OCR2_COMP) | BF_GPT_OCR2_COMP(v)))
  997. #endif
  998. //@}
  999. //-------------------------------------------------------------------------------------------
  1000. // HW_GPT_OCR3 - GPT Output Compare Register 3
  1001. //-------------------------------------------------------------------------------------------
  1002. #ifndef __LANGUAGE_ASM__
  1003. /*!
  1004. * @brief HW_GPT_OCR3 - GPT Output Compare Register 3 (RW)
  1005. *
  1006. * Reset value: 0xffffffff
  1007. *
  1008. * The GPT Compare Register 3 (GPT_OCR3) holds the value that determines when a compare event will
  1009. * be generated on Output Compare Channel 3.
  1010. */
  1011. typedef union _hw_gpt_ocr3
  1012. {
  1013. reg32_t U;
  1014. struct _hw_gpt_ocr3_bitfields
  1015. {
  1016. unsigned COMP : 32; //!< [31:0] Compare Value.
  1017. } B;
  1018. } hw_gpt_ocr3_t;
  1019. #endif
  1020. /*!
  1021. * @name Constants and macros for entire GPT_OCR3 register
  1022. */
  1023. //@{
  1024. #define HW_GPT_OCR3_ADDR (REGS_GPT_BASE + 0x18)
  1025. #ifndef __LANGUAGE_ASM__
  1026. #define HW_GPT_OCR3 (*(volatile hw_gpt_ocr3_t *) HW_GPT_OCR3_ADDR)
  1027. #define HW_GPT_OCR3_RD() (HW_GPT_OCR3.U)
  1028. #define HW_GPT_OCR3_WR(v) (HW_GPT_OCR3.U = (v))
  1029. #define HW_GPT_OCR3_SET(v) (HW_GPT_OCR3_WR(HW_GPT_OCR3_RD() | (v)))
  1030. #define HW_GPT_OCR3_CLR(v) (HW_GPT_OCR3_WR(HW_GPT_OCR3_RD() & ~(v)))
  1031. #define HW_GPT_OCR3_TOG(v) (HW_GPT_OCR3_WR(HW_GPT_OCR3_RD() ^ (v)))
  1032. #endif
  1033. //@}
  1034. /*
  1035. * constants & macros for individual GPT_OCR3 bitfields
  1036. */
  1037. /*! @name Register GPT_OCR3, field COMP[31:0] (RW)
  1038. *
  1039. * Compare Value. When the counter value equals the COMP bit field value, a compare event is
  1040. * generated on Output Compare Channel 3.
  1041. */
  1042. //@{
  1043. #define BP_GPT_OCR3_COMP (0) //!< Bit position for GPT_OCR3_COMP.
  1044. #define BM_GPT_OCR3_COMP (0xffffffff) //!< Bit mask for GPT_OCR3_COMP.
  1045. //! @brief Get value of GPT_OCR3_COMP from a register value.
  1046. #define BG_GPT_OCR3_COMP(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_GPT_OCR3_COMP) >> BP_GPT_OCR3_COMP)
  1047. //! @brief Format value for bitfield GPT_OCR3_COMP.
  1048. #define BF_GPT_OCR3_COMP(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_GPT_OCR3_COMP) & BM_GPT_OCR3_COMP)
  1049. #ifndef __LANGUAGE_ASM__
  1050. //! @brief Set the COMP field to a new value.
  1051. #define BW_GPT_OCR3_COMP(v) (HW_GPT_OCR3_WR((HW_GPT_OCR3_RD() & ~BM_GPT_OCR3_COMP) | BF_GPT_OCR3_COMP(v)))
  1052. #endif
  1053. //@}
  1054. //-------------------------------------------------------------------------------------------
  1055. // HW_GPT_ICR1 - GPT Input Capture Register 1
  1056. //-------------------------------------------------------------------------------------------
  1057. #ifndef __LANGUAGE_ASM__
  1058. /*!
  1059. * @brief HW_GPT_ICR1 - GPT Input Capture Register 1 (RO)
  1060. *
  1061. * Reset value: 0x00000000
  1062. *
  1063. * The GPT Input Capture Register 1 (GPT_ICR1) is a read-only register that holds the value that was
  1064. * in the counter during the last capture event on Input Capture Channel 1.
  1065. */
  1066. typedef union _hw_gpt_icr1
  1067. {
  1068. reg32_t U;
  1069. struct _hw_gpt_icr1_bitfields
  1070. {
  1071. unsigned CAPT : 32; //!< [31:0] Capture Value.
  1072. } B;
  1073. } hw_gpt_icr1_t;
  1074. #endif
  1075. /*!
  1076. * @name Constants and macros for entire GPT_ICR1 register
  1077. */
  1078. //@{
  1079. #define HW_GPT_ICR1_ADDR (REGS_GPT_BASE + 0x1c)
  1080. #ifndef __LANGUAGE_ASM__
  1081. #define HW_GPT_ICR1 (*(volatile hw_gpt_icr1_t *) HW_GPT_ICR1_ADDR)
  1082. #define HW_GPT_ICR1_RD() (HW_GPT_ICR1.U)
  1083. #endif
  1084. //@}
  1085. /*
  1086. * constants & macros for individual GPT_ICR1 bitfields
  1087. */
  1088. /*! @name Register GPT_ICR1, field CAPT[31:0] (RO)
  1089. *
  1090. * Capture Value. After a capture event on Input Capture Channel 1 occurs, the current value of the
  1091. * counter is loaded into GPT Input Capture Register 1.
  1092. */
  1093. //@{
  1094. #define BP_GPT_ICR1_CAPT (0) //!< Bit position for GPT_ICR1_CAPT.
  1095. #define BM_GPT_ICR1_CAPT (0xffffffff) //!< Bit mask for GPT_ICR1_CAPT.
  1096. //! @brief Get value of GPT_ICR1_CAPT from a register value.
  1097. #define BG_GPT_ICR1_CAPT(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_GPT_ICR1_CAPT) >> BP_GPT_ICR1_CAPT)
  1098. //@}
  1099. //-------------------------------------------------------------------------------------------
  1100. // HW_GPT_ICR2 - GPT Input Capture Register 2
  1101. //-------------------------------------------------------------------------------------------
  1102. #ifndef __LANGUAGE_ASM__
  1103. /*!
  1104. * @brief HW_GPT_ICR2 - GPT Input Capture Register 2 (RO)
  1105. *
  1106. * Reset value: 0x00000000
  1107. *
  1108. * The GPT Input capture Register 2 (GPT_ICR2) is a read-only register which holds the value that
  1109. * was in the counter during the last capture event on input capture channel 2.
  1110. */
  1111. typedef union _hw_gpt_icr2
  1112. {
  1113. reg32_t U;
  1114. struct _hw_gpt_icr2_bitfields
  1115. {
  1116. unsigned CAPT : 32; //!< [31:0] Capture Value.
  1117. } B;
  1118. } hw_gpt_icr2_t;
  1119. #endif
  1120. /*!
  1121. * @name Constants and macros for entire GPT_ICR2 register
  1122. */
  1123. //@{
  1124. #define HW_GPT_ICR2_ADDR (REGS_GPT_BASE + 0x20)
  1125. #ifndef __LANGUAGE_ASM__
  1126. #define HW_GPT_ICR2 (*(volatile hw_gpt_icr2_t *) HW_GPT_ICR2_ADDR)
  1127. #define HW_GPT_ICR2_RD() (HW_GPT_ICR2.U)
  1128. #endif
  1129. //@}
  1130. /*
  1131. * constants & macros for individual GPT_ICR2 bitfields
  1132. */
  1133. /*! @name Register GPT_ICR2, field CAPT[31:0] (RO)
  1134. *
  1135. * Capture Value. After a capture event on Input Capture Channel 2 occurs, the current value of the
  1136. * counter is loaded into GPT Input Capture Register 2.
  1137. */
  1138. //@{
  1139. #define BP_GPT_ICR2_CAPT (0) //!< Bit position for GPT_ICR2_CAPT.
  1140. #define BM_GPT_ICR2_CAPT (0xffffffff) //!< Bit mask for GPT_ICR2_CAPT.
  1141. //! @brief Get value of GPT_ICR2_CAPT from a register value.
  1142. #define BG_GPT_ICR2_CAPT(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_GPT_ICR2_CAPT) >> BP_GPT_ICR2_CAPT)
  1143. //@}
  1144. //-------------------------------------------------------------------------------------------
  1145. // HW_GPT_CNT - GPT Counter Register
  1146. //-------------------------------------------------------------------------------------------
  1147. #ifndef __LANGUAGE_ASM__
  1148. /*!
  1149. * @brief HW_GPT_CNT - GPT Counter Register (RO)
  1150. *
  1151. * Reset value: 0x00000000
  1152. *
  1153. * The GPT Counter Register (GPT_CNT) is the main counter's register. GPT_CNT is a read-only
  1154. * register and can be read without affecting the counting process of the GPT.
  1155. */
  1156. typedef union _hw_gpt_cnt
  1157. {
  1158. reg32_t U;
  1159. struct _hw_gpt_cnt_bitfields
  1160. {
  1161. unsigned COUNT : 32; //!< [31:0] Counter Value.
  1162. } B;
  1163. } hw_gpt_cnt_t;
  1164. #endif
  1165. /*!
  1166. * @name Constants and macros for entire GPT_CNT register
  1167. */
  1168. //@{
  1169. #define HW_GPT_CNT_ADDR (REGS_GPT_BASE + 0x24)
  1170. #ifndef __LANGUAGE_ASM__
  1171. #define HW_GPT_CNT (*(volatile hw_gpt_cnt_t *) HW_GPT_CNT_ADDR)
  1172. #define HW_GPT_CNT_RD() (HW_GPT_CNT.U)
  1173. #endif
  1174. //@}
  1175. /*
  1176. * constants & macros for individual GPT_CNT bitfields
  1177. */
  1178. /*! @name Register GPT_CNT, field COUNT[31:0] (RO)
  1179. *
  1180. * Counter Value. The COUNT bits show the current count value of the GPT counter.
  1181. */
  1182. //@{
  1183. #define BP_GPT_CNT_COUNT (0) //!< Bit position for GPT_CNT_COUNT.
  1184. #define BM_GPT_CNT_COUNT (0xffffffff) //!< Bit mask for GPT_CNT_COUNT.
  1185. //! @brief Get value of GPT_CNT_COUNT from a register value.
  1186. #define BG_GPT_CNT_COUNT(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_GPT_CNT_COUNT) >> BP_GPT_CNT_COUNT)
  1187. //@}
  1188. //-------------------------------------------------------------------------------------------
  1189. // hw_gpt_t - module struct
  1190. //-------------------------------------------------------------------------------------------
  1191. /*!
  1192. * @brief All GPT module registers.
  1193. */
  1194. #ifndef __LANGUAGE_ASM__
  1195. #pragma pack(1)
  1196. typedef struct _hw_gpt
  1197. {
  1198. volatile hw_gpt_cr_t CR; //!< GPT Control Register
  1199. volatile hw_gpt_pr_t PR; //!< GPT Prescaler Register
  1200. volatile hw_gpt_sr_t SR; //!< GPT Status Register
  1201. volatile hw_gpt_ir_t IR; //!< GPT Interrupt Register
  1202. volatile hw_gpt_ocr1_t OCR1; //!< GPT Output Compare Register 1
  1203. volatile hw_gpt_ocr2_t OCR2; //!< GPT Output Compare Register 2
  1204. volatile hw_gpt_ocr3_t OCR3; //!< GPT Output Compare Register 3
  1205. volatile hw_gpt_icr1_t ICR1; //!< GPT Input Capture Register 1
  1206. volatile hw_gpt_icr2_t ICR2; //!< GPT Input Capture Register 2
  1207. volatile hw_gpt_cnt_t CNT; //!< GPT Counter Register
  1208. } hw_gpt_t;
  1209. #pragma pack()
  1210. //! @brief Macro to access all GPT registers.
  1211. //! @return Reference (not a pointer) to the registers struct. To get a pointer to the struct,
  1212. //! use the '&' operator, like <code>&HW_GPT</code>.
  1213. #define HW_GPT (*(hw_gpt_t *) REGS_GPT_BASE)
  1214. #endif
  1215. #endif // __HW_GPT_REGISTERS_H__
  1216. // v18/121106/1.2.2
  1217. // EOF