/* * Copyright 1997-2016 Freescale Semiconductor, Inc. * Copyright 2016-2022 NXP * * SPDX-License-Identifier: BSD-3-Clause */ /*! * @file S32K142_GPIO.h * @version 1.1 * @date 2022-02-01 * @brief Peripheral Access Layer for S32K142_GPIO * * This file contains register definitions and macros for easy access to their * bit fields. * * This file assumes LITTLE endian system. */ /** * @page misra_violations MISRA-C:2012 violations * * @section [global] * Violates MISRA 2012 Advisory Rule 2.3, local typedef not referenced * The SoC header defines typedef for all modules. * * @section [global] * Violates MISRA 2012 Advisory Rule 2.5, local macro not referenced * The SoC header defines macros for all modules and registers. * * @section [global] * Violates MISRA 2012 Advisory Directive 4.9, Function-like macro * These are generated macros used for accessing the bit-fields from registers. * * @section [global] * Violates MISRA 2012 Required Rule 5.1, identifier clash * The supported compilers use more than 31 significant characters for identifiers. * * @section [global] * Violates MISRA 2012 Required Rule 5.2, identifier clash * The supported compilers use more than 31 significant characters for identifiers. * * @section [global] * Violates MISRA 2012 Required Rule 5.4, identifier clash * The supported compilers use more than 31 significant characters for identifiers. * * @section [global] * Violates MISRA 2012 Required Rule 5.5, identifier clash * The supported compilers use more than 31 significant characters for identifiers. * * @section [global] * Violates MISRA 2012 Required Rule 21.1, defined macro '__I' is reserved to the compiler * This type qualifier is needed to ensure correct I/O access and addressing. */ /* Prevention from multiple including the same memory map */ #if !defined(S32K142_GPIO_H_) /* Check if memory map has not been already included */ #define S32K142_GPIO_H_ #include "S32K142_COMMON.h" /* ---------------------------------------------------------------------------- -- GPIO Peripheral Access Layer ---------------------------------------------------------------------------- */ /*! * @addtogroup GPIO_Peripheral_Access_Layer GPIO Peripheral Access Layer * @{ */ /** GPIO - Register Layout Typedef */ typedef struct { __IO uint32_t PDOR; /**< Port Data Output Register, offset: 0x0 */ __O uint32_t PSOR; /**< Port Set Output Register, offset: 0x4 */ __O uint32_t PCOR; /**< Port Clear Output Register, offset: 0x8 */ __O uint32_t PTOR; /**< Port Toggle Output Register, offset: 0xC */ __I uint32_t PDIR; /**< Port Data Input Register, offset: 0x10 */ __IO uint32_t PDDR; /**< Port Data Direction Register, offset: 0x14 */ __IO uint32_t PIDR; /**< Port Input Disable Register, offset: 0x18 */ } GPIO_Type, *GPIO_MemMapPtr; /** Number of instances of the GPIO module. */ #define GPIO_INSTANCE_COUNT (5u) /* GPIO - Peripheral instance base addresses */ /** Peripheral PTA base address */ #define IP_PTA_BASE (0x400FF000u) /** Peripheral PTA base pointer */ #define IP_PTA ((GPIO_Type *)IP_PTA_BASE) /** Peripheral PTB base address */ #define IP_PTB_BASE (0x400FF040u) /** Peripheral PTB base pointer */ #define IP_PTB ((GPIO_Type *)IP_PTB_BASE) /** Peripheral PTC base address */ #define IP_PTC_BASE (0x400FF080u) /** Peripheral PTC base pointer */ #define IP_PTC ((GPIO_Type *)IP_PTC_BASE) /** Peripheral PTD base address */ #define IP_PTD_BASE (0x400FF0C0u) /** Peripheral PTD base pointer */ #define IP_PTD ((GPIO_Type *)IP_PTD_BASE) /** Peripheral PTE base address */ #define IP_PTE_BASE (0x400FF100u) /** Peripheral PTE base pointer */ #define IP_PTE ((GPIO_Type *)IP_PTE_BASE) /** Array initializer of GPIO peripheral base addresses */ #define IP_GPIO_BASE_ADDRS { IP_PTA_BASE, IP_PTB_BASE, IP_PTC_BASE, IP_PTD_BASE, IP_PTE_BASE } /** Array initializer of GPIO peripheral base pointers */ #define IP_GPIO_BASE_PTRS { IP_PTA, IP_PTB, IP_PTC, IP_PTD, IP_PTE } /* ---------------------------------------------------------------------------- -- GPIO Register Masks ---------------------------------------------------------------------------- */ /*! * @addtogroup GPIO_Register_Masks GPIO Register Masks * @{ */ /*! @name PDOR - Port Data Output Register */ /*! @{ */ #define GPIO_PDOR_PDO_MASK (0xFFFFFFFFU) #define GPIO_PDOR_PDO_SHIFT (0U) #define GPIO_PDOR_PDO_WIDTH (32U) #define GPIO_PDOR_PDO(x) (((uint32_t)(((uint32_t)(x)) << GPIO_PDOR_PDO_SHIFT)) & GPIO_PDOR_PDO_MASK) /*! @} */ /*! @name PSOR - Port Set Output Register */ /*! @{ */ #define GPIO_PSOR_PTSO_MASK (0xFFFFFFFFU) #define GPIO_PSOR_PTSO_SHIFT (0U) #define GPIO_PSOR_PTSO_WIDTH (32U) #define GPIO_PSOR_PTSO(x) (((uint32_t)(((uint32_t)(x)) << GPIO_PSOR_PTSO_SHIFT)) & GPIO_PSOR_PTSO_MASK) /*! @} */ /*! @name PCOR - Port Clear Output Register */ /*! @{ */ #define GPIO_PCOR_PTCO_MASK (0xFFFFFFFFU) #define GPIO_PCOR_PTCO_SHIFT (0U) #define GPIO_PCOR_PTCO_WIDTH (32U) #define GPIO_PCOR_PTCO(x) (((uint32_t)(((uint32_t)(x)) << GPIO_PCOR_PTCO_SHIFT)) & GPIO_PCOR_PTCO_MASK) /*! @} */ /*! @name PTOR - Port Toggle Output Register */ /*! @{ */ #define GPIO_PTOR_PTTO_MASK (0xFFFFFFFFU) #define GPIO_PTOR_PTTO_SHIFT (0U) #define GPIO_PTOR_PTTO_WIDTH (32U) #define GPIO_PTOR_PTTO(x) (((uint32_t)(((uint32_t)(x)) << GPIO_PTOR_PTTO_SHIFT)) & GPIO_PTOR_PTTO_MASK) /*! @} */ /*! @name PDIR - Port Data Input Register */ /*! @{ */ #define GPIO_PDIR_PDI_MASK (0xFFFFFFFFU) #define GPIO_PDIR_PDI_SHIFT (0U) #define GPIO_PDIR_PDI_WIDTH (32U) #define GPIO_PDIR_PDI(x) (((uint32_t)(((uint32_t)(x)) << GPIO_PDIR_PDI_SHIFT)) & GPIO_PDIR_PDI_MASK) /*! @} */ /*! @name PDDR - Port Data Direction Register */ /*! @{ */ #define GPIO_PDDR_PDD_MASK (0xFFFFFFFFU) #define GPIO_PDDR_PDD_SHIFT (0U) #define GPIO_PDDR_PDD_WIDTH (32U) #define GPIO_PDDR_PDD(x) (((uint32_t)(((uint32_t)(x)) << GPIO_PDDR_PDD_SHIFT)) & GPIO_PDDR_PDD_MASK) /*! @} */ /*! @name PIDR - Port Input Disable Register */ /*! @{ */ #define GPIO_PIDR_PID_MASK (0xFFFFFFFFU) #define GPIO_PIDR_PID_SHIFT (0U) #define GPIO_PIDR_PID_WIDTH (32U) #define GPIO_PIDR_PID(x) (((uint32_t)(((uint32_t)(x)) << GPIO_PIDR_PID_SHIFT)) & GPIO_PIDR_PID_MASK) /*! @} */ /*! * @} */ /* end of group GPIO_Register_Masks */ /*! * @} */ /* end of group GPIO_Peripheral_Access_Layer */ #endif /* #if !defined(S32K142_GPIO_H_) */