MK64F12_port.h 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957
  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_PORT_REGISTERS_H__
  22. #define __HW_PORT_REGISTERS_H__
  23. #include "regs.h"
  24. /*
  25. * MK64F12 PORT
  26. *
  27. * Pin Control and Interrupts
  28. *
  29. * Registers defined in this header file:
  30. * - HW_PORT_PCRn - Pin Control Register n
  31. * - HW_PORT_GPCLR - Global Pin Control Low Register
  32. * - HW_PORT_GPCHR - Global Pin Control High Register
  33. * - HW_PORT_ISFR - Interrupt Status Flag Register
  34. * - HW_PORT_DFER - Digital Filter Enable Register
  35. * - HW_PORT_DFCR - Digital Filter Clock Register
  36. * - HW_PORT_DFWR - Digital Filter Width Register
  37. *
  38. * - hw_port_t - Struct containing all module registers.
  39. */
  40. //! @name Module base addresses
  41. //@{
  42. #ifndef REGS_PORT_BASE
  43. #define HW_PORT_INSTANCE_COUNT (5U) //!< Number of instances of the PORT module.
  44. #define HW_PORTA (0U) //!< Instance number for PORTA.
  45. #define HW_PORTB (1U) //!< Instance number for PORTB.
  46. #define HW_PORTC (2U) //!< Instance number for PORTC.
  47. #define HW_PORTD (3U) //!< Instance number for PORTD.
  48. #define HW_PORTE (4U) //!< Instance number for PORTE.
  49. #define REGS_PORTA_BASE (0x40049000U) //!< Base address for PORTA.
  50. #define REGS_PORTB_BASE (0x4004A000U) //!< Base address for PORTB.
  51. #define REGS_PORTC_BASE (0x4004B000U) //!< Base address for PORTC.
  52. #define REGS_PORTD_BASE (0x4004C000U) //!< Base address for PORTD.
  53. #define REGS_PORTE_BASE (0x4004D000U) //!< Base address for PORTE.
  54. //! @brief Table of base addresses for PORT instances.
  55. static const uint32_t __g_regs_PORT_base_addresses[] = {
  56. REGS_PORTA_BASE,
  57. REGS_PORTB_BASE,
  58. REGS_PORTC_BASE,
  59. REGS_PORTD_BASE,
  60. REGS_PORTE_BASE,
  61. };
  62. //! @brief Get the base address of PORT by instance number.
  63. //! @param x PORT instance number, from 0 through 4.
  64. #define REGS_PORT_BASE(x) (__g_regs_PORT_base_addresses[(x)])
  65. //! @brief Get the instance number given a base address.
  66. //! @param b Base address for an instance of PORT.
  67. #define REGS_PORT_INSTANCE(b) ((b) == REGS_PORTA_BASE ? HW_PORTA : (b) == REGS_PORTB_BASE ? HW_PORTB : (b) == REGS_PORTC_BASE ? HW_PORTC : (b) == REGS_PORTD_BASE ? HW_PORTD : (b) == REGS_PORTE_BASE ? HW_PORTE : 0)
  68. #endif
  69. //@}
  70. //-------------------------------------------------------------------------------------------
  71. // HW_PORT_PCRn - Pin Control Register n
  72. //-------------------------------------------------------------------------------------------
  73. #ifndef __LANGUAGE_ASM__
  74. /*!
  75. * @brief HW_PORT_PCRn - Pin Control Register n (RW)
  76. *
  77. * Reset value: 0x00000742U
  78. *
  79. * See the Signal Multiplexing and Pin Assignment chapter for the reset value of
  80. * this device. See the GPIO Configuration section for details on the available
  81. * functions for each pin. Do not modify pin configuration registers associated
  82. * with pins not available in your selected package. All unbonded pins not
  83. * available in your package will default to DISABLE state for lowest power consumption.
  84. */
  85. typedef union _hw_port_pcrn
  86. {
  87. uint32_t U;
  88. struct _hw_port_pcrn_bitfields
  89. {
  90. uint32_t PS : 1; //!< [0] Pull Select
  91. uint32_t PE : 1; //!< [1] Pull Enable
  92. uint32_t SRE : 1; //!< [2] Slew Rate Enable
  93. uint32_t RESERVED0 : 1; //!< [3]
  94. uint32_t PFE : 1; //!< [4] Passive Filter Enable
  95. uint32_t ODE : 1; //!< [5] Open Drain Enable
  96. uint32_t DSE : 1; //!< [6] Drive Strength Enable
  97. uint32_t RESERVED1 : 1; //!< [7]
  98. uint32_t MUX : 3; //!< [10:8] Pin Mux Control
  99. uint32_t RESERVED2 : 4; //!< [14:11]
  100. uint32_t LK : 1; //!< [15] Lock Register
  101. uint32_t IRQC : 4; //!< [19:16] Interrupt Configuration
  102. uint32_t RESERVED3 : 4; //!< [23:20]
  103. uint32_t ISF : 1; //!< [24] Interrupt Status Flag
  104. uint32_t RESERVED4 : 7; //!< [31:25]
  105. } B;
  106. } hw_port_pcrn_t;
  107. #endif
  108. /*!
  109. * @name Constants and macros for entire PORT_PCRn register
  110. */
  111. //@{
  112. #define HW_PORT_PCRn_COUNT (32U)
  113. #define HW_PORT_PCRn_ADDR(x, n) (REGS_PORT_BASE(x) + 0x0U + (0x4U * n))
  114. #ifndef __LANGUAGE_ASM__
  115. #define HW_PORT_PCRn(x, n) (*(__IO hw_port_pcrn_t *) HW_PORT_PCRn_ADDR(x, n))
  116. #define HW_PORT_PCRn_RD(x, n) (HW_PORT_PCRn(x, n).U)
  117. #define HW_PORT_PCRn_WR(x, n, v) (HW_PORT_PCRn(x, n).U = (v))
  118. #define HW_PORT_PCRn_SET(x, n, v) (HW_PORT_PCRn_WR(x, n, HW_PORT_PCRn_RD(x, n) | (v)))
  119. #define HW_PORT_PCRn_CLR(x, n, v) (HW_PORT_PCRn_WR(x, n, HW_PORT_PCRn_RD(x, n) & ~(v)))
  120. #define HW_PORT_PCRn_TOG(x, n, v) (HW_PORT_PCRn_WR(x, n, HW_PORT_PCRn_RD(x, n) ^ (v)))
  121. #endif
  122. //@}
  123. /*
  124. * Constants & macros for individual PORT_PCRn bitfields
  125. */
  126. /*!
  127. * @name Register PORT_PCRn, field PS[0] (RW)
  128. *
  129. * Pull configuration is valid in all digital pin muxing modes.
  130. *
  131. * Values:
  132. * - 0 - Internal pulldown resistor is enabled on the corresponding pin, if the
  133. * corresponding PE field is set.
  134. * - 1 - Internal pullup resistor is enabled on the corresponding pin, if the
  135. * corresponding PE field is set.
  136. */
  137. //@{
  138. #define BP_PORT_PCRn_PS (0U) //!< Bit position for PORT_PCRn_PS.
  139. #define BM_PORT_PCRn_PS (0x00000001U) //!< Bit mask for PORT_PCRn_PS.
  140. #define BS_PORT_PCRn_PS (1U) //!< Bit field size in bits for PORT_PCRn_PS.
  141. #ifndef __LANGUAGE_ASM__
  142. //! @brief Read current value of the PORT_PCRn_PS field.
  143. #define BR_PORT_PCRn_PS(x, n) (BITBAND_ACCESS32(HW_PORT_PCRn_ADDR(x, n), BP_PORT_PCRn_PS))
  144. #endif
  145. //! @brief Format value for bitfield PORT_PCRn_PS.
  146. #define BF_PORT_PCRn_PS(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_PORT_PCRn_PS), uint32_t) & BM_PORT_PCRn_PS)
  147. #ifndef __LANGUAGE_ASM__
  148. //! @brief Set the PS field to a new value.
  149. #define BW_PORT_PCRn_PS(x, n, v) (BITBAND_ACCESS32(HW_PORT_PCRn_ADDR(x, n), BP_PORT_PCRn_PS) = (v))
  150. #endif
  151. //@}
  152. /*!
  153. * @name Register PORT_PCRn, field PE[1] (RW)
  154. *
  155. * Pull configuration is valid in all digital pin muxing modes.
  156. *
  157. * Values:
  158. * - 0 - Internal pullup or pulldown resistor is not enabled on the
  159. * corresponding pin.
  160. * - 1 - Internal pullup or pulldown resistor is enabled on the corresponding
  161. * pin, if the pin is configured as a digital input.
  162. */
  163. //@{
  164. #define BP_PORT_PCRn_PE (1U) //!< Bit position for PORT_PCRn_PE.
  165. #define BM_PORT_PCRn_PE (0x00000002U) //!< Bit mask for PORT_PCRn_PE.
  166. #define BS_PORT_PCRn_PE (1U) //!< Bit field size in bits for PORT_PCRn_PE.
  167. #ifndef __LANGUAGE_ASM__
  168. //! @brief Read current value of the PORT_PCRn_PE field.
  169. #define BR_PORT_PCRn_PE(x, n) (BITBAND_ACCESS32(HW_PORT_PCRn_ADDR(x, n), BP_PORT_PCRn_PE))
  170. #endif
  171. //! @brief Format value for bitfield PORT_PCRn_PE.
  172. #define BF_PORT_PCRn_PE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_PORT_PCRn_PE), uint32_t) & BM_PORT_PCRn_PE)
  173. #ifndef __LANGUAGE_ASM__
  174. //! @brief Set the PE field to a new value.
  175. #define BW_PORT_PCRn_PE(x, n, v) (BITBAND_ACCESS32(HW_PORT_PCRn_ADDR(x, n), BP_PORT_PCRn_PE) = (v))
  176. #endif
  177. //@}
  178. /*!
  179. * @name Register PORT_PCRn, field SRE[2] (RW)
  180. *
  181. * Slew rate configuration is valid in all digital pin muxing modes.
  182. *
  183. * Values:
  184. * - 0 - Fast slew rate is configured on the corresponding pin, if the pin is
  185. * configured as a digital output.
  186. * - 1 - Slow slew rate is configured on the corresponding pin, if the pin is
  187. * configured as a digital output.
  188. */
  189. //@{
  190. #define BP_PORT_PCRn_SRE (2U) //!< Bit position for PORT_PCRn_SRE.
  191. #define BM_PORT_PCRn_SRE (0x00000004U) //!< Bit mask for PORT_PCRn_SRE.
  192. #define BS_PORT_PCRn_SRE (1U) //!< Bit field size in bits for PORT_PCRn_SRE.
  193. #ifndef __LANGUAGE_ASM__
  194. //! @brief Read current value of the PORT_PCRn_SRE field.
  195. #define BR_PORT_PCRn_SRE(x, n) (BITBAND_ACCESS32(HW_PORT_PCRn_ADDR(x, n), BP_PORT_PCRn_SRE))
  196. #endif
  197. //! @brief Format value for bitfield PORT_PCRn_SRE.
  198. #define BF_PORT_PCRn_SRE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_PORT_PCRn_SRE), uint32_t) & BM_PORT_PCRn_SRE)
  199. #ifndef __LANGUAGE_ASM__
  200. //! @brief Set the SRE field to a new value.
  201. #define BW_PORT_PCRn_SRE(x, n, v) (BITBAND_ACCESS32(HW_PORT_PCRn_ADDR(x, n), BP_PORT_PCRn_SRE) = (v))
  202. #endif
  203. //@}
  204. /*!
  205. * @name Register PORT_PCRn, field PFE[4] (RW)
  206. *
  207. * Passive filter configuration is valid in all digital pin muxing modes.
  208. *
  209. * Values:
  210. * - 0 - Passive input filter is disabled on the corresponding pin.
  211. * - 1 - Passive input filter is enabled on the corresponding pin, if the pin is
  212. * configured as a digital input. Refer to the device data sheet for filter
  213. * characteristics.
  214. */
  215. //@{
  216. #define BP_PORT_PCRn_PFE (4U) //!< Bit position for PORT_PCRn_PFE.
  217. #define BM_PORT_PCRn_PFE (0x00000010U) //!< Bit mask for PORT_PCRn_PFE.
  218. #define BS_PORT_PCRn_PFE (1U) //!< Bit field size in bits for PORT_PCRn_PFE.
  219. #ifndef __LANGUAGE_ASM__
  220. //! @brief Read current value of the PORT_PCRn_PFE field.
  221. #define BR_PORT_PCRn_PFE(x, n) (BITBAND_ACCESS32(HW_PORT_PCRn_ADDR(x, n), BP_PORT_PCRn_PFE))
  222. #endif
  223. //! @brief Format value for bitfield PORT_PCRn_PFE.
  224. #define BF_PORT_PCRn_PFE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_PORT_PCRn_PFE), uint32_t) & BM_PORT_PCRn_PFE)
  225. #ifndef __LANGUAGE_ASM__
  226. //! @brief Set the PFE field to a new value.
  227. #define BW_PORT_PCRn_PFE(x, n, v) (BITBAND_ACCESS32(HW_PORT_PCRn_ADDR(x, n), BP_PORT_PCRn_PFE) = (v))
  228. #endif
  229. //@}
  230. /*!
  231. * @name Register PORT_PCRn, field ODE[5] (RW)
  232. *
  233. * Open drain configuration is valid in all digital pin muxing modes.
  234. *
  235. * Values:
  236. * - 0 - Open drain output is disabled on the corresponding pin.
  237. * - 1 - Open drain output is enabled on the corresponding pin, if the pin is
  238. * configured as a digital output.
  239. */
  240. //@{
  241. #define BP_PORT_PCRn_ODE (5U) //!< Bit position for PORT_PCRn_ODE.
  242. #define BM_PORT_PCRn_ODE (0x00000020U) //!< Bit mask for PORT_PCRn_ODE.
  243. #define BS_PORT_PCRn_ODE (1U) //!< Bit field size in bits for PORT_PCRn_ODE.
  244. #ifndef __LANGUAGE_ASM__
  245. //! @brief Read current value of the PORT_PCRn_ODE field.
  246. #define BR_PORT_PCRn_ODE(x, n) (BITBAND_ACCESS32(HW_PORT_PCRn_ADDR(x, n), BP_PORT_PCRn_ODE))
  247. #endif
  248. //! @brief Format value for bitfield PORT_PCRn_ODE.
  249. #define BF_PORT_PCRn_ODE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_PORT_PCRn_ODE), uint32_t) & BM_PORT_PCRn_ODE)
  250. #ifndef __LANGUAGE_ASM__
  251. //! @brief Set the ODE field to a new value.
  252. #define BW_PORT_PCRn_ODE(x, n, v) (BITBAND_ACCESS32(HW_PORT_PCRn_ADDR(x, n), BP_PORT_PCRn_ODE) = (v))
  253. #endif
  254. //@}
  255. /*!
  256. * @name Register PORT_PCRn, field DSE[6] (RW)
  257. *
  258. * Drive strength configuration is valid in all digital pin muxing modes.
  259. *
  260. * Values:
  261. * - 0 - Low drive strength is configured on the corresponding pin, if pin is
  262. * configured as a digital output.
  263. * - 1 - High drive strength is configured on the corresponding pin, if pin is
  264. * configured as a digital output.
  265. */
  266. //@{
  267. #define BP_PORT_PCRn_DSE (6U) //!< Bit position for PORT_PCRn_DSE.
  268. #define BM_PORT_PCRn_DSE (0x00000040U) //!< Bit mask for PORT_PCRn_DSE.
  269. #define BS_PORT_PCRn_DSE (1U) //!< Bit field size in bits for PORT_PCRn_DSE.
  270. #ifndef __LANGUAGE_ASM__
  271. //! @brief Read current value of the PORT_PCRn_DSE field.
  272. #define BR_PORT_PCRn_DSE(x, n) (BITBAND_ACCESS32(HW_PORT_PCRn_ADDR(x, n), BP_PORT_PCRn_DSE))
  273. #endif
  274. //! @brief Format value for bitfield PORT_PCRn_DSE.
  275. #define BF_PORT_PCRn_DSE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_PORT_PCRn_DSE), uint32_t) & BM_PORT_PCRn_DSE)
  276. #ifndef __LANGUAGE_ASM__
  277. //! @brief Set the DSE field to a new value.
  278. #define BW_PORT_PCRn_DSE(x, n, v) (BITBAND_ACCESS32(HW_PORT_PCRn_ADDR(x, n), BP_PORT_PCRn_DSE) = (v))
  279. #endif
  280. //@}
  281. /*!
  282. * @name Register PORT_PCRn, field MUX[10:8] (RW)
  283. *
  284. * Not all pins support all pin muxing slots. Unimplemented pin muxing slots are
  285. * reserved and may result in configuring the pin for a different pin muxing
  286. * slot. The corresponding pin is configured in the following pin muxing slot as
  287. * follows:
  288. *
  289. * Values:
  290. * - 000 - Pin disabled (analog).
  291. * - 001 - Alternative 1 (GPIO).
  292. * - 010 - Alternative 2 (chip-specific).
  293. * - 011 - Alternative 3 (chip-specific).
  294. * - 100 - Alternative 4 (chip-specific).
  295. * - 101 - Alternative 5 (chip-specific).
  296. * - 110 - Alternative 6 (chip-specific).
  297. * - 111 - Alternative 7 (chip-specific).
  298. */
  299. //@{
  300. #define BP_PORT_PCRn_MUX (8U) //!< Bit position for PORT_PCRn_MUX.
  301. #define BM_PORT_PCRn_MUX (0x00000700U) //!< Bit mask for PORT_PCRn_MUX.
  302. #define BS_PORT_PCRn_MUX (3U) //!< Bit field size in bits for PORT_PCRn_MUX.
  303. #ifndef __LANGUAGE_ASM__
  304. //! @brief Read current value of the PORT_PCRn_MUX field.
  305. #define BR_PORT_PCRn_MUX(x, n) (HW_PORT_PCRn(x, n).B.MUX)
  306. #endif
  307. //! @brief Format value for bitfield PORT_PCRn_MUX.
  308. #define BF_PORT_PCRn_MUX(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_PORT_PCRn_MUX), uint32_t) & BM_PORT_PCRn_MUX)
  309. #ifndef __LANGUAGE_ASM__
  310. //! @brief Set the MUX field to a new value.
  311. #define BW_PORT_PCRn_MUX(x, n, v) (HW_PORT_PCRn_WR(x, n, (HW_PORT_PCRn_RD(x, n) & ~BM_PORT_PCRn_MUX) | BF_PORT_PCRn_MUX(v)))
  312. #endif
  313. //@}
  314. /*!
  315. * @name Register PORT_PCRn, field LK[15] (RW)
  316. *
  317. * Values:
  318. * - 0 - Pin Control Register fields [15:0] are not locked.
  319. * - 1 - Pin Control Register fields [15:0] are locked and cannot be updated
  320. * until the next system reset.
  321. */
  322. //@{
  323. #define BP_PORT_PCRn_LK (15U) //!< Bit position for PORT_PCRn_LK.
  324. #define BM_PORT_PCRn_LK (0x00008000U) //!< Bit mask for PORT_PCRn_LK.
  325. #define BS_PORT_PCRn_LK (1U) //!< Bit field size in bits for PORT_PCRn_LK.
  326. #ifndef __LANGUAGE_ASM__
  327. //! @brief Read current value of the PORT_PCRn_LK field.
  328. #define BR_PORT_PCRn_LK(x, n) (BITBAND_ACCESS32(HW_PORT_PCRn_ADDR(x, n), BP_PORT_PCRn_LK))
  329. #endif
  330. //! @brief Format value for bitfield PORT_PCRn_LK.
  331. #define BF_PORT_PCRn_LK(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_PORT_PCRn_LK), uint32_t) & BM_PORT_PCRn_LK)
  332. #ifndef __LANGUAGE_ASM__
  333. //! @brief Set the LK field to a new value.
  334. #define BW_PORT_PCRn_LK(x, n, v) (BITBAND_ACCESS32(HW_PORT_PCRn_ADDR(x, n), BP_PORT_PCRn_LK) = (v))
  335. #endif
  336. //@}
  337. /*!
  338. * @name Register PORT_PCRn, field IRQC[19:16] (RW)
  339. *
  340. * The pin interrupt configuration is valid in all digital pin muxing modes. The
  341. * corresponding pin is configured to generate interrupt/DMA request as follows:
  342. *
  343. * Values:
  344. * - 0000 - Interrupt/DMA request disabled.
  345. * - 0001 - DMA request on rising edge.
  346. * - 0010 - DMA request on falling edge.
  347. * - 0011 - DMA request on either edge.
  348. * - 1000 - Interrupt when logic 0.
  349. * - 1001 - Interrupt on rising-edge.
  350. * - 1010 - Interrupt on falling-edge.
  351. * - 1011 - Interrupt on either edge.
  352. * - 1100 - Interrupt when logic 1.
  353. */
  354. //@{
  355. #define BP_PORT_PCRn_IRQC (16U) //!< Bit position for PORT_PCRn_IRQC.
  356. #define BM_PORT_PCRn_IRQC (0x000F0000U) //!< Bit mask for PORT_PCRn_IRQC.
  357. #define BS_PORT_PCRn_IRQC (4U) //!< Bit field size in bits for PORT_PCRn_IRQC.
  358. #ifndef __LANGUAGE_ASM__
  359. //! @brief Read current value of the PORT_PCRn_IRQC field.
  360. #define BR_PORT_PCRn_IRQC(x, n) (HW_PORT_PCRn(x, n).B.IRQC)
  361. #endif
  362. //! @brief Format value for bitfield PORT_PCRn_IRQC.
  363. #define BF_PORT_PCRn_IRQC(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_PORT_PCRn_IRQC), uint32_t) & BM_PORT_PCRn_IRQC)
  364. #ifndef __LANGUAGE_ASM__
  365. //! @brief Set the IRQC field to a new value.
  366. #define BW_PORT_PCRn_IRQC(x, n, v) (HW_PORT_PCRn_WR(x, n, (HW_PORT_PCRn_RD(x, n) & ~BM_PORT_PCRn_IRQC) | BF_PORT_PCRn_IRQC(v)))
  367. #endif
  368. //@}
  369. /*!
  370. * @name Register PORT_PCRn, field ISF[24] (W1C)
  371. *
  372. * The pin interrupt configuration is valid in all digital pin muxing modes.
  373. *
  374. * Values:
  375. * - 0 - Configured interrupt is not detected.
  376. * - 1 - Configured interrupt is detected. If the pin is configured to generate
  377. * a DMA request, then the corresponding flag will be cleared automatically
  378. * at the completion of the requested DMA transfer. Otherwise, the flag
  379. * remains set until a logic 1 is written to the flag. If the pin is configured for
  380. * a level sensitive interrupt and the pin remains asserted, then the flag
  381. * is set again immediately after it is cleared.
  382. */
  383. //@{
  384. #define BP_PORT_PCRn_ISF (24U) //!< Bit position for PORT_PCRn_ISF.
  385. #define BM_PORT_PCRn_ISF (0x01000000U) //!< Bit mask for PORT_PCRn_ISF.
  386. #define BS_PORT_PCRn_ISF (1U) //!< Bit field size in bits for PORT_PCRn_ISF.
  387. #ifndef __LANGUAGE_ASM__
  388. //! @brief Read current value of the PORT_PCRn_ISF field.
  389. #define BR_PORT_PCRn_ISF(x, n) (BITBAND_ACCESS32(HW_PORT_PCRn_ADDR(x, n), BP_PORT_PCRn_ISF))
  390. #endif
  391. //! @brief Format value for bitfield PORT_PCRn_ISF.
  392. #define BF_PORT_PCRn_ISF(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_PORT_PCRn_ISF), uint32_t) & BM_PORT_PCRn_ISF)
  393. #ifndef __LANGUAGE_ASM__
  394. //! @brief Set the ISF field to a new value.
  395. #define BW_PORT_PCRn_ISF(x, n, v) (BITBAND_ACCESS32(HW_PORT_PCRn_ADDR(x, n), BP_PORT_PCRn_ISF) = (v))
  396. #endif
  397. //@}
  398. //-------------------------------------------------------------------------------------------
  399. // HW_PORT_GPCLR - Global Pin Control Low Register
  400. //-------------------------------------------------------------------------------------------
  401. #ifndef __LANGUAGE_ASM__
  402. /*!
  403. * @brief HW_PORT_GPCLR - Global Pin Control Low Register (WORZ)
  404. *
  405. * Reset value: 0x00000000U
  406. *
  407. * Only 32-bit writes are supported to this register.
  408. */
  409. typedef union _hw_port_gpclr
  410. {
  411. uint32_t U;
  412. struct _hw_port_gpclr_bitfields
  413. {
  414. uint32_t GPWD : 16; //!< [15:0] Global Pin Write Data
  415. uint32_t GPWE : 16; //!< [31:16] Global Pin Write Enable
  416. } B;
  417. } hw_port_gpclr_t;
  418. #endif
  419. /*!
  420. * @name Constants and macros for entire PORT_GPCLR register
  421. */
  422. //@{
  423. #define HW_PORT_GPCLR_ADDR(x) (REGS_PORT_BASE(x) + 0x80U)
  424. #ifndef __LANGUAGE_ASM__
  425. #define HW_PORT_GPCLR(x) (*(__O hw_port_gpclr_t *) HW_PORT_GPCLR_ADDR(x))
  426. #define HW_PORT_GPCLR_RD(x) (HW_PORT_GPCLR(x).U)
  427. #define HW_PORT_GPCLR_WR(x, v) (HW_PORT_GPCLR(x).U = (v))
  428. #endif
  429. //@}
  430. /*
  431. * Constants & macros for individual PORT_GPCLR bitfields
  432. */
  433. /*!
  434. * @name Register PORT_GPCLR, field GPWD[15:0] (WORZ)
  435. *
  436. * Write value that is written to all Pin Control Registers bits [15:0] that are
  437. * selected by GPWE.
  438. */
  439. //@{
  440. #define BP_PORT_GPCLR_GPWD (0U) //!< Bit position for PORT_GPCLR_GPWD.
  441. #define BM_PORT_GPCLR_GPWD (0x0000FFFFU) //!< Bit mask for PORT_GPCLR_GPWD.
  442. #define BS_PORT_GPCLR_GPWD (16U) //!< Bit field size in bits for PORT_GPCLR_GPWD.
  443. //! @brief Format value for bitfield PORT_GPCLR_GPWD.
  444. #define BF_PORT_GPCLR_GPWD(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_PORT_GPCLR_GPWD), uint32_t) & BM_PORT_GPCLR_GPWD)
  445. #ifndef __LANGUAGE_ASM__
  446. //! @brief Set the GPWD field to a new value.
  447. #define BW_PORT_GPCLR_GPWD(x, v) (HW_PORT_GPCLR_WR(x, (HW_PORT_GPCLR_RD(x) & ~BM_PORT_GPCLR_GPWD) | BF_PORT_GPCLR_GPWD(v)))
  448. #endif
  449. //@}
  450. /*!
  451. * @name Register PORT_GPCLR, field GPWE[31:16] (WORZ)
  452. *
  453. * Selects which Pin Control Registers (15 through 0) bits [15:0] update with
  454. * the value in GPWD. If a selected Pin Control Register is locked then the write
  455. * to that register is ignored.
  456. *
  457. * Values:
  458. * - 0 - Corresponding Pin Control Register is not updated with the value in
  459. * GPWD.
  460. * - 1 - Corresponding Pin Control Register is updated with the value in GPWD.
  461. */
  462. //@{
  463. #define BP_PORT_GPCLR_GPWE (16U) //!< Bit position for PORT_GPCLR_GPWE.
  464. #define BM_PORT_GPCLR_GPWE (0xFFFF0000U) //!< Bit mask for PORT_GPCLR_GPWE.
  465. #define BS_PORT_GPCLR_GPWE (16U) //!< Bit field size in bits for PORT_GPCLR_GPWE.
  466. //! @brief Format value for bitfield PORT_GPCLR_GPWE.
  467. #define BF_PORT_GPCLR_GPWE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_PORT_GPCLR_GPWE), uint32_t) & BM_PORT_GPCLR_GPWE)
  468. #ifndef __LANGUAGE_ASM__
  469. //! @brief Set the GPWE field to a new value.
  470. #define BW_PORT_GPCLR_GPWE(x, v) (HW_PORT_GPCLR_WR(x, (HW_PORT_GPCLR_RD(x) & ~BM_PORT_GPCLR_GPWE) | BF_PORT_GPCLR_GPWE(v)))
  471. #endif
  472. //@}
  473. //-------------------------------------------------------------------------------------------
  474. // HW_PORT_GPCHR - Global Pin Control High Register
  475. //-------------------------------------------------------------------------------------------
  476. #ifndef __LANGUAGE_ASM__
  477. /*!
  478. * @brief HW_PORT_GPCHR - Global Pin Control High Register (WORZ)
  479. *
  480. * Reset value: 0x00000000U
  481. *
  482. * Only 32-bit writes are supported to this register.
  483. */
  484. typedef union _hw_port_gpchr
  485. {
  486. uint32_t U;
  487. struct _hw_port_gpchr_bitfields
  488. {
  489. uint32_t GPWD : 16; //!< [15:0] Global Pin Write Data
  490. uint32_t GPWE : 16; //!< [31:16] Global Pin Write Enable
  491. } B;
  492. } hw_port_gpchr_t;
  493. #endif
  494. /*!
  495. * @name Constants and macros for entire PORT_GPCHR register
  496. */
  497. //@{
  498. #define HW_PORT_GPCHR_ADDR(x) (REGS_PORT_BASE(x) + 0x84U)
  499. #ifndef __LANGUAGE_ASM__
  500. #define HW_PORT_GPCHR(x) (*(__O hw_port_gpchr_t *) HW_PORT_GPCHR_ADDR(x))
  501. #define HW_PORT_GPCHR_RD(x) (HW_PORT_GPCHR(x).U)
  502. #define HW_PORT_GPCHR_WR(x, v) (HW_PORT_GPCHR(x).U = (v))
  503. #endif
  504. //@}
  505. /*
  506. * Constants & macros for individual PORT_GPCHR bitfields
  507. */
  508. /*!
  509. * @name Register PORT_GPCHR, field GPWD[15:0] (WORZ)
  510. *
  511. * Write value that is written to all Pin Control Registers bits [15:0] that are
  512. * selected by GPWE.
  513. */
  514. //@{
  515. #define BP_PORT_GPCHR_GPWD (0U) //!< Bit position for PORT_GPCHR_GPWD.
  516. #define BM_PORT_GPCHR_GPWD (0x0000FFFFU) //!< Bit mask for PORT_GPCHR_GPWD.
  517. #define BS_PORT_GPCHR_GPWD (16U) //!< Bit field size in bits for PORT_GPCHR_GPWD.
  518. //! @brief Format value for bitfield PORT_GPCHR_GPWD.
  519. #define BF_PORT_GPCHR_GPWD(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_PORT_GPCHR_GPWD), uint32_t) & BM_PORT_GPCHR_GPWD)
  520. #ifndef __LANGUAGE_ASM__
  521. //! @brief Set the GPWD field to a new value.
  522. #define BW_PORT_GPCHR_GPWD(x, v) (HW_PORT_GPCHR_WR(x, (HW_PORT_GPCHR_RD(x) & ~BM_PORT_GPCHR_GPWD) | BF_PORT_GPCHR_GPWD(v)))
  523. #endif
  524. //@}
  525. /*!
  526. * @name Register PORT_GPCHR, field GPWE[31:16] (WORZ)
  527. *
  528. * Selects which Pin Control Registers (31 through 16) bits [15:0] update with
  529. * the value in GPWD. If a selected Pin Control Register is locked then the write
  530. * to that register is ignored.
  531. *
  532. * Values:
  533. * - 0 - Corresponding Pin Control Register is not updated with the value in
  534. * GPWD.
  535. * - 1 - Corresponding Pin Control Register is updated with the value in GPWD.
  536. */
  537. //@{
  538. #define BP_PORT_GPCHR_GPWE (16U) //!< Bit position for PORT_GPCHR_GPWE.
  539. #define BM_PORT_GPCHR_GPWE (0xFFFF0000U) //!< Bit mask for PORT_GPCHR_GPWE.
  540. #define BS_PORT_GPCHR_GPWE (16U) //!< Bit field size in bits for PORT_GPCHR_GPWE.
  541. //! @brief Format value for bitfield PORT_GPCHR_GPWE.
  542. #define BF_PORT_GPCHR_GPWE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_PORT_GPCHR_GPWE), uint32_t) & BM_PORT_GPCHR_GPWE)
  543. #ifndef __LANGUAGE_ASM__
  544. //! @brief Set the GPWE field to a new value.
  545. #define BW_PORT_GPCHR_GPWE(x, v) (HW_PORT_GPCHR_WR(x, (HW_PORT_GPCHR_RD(x) & ~BM_PORT_GPCHR_GPWE) | BF_PORT_GPCHR_GPWE(v)))
  546. #endif
  547. //@}
  548. //-------------------------------------------------------------------------------------------
  549. // HW_PORT_ISFR - Interrupt Status Flag Register
  550. //-------------------------------------------------------------------------------------------
  551. #ifndef __LANGUAGE_ASM__
  552. /*!
  553. * @brief HW_PORT_ISFR - Interrupt Status Flag Register (W1C)
  554. *
  555. * Reset value: 0x00000000U
  556. *
  557. * The pin interrupt configuration is valid in all digital pin muxing modes. The
  558. * Interrupt Status Flag for each pin is also visible in the corresponding Pin
  559. * Control Register, and each flag can be cleared in either location.
  560. */
  561. typedef union _hw_port_isfr
  562. {
  563. uint32_t U;
  564. struct _hw_port_isfr_bitfields
  565. {
  566. uint32_t ISF : 32; //!< [31:0] Interrupt Status Flag
  567. } B;
  568. } hw_port_isfr_t;
  569. #endif
  570. /*!
  571. * @name Constants and macros for entire PORT_ISFR register
  572. */
  573. //@{
  574. #define HW_PORT_ISFR_ADDR(x) (REGS_PORT_BASE(x) + 0xA0U)
  575. #ifndef __LANGUAGE_ASM__
  576. #define HW_PORT_ISFR(x) (*(__IO hw_port_isfr_t *) HW_PORT_ISFR_ADDR(x))
  577. #define HW_PORT_ISFR_RD(x) (HW_PORT_ISFR(x).U)
  578. #define HW_PORT_ISFR_WR(x, v) (HW_PORT_ISFR(x).U = (v))
  579. #define HW_PORT_ISFR_SET(x, v) (HW_PORT_ISFR_WR(x, HW_PORT_ISFR_RD(x) | (v)))
  580. #define HW_PORT_ISFR_CLR(x, v) (HW_PORT_ISFR_WR(x, HW_PORT_ISFR_RD(x) & ~(v)))
  581. #define HW_PORT_ISFR_TOG(x, v) (HW_PORT_ISFR_WR(x, HW_PORT_ISFR_RD(x) ^ (v)))
  582. #endif
  583. //@}
  584. /*
  585. * Constants & macros for individual PORT_ISFR bitfields
  586. */
  587. /*!
  588. * @name Register PORT_ISFR, field ISF[31:0] (W1C)
  589. *
  590. * Each bit in the field indicates the detection of the configured interrupt of
  591. * the same number as the field.
  592. *
  593. * Values:
  594. * - 0 - Configured interrupt is not detected.
  595. * - 1 - Configured interrupt is detected. If the pin is configured to generate
  596. * a DMA request, then the corresponding flag will be cleared automatically
  597. * at the completion of the requested DMA transfer. Otherwise, the flag
  598. * remains set until a logic 1 is written to the flag. If the pin is configured for
  599. * a level sensitive interrupt and the pin remains asserted, then the flag
  600. * is set again immediately after it is cleared.
  601. */
  602. //@{
  603. #define BP_PORT_ISFR_ISF (0U) //!< Bit position for PORT_ISFR_ISF.
  604. #define BM_PORT_ISFR_ISF (0xFFFFFFFFU) //!< Bit mask for PORT_ISFR_ISF.
  605. #define BS_PORT_ISFR_ISF (32U) //!< Bit field size in bits for PORT_ISFR_ISF.
  606. #ifndef __LANGUAGE_ASM__
  607. //! @brief Read current value of the PORT_ISFR_ISF field.
  608. #define BR_PORT_ISFR_ISF(x) (HW_PORT_ISFR(x).U)
  609. #endif
  610. //! @brief Format value for bitfield PORT_ISFR_ISF.
  611. #define BF_PORT_ISFR_ISF(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_PORT_ISFR_ISF), uint32_t) & BM_PORT_ISFR_ISF)
  612. #ifndef __LANGUAGE_ASM__
  613. //! @brief Set the ISF field to a new value.
  614. #define BW_PORT_ISFR_ISF(x, v) (HW_PORT_ISFR_WR(x, v))
  615. #endif
  616. //@}
  617. //-------------------------------------------------------------------------------------------
  618. // HW_PORT_DFER - Digital Filter Enable Register
  619. //-------------------------------------------------------------------------------------------
  620. #ifndef __LANGUAGE_ASM__
  621. /*!
  622. * @brief HW_PORT_DFER - Digital Filter Enable Register (RW)
  623. *
  624. * Reset value: 0x00000000U
  625. *
  626. * The corresponding bit is read only for pins that do not support a digital
  627. * filter. Refer to the Chapter of Signal Multiplexing and Signal Descriptions for
  628. * the pins that support digital filter. The digital filter configuration is valid
  629. * in all digital pin muxing modes.
  630. */
  631. typedef union _hw_port_dfer
  632. {
  633. uint32_t U;
  634. struct _hw_port_dfer_bitfields
  635. {
  636. uint32_t DFE : 32; //!< [31:0] Digital Filter Enable
  637. } B;
  638. } hw_port_dfer_t;
  639. #endif
  640. /*!
  641. * @name Constants and macros for entire PORT_DFER register
  642. */
  643. //@{
  644. #define HW_PORT_DFER_ADDR(x) (REGS_PORT_BASE(x) + 0xC0U)
  645. #ifndef __LANGUAGE_ASM__
  646. #define HW_PORT_DFER(x) (*(__IO hw_port_dfer_t *) HW_PORT_DFER_ADDR(x))
  647. #define HW_PORT_DFER_RD(x) (HW_PORT_DFER(x).U)
  648. #define HW_PORT_DFER_WR(x, v) (HW_PORT_DFER(x).U = (v))
  649. #define HW_PORT_DFER_SET(x, v) (HW_PORT_DFER_WR(x, HW_PORT_DFER_RD(x) | (v)))
  650. #define HW_PORT_DFER_CLR(x, v) (HW_PORT_DFER_WR(x, HW_PORT_DFER_RD(x) & ~(v)))
  651. #define HW_PORT_DFER_TOG(x, v) (HW_PORT_DFER_WR(x, HW_PORT_DFER_RD(x) ^ (v)))
  652. #endif
  653. //@}
  654. /*
  655. * Constants & macros for individual PORT_DFER bitfields
  656. */
  657. /*!
  658. * @name Register PORT_DFER, field DFE[31:0] (RW)
  659. *
  660. * The digital filter configuration is valid in all digital pin muxing modes.
  661. * The output of each digital filter is reset to zero at system reset and whenever
  662. * the digital filter is disabled. Each bit in the field enables the digital
  663. * filter of the same number as the field.
  664. *
  665. * Values:
  666. * - 0 - Digital filter is disabled on the corresponding pin and output of the
  667. * digital filter is reset to zero.
  668. * - 1 - Digital filter is enabled on the corresponding pin, if the pin is
  669. * configured as a digital input.
  670. */
  671. //@{
  672. #define BP_PORT_DFER_DFE (0U) //!< Bit position for PORT_DFER_DFE.
  673. #define BM_PORT_DFER_DFE (0xFFFFFFFFU) //!< Bit mask for PORT_DFER_DFE.
  674. #define BS_PORT_DFER_DFE (32U) //!< Bit field size in bits for PORT_DFER_DFE.
  675. #ifndef __LANGUAGE_ASM__
  676. //! @brief Read current value of the PORT_DFER_DFE field.
  677. #define BR_PORT_DFER_DFE(x) (HW_PORT_DFER(x).U)
  678. #endif
  679. //! @brief Format value for bitfield PORT_DFER_DFE.
  680. #define BF_PORT_DFER_DFE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_PORT_DFER_DFE), uint32_t) & BM_PORT_DFER_DFE)
  681. #ifndef __LANGUAGE_ASM__
  682. //! @brief Set the DFE field to a new value.
  683. #define BW_PORT_DFER_DFE(x, v) (HW_PORT_DFER_WR(x, v))
  684. #endif
  685. //@}
  686. //-------------------------------------------------------------------------------------------
  687. // HW_PORT_DFCR - Digital Filter Clock Register
  688. //-------------------------------------------------------------------------------------------
  689. #ifndef __LANGUAGE_ASM__
  690. /*!
  691. * @brief HW_PORT_DFCR - Digital Filter Clock Register (RW)
  692. *
  693. * Reset value: 0x00000000U
  694. *
  695. * This register is read only for ports that do not support a digital filter.
  696. * The digital filter configuration is valid in all digital pin muxing modes.
  697. */
  698. typedef union _hw_port_dfcr
  699. {
  700. uint32_t U;
  701. struct _hw_port_dfcr_bitfields
  702. {
  703. uint32_t CS : 1; //!< [0] Clock Source
  704. uint32_t RESERVED0 : 31; //!< [31:1]
  705. } B;
  706. } hw_port_dfcr_t;
  707. #endif
  708. /*!
  709. * @name Constants and macros for entire PORT_DFCR register
  710. */
  711. //@{
  712. #define HW_PORT_DFCR_ADDR(x) (REGS_PORT_BASE(x) + 0xC4U)
  713. #ifndef __LANGUAGE_ASM__
  714. #define HW_PORT_DFCR(x) (*(__IO hw_port_dfcr_t *) HW_PORT_DFCR_ADDR(x))
  715. #define HW_PORT_DFCR_RD(x) (HW_PORT_DFCR(x).U)
  716. #define HW_PORT_DFCR_WR(x, v) (HW_PORT_DFCR(x).U = (v))
  717. #define HW_PORT_DFCR_SET(x, v) (HW_PORT_DFCR_WR(x, HW_PORT_DFCR_RD(x) | (v)))
  718. #define HW_PORT_DFCR_CLR(x, v) (HW_PORT_DFCR_WR(x, HW_PORT_DFCR_RD(x) & ~(v)))
  719. #define HW_PORT_DFCR_TOG(x, v) (HW_PORT_DFCR_WR(x, HW_PORT_DFCR_RD(x) ^ (v)))
  720. #endif
  721. //@}
  722. /*
  723. * Constants & macros for individual PORT_DFCR bitfields
  724. */
  725. /*!
  726. * @name Register PORT_DFCR, field CS[0] (RW)
  727. *
  728. * The digital filter configuration is valid in all digital pin muxing modes.
  729. * Configures the clock source for the digital input filters. Changing the filter
  730. * clock source must be done only when all digital filters are disabled.
  731. *
  732. * Values:
  733. * - 0 - Digital filters are clocked by the bus clock.
  734. * - 1 - Digital filters are clocked by the 1 kHz LPO clock.
  735. */
  736. //@{
  737. #define BP_PORT_DFCR_CS (0U) //!< Bit position for PORT_DFCR_CS.
  738. #define BM_PORT_DFCR_CS (0x00000001U) //!< Bit mask for PORT_DFCR_CS.
  739. #define BS_PORT_DFCR_CS (1U) //!< Bit field size in bits for PORT_DFCR_CS.
  740. #ifndef __LANGUAGE_ASM__
  741. //! @brief Read current value of the PORT_DFCR_CS field.
  742. #define BR_PORT_DFCR_CS(x) (BITBAND_ACCESS32(HW_PORT_DFCR_ADDR(x), BP_PORT_DFCR_CS))
  743. #endif
  744. //! @brief Format value for bitfield PORT_DFCR_CS.
  745. #define BF_PORT_DFCR_CS(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_PORT_DFCR_CS), uint32_t) & BM_PORT_DFCR_CS)
  746. #ifndef __LANGUAGE_ASM__
  747. //! @brief Set the CS field to a new value.
  748. #define BW_PORT_DFCR_CS(x, v) (BITBAND_ACCESS32(HW_PORT_DFCR_ADDR(x), BP_PORT_DFCR_CS) = (v))
  749. #endif
  750. //@}
  751. //-------------------------------------------------------------------------------------------
  752. // HW_PORT_DFWR - Digital Filter Width Register
  753. //-------------------------------------------------------------------------------------------
  754. #ifndef __LANGUAGE_ASM__
  755. /*!
  756. * @brief HW_PORT_DFWR - Digital Filter Width Register (RW)
  757. *
  758. * Reset value: 0x00000000U
  759. *
  760. * This register is read only for ports that do not support a digital filter.
  761. * The digital filter configuration is valid in all digital pin muxing modes.
  762. */
  763. typedef union _hw_port_dfwr
  764. {
  765. uint32_t U;
  766. struct _hw_port_dfwr_bitfields
  767. {
  768. uint32_t FILT : 5; //!< [4:0] Filter Length
  769. uint32_t RESERVED0 : 27; //!< [31:5]
  770. } B;
  771. } hw_port_dfwr_t;
  772. #endif
  773. /*!
  774. * @name Constants and macros for entire PORT_DFWR register
  775. */
  776. //@{
  777. #define HW_PORT_DFWR_ADDR(x) (REGS_PORT_BASE(x) + 0xC8U)
  778. #ifndef __LANGUAGE_ASM__
  779. #define HW_PORT_DFWR(x) (*(__IO hw_port_dfwr_t *) HW_PORT_DFWR_ADDR(x))
  780. #define HW_PORT_DFWR_RD(x) (HW_PORT_DFWR(x).U)
  781. #define HW_PORT_DFWR_WR(x, v) (HW_PORT_DFWR(x).U = (v))
  782. #define HW_PORT_DFWR_SET(x, v) (HW_PORT_DFWR_WR(x, HW_PORT_DFWR_RD(x) | (v)))
  783. #define HW_PORT_DFWR_CLR(x, v) (HW_PORT_DFWR_WR(x, HW_PORT_DFWR_RD(x) & ~(v)))
  784. #define HW_PORT_DFWR_TOG(x, v) (HW_PORT_DFWR_WR(x, HW_PORT_DFWR_RD(x) ^ (v)))
  785. #endif
  786. //@}
  787. /*
  788. * Constants & macros for individual PORT_DFWR bitfields
  789. */
  790. /*!
  791. * @name Register PORT_DFWR, field FILT[4:0] (RW)
  792. *
  793. * The digital filter configuration is valid in all digital pin muxing modes.
  794. * Configures the maximum size of the glitches, in clock cycles, that the digital
  795. * filter absorbs for the enabled digital filters. Glitches that are longer than
  796. * this register setting will pass through the digital filter, and glitches that
  797. * are equal to or less than this register setting are filtered. Changing the
  798. * filter length must be done only after all filters are disabled.
  799. */
  800. //@{
  801. #define BP_PORT_DFWR_FILT (0U) //!< Bit position for PORT_DFWR_FILT.
  802. #define BM_PORT_DFWR_FILT (0x0000001FU) //!< Bit mask for PORT_DFWR_FILT.
  803. #define BS_PORT_DFWR_FILT (5U) //!< Bit field size in bits for PORT_DFWR_FILT.
  804. #ifndef __LANGUAGE_ASM__
  805. //! @brief Read current value of the PORT_DFWR_FILT field.
  806. #define BR_PORT_DFWR_FILT(x) (HW_PORT_DFWR(x).B.FILT)
  807. #endif
  808. //! @brief Format value for bitfield PORT_DFWR_FILT.
  809. #define BF_PORT_DFWR_FILT(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_PORT_DFWR_FILT), uint32_t) & BM_PORT_DFWR_FILT)
  810. #ifndef __LANGUAGE_ASM__
  811. //! @brief Set the FILT field to a new value.
  812. #define BW_PORT_DFWR_FILT(x, v) (HW_PORT_DFWR_WR(x, (HW_PORT_DFWR_RD(x) & ~BM_PORT_DFWR_FILT) | BF_PORT_DFWR_FILT(v)))
  813. #endif
  814. //@}
  815. //-------------------------------------------------------------------------------------------
  816. // hw_port_t - module struct
  817. //-------------------------------------------------------------------------------------------
  818. /*!
  819. * @brief All PORT module registers.
  820. */
  821. #ifndef __LANGUAGE_ASM__
  822. #pragma pack(1)
  823. typedef struct _hw_port
  824. {
  825. __IO hw_port_pcrn_t PCRn[32]; //!< [0x0] Pin Control Register n
  826. __O hw_port_gpclr_t GPCLR; //!< [0x80] Global Pin Control Low Register
  827. __O hw_port_gpchr_t GPCHR; //!< [0x84] Global Pin Control High Register
  828. uint8_t _reserved0[24];
  829. __IO hw_port_isfr_t ISFR; //!< [0xA0] Interrupt Status Flag Register
  830. uint8_t _reserved1[28];
  831. __IO hw_port_dfer_t DFER; //!< [0xC0] Digital Filter Enable Register
  832. __IO hw_port_dfcr_t DFCR; //!< [0xC4] Digital Filter Clock Register
  833. __IO hw_port_dfwr_t DFWR; //!< [0xC8] Digital Filter Width Register
  834. } hw_port_t;
  835. #pragma pack()
  836. //! @brief Macro to access all PORT registers.
  837. //! @param x PORT instance number.
  838. //! @return Reference (not a pointer) to the registers struct. To get a pointer to the struct,
  839. //! use the '&' operator, like <code>&HW_PORT(0)</code>.
  840. #define HW_PORT(x) (*(hw_port_t *) REGS_PORT_BASE(x))
  841. #endif
  842. #endif // __HW_PORT_REGISTERS_H__
  843. // v22/130726/0.9
  844. // EOF