* arch/arm/src/mx8mp/hardware/mx8mp_gpio.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
* "i.MX 8M Plus Applications Processor Reference Manual",
* Document Number: IMX8MPRM Rev. 1, 06/2021. NXP
*/
#ifndef __ARCH_ARM_SRC_MX8MP_HARDWARE_MX8MP_GPIO_H
#define __ARCH_ARM_SRC_MX8MP_HARDWARE_MX8MP_GPIO_H
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include "hardware/mx8mp_memorymap.h"
* Pre-processor Definitions
****************************************************************************/
#define GPIO_NPORTS 5
#define GPIO_NPINS 32
#define DR_OFFSET 0x0000
#define GDIR_OFFSET 0x0004
#define PSR_OFFSET 0x0008
#define ICR1_OFFSET 0x000c
#define ICR2_OFFSET 0x0010
#define IMR_OFFSET 0x0014
#define ISR_OFFSET 0x0018
#define EDGE_OFFSET 0x001c
#define GPIO_DR(n) (((n - 1) * 0x10000 + MX8M_GPIO) + DR_OFFSET)
#define GPIO_GDIR(n) (((n - 1) * 0x10000 + MX8M_GPIO) + GDIR_OFFSET)
#define GPIO_PSR(n) (((n - 1) * 0x10000 + MX8M_GPIO) + PSR_OFFSET)
#define GPIO_ICR1(n) (((n - 1) * 0x10000 + MX8M_GPIO) + ICR1_OFFSET)
#define GPIO_ICR2(n) (((n - 1) * 0x10000 + MX8M_GPIO) + ICR2_OFFSET)
#define GPIO_IMR(n) (((n - 1) * 0x10000 + MX8M_GPIO) + IMR_OFFSET)
#define GPIO_ISR(n) (((n - 1) * 0x10000 + MX8M_GPIO) + ISR_OFFSET)
#define GPIO_EDGE(n) (((n - 1) * 0x10000 + MX8M_GPIO) + EDGE_OFFSET)
#define GPIO_PIN(n) (1 << (n))
#define ICR_INDEX(n) (((n) >> 4) & 1)
#define ICR_OFFSET(n) (ICR1_OFFSET + (ICR_INDEX(n) << 2))
#define ICR_LOW_LEVEL 0
#define ICR_HIGH_LEVEL 1
#define ICR_RISING_EDGE 2
#define ICR_FALLING_EDGE 3
#define ICR_SHIFT(n) (((n) & 15) << 1)
#define ICR_MASK(n) (3 << ICR_SHIFT(n))
#define ICR(i,n) ((uint32_t)(i) << ICR_SHIFT(n))
#endif