2 ** ###################################################################
3 ** Compilers: Keil ARM C/C++ Compiler
4 ** Freescale C/C++ for Embedded ARM
6 ** IAR ANSI C/C++ Compiler for ARM
8 ** Reference manual: K64P144M120SF5RM, Rev.2, January 2014
9 ** Version: rev. 2.5, 2014-02-10
13 ** Extension to the CMSIS register access layer header.
15 ** Copyright (c) 2014 Freescale Semiconductor, Inc.
16 ** All rights reserved.
18 ** Redistribution and use in source and binary forms, with or without modification,
19 ** are permitted provided that the following conditions are met:
21 ** o Redistributions of source code must retain the above copyright notice, this list
22 ** of conditions and the following disclaimer.
24 ** o Redistributions in binary form must reproduce the above copyright notice, this
25 ** list of conditions and the following disclaimer in the documentation and/or
26 ** other materials provided with the distribution.
28 ** o Neither the name of Freescale Semiconductor, Inc. nor the names of its
29 ** contributors may be used to endorse or promote products derived from this
30 ** software without specific prior written permission.
32 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
33 ** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
34 ** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
35 ** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
36 ** ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
37 ** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
38 ** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
39 ** ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
40 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
41 ** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
43 ** http: www.freescale.com
44 ** mail: support@freescale.com
47 ** - rev. 1.0 (2013-08-12)
49 ** - rev. 2.0 (2013-10-29)
50 ** Register accessor macros added to the memory map.
51 ** Symbols for Processor Expert memory map compatibility added to the memory map.
52 ** Startup file for gcc has been updated according to CMSIS 3.2.
53 ** System initialization updated.
54 ** MCG - registers updated.
55 ** PORTA, PORTB, PORTC, PORTE - registers for digital filter removed.
56 ** - rev. 2.1 (2013-10-30)
57 ** Definition of BITBAND macros updated to support peripherals with 32-bit acces disabled.
58 ** - rev. 2.2 (2013-12-09)
59 ** DMA - EARS register removed.
60 ** AIPS0, AIPS1 - MPRA register updated.
61 ** - rev. 2.3 (2014-01-24)
62 ** Update according to reference manual rev. 2
63 ** ENET, MCG, MCM, SIM, USB - registers updated
64 ** - rev. 2.4 (2014-02-10)
65 ** The declaration of clock configurations has been moved to separate header file system_MK64F12.h
66 ** Update of SystemInit() and SystemCoreClockUpdate() functions.
67 ** - rev. 2.5 (2014-02-10)
68 ** The declaration of clock configurations has been moved to separate header file system_MK64F12.h
69 ** Update of SystemInit() and SystemCoreClockUpdate() functions.
70 ** Module access macro module_BASES replaced by module_BASE_PTRS.
72 ** ###################################################################
76 * WARNING! DO NOT EDIT THIS FILE DIRECTLY!
78 * This file was generated automatically and any changes may be lost.
80 #ifndef __HW_PORT_REGISTERS_H__
81 #define __HW_PORT_REGISTERS_H__
84 #include "fsl_bitaccess.h"
89 * Pin Control and Interrupts
91 * Registers defined in this header file:
92 * - HW_PORT_PCRn - Pin Control Register n
93 * - HW_PORT_GPCLR - Global Pin Control Low Register
94 * - HW_PORT_GPCHR - Global Pin Control High Register
95 * - HW_PORT_ISFR - Interrupt Status Flag Register
96 * - HW_PORT_DFER - Digital Filter Enable Register
97 * - HW_PORT_DFCR - Digital Filter Clock Register
98 * - HW_PORT_DFWR - Digital Filter Width Register
100 * - hw_port_t - Struct containing all module registers.
103 #define HW_PORT_INSTANCE_COUNT (5U) /*!< Number of instances of the PORT module. */
104 #define HW_PORTA (0U) /*!< Instance number for PORTA. */
105 #define HW_PORTB (1U) /*!< Instance number for PORTB. */
106 #define HW_PORTC (2U) /*!< Instance number for PORTC. */
107 #define HW_PORTD (3U) /*!< Instance number for PORTD. */
108 #define HW_PORTE (4U) /*!< Instance number for PORTE. */
110 /*******************************************************************************
111 * HW_PORT_PCRn - Pin Control Register n
112 ******************************************************************************/
115 * @brief HW_PORT_PCRn - Pin Control Register n (RW)
117 * Reset value: 0x00000742U
119 * See the Signal Multiplexing and Pin Assignment chapter for the reset value of
120 * this device. See the GPIO Configuration section for details on the available
121 * functions for each pin. Do not modify pin configuration registers associated
122 * with pins not available in your selected package. All unbonded pins not
123 * available in your package will default to DISABLE state for lowest power consumption.
125 typedef union _hw_port_pcrn
128 struct _hw_port_pcrn_bitfields
130 uint32_t PS : 1; /*!< [0] Pull Select */
131 uint32_t PE : 1; /*!< [1] Pull Enable */
132 uint32_t SRE : 1; /*!< [2] Slew Rate Enable */
133 uint32_t RESERVED0 : 1; /*!< [3] */
134 uint32_t PFE : 1; /*!< [4] Passive Filter Enable */
135 uint32_t ODE : 1; /*!< [5] Open Drain Enable */
136 uint32_t DSE : 1; /*!< [6] Drive Strength Enable */
137 uint32_t RESERVED1 : 1; /*!< [7] */
138 uint32_t MUX : 3; /*!< [10:8] Pin Mux Control */
139 uint32_t RESERVED2 : 4; /*!< [14:11] */
140 uint32_t LK : 1; /*!< [15] Lock Register */
141 uint32_t IRQC : 4; /*!< [19:16] Interrupt Configuration */
142 uint32_t RESERVED3 : 4; /*!< [23:20] */
143 uint32_t ISF : 1; /*!< [24] Interrupt Status Flag */
144 uint32_t RESERVED4 : 7; /*!< [31:25] */
149 * @name Constants and macros for entire PORT_PCRn register
152 #define HW_PORT_PCRn_COUNT (32U)
154 #define HW_PORT_PCRn_ADDR(x, n) ((x) + 0x0U + (0x4U * (n)))
156 #define HW_PORT_PCRn(x, n) (*(__IO hw_port_pcrn_t *) HW_PORT_PCRn_ADDR(x, n))
157 #define HW_PORT_PCRn_RD(x, n) (HW_PORT_PCRn(x, n).U)
158 #define HW_PORT_PCRn_WR(x, n, v) (HW_PORT_PCRn(x, n).U = (v))
159 #define HW_PORT_PCRn_SET(x, n, v) (HW_PORT_PCRn_WR(x, n, HW_PORT_PCRn_RD(x, n) | (v)))
160 #define HW_PORT_PCRn_CLR(x, n, v) (HW_PORT_PCRn_WR(x, n, HW_PORT_PCRn_RD(x, n) & ~(v)))
161 #define HW_PORT_PCRn_TOG(x, n, v) (HW_PORT_PCRn_WR(x, n, HW_PORT_PCRn_RD(x, n) ^ (v)))
165 * Constants & macros for individual PORT_PCRn bitfields
169 * @name Register PORT_PCRn, field PS[0] (RW)
171 * Pull configuration is valid in all digital pin muxing modes.
174 * - 0 - Internal pulldown resistor is enabled on the corresponding pin, if the
175 * corresponding PE field is set.
176 * - 1 - Internal pullup resistor is enabled on the corresponding pin, if the
177 * corresponding PE field is set.
180 #define BP_PORT_PCRn_PS (0U) /*!< Bit position for PORT_PCRn_PS. */
181 #define BM_PORT_PCRn_PS (0x00000001U) /*!< Bit mask for PORT_PCRn_PS. */
182 #define BS_PORT_PCRn_PS (1U) /*!< Bit field size in bits for PORT_PCRn_PS. */
184 /*! @brief Read current value of the PORT_PCRn_PS field. */
185 #define BR_PORT_PCRn_PS(x, n) (BITBAND_ACCESS32(HW_PORT_PCRn_ADDR(x, n), BP_PORT_PCRn_PS))
187 /*! @brief Format value for bitfield PORT_PCRn_PS. */
188 #define BF_PORT_PCRn_PS(v) ((uint32_t)((uint32_t)(v) << BP_PORT_PCRn_PS) & BM_PORT_PCRn_PS)
190 /*! @brief Set the PS field to a new value. */
191 #define BW_PORT_PCRn_PS(x, n, v) (BITBAND_ACCESS32(HW_PORT_PCRn_ADDR(x, n), BP_PORT_PCRn_PS) = (v))
195 * @name Register PORT_PCRn, field PE[1] (RW)
197 * Pull configuration is valid in all digital pin muxing modes.
200 * - 0 - Internal pullup or pulldown resistor is not enabled on the
202 * - 1 - Internal pullup or pulldown resistor is enabled on the corresponding
203 * pin, if the pin is configured as a digital input.
206 #define BP_PORT_PCRn_PE (1U) /*!< Bit position for PORT_PCRn_PE. */
207 #define BM_PORT_PCRn_PE (0x00000002U) /*!< Bit mask for PORT_PCRn_PE. */
208 #define BS_PORT_PCRn_PE (1U) /*!< Bit field size in bits for PORT_PCRn_PE. */
210 /*! @brief Read current value of the PORT_PCRn_PE field. */
211 #define BR_PORT_PCRn_PE(x, n) (BITBAND_ACCESS32(HW_PORT_PCRn_ADDR(x, n), BP_PORT_PCRn_PE))
213 /*! @brief Format value for bitfield PORT_PCRn_PE. */
214 #define BF_PORT_PCRn_PE(v) ((uint32_t)((uint32_t)(v) << BP_PORT_PCRn_PE) & BM_PORT_PCRn_PE)
216 /*! @brief Set the PE field to a new value. */
217 #define BW_PORT_PCRn_PE(x, n, v) (BITBAND_ACCESS32(HW_PORT_PCRn_ADDR(x, n), BP_PORT_PCRn_PE) = (v))
221 * @name Register PORT_PCRn, field SRE[2] (RW)
223 * Slew rate configuration is valid in all digital pin muxing modes.
226 * - 0 - Fast slew rate is configured on the corresponding pin, if the pin is
227 * configured as a digital output.
228 * - 1 - Slow slew rate is configured on the corresponding pin, if the pin is
229 * configured as a digital output.
232 #define BP_PORT_PCRn_SRE (2U) /*!< Bit position for PORT_PCRn_SRE. */
233 #define BM_PORT_PCRn_SRE (0x00000004U) /*!< Bit mask for PORT_PCRn_SRE. */
234 #define BS_PORT_PCRn_SRE (1U) /*!< Bit field size in bits for PORT_PCRn_SRE. */
236 /*! @brief Read current value of the PORT_PCRn_SRE field. */
237 #define BR_PORT_PCRn_SRE(x, n) (BITBAND_ACCESS32(HW_PORT_PCRn_ADDR(x, n), BP_PORT_PCRn_SRE))
239 /*! @brief Format value for bitfield PORT_PCRn_SRE. */
240 #define BF_PORT_PCRn_SRE(v) ((uint32_t)((uint32_t)(v) << BP_PORT_PCRn_SRE) & BM_PORT_PCRn_SRE)
242 /*! @brief Set the SRE field to a new value. */
243 #define BW_PORT_PCRn_SRE(x, n, v) (BITBAND_ACCESS32(HW_PORT_PCRn_ADDR(x, n), BP_PORT_PCRn_SRE) = (v))
247 * @name Register PORT_PCRn, field PFE[4] (RW)
249 * Passive filter configuration is valid in all digital pin muxing modes.
252 * - 0 - Passive input filter is disabled on the corresponding pin.
253 * - 1 - Passive input filter is enabled on the corresponding pin, if the pin is
254 * configured as a digital input. Refer to the device data sheet for filter
258 #define BP_PORT_PCRn_PFE (4U) /*!< Bit position for PORT_PCRn_PFE. */
259 #define BM_PORT_PCRn_PFE (0x00000010U) /*!< Bit mask for PORT_PCRn_PFE. */
260 #define BS_PORT_PCRn_PFE (1U) /*!< Bit field size in bits for PORT_PCRn_PFE. */
262 /*! @brief Read current value of the PORT_PCRn_PFE field. */
263 #define BR_PORT_PCRn_PFE(x, n) (BITBAND_ACCESS32(HW_PORT_PCRn_ADDR(x, n), BP_PORT_PCRn_PFE))
265 /*! @brief Format value for bitfield PORT_PCRn_PFE. */
266 #define BF_PORT_PCRn_PFE(v) ((uint32_t)((uint32_t)(v) << BP_PORT_PCRn_PFE) & BM_PORT_PCRn_PFE)
268 /*! @brief Set the PFE field to a new value. */
269 #define BW_PORT_PCRn_PFE(x, n, v) (BITBAND_ACCESS32(HW_PORT_PCRn_ADDR(x, n), BP_PORT_PCRn_PFE) = (v))
273 * @name Register PORT_PCRn, field ODE[5] (RW)
275 * Open drain configuration is valid in all digital pin muxing modes.
278 * - 0 - Open drain output is disabled on the corresponding pin.
279 * - 1 - Open drain output is enabled on the corresponding pin, if the pin is
280 * configured as a digital output.
283 #define BP_PORT_PCRn_ODE (5U) /*!< Bit position for PORT_PCRn_ODE. */
284 #define BM_PORT_PCRn_ODE (0x00000020U) /*!< Bit mask for PORT_PCRn_ODE. */
285 #define BS_PORT_PCRn_ODE (1U) /*!< Bit field size in bits for PORT_PCRn_ODE. */
287 /*! @brief Read current value of the PORT_PCRn_ODE field. */
288 #define BR_PORT_PCRn_ODE(x, n) (BITBAND_ACCESS32(HW_PORT_PCRn_ADDR(x, n), BP_PORT_PCRn_ODE))
290 /*! @brief Format value for bitfield PORT_PCRn_ODE. */
291 #define BF_PORT_PCRn_ODE(v) ((uint32_t)((uint32_t)(v) << BP_PORT_PCRn_ODE) & BM_PORT_PCRn_ODE)
293 /*! @brief Set the ODE field to a new value. */
294 #define BW_PORT_PCRn_ODE(x, n, v) (BITBAND_ACCESS32(HW_PORT_PCRn_ADDR(x, n), BP_PORT_PCRn_ODE) = (v))
298 * @name Register PORT_PCRn, field DSE[6] (RW)
300 * Drive strength configuration is valid in all digital pin muxing modes.
303 * - 0 - Low drive strength is configured on the corresponding pin, if pin is
304 * configured as a digital output.
305 * - 1 - High drive strength is configured on the corresponding pin, if pin is
306 * configured as a digital output.
309 #define BP_PORT_PCRn_DSE (6U) /*!< Bit position for PORT_PCRn_DSE. */
310 #define BM_PORT_PCRn_DSE (0x00000040U) /*!< Bit mask for PORT_PCRn_DSE. */
311 #define BS_PORT_PCRn_DSE (1U) /*!< Bit field size in bits for PORT_PCRn_DSE. */
313 /*! @brief Read current value of the PORT_PCRn_DSE field. */
314 #define BR_PORT_PCRn_DSE(x, n) (BITBAND_ACCESS32(HW_PORT_PCRn_ADDR(x, n), BP_PORT_PCRn_DSE))
316 /*! @brief Format value for bitfield PORT_PCRn_DSE. */
317 #define BF_PORT_PCRn_DSE(v) ((uint32_t)((uint32_t)(v) << BP_PORT_PCRn_DSE) & BM_PORT_PCRn_DSE)
319 /*! @brief Set the DSE field to a new value. */
320 #define BW_PORT_PCRn_DSE(x, n, v) (BITBAND_ACCESS32(HW_PORT_PCRn_ADDR(x, n), BP_PORT_PCRn_DSE) = (v))
324 * @name Register PORT_PCRn, field MUX[10:8] (RW)
326 * Not all pins support all pin muxing slots. Unimplemented pin muxing slots are
327 * reserved and may result in configuring the pin for a different pin muxing
328 * slot. The corresponding pin is configured in the following pin muxing slot as
332 * - 000 - Pin disabled (analog).
333 * - 001 - Alternative 1 (GPIO).
334 * - 010 - Alternative 2 (chip-specific).
335 * - 011 - Alternative 3 (chip-specific).
336 * - 100 - Alternative 4 (chip-specific).
337 * - 101 - Alternative 5 (chip-specific).
338 * - 110 - Alternative 6 (chip-specific).
339 * - 111 - Alternative 7 (chip-specific).
342 #define BP_PORT_PCRn_MUX (8U) /*!< Bit position for PORT_PCRn_MUX. */
343 #define BM_PORT_PCRn_MUX (0x00000700U) /*!< Bit mask for PORT_PCRn_MUX. */
344 #define BS_PORT_PCRn_MUX (3U) /*!< Bit field size in bits for PORT_PCRn_MUX. */
346 /*! @brief Read current value of the PORT_PCRn_MUX field. */
347 #define BR_PORT_PCRn_MUX(x, n) (HW_PORT_PCRn(x, n).B.MUX)
349 /*! @brief Format value for bitfield PORT_PCRn_MUX. */
350 #define BF_PORT_PCRn_MUX(v) ((uint32_t)((uint32_t)(v) << BP_PORT_PCRn_MUX) & BM_PORT_PCRn_MUX)
352 /*! @brief Set the MUX field to a new value. */
353 #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)))
357 * @name Register PORT_PCRn, field LK[15] (RW)
360 * - 0 - Pin Control Register fields [15:0] are not locked.
361 * - 1 - Pin Control Register fields [15:0] are locked and cannot be updated
362 * until the next system reset.
365 #define BP_PORT_PCRn_LK (15U) /*!< Bit position for PORT_PCRn_LK. */
366 #define BM_PORT_PCRn_LK (0x00008000U) /*!< Bit mask for PORT_PCRn_LK. */
367 #define BS_PORT_PCRn_LK (1U) /*!< Bit field size in bits for PORT_PCRn_LK. */
369 /*! @brief Read current value of the PORT_PCRn_LK field. */
370 #define BR_PORT_PCRn_LK(x, n) (BITBAND_ACCESS32(HW_PORT_PCRn_ADDR(x, n), BP_PORT_PCRn_LK))
372 /*! @brief Format value for bitfield PORT_PCRn_LK. */
373 #define BF_PORT_PCRn_LK(v) ((uint32_t)((uint32_t)(v) << BP_PORT_PCRn_LK) & BM_PORT_PCRn_LK)
375 /*! @brief Set the LK field to a new value. */
376 #define BW_PORT_PCRn_LK(x, n, v) (BITBAND_ACCESS32(HW_PORT_PCRn_ADDR(x, n), BP_PORT_PCRn_LK) = (v))
380 * @name Register PORT_PCRn, field IRQC[19:16] (RW)
382 * The pin interrupt configuration is valid in all digital pin muxing modes. The
383 * corresponding pin is configured to generate interrupt/DMA request as follows:
386 * - 0000 - Interrupt/DMA request disabled.
387 * - 0001 - DMA request on rising edge.
388 * - 0010 - DMA request on falling edge.
389 * - 0011 - DMA request on either edge.
390 * - 1000 - Interrupt when logic 0.
391 * - 1001 - Interrupt on rising-edge.
392 * - 1010 - Interrupt on falling-edge.
393 * - 1011 - Interrupt on either edge.
394 * - 1100 - Interrupt when logic 1.
397 #define BP_PORT_PCRn_IRQC (16U) /*!< Bit position for PORT_PCRn_IRQC. */
398 #define BM_PORT_PCRn_IRQC (0x000F0000U) /*!< Bit mask for PORT_PCRn_IRQC. */
399 #define BS_PORT_PCRn_IRQC (4U) /*!< Bit field size in bits for PORT_PCRn_IRQC. */
401 /*! @brief Read current value of the PORT_PCRn_IRQC field. */
402 #define BR_PORT_PCRn_IRQC(x, n) (HW_PORT_PCRn(x, n).B.IRQC)
404 /*! @brief Format value for bitfield PORT_PCRn_IRQC. */
405 #define BF_PORT_PCRn_IRQC(v) ((uint32_t)((uint32_t)(v) << BP_PORT_PCRn_IRQC) & BM_PORT_PCRn_IRQC)
407 /*! @brief Set the IRQC field to a new value. */
408 #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)))
412 * @name Register PORT_PCRn, field ISF[24] (W1C)
414 * The pin interrupt configuration is valid in all digital pin muxing modes.
417 * - 0 - Configured interrupt is not detected.
418 * - 1 - Configured interrupt is detected. If the pin is configured to generate
419 * a DMA request, then the corresponding flag will be cleared automatically
420 * at the completion of the requested DMA transfer. Otherwise, the flag
421 * remains set until a logic 1 is written to the flag. If the pin is configured for
422 * a level sensitive interrupt and the pin remains asserted, then the flag
423 * is set again immediately after it is cleared.
426 #define BP_PORT_PCRn_ISF (24U) /*!< Bit position for PORT_PCRn_ISF. */
427 #define BM_PORT_PCRn_ISF (0x01000000U) /*!< Bit mask for PORT_PCRn_ISF. */
428 #define BS_PORT_PCRn_ISF (1U) /*!< Bit field size in bits for PORT_PCRn_ISF. */
430 /*! @brief Read current value of the PORT_PCRn_ISF field. */
431 #define BR_PORT_PCRn_ISF(x, n) (BITBAND_ACCESS32(HW_PORT_PCRn_ADDR(x, n), BP_PORT_PCRn_ISF))
433 /*! @brief Format value for bitfield PORT_PCRn_ISF. */
434 #define BF_PORT_PCRn_ISF(v) ((uint32_t)((uint32_t)(v) << BP_PORT_PCRn_ISF) & BM_PORT_PCRn_ISF)
436 /*! @brief Set the ISF field to a new value. */
437 #define BW_PORT_PCRn_ISF(x, n, v) (BITBAND_ACCESS32(HW_PORT_PCRn_ADDR(x, n), BP_PORT_PCRn_ISF) = (v))
440 /*******************************************************************************
441 * HW_PORT_GPCLR - Global Pin Control Low Register
442 ******************************************************************************/
445 * @brief HW_PORT_GPCLR - Global Pin Control Low Register (WORZ)
447 * Reset value: 0x00000000U
449 * Only 32-bit writes are supported to this register.
451 typedef union _hw_port_gpclr
454 struct _hw_port_gpclr_bitfields
456 uint32_t GPWD : 16; /*!< [15:0] Global Pin Write Data */
457 uint32_t GPWE : 16; /*!< [31:16] Global Pin Write Enable */
462 * @name Constants and macros for entire PORT_GPCLR register
465 #define HW_PORT_GPCLR_ADDR(x) ((x) + 0x80U)
467 #define HW_PORT_GPCLR(x) (*(__O hw_port_gpclr_t *) HW_PORT_GPCLR_ADDR(x))
468 #define HW_PORT_GPCLR_RD(x) (HW_PORT_GPCLR(x).U)
469 #define HW_PORT_GPCLR_WR(x, v) (HW_PORT_GPCLR(x).U = (v))
473 * Constants & macros for individual PORT_GPCLR bitfields
477 * @name Register PORT_GPCLR, field GPWD[15:0] (WORZ)
479 * Write value that is written to all Pin Control Registers bits [15:0] that are
483 #define BP_PORT_GPCLR_GPWD (0U) /*!< Bit position for PORT_GPCLR_GPWD. */
484 #define BM_PORT_GPCLR_GPWD (0x0000FFFFU) /*!< Bit mask for PORT_GPCLR_GPWD. */
485 #define BS_PORT_GPCLR_GPWD (16U) /*!< Bit field size in bits for PORT_GPCLR_GPWD. */
487 /*! @brief Format value for bitfield PORT_GPCLR_GPWD. */
488 #define BF_PORT_GPCLR_GPWD(v) ((uint32_t)((uint32_t)(v) << BP_PORT_GPCLR_GPWD) & BM_PORT_GPCLR_GPWD)
490 /*! @brief Set the GPWD field to a new value. */
491 #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)))
495 * @name Register PORT_GPCLR, field GPWE[31:16] (WORZ)
497 * Selects which Pin Control Registers (15 through 0) bits [15:0] update with
498 * the value in GPWD. If a selected Pin Control Register is locked then the write
499 * to that register is ignored.
502 * - 0 - Corresponding Pin Control Register is not updated with the value in
504 * - 1 - Corresponding Pin Control Register is updated with the value in GPWD.
507 #define BP_PORT_GPCLR_GPWE (16U) /*!< Bit position for PORT_GPCLR_GPWE. */
508 #define BM_PORT_GPCLR_GPWE (0xFFFF0000U) /*!< Bit mask for PORT_GPCLR_GPWE. */
509 #define BS_PORT_GPCLR_GPWE (16U) /*!< Bit field size in bits for PORT_GPCLR_GPWE. */
511 /*! @brief Format value for bitfield PORT_GPCLR_GPWE. */
512 #define BF_PORT_GPCLR_GPWE(v) ((uint32_t)((uint32_t)(v) << BP_PORT_GPCLR_GPWE) & BM_PORT_GPCLR_GPWE)
514 /*! @brief Set the GPWE field to a new value. */
515 #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)))
518 /*******************************************************************************
519 * HW_PORT_GPCHR - Global Pin Control High Register
520 ******************************************************************************/
523 * @brief HW_PORT_GPCHR - Global Pin Control High Register (WORZ)
525 * Reset value: 0x00000000U
527 * Only 32-bit writes are supported to this register.
529 typedef union _hw_port_gpchr
532 struct _hw_port_gpchr_bitfields
534 uint32_t GPWD : 16; /*!< [15:0] Global Pin Write Data */
535 uint32_t GPWE : 16; /*!< [31:16] Global Pin Write Enable */
540 * @name Constants and macros for entire PORT_GPCHR register
543 #define HW_PORT_GPCHR_ADDR(x) ((x) + 0x84U)
545 #define HW_PORT_GPCHR(x) (*(__O hw_port_gpchr_t *) HW_PORT_GPCHR_ADDR(x))
546 #define HW_PORT_GPCHR_RD(x) (HW_PORT_GPCHR(x).U)
547 #define HW_PORT_GPCHR_WR(x, v) (HW_PORT_GPCHR(x).U = (v))
551 * Constants & macros for individual PORT_GPCHR bitfields
555 * @name Register PORT_GPCHR, field GPWD[15:0] (WORZ)
557 * Write value that is written to all Pin Control Registers bits [15:0] that are
561 #define BP_PORT_GPCHR_GPWD (0U) /*!< Bit position for PORT_GPCHR_GPWD. */
562 #define BM_PORT_GPCHR_GPWD (0x0000FFFFU) /*!< Bit mask for PORT_GPCHR_GPWD. */
563 #define BS_PORT_GPCHR_GPWD (16U) /*!< Bit field size in bits for PORT_GPCHR_GPWD. */
565 /*! @brief Format value for bitfield PORT_GPCHR_GPWD. */
566 #define BF_PORT_GPCHR_GPWD(v) ((uint32_t)((uint32_t)(v) << BP_PORT_GPCHR_GPWD) & BM_PORT_GPCHR_GPWD)
568 /*! @brief Set the GPWD field to a new value. */
569 #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)))
573 * @name Register PORT_GPCHR, field GPWE[31:16] (WORZ)
575 * Selects which Pin Control Registers (31 through 16) bits [15:0] update with
576 * the value in GPWD. If a selected Pin Control Register is locked then the write
577 * to that register is ignored.
580 * - 0 - Corresponding Pin Control Register is not updated with the value in
582 * - 1 - Corresponding Pin Control Register is updated with the value in GPWD.
585 #define BP_PORT_GPCHR_GPWE (16U) /*!< Bit position for PORT_GPCHR_GPWE. */
586 #define BM_PORT_GPCHR_GPWE (0xFFFF0000U) /*!< Bit mask for PORT_GPCHR_GPWE. */
587 #define BS_PORT_GPCHR_GPWE (16U) /*!< Bit field size in bits for PORT_GPCHR_GPWE. */
589 /*! @brief Format value for bitfield PORT_GPCHR_GPWE. */
590 #define BF_PORT_GPCHR_GPWE(v) ((uint32_t)((uint32_t)(v) << BP_PORT_GPCHR_GPWE) & BM_PORT_GPCHR_GPWE)
592 /*! @brief Set the GPWE field to a new value. */
593 #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)))
596 /*******************************************************************************
597 * HW_PORT_ISFR - Interrupt Status Flag Register
598 ******************************************************************************/
601 * @brief HW_PORT_ISFR - Interrupt Status Flag Register (W1C)
603 * Reset value: 0x00000000U
605 * The pin interrupt configuration is valid in all digital pin muxing modes. The
606 * Interrupt Status Flag for each pin is also visible in the corresponding Pin
607 * Control Register, and each flag can be cleared in either location.
609 typedef union _hw_port_isfr
612 struct _hw_port_isfr_bitfields
614 uint32_t ISF : 32; /*!< [31:0] Interrupt Status Flag */
619 * @name Constants and macros for entire PORT_ISFR register
622 #define HW_PORT_ISFR_ADDR(x) ((x) + 0xA0U)
624 #define HW_PORT_ISFR(x) (*(__IO hw_port_isfr_t *) HW_PORT_ISFR_ADDR(x))
625 #define HW_PORT_ISFR_RD(x) (HW_PORT_ISFR(x).U)
626 #define HW_PORT_ISFR_WR(x, v) (HW_PORT_ISFR(x).U = (v))
627 #define HW_PORT_ISFR_SET(x, v) (HW_PORT_ISFR_WR(x, HW_PORT_ISFR_RD(x) | (v)))
628 #define HW_PORT_ISFR_CLR(x, v) (HW_PORT_ISFR_WR(x, HW_PORT_ISFR_RD(x) & ~(v)))
629 #define HW_PORT_ISFR_TOG(x, v) (HW_PORT_ISFR_WR(x, HW_PORT_ISFR_RD(x) ^ (v)))
633 * Constants & macros for individual PORT_ISFR bitfields
637 * @name Register PORT_ISFR, field ISF[31:0] (W1C)
639 * Each bit in the field indicates the detection of the configured interrupt of
640 * the same number as the field.
643 * - 0 - Configured interrupt is not detected.
644 * - 1 - Configured interrupt is detected. If the pin is configured to generate
645 * a DMA request, then the corresponding flag will be cleared automatically
646 * at the completion of the requested DMA transfer. Otherwise, the flag
647 * remains set until a logic 1 is written to the flag. If the pin is configured for
648 * a level sensitive interrupt and the pin remains asserted, then the flag
649 * is set again immediately after it is cleared.
652 #define BP_PORT_ISFR_ISF (0U) /*!< Bit position for PORT_ISFR_ISF. */
653 #define BM_PORT_ISFR_ISF (0xFFFFFFFFU) /*!< Bit mask for PORT_ISFR_ISF. */
654 #define BS_PORT_ISFR_ISF (32U) /*!< Bit field size in bits for PORT_ISFR_ISF. */
656 /*! @brief Read current value of the PORT_ISFR_ISF field. */
657 #define BR_PORT_ISFR_ISF(x) (HW_PORT_ISFR(x).U)
659 /*! @brief Format value for bitfield PORT_ISFR_ISF. */
660 #define BF_PORT_ISFR_ISF(v) ((uint32_t)((uint32_t)(v) << BP_PORT_ISFR_ISF) & BM_PORT_ISFR_ISF)
662 /*! @brief Set the ISF field to a new value. */
663 #define BW_PORT_ISFR_ISF(x, v) (HW_PORT_ISFR_WR(x, v))
666 /*******************************************************************************
667 * HW_PORT_DFER - Digital Filter Enable Register
668 ******************************************************************************/
671 * @brief HW_PORT_DFER - Digital Filter Enable Register (RW)
673 * Reset value: 0x00000000U
675 * The corresponding bit is read only for pins that do not support a digital
676 * filter. Refer to the Chapter of Signal Multiplexing and Signal Descriptions for
677 * the pins that support digital filter. The digital filter configuration is valid
678 * in all digital pin muxing modes.
680 typedef union _hw_port_dfer
683 struct _hw_port_dfer_bitfields
685 uint32_t DFE : 32; /*!< [31:0] Digital Filter Enable */
690 * @name Constants and macros for entire PORT_DFER register
693 #define HW_PORT_DFER_ADDR(x) ((x) + 0xC0U)
695 #define HW_PORT_DFER(x) (*(__IO hw_port_dfer_t *) HW_PORT_DFER_ADDR(x))
696 #define HW_PORT_DFER_RD(x) (HW_PORT_DFER(x).U)
697 #define HW_PORT_DFER_WR(x, v) (HW_PORT_DFER(x).U = (v))
698 #define HW_PORT_DFER_SET(x, v) (HW_PORT_DFER_WR(x, HW_PORT_DFER_RD(x) | (v)))
699 #define HW_PORT_DFER_CLR(x, v) (HW_PORT_DFER_WR(x, HW_PORT_DFER_RD(x) & ~(v)))
700 #define HW_PORT_DFER_TOG(x, v) (HW_PORT_DFER_WR(x, HW_PORT_DFER_RD(x) ^ (v)))
704 * Constants & macros for individual PORT_DFER bitfields
708 * @name Register PORT_DFER, field DFE[31:0] (RW)
710 * The digital filter configuration is valid in all digital pin muxing modes.
711 * The output of each digital filter is reset to zero at system reset and whenever
712 * the digital filter is disabled. Each bit in the field enables the digital
713 * filter of the same number as the field.
716 * - 0 - Digital filter is disabled on the corresponding pin and output of the
717 * digital filter is reset to zero.
718 * - 1 - Digital filter is enabled on the corresponding pin, if the pin is
719 * configured as a digital input.
722 #define BP_PORT_DFER_DFE (0U) /*!< Bit position for PORT_DFER_DFE. */
723 #define BM_PORT_DFER_DFE (0xFFFFFFFFU) /*!< Bit mask for PORT_DFER_DFE. */
724 #define BS_PORT_DFER_DFE (32U) /*!< Bit field size in bits for PORT_DFER_DFE. */
726 /*! @brief Read current value of the PORT_DFER_DFE field. */
727 #define BR_PORT_DFER_DFE(x) (HW_PORT_DFER(x).U)
729 /*! @brief Format value for bitfield PORT_DFER_DFE. */
730 #define BF_PORT_DFER_DFE(v) ((uint32_t)((uint32_t)(v) << BP_PORT_DFER_DFE) & BM_PORT_DFER_DFE)
732 /*! @brief Set the DFE field to a new value. */
733 #define BW_PORT_DFER_DFE(x, v) (HW_PORT_DFER_WR(x, v))
736 /*******************************************************************************
737 * HW_PORT_DFCR - Digital Filter Clock Register
738 ******************************************************************************/
741 * @brief HW_PORT_DFCR - Digital Filter Clock Register (RW)
743 * Reset value: 0x00000000U
745 * This register is read only for ports that do not support a digital filter.
746 * The digital filter configuration is valid in all digital pin muxing modes.
748 typedef union _hw_port_dfcr
751 struct _hw_port_dfcr_bitfields
753 uint32_t CS : 1; /*!< [0] Clock Source */
754 uint32_t RESERVED0 : 31; /*!< [31:1] */
759 * @name Constants and macros for entire PORT_DFCR register
762 #define HW_PORT_DFCR_ADDR(x) ((x) + 0xC4U)
764 #define HW_PORT_DFCR(x) (*(__IO hw_port_dfcr_t *) HW_PORT_DFCR_ADDR(x))
765 #define HW_PORT_DFCR_RD(x) (HW_PORT_DFCR(x).U)
766 #define HW_PORT_DFCR_WR(x, v) (HW_PORT_DFCR(x).U = (v))
767 #define HW_PORT_DFCR_SET(x, v) (HW_PORT_DFCR_WR(x, HW_PORT_DFCR_RD(x) | (v)))
768 #define HW_PORT_DFCR_CLR(x, v) (HW_PORT_DFCR_WR(x, HW_PORT_DFCR_RD(x) & ~(v)))
769 #define HW_PORT_DFCR_TOG(x, v) (HW_PORT_DFCR_WR(x, HW_PORT_DFCR_RD(x) ^ (v)))
773 * Constants & macros for individual PORT_DFCR bitfields
777 * @name Register PORT_DFCR, field CS[0] (RW)
779 * The digital filter configuration is valid in all digital pin muxing modes.
780 * Configures the clock source for the digital input filters. Changing the filter
781 * clock source must be done only when all digital filters are disabled.
784 * - 0 - Digital filters are clocked by the bus clock.
785 * - 1 - Digital filters are clocked by the 1 kHz LPO clock.
788 #define BP_PORT_DFCR_CS (0U) /*!< Bit position for PORT_DFCR_CS. */
789 #define BM_PORT_DFCR_CS (0x00000001U) /*!< Bit mask for PORT_DFCR_CS. */
790 #define BS_PORT_DFCR_CS (1U) /*!< Bit field size in bits for PORT_DFCR_CS. */
792 /*! @brief Read current value of the PORT_DFCR_CS field. */
793 #define BR_PORT_DFCR_CS(x) (BITBAND_ACCESS32(HW_PORT_DFCR_ADDR(x), BP_PORT_DFCR_CS))
795 /*! @brief Format value for bitfield PORT_DFCR_CS. */
796 #define BF_PORT_DFCR_CS(v) ((uint32_t)((uint32_t)(v) << BP_PORT_DFCR_CS) & BM_PORT_DFCR_CS)
798 /*! @brief Set the CS field to a new value. */
799 #define BW_PORT_DFCR_CS(x, v) (BITBAND_ACCESS32(HW_PORT_DFCR_ADDR(x), BP_PORT_DFCR_CS) = (v))
802 /*******************************************************************************
803 * HW_PORT_DFWR - Digital Filter Width Register
804 ******************************************************************************/
807 * @brief HW_PORT_DFWR - Digital Filter Width Register (RW)
809 * Reset value: 0x00000000U
811 * This register is read only for ports that do not support a digital filter.
812 * The digital filter configuration is valid in all digital pin muxing modes.
814 typedef union _hw_port_dfwr
817 struct _hw_port_dfwr_bitfields
819 uint32_t FILT : 5; /*!< [4:0] Filter Length */
820 uint32_t RESERVED0 : 27; /*!< [31:5] */
825 * @name Constants and macros for entire PORT_DFWR register
828 #define HW_PORT_DFWR_ADDR(x) ((x) + 0xC8U)
830 #define HW_PORT_DFWR(x) (*(__IO hw_port_dfwr_t *) HW_PORT_DFWR_ADDR(x))
831 #define HW_PORT_DFWR_RD(x) (HW_PORT_DFWR(x).U)
832 #define HW_PORT_DFWR_WR(x, v) (HW_PORT_DFWR(x).U = (v))
833 #define HW_PORT_DFWR_SET(x, v) (HW_PORT_DFWR_WR(x, HW_PORT_DFWR_RD(x) | (v)))
834 #define HW_PORT_DFWR_CLR(x, v) (HW_PORT_DFWR_WR(x, HW_PORT_DFWR_RD(x) & ~(v)))
835 #define HW_PORT_DFWR_TOG(x, v) (HW_PORT_DFWR_WR(x, HW_PORT_DFWR_RD(x) ^ (v)))
839 * Constants & macros for individual PORT_DFWR bitfields
843 * @name Register PORT_DFWR, field FILT[4:0] (RW)
845 * The digital filter configuration is valid in all digital pin muxing modes.
846 * Configures the maximum size of the glitches, in clock cycles, that the digital
847 * filter absorbs for the enabled digital filters. Glitches that are longer than
848 * this register setting will pass through the digital filter, and glitches that
849 * are equal to or less than this register setting are filtered. Changing the
850 * filter length must be done only after all filters are disabled.
853 #define BP_PORT_DFWR_FILT (0U) /*!< Bit position for PORT_DFWR_FILT. */
854 #define BM_PORT_DFWR_FILT (0x0000001FU) /*!< Bit mask for PORT_DFWR_FILT. */
855 #define BS_PORT_DFWR_FILT (5U) /*!< Bit field size in bits for PORT_DFWR_FILT. */
857 /*! @brief Read current value of the PORT_DFWR_FILT field. */
858 #define BR_PORT_DFWR_FILT(x) (HW_PORT_DFWR(x).B.FILT)
860 /*! @brief Format value for bitfield PORT_DFWR_FILT. */
861 #define BF_PORT_DFWR_FILT(v) ((uint32_t)((uint32_t)(v) << BP_PORT_DFWR_FILT) & BM_PORT_DFWR_FILT)
863 /*! @brief Set the FILT field to a new value. */
864 #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)))
867 /*******************************************************************************
868 * hw_port_t - module struct
869 ******************************************************************************/
871 * @brief All PORT module registers.
874 typedef struct _hw_port
876 __IO hw_port_pcrn_t PCRn[32]; /*!< [0x0] Pin Control Register n */
877 __O hw_port_gpclr_t GPCLR; /*!< [0x80] Global Pin Control Low Register */
878 __O hw_port_gpchr_t GPCHR; /*!< [0x84] Global Pin Control High Register */
879 uint8_t _reserved0[24];
880 __IO hw_port_isfr_t ISFR; /*!< [0xA0] Interrupt Status Flag Register */
881 uint8_t _reserved1[28];
882 __IO hw_port_dfer_t DFER; /*!< [0xC0] Digital Filter Enable Register */
883 __IO hw_port_dfcr_t DFCR; /*!< [0xC4] Digital Filter Clock Register */
884 __IO hw_port_dfwr_t DFWR; /*!< [0xC8] Digital Filter Width Register */
888 /*! @brief Macro to access all PORT registers. */
889 /*! @param x PORT module instance base address. */
890 /*! @return Reference (not a pointer) to the registers struct. To get a pointer to the struct,
891 * use the '&' operator, like <code>&HW_PORT(PORTA_BASE)</code>. */
892 #define HW_PORT(x) (*(hw_port_t *)(x))
894 #endif /* __HW_PORT_REGISTERS_H__ */