From c1b83cfbc8bb37deb22dc09d06762de2bb6dad0c Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 10 Sep 2015 13:05:24 -0600 Subject: [PATCH] SAMA5D2: Add pin multiplexing definition file and other necessary changes for the SAMA5D2 --- arch/arm/src/sama5/Kconfig | 181 +++++ arch/arm/src/sama5/chip/sam_pinmap.h | 4 +- arch/arm/src/sama5/chip/sam_pmc.h | 2 + arch/arm/src/sama5/chip/sama5d2x_memorymap.h | 21 +- arch/arm/src/sama5/chip/sama5d2x_pinmap.h | 804 +++++++++++++++++++ arch/arm/src/sama5/sam_pck.c | 37 +- arch/arm/src/sama5/sam_pio.c | 31 +- arch/arm/src/sama5/sam_pio.h | 167 +--- arch/arm/src/sama5/sama5d2x_memorymap.c | 4 +- arch/arm/src/sama5/sama5d2x_pio.h | 221 +++++ arch/arm/src/sama5/sama5d3x4x_pio.h | 213 +++++ 11 files changed, 1510 insertions(+), 175 deletions(-) create mode 100755 arch/arm/src/sama5/chip/sama5d2x_pinmap.h create mode 100644 arch/arm/src/sama5/sama5d2x_pio.h create mode 100644 arch/arm/src/sama5/sama5d3x4x_pio.h diff --git a/arch/arm/src/sama5/Kconfig b/arch/arm/src/sama5/Kconfig index 146551ca38..0f55b71e1f 100644 --- a/arch/arm/src/sama5/Kconfig +++ b/arch/arm/src/sama5/Kconfig @@ -17,6 +17,10 @@ config SAMA5_HAVE_ICM bool default n +config SAMA5_HAVE_RXLP + bool + default n + config SAMA5_HAVE_UART0 bool default n @@ -57,6 +61,26 @@ config SAMA5_HAVE_USART4 bool default n +config SAMA5_HAVE_FLEXCOM0 + bool + default n + +config SAMA5_HAVE_FLEXCOM1 + bool + default n + +config SAMA5_HAVE_FLEXCOM2 + bool + default n + +config SAMA5_HAVE_FLEXCOM3 + bool + default n + +config SAMA5_HAVE_FLEXCOM4 + bool + default n + config SAMA5_HAVE_CAN0 bool default n @@ -145,6 +169,24 @@ config SAMA5_HAVE_VDEC bool default n +# Summary configuratinos + +config SAMA5_FLEXCOM + bool + default n + +config SAMA5_FLEXCOM_USART + bool + default n + +config SAMA5_FLEXCOM_SPI + bool + default n + +config SAMA5_FLEXCOM_TWI + bool + default n + # Chip Selection config ARCH_CHIP_SAMA5D2 @@ -156,11 +198,16 @@ config ARCH_CHIP_SAMA5D2 select SAMA5_HAVE_EMACB select SAMA5_HAVE_ICM select SAMA5_HAVE_LCDC + select SAMA5_HAVE_RXLP select SAMA5_HAVE_UART0 select SAMA5_HAVE_UART1 select SAMA5_HAVE_UART2 select SAMA5_HAVE_UART3 select SAMA5_HAVE_UART4 + select SAMA5_HAVE_FLEXCOM0 + select SAMA5_HAVE_FLEXCOM1 + select SAMA5_HAVE_FLEXCOM2 + select SAMA5_HAVE_FLEXCOM3 select SAMA5_HAVE_QSPI select SAMA5_HAVE_XDMA select SAMA5_HAVE_SAIC @@ -379,6 +426,11 @@ config SAMA5_SAIC depends on SAMA5_HAVE_SAIC select ARMV7A_DECODEFIQ +config SAMA5_RXLP + bool "Low power asynchronous receiver" + default y + depends on SAMA5_HAVE_RXLP + config SAMA5_UART0 bool "UART 0" default y @@ -449,6 +501,36 @@ config SAMA5_USART4 select ARCH_HAVE_USART4 select ARCH_HAVE_SERIAL_TERMIOS +config SAMA5_FLEXCOM0 + bool "FLEXCOM 0" + default n + depends on SAMA5_HAVE_FLEXCOM0 + select SAMA5_FLEXCOM + +config SAMA5_FLEXCOM1 + bool "FLEXCOM 1" + default n + depends on SAMA5_HAVE_FLEXCOM1 + select SAMA5_FLEXCOM + +config SAMA5_FLEXCOM2 + bool "FLEXCOM 2" + default n + depends on SAMA5_HAVE_FLEXCOM2 + select SAMA5_FLEXCOM + +config SAMA5_FLEXCOM3 + bool "FLEXCOM 3" + default n + depends on SAMA5_HAVE_FLEXCOM3 + select SAMA5_FLEXCOM + +config SAMA5_FLEXCOM4 + bool "FLEXCOM 4" + default n + depends on SAMA5_HAVE_FLEXCOM4 + select SAMA5_FLEXCOM + config SAMA5_TWI0 bool "Two-Wire Interface 0 (TWI0)" default n @@ -703,6 +785,105 @@ config SAMA5_PIOE_IRQ endif # PIO_IRQ +menu "Flexcom Configuration" + depends on SAMA5_FLEXCOM + +choice + prompt "FLEXCOM0 Configuration" + default SAMA5_FLEXCOM0_USART + depends on SAMA5_FLEXCOM0 + +config SAMA5_FLEXCOM0_USART + bool "USART" + select SAMA5_FLEXCOM_USART + +config SAMA5_FLEXCOM0_SPI + bool "SPI" + select SAMA5_FLEXCOM_SPI + +config SAMA5_FLEXCOM0_SPI + bool "TWI" + select SAMA5_FLEXCOM_TWI + +endchoice # FLEXCOM0 Configuration + +choice + prompt "FLEXCOM1 Configuration" + default SAMA5_FLEXCOM1_USART + depends on SAMA5_FLEXCOM1 + +config SAMA5_FLEXCOM1_USART + bool "USART" + select SAMA5_FLEXCOM_USART + +config SAMA5_FLEXCOM1_SPI + bool "SPI" + select SAMA5_FLEXCOM_SPI + +config SAMA5_FLEXCOM1_SPI + bool "TWI" + select SAMA5_FLEXCOM_TWI + +endchoice # FLEXCOM1 Configuration + +choice + prompt "FLEXCOM2 Configuration" + default SAMA5_FLEXCOM2_USART + depends on SAMA5_FLEXCOM2 + +config SAMA5_FLEXCOM2_USART + bool "USART" + select SAMA5_FLEXCOM_USART + +config SAMA5_FLEXCOM2_SPI + bool "SPI" + select SAMA5_FLEXCOM_SPI + +config SAMA5_FLEXCOM2_SPI + bool "TWI" + select SAMA5_FLEXCOM_TWI + +endchoice # FLEXCOM2 Configuration + +choice + prompt "FLEXCOM3 Configuration" + default SAMA5_FLEXCOM3_USART + depends on SAMA5_FLEXCOM3 + +config SAMA5_FLEXCOM3_USART + bool "USART" + select SAMA5_FLEXCOM_USART + +config SAMA5_FLEXCOM3_SPI + bool "SPI" + select SAMA5_FLEXCOM_SPI + +config SAMA5_FLEXCOM3_SPI + bool "TWI" + select SAMA5_FLEXCOM_TWI + +endchoice # FLEXCOM3 Configuration + +choice + prompt "FLEXCOM4 Configuration" + default SAMA5_FLEXCOM4_USART + depends on SAMA5_FLEXCOM4 + +config SAMA5_FLEXCOM4_USART + bool "USART" + select SAMA5_FLEXCOM_USART + +config SAMA5_FLEXCOM4_SPI + bool "SPI" + select SAMA5_FLEXCOM_SPI + +config SAMA5_FLEXCOM4_SPI + bool "TWI" + select SAMA5_FLEXCOM_TWI + +endchoice # FLEXCOM4 Configuration +endmenu # Flexcom Configuration + menu "DBGU Configuration" depends on SAMA5_DBGU diff --git a/arch/arm/src/sama5/chip/sam_pinmap.h b/arch/arm/src/sama5/chip/sam_pinmap.h index c1f781c868..a6613e39ac 100644 --- a/arch/arm/src/sama5/chip/sam_pinmap.h +++ b/arch/arm/src/sama5/chip/sam_pinmap.h @@ -43,7 +43,9 @@ #include #include -#if defined(ATSAMA5D3) +#if defined(ATSAMA5D2) +# include "chip/sama5d3x_pinmap.h" +#elif defined(ATSAMA5D3) # include "chip/sama5d3x_pinmap.h" #elif defined(ATSAMA5D4) # include "chip/sama5d4x_pinmap.h" diff --git a/arch/arm/src/sama5/chip/sam_pmc.h b/arch/arm/src/sama5/chip/sam_pmc.h index bc79d25e2d..abe06ed86b 100644 --- a/arch/arm/src/sama5/chip/sam_pmc.h +++ b/arch/arm/src/sama5/chip/sam_pmc.h @@ -384,6 +384,7 @@ #endif #if defined(ATSAMA5D3) || defined(ATSAMA5D4) +# undef SAMA5_HAVE_PCK_INT_PRES /* Supports conditional compilation */ # define PMC_PCK_PRES_SHIFT (4) /* Bits 4-6: Programmable Clock Prescaler */ # define PMC_PCK_PRES_MASK (7 << PMC_PCK_PRES_SHIFT) # define PMC_PCK_PRES_DIV1 (0 << PMC_PCK_PRES_SHIFT) /* Selected clock */ @@ -394,6 +395,7 @@ # define PMC_PCK_PRES_DIV32 (5 << PMC_PCK_PRES_SHIFT) /* Selected clock divided by 32 */ # define PMC_PCK_PRES_DIV64 (6 << PMC_PCK_PRES_SHIFT) /* Selected clock divided by 64 */ #elif defined(ATSAMA5D2) +# define SAMA5_HAVE_PCK_INT_PRES 1 /* Supports conditional compilation */ # define PMC_PCK_PRES_SHIFT (4) /* Bits 4-11: Programmable Clock Prescaler */ # define PMC_PCK_PRES_MASK (0xff << PMC_PCK_PRES_SHIFT) # define PMC_PCK_PRES(n) ((uint32_t)(n) << PMC_PCK_PRES_SHIFT) diff --git a/arch/arm/src/sama5/chip/sama5d2x_memorymap.h b/arch/arm/src/sama5/chip/sama5d2x_memorymap.h index e45a574506..546cf9813a 100644 --- a/arch/arm/src/sama5/chip/sama5d2x_memorymap.h +++ b/arch/arm/src/sama5/chip/sama5d2x_memorymap.h @@ -172,7 +172,15 @@ # define SAM_UDPHS_OFFSET 0x0002c000 /* 0x0002c000-0x0002ffff: UDPHS */ # define SAM_ADC_OFFSET 0x00030000 /* 0x00030000-0x00033fff: ADC */ /* 0x00034000-0x00037fff: Reserved */ -# define SAM_PIOA_OFFSET 0x00038000 /* 0x00038000-0x0003bfff: PIOA */ +# define SAM_PIO_OFFSET 0x00038000 /* 0x00038000-0x0003bfff: PIO */ +# define SAM_PIOA_OFFSET 0x00038000 /* 0x00038000-0x0003803f: PIOA */ +# define SAM_PIOB_OFFSET 0x00038040 /* 0x00038040-0x0003807f: PIOB */ +# define SAM_PIOC_OFFSET 0x00038080 /* 0x00038080-0x000380bf: PIOC */ +# define SAM_PIOD_OFFSET 0x000380c0 /* 0x000380c0-0x000380ff: PIOD */ +# define SAM_SPIOA_OFFSET 0x00039000 /* 0x00039000-0x0003903f: Secure PIOA */ +# define SAM_SPIOB_OFFSET 0x00039040 /* 0x00039040-0x0003907f: Secure PIOB */ +# define SAM_SPIOC_OFFSET 0x00039080 /* 0x00039080-0x000390bf: Secure PIOC */ +# define SAM_SPIOD_OFFSET 0x000390c0 /* 0x000390c0-0x000390ff: Secure PIOD */ # define SAM_MATRIX1_OFFSET 0x0003c000 /* 0x0003c000-0x0003ffff: MATRIX1 */ # define SAM_SECUMOD_OFFSET 0x00040000 /* 0x00040000-0x00043fff: SECUMOD */ # define SAM_TDES_OFFSET 0x00044000 /* 0x00044000-0x00047fff: TDES */ @@ -313,6 +321,7 @@ #define SAM_UHPEHCI_MMUFLAGS MMU_IOFLAGS #define SAM_AXIMX_MMUFLAGS MMU_IOFLAGS #define SAM_DAP_MMUFLAGS MMU_IOFLAGS +#define SAM_L2CC_MMUFLAGS MMU_IOFLAGS /* If the NFC is not being used, the NFC SRAM can be used as general purpose * SRAM (cached). If the NFC is used, then the NFC SRAM should be treated @@ -509,7 +518,15 @@ #define SAM_TWI1_VBASE (SAM_PERIPHC_VSECTION+SAM_TWI1_OFFSET) #define SAM_UDPHS_VBASE (SAM_PERIPHC_VSECTION+SAM_UDPHS_OFFSET) #define SAM_ADC_VBASE (SAM_PERIPHC_VSECTION+SAM_ADC_OFFSET) -#define SAM_PIOA_VBASE (SAM_PERIPHC_VSECTION+SAM_PIOA_OFFSET) +#define SAM_PIO_VBASE (SAM_PERIPHC_VSECTION+SAM_PIO_OFFSET) +# define SAM_PIOA_VBASE (SAM_PERIPHC_VSECTION+SAM_PIOA_OFFSET) +# define SAM_PIOB_VBASE (SAM_PERIPHC_VSECTION+SAM_PIOB_OFFSET) +# define SAM_PIOC_VBASE (SAM_PERIPHC_VSECTION+SAM_PIOC_OFFSET) +# define SAM_PIOD_VBASE (SAM_PERIPHC_VSECTION+SAM_PIOD_OFFSET) +# define SAM_SPIOA_VBASE (SAM_PERIPHC_VSECTION+SAM_SPIOA_OFFSET) +# define SAM_SPIOB_VBASE (SAM_PERIPHC_VSECTION+SAM_SPIOB_OFFSET) +# define SAM_SPIOC_VBASE (SAM_PERIPHC_VSECTION+SAM_SPIOC_OFFSET) +# define SAM_SPIOD_VBASE (SAM_PERIPHC_VSECTION+SAM_SPIOD_OFFSET) #define SAM_MATRIX1_VBASE (SAM_PERIPHC_VSECTION+SAM_MATRIX1_OFFSET) #define SAM_SECUMOD_VBASE (SAM_PERIPHC_VSECTION+SAM_SECUMOD_OFFSET) #define SAM_TDES_VBASE (SAM_PERIPHC_VSECTION+SAM_TDES_OFFSET) diff --git a/arch/arm/src/sama5/chip/sama5d2x_pinmap.h b/arch/arm/src/sama5/chip/sama5d2x_pinmap.h new file mode 100755 index 0000000000..3fcfb33e92 --- /dev/null +++ b/arch/arm/src/sama5/chip/sama5d2x_pinmap.h @@ -0,0 +1,804 @@ +/************************************************************************************************************ + * arch/arm/src/sama5/chip/sama5d2x_pinmap.h + * + * Copyright (C) 2015 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ************************************************************************************************************/ + +#ifndef __ARCH_ARM_SRC_SAMA5_CHIP_SAMA5D2X_PINMAP_H +#define __ARCH_ARM_SRC_SAMA5_CHIP_SAMA5D2X_PINMAP_H + +/************************************************************************************************************ + * Included Files + ************************************************************************************************************/ + +#include + +#include "chip.h" +#include "sam_pio.h" + +/************************************************************************************************************ + * Pre-processor Definitions + ************************************************************************************************************/ + +/* PIO pin definitions **************************************************************************************/ +/* Alternate Pin Functions. + * + * Alternative pin selections are provided with a numeric suffix like _1, _2, etc. Drivers, however, will + * use the pin selection without the numeric suffix. Additional definitions are required in the board.h + * file. For example, if we wanted the PCK0 on PB26, then the following definition should appear in the + * board.h header file for that board: + * + * #define PIO_PMC_PCK0 PIO_PMC_PCK0_1 + * + * The PCK logic will then automatically configure PB26 as the PCK0 pin. + */ + +/* WARNING!!! WARNING!!! WARNING!!! WARNING!!! WARNING!!! WARNING!!! WARNING!!! + * Additional effort is required to select specific PIO options such as frequency, open-drain/push-pull, + * and pull-up/down! Just the basics are defined for most pins in this file at the present time. + */ + +/* Analog-to-Digital Converter - ADC */ + +#define PIO_ADC_AD0 (PIO_ANALOG | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN19) +#define PIO_ADC_AD1 (PIO_ANALOG | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN20) +#define PIO_ADC_AD2 (PIO_ANALOG | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN21) +#define PIO_ADC_AD3 (PIO_ANALOG | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN22) +#define PIO_ADC_AD4 (PIO_ANALOG | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN23) +#define PIO_ADC_AD5 (PIO_ANALOG | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN24) +#define PIO_ADC_AD6 (PIO_ANALOG | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN25) +#define PIO_ADC_AD7 (PIO_ANALOG | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN26) +#define PIO_ADC_AD8 (PIO_ANALOG | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN27) +#define PIO_ADC_AD9 (PIO_ANALOG | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN28) +#define PIO_ADC_AD10 (PIO_ANALOG | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN29) +#define PIO_ADC_AD11 (PIO_ANALOG | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN30) +#define PIO_ADC_TRG (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOE | PIO_PIN31) + +/* Advanced Interrupt Controller - AIC */ + +#define PIO_FIQ_1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN9) +#define PIO_FIQ_2 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN3) +#define PIO_FIQ_3 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN4) +#define PIO_FIQ_4 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN8) +#define PIO_IRQ_1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN21) +#define PIO_IRQ_2 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN12) +#define PIO_IRQ_3 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN3) +#define PIO_IRQ_4 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN31) + +/* Control Area Network - CAN */ + +#define PIO_CAN0_RX_1 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN2) +#define PIO_CAN0_RX_2 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN11) +#define PIO_CAN0_TX_1 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN1) +#define PIO_CAN0_TX_2 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN10) +#define PIO_CAN1_RX (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN27) +#define PIO_CAN1_TX (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN26) + +/* Audio Class Amplifier - Class D */ + +#define PIO_CLASSD_L0 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN28) +#define PIO_CLASSD_L1 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN29) +#define PIO_CLASSD_L2 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN30) +#define PIO_CLASSD_L3 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN31) +#define PIO_CLASSD_R0 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN1) +#define PIO_CLASSD_R1 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN2) +#define PIO_CLASSD_R2 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN3) +#define PIO_CLASSD_R3 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN4) + +/* External Bus Interface - EBI */ + +#define PIO_EBI_A0_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN11) +#define PIO_EBI_A0_2 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN11) +#define PIO_EBI_A1_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN12) +#define PIO_EBI_A1_2 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN12) +#define PIO_EBI_A2_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN13) +#define PIO_EBI_A2_2 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN13) +#define PIO_EBI_A3_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN14) +#define PIO_EBI_A3_2 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN14) +#define PIO_EBI_A4_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN15) +#define PIO_EBI_A4_2 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN15) +#define PIO_EBI_A5_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN16) +#define PIO_EBI_A5_2 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN16) +#define PIO_EBI_A6_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN17) +#define PIO_EBI_A6_2 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN17) +#define PIO_EBI_A7_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN18) +#define PIO_EBI_A7_2 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN18) +#define PIO_EBI_A8_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN19) +#define PIO_EBI_A8_2 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN19) +#define PIO_EBI_A9_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN20) +#define PIO_EBI_A9_2 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN20) +#define PIO_EBI_A10_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN21) +#define PIO_EBI_A10_2 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN21) +#define PIO_EBI_A11_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN22) +#define PIO_EBI_A11_2 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN22) +#define PIO_EBI_A12_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN23) +#define PIO_EBI_A12_2 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN23) +#define PIO_EBI_A13_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN24) +#define PIO_EBI_A13_2 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN24) +#define PIO_EBI_A14_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN25) +#define PIO_EBI_A14_2 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN25) +#define PIO_EBI_A15_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN26) +#define PIO_EBI_A15_2 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN26) +#define PIO_EBI_A16_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN27) +#define PIO_EBI_A16_2 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN27) +#define PIO_EBI_A17_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN28) +#define PIO_EBI_A17_2 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN28) +#define PIO_EBI_A18_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN29) +#define PIO_EBI_A18_2 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN29) +#define PIO_EBI_A19_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN30) +#define PIO_EBI_A19_2 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN30) +#define PIO_EBI_A20_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN31) +#define PIO_EBI_A20_2 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN31) +#define PIO_EBI_A21_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN0) +#define PIO_EBI_A21_2 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN10) +#define PIO_EBI_A22_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN1) +#define PIO_EBI_A22_2 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN11) +#define PIO_EBI_A23_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN0) +#define PIO_EBI_A23_2 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN0) +#define PIO_EBI_A24_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN1) +#define PIO_EBI_A24_2 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN1) +#define PIO_EBI_A25_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN2) +#define PIO_EBI_A25_2 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN2) + +#define PIO_EBI_D0_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN22) +#define PIO_EBI_D0_2 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN0) +#define PIO_EBI_D1_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN23) +#define PIO_EBI_D1_2 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN1) +#define PIO_EBI_D2_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN24) +#define PIO_EBI_D2_2 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN2) +#define PIO_EBI_D3_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN25) +#define PIO_EBI_D3_2 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN3) +#define PIO_EBI_D4_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN26) +#define PIO_EBI_D4_2 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN4) +#define PIO_EBI_D5_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN27) +#define PIO_EBI_D5_2 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN5) +#define PIO_EBI_D6_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN28) +#define PIO_EBI_D6_2 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN6) +#define PIO_EBI_D7_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN29) +#define PIO_EBI_D7_2 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN7) +#define PIO_EBI_D8_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN3) +#define PIO_EBI_D8_2 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN13) +#define PIO_EBI_D9_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN4) +#define PIO_EBI_D9_2 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN14) +#define PIO_EBI_D10_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN5) +#define PIO_EBI_D10_2 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN15) +#define PIO_EBI_D11_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN6) +#define PIO_EBI_D11_2 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN16) +#define PIO_EBI_D12_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN7) +#define PIO_EBI_D12_2 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN17) +#define PIO_EBI_D13_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN8) +#define PIO_EBI_D13_2 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN18) +#define PIO_EBI_D14_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN9) +#define PIO_EBI_D14_2 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN19) +#define PIO_EBI_D15_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN10) +#define PIO_EBI_D15_2 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN20) + +#define PIO_EBI_NWAIT_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN3) +#define PIO_EBI_NWAIT_2 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN3) + +/* FLEXCOM */ + +#define PIO_FLEXCOM0_IO0 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN28) +#define PIO_FLEXCOM0_IO1 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN29) +#define PIO_FLEXCOM0_IO2 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN30) +#define PIO_FLEXCOM0_IO3 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN31) +#define PIO_FLEXCOM0_IO4 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN0) + +#define PIO_FLEXCOM1_IO0 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN24) +#define PIO_FLEXCOM1_IO1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN23) +#define PIO_FLEXCOM1_IO2 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN22) +#define PIO_FLEXCOM1_IO3 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN25) +#define PIO_FLEXCOM1_IO4 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN26) + +#define PIO_FLEXCOM2_IO0_1 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN26) +#define PIO_FLEXCOM2_IO0_2 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN6) +#define PIO_FLEXCOM2_IO1_1 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN27) +#define PIO_FLEXCOM2_IO1_2 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN7) +#define PIO_FLEXCOM2_IO2 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN28) +#define PIO_FLEXCOM2_IO3_1 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN29) +#define PIO_FLEXCOM2_IO3_2 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN9) +#define PIO_FLEXCOM2_IO4_1 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN30) +#define PIO_FLEXCOM2_IO4_2 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN10) + +#define PIO_FLEXCOM3_IO0_1 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN15) +#define PIO_FLEXCOM3_IO0_2 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN23) +#define PIO_FLEXCOM3_IO0 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN20) +#define PIO_FLEXCOM3_IO1_1 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN13) +#define PIO_FLEXCOM3_IO1_2 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN22) +#define PIO_FLEXCOM3_IO1_3 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN19) +#define PIO_FLEXCOM3_IO2_1 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN14) +#define PIO_FLEXCOM3_IO2_2 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN21) +#define PIO_FLEXCOM3_IO2_3 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN18) +#define PIO_FLEXCOM3_IO3_1 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN16) +#define PIO_FLEXCOM3_IO3_2 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN24) +#define PIO_FLEXCOM3_IO3_3 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN21) +#define PIO_FLEXCOM3_IO4_1 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN17) +#define PIO_FLEXCOM3_IO4_2 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN25) +#define PIO_FLEXCOM3_IO4_3 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN22) + +#define PIO_FLEXCOM4_IO0_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN28) +#define PIO_FLEXCOM4_IO0_2 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN12) +#define PIO_FLEXCOM4_IO0_3 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN21) +#define PIO_FLEXCOM4_IO1_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN29) +#define PIO_FLEXCOM4_IO1_2 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN13) +#define PIO_FLEXCOM4_IO1_3 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN22) +#define PIO_FLEXCOM4_IO2_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN30) +#define PIO_FLEXCOM4_IO2_2 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN14) +#define PIO_FLEXCOM4_IO2_3 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN23) +#define PIO_FLEXCOM4_IO3_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN31) +#define PIO_FLEXCOM4_IO3_2 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN15) +#define PIO_FLEXCOM4_IO3_3 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN24) +#define PIO_FLEXCOM4_IO4_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN0) +#define PIO_FLEXCOM4_IO4_2 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN16) +#define PIO_FLEXCOM4_IO4_3 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN25) + +/* Ethernet MAC -- EMAC0 */ + +#define PIO_EMAC0_COL_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN23) +#define PIO_EMAC0_COL_2 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN4) +#define PIO_EMAC0_COL_3 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN9) +#define PIO_EMAC0_CRS_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN22) +#define PIO_EMAC0_CRS_2 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN3) +#define PIO_EMAC0_CRS_3 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN8) +#define PIO_EMAC0_MDC_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN18) +#define PIO_EMAC0_MDC_2 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN17) +#define PIO_EMAC0_MDC_3 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN22) +#define PIO_EMAC0_MDIO_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN19) +#define PIO_EMAC0_MDIO_2 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN18) +#define PIO_EMAC0_MDIO_3 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN23) +#define PIO_EMAC0_RX0_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN14) +#define PIO_EMAC0_RX0_2 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN13) +#define PIO_EMAC0_RX0_3 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN18) +#define PIO_EMAC0_RX1_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN15) +#define PIO_EMAC0_RX1_2 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN14) +#define PIO_EMAC0_RX1_3 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN19) +#define PIO_EMAC0_RX2_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN24) +#define PIO_EMAC0_RX2_2 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN5) +#define PIO_EMAC0_RX2_3 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN10) +#define PIO_EMAC0_RX3_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN25) +#define PIO_EMAC0_RX3_2 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN6) +#define PIO_EMAC0_RX3_3 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN11) +#define PIO_EMAC0_RXCK_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN20) +#define PIO_EMAC0_RXCK_2 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN1) +#define PIO_EMAC0_RXCK_3 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN7) +#define PIO_EMAC0_RXDV_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN12) +#define PIO_EMAC0_RXDV_2 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN11) +#define PIO_EMAC0_RXDV_3 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN16) +#define PIO_EMAC0_RXER_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN13) +#define PIO_EMAC0_RXER_2 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN12) +#define PIO_EMAC0_RXER_3 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN17) +#define PIO_EMAC0_TSUCOMP_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN9) +#define PIO_EMAC0_TSUCOMP_2 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN0) +#define PIO_EMAC0_TSUCOMP_3 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN5) +#define PIO_EMAC0_TX0_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN16) +#define PIO_EMAC0_TX0_2 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN15) +#define PIO_EMAC0_TX0_3 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN20) +#define PIO_EMAC0_TX1_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN17) +#define PIO_EMAC0_TX1_2 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN16) +#define PIO_EMAC0_TX1_3 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN21) +#define PIO_EMAC0_TX2_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN26) +#define PIO_EMAC0_TX2_2 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN7) +#define PIO_EMAC0_TX2_3 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN12) +#define PIO_EMAC0_TX3_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN27) +#define PIO_EMAC0_TX3_2 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN8) +#define PIO_EMAC0_TX3_3 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN13) +#define PIO_EMAC0_TXCK_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN10) +#define PIO_EMAC0_TXCK_2 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN9) +#define PIO_EMAC0_TXCK_3 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN14) +#define PIO_EMAC0_TXEN_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN11) +#define PIO_EMAC0_TXEN_2 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN10) +#define PIO_EMAC0_TXEN_3 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN15) +#define PIO_EMAC0_TXER_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN21) +#define PIO_EMAC0_TXER_2 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN2) +#define PIO_EMAC0_TXER_3 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN6) + +/* Static Memory Controller - HSMC */ + +#define PIO_NANDALE_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN0) +#define PIO_NANDALE_2 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN10) +#define PIO_NANDCLE_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN1) +#define PIO_NANDCLE_2 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN11) +#define PIO_NANDOE_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN2) +#define PIO_NANDOE_2 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN12) +#define PIO_NANDRDY_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN8) +#define PIO_NANDRDY_2 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN8) +#define PIO_NANDWE (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN30) +#define PIO_NBS0_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN11) +#define PIO_NBS0_2 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN11) +#define PIO_NBS1_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN4) +#define PIO_NBS1_2 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN7) +#define PIO_NCS0_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN5) +#define PIO_NCS0_2 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN4) +#define PIO_NCS1_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN6) +#define PIO_NCS1_2 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN5) +#define PIO_NCS2_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN7) +#define PIO_NCS2_2 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN6) +#define PIO_NCS3_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN31) +#define PIO_NCS3_2 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN9) +#define PIO_NRD_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN2) +#define PIO_NRD_2 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN12) +#define PIO_NWE (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN30) +#define PIO_NWR1_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN4) +#define PIO_NWR1_2 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN7) + +/* Inter-IC Sound Controller - I2SC */ + +#define PIO_I2SC0_CK_1 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN1) +#define PIO_I2SC0_CK_2 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN19) +#define PIO_I2SC0_DI0_1 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN4) +#define PIO_I2SC0_DI0_2 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN22) +#define PIO_I2SC0_DO0_1 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN5) +#define PIO_I2SC0_DO0_2 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN23) +#define PIO_I2SC0_MCK_1 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN2) +#define PIO_I2SC0_MCK_2 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN20) +#define PIO_I2SC0_WS_1 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN3) +#define PIO_I2SC0_WS_2 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN21) + +#define PIO_I2SC1_CK_1 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN15) +#define PIO_I2SC1_CK_2 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN15) +#define PIO_I2SC1_DI0_1 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN17) +#define PIO_I2SC1_DI0_2 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN17) +#define PIO_I2SC1_DO0_1 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN18) +#define PIO_I2SC1_DO0_2 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN18) +#define PIO_I2SC1_MCK_1 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN14) +#define PIO_I2SC1_MCK_2 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN14) +#define PIO_I2SC1_WS_1 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN16) +#define PIO_I2SC1_WS_2 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN16) + +/* Image Sensor Controller - ISC */ + +#define PIO_ISC_D0_1 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN9) +#define PIO_ISC_D0_2 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN7) +#define PIO_ISC_D0_3 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN26) +#define PIO_ISC_D1_1 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN10) +#define PIO_ISC_D1_2 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN8) +#define PIO_ISC_D1_3 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN27) +#define PIO_ISC_D2_1 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN11) +#define PIO_ISC_D2_2 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN9) +#define PIO_ISC_D2_3 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN28) +#define PIO_ISC_D3_1 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN12) +#define PIO_ISC_D3_2 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN10) +#define PIO_ISC_D3_3 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN29) +#define PIO_ISC_D4_1 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN13) +#define PIO_ISC_D4_2 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN11) +#define PIO_ISC_D4_3 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN30) +#define PIO_ISC_D4_4 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN12) +#define PIO_ISC_D5_1 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN14) +#define PIO_ISC_D5_2 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN12) +#define PIO_ISC_D5_3 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN31) +#define PIO_ISC_D5_4 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN13) +#define PIO_ISC_D6_1 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN15) +#define PIO_ISC_D6_2 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN13) +#define PIO_ISC_D6_3 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN0) +#define PIO_ISC_D6_4 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN14) +#define PIO_ISC_D7_1 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN16) +#define PIO_ISC_D7_2 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN14) +#define PIO_ISC_D7_3 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN1) +#define PIO_ISC_D7_4 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN15) +#define PIO_ISC_D8_1 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN17) +#define PIO_ISC_D8_2 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN6) +#define PIO_ISC_D8_3 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN2) +#define PIO_ISC_D8_4 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN16) +#define PIO_ISC_D9_1 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN18) +#define PIO_ISC_D9_2 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN5) +#define PIO_ISC_D9_3 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN3) +#define PIO_ISC_D9_4 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN17) +#define PIO_ISC_D10_1 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN19) +#define PIO_ISC_D10_2 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN4) +#define PIO_ISC_D10_3 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN24) +#define PIO_ISC_D10_4 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN18) +#define PIO_ISC_D11_1 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN20) +#define PIO_ISC_D11_2 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN3) +#define PIO_ISC_D11_3 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN25) +#define PIO_ISC_D11_4 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN19) +#define PIO_ISC_FIELD_1 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN25) +#define PIO_ISC_FIELD_2 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN18) +#define PIO_ISC_FIELD_3 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN8) +#define PIO_ISC_FIELD_4 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN23) +#define PIO_ISC_HSYNC_1 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN23) +#define PIO_ISC_HSYNC_2 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN17) +#define PIO_ISC_HSYNC_3 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN6) +#define PIO_ISC_HSYNC_4 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN22) +#define PIO_ISC_MCK_1 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN24) +#define PIO_ISC_MCK_2 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN2) +#define PIO_ISC_MCK_3 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN7) +#define PIO_ISC_MCK_4 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN11) +#define PIO_ISC_PCK_1 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN21) +#define PIO_ISC_PCK_2 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN15) +#define PIO_ISC_PCK_3 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN4) +#define PIO_ISC_PCK_4 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN20) +#define PIO_ISC_VSYNC_1 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN22) +#define PIO_ISC_VSYNC_2 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN16) +#define PIO_ISC_VSYNC_3 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN5) +#define PIO_ISC_VSYNC_4 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN21) + +/* ICE and JTAG */ + +#define PIO_JTAG_TCK_1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN14) +#define PIO_JTAG_TCK_2 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN6) +#define PIO_JTAG_TCK_3 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN27) +#define PIO_JTAG_TCK_4 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN22) +#define PIO_JTAG_TDI_1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN15) +#define PIO_JTAG_TDI_2 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN7) +#define PIO_JTAG_TDI_3 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN28) +#define PIO_JTAG_TDI_4 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN23) +#define PIO_JTAG_TDO_1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN16) +#define PIO_JTAG_TDO_2 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN8) +#define PIO_JTAG_TDO_3 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN29) +#define PIO_JTAG_TDO_4 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN24) +#define PIO_JTAG_TMS_1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN17) +#define PIO_JTAG_TMS_2 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN9) +#define PIO_JTAG_TMS_3 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN30) +#define PIO_JTAG_TMS_4 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN25) + +/* LCD Controller - LCDC */ + +#define PIO_LCD_DAT0 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN11) +#define PIO_LCD_DAT1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN12) +#define PIO_LCD_DAT2_1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN13) +#define PIO_LCD_DAT2_2 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN10) +#define PIO_LCD_DAT3_1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN14) +#define PIO_LCD_DAT3_2 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN11) +#define PIO_LCD_DAT4_1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN15) +#define PIO_LCD_DAT4_2 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN12) +#define PIO_LCD_DAT5_1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN16) +#define PIO_LCD_DAT5_2 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN13) +#define PIO_LCD_DAT6_1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN17) +#define PIO_LCD_DAT6_2 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN14) +#define PIO_LCD_DAT7_1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN18) +#define PIO_LCD_DAT7_2 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN15) +#define PIO_LCD_DAT8 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN19) +#define PIO_LCD_DAT9 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN20) +#define PIO_LCD_DAT10_1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN21) +#define PIO_LCD_DAT10_2 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN16) +#define PIO_LCD_DAT11_1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN22) +#define PIO_LCD_DAT11_2 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN17) +#define PIO_LCD_DAT12_1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN23) +#define PIO_LCD_DAT12_2 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN18) +#define PIO_LCD_DAT13_1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN24) +#define PIO_LCD_DAT13_2 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN19) +#define PIO_LCD_DAT14_1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN25) +#define PIO_LCD_DAT14_2 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN20) +#define PIO_LCD_DAT15_1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN26) +#define PIO_LCD_DAT15_2 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN21) +#define PIO_LCD_DAT16 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN27) +#define PIO_LCD_DAT17 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN28) +#define PIO_LCD_DAT18_1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN29) +#define PIO_LCD_DAT18_2 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN22) +#define PIO_LCD_DAT19_1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN30) +#define PIO_LCD_DAT19_2 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN23) +#define PIO_LCD_DAT20_1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN31) +#define PIO_LCD_DAT20_2 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN24) +#define PIO_LCD_DAT21_1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN0) +#define PIO_LCD_DAT21_2 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN25) +#define PIO_LCD_DAT22_1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN1) +#define PIO_LCD_DAT22_2 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN26) +#define PIO_LCD_DAT23_1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN2) +#define PIO_LCD_DAT23_2 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN27) +#define PIO_LCD_DEN_1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN8) +#define PIO_LCD_DEN_2 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN1) +#define PIO_LCD_DISP_1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN29) +#define PIO_LCD_DISP_2 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN4) +#define PIO_LCD_HSYNC_1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN31) +#define PIO_LCD_HSYNC_2 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN6) +#define PIO_LCD_PCK_1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN7) +#define PIO_LCD_PCK_2 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN0) +#define PIO_LCD_PWM_1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN28) +#define PIO_LCD_PWM_2 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN3) +#define PIO_LCD_VSYNC_1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN30) +#define PIO_LCD_VSYNC_2 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN5) + +/* Clocks, Oscillators and PLLs */ + +#define PIO_PMC_PCK0_1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN19) +#define PIO_PMC_PCK0_2 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN8) +#define PIO_PMC_PCK0_3 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN31) +#define PIO_PMC_PCK1_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN6) +#define PIO_PMC_PCK1_2 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN13) +#define PIO_PMC_PCK1_3 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN27) +#define PIO_PMC_PCK1_4 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN20) +#define PIO_PMC_PCK2_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN21) +#define PIO_PMC_PCK2_2 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN11) +#define PIO_PMC_PCK2_3 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN28) + +/* Pulse Density Modulation Interface Controller - PDMIC */ + +#define PIO_PDMIC_CLK_1 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN12) +#define PIO_PDMIC_CLK_2 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN27) +#define PIO_PDMIC_DAT_1 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN11) +#define PIO_PDMIC_DAT_2 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN26) + + +/* Pulse Width Modulation Controller - PWM */ + +#define PIO_PWM0_EXTRG0 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN3) +#define PIO_PWM0_EXTRG1 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN10) +#define PIO_PWM0_FI0 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN2) +#define PIO_PWM0_FI1 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN9) +#define PIO_PWM0_H0 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN30) +#define PIO_PWM0_H1 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN0) +#define PIO_PWM0_H2 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN5) +#define PIO_PWM0_H3 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN7) +#define PIO_PWM0_L0 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN31) +#define PIO_PWM0_L1 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN1) +#define PIO_PWM0_L2 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN6) +#define PIO_PWM0_L3 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN8) + +/* Reset Control -- RSTC */ + +#define PIO_RSTC_NTRST_1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN10) +#define PIO_RSTC_NTRST_2 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN18) +#define PIO_RSTC_NTRST_3 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN31) +#define PIO_RSTC_NTRST_4 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN26) + +/* Quad IO SPI - QSPI */ + +#define PIO_QSPI0_CS_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN1) +#define PIO_QSPI0_CS_2 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN15) +#define PIO_QSPI0_CS_3 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN23) +#define PIO_QSPI0_IO0_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN2) +#define PIO_QSPI0_IO0_2 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN16) +#define PIO_QSPI0_IO0_3 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN24) +#define PIO_QSPI0_IO1_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN3) +#define PIO_QSPI0_IO1_2 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN17) +#define PIO_QSPI0_IO1_3 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN25) +#define PIO_QSPI0_IO2_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN4) +#define PIO_QSPI0_IO2_2 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN18) +#define PIO_QSPI0_IO2_3 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN26) +#define PIO_QSPI0_IO3_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN5) +#define PIO_QSPI0_IO3_2 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN19) +#define PIO_QSPI0_IO3_3 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN27) +#define PIO_QSPI0_SCK_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN0) +#define PIO_QSPI0_SCK_2 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN14) +#define PIO_QSPI0_SCK_3 (PIO_PERIPHF | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN22) + +#define PIO_QSPI1_CS_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN11) +#define PIO_QSPI1_CS_2 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN6) +#define PIO_QSPI1_CS_3 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN15) +#define PIO_QSPI1_IO0_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN7) +#define PIO_QSPI1_IO0_2 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN7) +#define PIO_QSPI1_IO0_3 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN16) +#define PIO_QSPI1_IO1_1 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN8) +#define PIO_QSPI1_IO1_2 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN17) +#define PIO_QSPI1_IO2_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN9) +#define PIO_QSPI1_IO2_2 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN9) +#define PIO_QSPI1_IO2_3 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN18) +#define PIO_QSPI1_IO3_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN10) +#define PIO_QSPI1_IO3_2 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN10) +#define PIO_QSPI1_IO3_3 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN19) +#define PIO_QSPI1_SCK_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN6) +#define PIO_QSPI1_SCK_2 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN5) +#define PIO_QSPI1_SCK_3 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN14) + +/* Secure Data Memory Card - SDMMC */ + +#define PIO_SDMMC0_CD (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN13) +#define PIO_SDMMC0_CK (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN0) +#define PIO_SDMMC0_CMD (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN1) +#define PIO_SDMMC0_DAT0 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN2) +#define PIO_SDMMC0_DAT1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN3) +#define PIO_SDMMC0_DAT2 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN4) +#define PIO_SDMMC0_DAT3 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN5) +#define PIO_SDMMC0_DAT4 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN6) +#define PIO_SDMMC0_DAT5 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN7) +#define PIO_SDMMC0_DAT6 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN8) +#define PIO_SDMMC0_DAT7 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN9) +#define PIO_SDMMC0_RSTN (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN10) +#define PIO_SDMMC0_VDDSEL (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN11) +#define PIO_SDMMC0_WP (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN12) + +#define PIO_SDMMC1_CD (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN30) +#define PIO_SDMMC1_CK (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN22) +#define PIO_SDMMC1_CMD (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN28) +#define PIO_SDMMC1_DAT0 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN18) +#define PIO_SDMMC1_DAT1 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN19) +#define PIO_SDMMC1_DAT2 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN20) +#define PIO_SDMMC1_DAT3 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN21) +#define PIO_SDMMC1_RSTN (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN27) +#define PIO_SDMMC1_WP (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN29) + +/* Serial Peripheral Interface - SPI */ + +#define PIO_SPI0_MISO_1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN16) +#define PIO_SPI0_MISO_2 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN31) +#define PIO_SPI0_MOSI_1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN15) +#define PIO_SPI0_MOSI_2 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN0) +#define PIO_SPI0_NPCS0_1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN17) +#define PIO_SPI0_NPCS0_2 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN30) +#define PIO_SPI0_NPCS1_1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN18) +#define PIO_SPI0_NPCS1_2 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN29) +#define PIO_SPI0_NPCS2_1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN19) +#define PIO_SPI0_NPCS2_2 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN27) +#define PIO_SPI0_NPCS3_1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN20) +#define PIO_SPI0_NPCS3_2 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN28) +#define PIO_SPI0_SPCK_1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN14) +#define PIO_SPI0_SPCK_2 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN1) + +#define PIO_SPI1_MISO_1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN27) +#define PIO_SPI1_MISO_2 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN24) +#define PIO_SPI1_MISO_3 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN3) +#define PIO_SPI1_MOSI_1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN26) +#define PIO_SPI1_MOSI_2 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN23) +#define PIO_SPI1_MOSI_3 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN2) +#define PIO_SPI1_NPCS0_1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN28) +#define PIO_SPI1_NPCS0_2 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN25) +#define PIO_SPI1_NPCS0_3 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN4) +#define PIO_SPI1_NPCS1_1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN29) +#define PIO_SPI1_NPCS1_2 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN26) +#define PIO_SPI1_NPCS1_3 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN5) +#define PIO_SPI1_NPCS2_1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN30) +#define PIO_SPI1_NPCS2_2 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN27) +#define PIO_SPI1_NPCS2_3 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN6) +#define PIO_SPI1_NPCS3_1 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN28) +#define PIO_SPI1_NPCS3_2 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN7) +#define PIO_SPI1_SPCK_1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN25) +#define PIO_SPI1_SPCK_2 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN22) +#define PIO_SPI1_SPCK_3 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN1) + +/* Synchronous Serial Controller - SSC */ + +#define PIO_SSC0_RD_1 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN23) +#define PIO_SSC0_RD_2 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN15) +#define PIO_SSC0_RF_1 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN25) +#define PIO_SSC0_RF_2 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN17) +#define PIO_SSC0_RK_1 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN24) +#define PIO_SSC0_RK_2 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN16) +#define PIO_SSC0_TD0_1 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN22) +#define PIO_SSC0_TD0_2 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN14) +#define PIO_SSC0_TF0_1 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN21) +#define PIO_SSC0_TF0_2 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN13) +#define PIO_SSC0_TK0_1 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN20) +#define PIO_SSC0_TK0_2 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN12) + +#define PIO_SSC1_RD_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN17) +#define PIO_SSC1_RD_2 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN17) +#define PIO_SSC1_RF_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN19) +#define PIO_SSC1_RF_2 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN19) +#define PIO_SSC1_RK_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN18) +#define PIO_SSC1_RK_2 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN18) +#define PIO_SSC1_TD1_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN16) +#define PIO_SSC1_TD1_2 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN16) +#define PIO_SSC1_TF1_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN15) +#define PIO_SSC1_TF1_2 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN15) +#define PIO_SSC1_TK1_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN14) +#define PIO_SSC1_TK1_2 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN14) + +/* Timer/Counter - TC */ + +#define PIO_TC0_CLK (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN21) +#define PIO_TC0_IOA (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN19) +#define PIO_TC0_IOB (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN20) + +#define PIO_TC1_CLK_1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN29) +#define PIO_TC1_CLK_2 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN13) +#define PIO_TC1_CLK_3 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN5) +#define PIO_TC1_IOA_1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN27) +#define PIO_TC1_IOA_2 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN11) +#define PIO_TC1_IOA_3 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN3) +#define PIO_TC1_IOB_1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN28) +#define PIO_TC1_IOB_2 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN12) +#define PIO_TC1_IOB_3 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN4) + +#define PIO_TC2_CLK_1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN5) +#define PIO_TC2_CLK_2 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN22) +#define PIO_TC2_CLK_3 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN24) +#define PIO_TC2_IOA_1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN6) +#define PIO_TC2_IOA_2 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN20) +#define PIO_TC2_IOA_3 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN22) +#define PIO_TC2_IOB_1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN7) +#define PIO_TC2_IOB_2 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN21) +#define PIO_TC2_IOB_3 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN23) + +#define PIO_TC3_CLK_1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN8) +#define PIO_TC3_CLK_2 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN21) +#define PIO_TC3_CLK_3 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN31) +#define PIO_TC3_IOA_1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN9) +#define PIO_TC3_IOA_2 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN19) +#define PIO_TC3_IOA_3 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN29) +#define PIO_TC3_IOB_1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN10) +#define PIO_TC3_IOB_2 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN20) +#define PIO_TC3_IOB_3 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN30) + +#define PIO_TC4_CLK_1 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN11) +#define PIO_TC4_CLK_2 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN11) +#define PIO_TC4_IOA_1 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN9) +#define PIO_TC4_IOA_2 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN9) +#define PIO_TC4_IOB_1 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN10) +#define PIO_TC4_IOB_2 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN10) + +#define PIO_TC5_CLK_1 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOa | PIO_PIN8) +#define PIO_TC5_CLK_2 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN30) +#define PIO_TC5_IOA_1 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN6) +#define PIO_TC5_IOA_2 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN28) +#define PIO_TC5_IOB_1 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN7) +#define PIO_TC5_IOB_2 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN29) + +/* Two-Wire Interface - TWI */ + +#define PIO_TWI0_CK_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN22) +#define PIO_TWI0_CK_2 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN0) +#define PIO_TWI0_CK_3 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN28) +#define PIO_TWI0_CK_4 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN30) +#define PIO_TWI0_D_1 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN21) +#define PIO_TWI0_D_2 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN31) +#define PIO_TWI0_D_3 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN27) +#define PIO_TWI0_D_4 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN29) + +#define PIO_TWI1_CK_1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN5) +#define PIO_TWI1_CK_2 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN20) +#define PIO_TWI1_CK_3 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN7) +#define PIO_TWI1_D_1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN4) +#define PIO_TWI1_D_2 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN19) +#define PIO_TWI1_D_3 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN6) + +/* Universal Asynchronous Receiver Transmitter - UART */ + +#define PIO_UART0_TXD (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN27) +#define PIO_UART0_RXD (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN26) + +#define PIO_UART1_RXD_1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN2) +#define PIO_UART1_RXD_2 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN7) +#define PIO_UART1_TXD_1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN3) +#define PIO_UART1_TXD_2 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN8) + +#define PIO_UART2_RXD_1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN23) +#define PIO_UART2_RXD_2 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN4) +#define PIO_UART2_RXD_3 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN19) +#define PIO_UART2_TXD_1 (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN24) +#define PIO_UART2_TXD_2 (PIO_PERIPHB | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN5) +#define PIO_UART2_TXD_3 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN20) + +#define PIO_UART3_RXD_1 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN11) +#define PIO_UART3_RXD_2 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN31) +#define PIO_UART3_RXD_3 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN12) +#define PIO_UART3_TXD_1 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN12) +#define PIO_UART3_TXD_2 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN0) +#define PIO_UART3_TXD_3 (PIO_PERIPHD | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN13) + +#define PIO_UART4_RXD (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN3) +#define PIO_UART4_TXD (PIO_PERIPHA | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN4) + +/* UTMI */ + +#define PIO_UTMI_CDRBISTEN (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN16) +#define PIO_UTMI_CDRCPDIVEN (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN15) +#define PIO_UTMI_CDRCPSEL0 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN13) +#define PIO_UTMI_CDRCPSEL1 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN14) +#define PIO_UTMI_CDRCPSELDIV (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN17) +#define PIO_UTMI_HDIS (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN10) +#define PIO_UTMI_LS0 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN11) +#define PIO_UTMI_LS1 (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN12) +#define PIO_UTMI_RXACT (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN9) +#define PIO_UTMI_RXERR (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN8) +#define PIO_UTMI_RXVAL (PIO_PERIPHC | PIO_CFG_DEFAULT | PIO_PORT_PIOD | PIO_PIN7) + +#endif /* __ARCH_ARM_SRC_SAMA5_CHIP_SAMA5D2X_PINMAP_H */ diff --git a/arch/arm/src/sama5/sam_pck.c b/arch/arm/src/sama5/sam_pck.c index 2f6ddb0b76..0457318294 100644 --- a/arch/arm/src/sama5/sam_pck.c +++ b/arch/arm/src/sama5/sam_pck.c @@ -106,6 +106,9 @@ uint32_t sam_pck_configure(enum pckid_e pckid, enum pckid_clksrc_e clksrc, uint32_t regval; uint32_t clkin; uint32_t actual; +#ifdef SAMA5_HAVE_PCK_INT_PRES + uint32_t pres; +#endif /* Pick a clock source. Several are possible but only MCK, PLLA, the * MAINCK,or SCK are supported here. @@ -152,6 +155,23 @@ uint32_t sam_pck_configure(enum pckid_e pckid, enum pckid_clksrc_e clksrc, return 0; } +#ifdef SAMA5_HAVE_PCK_INT_PRES + /* Programmable Clock frequency is selected clock freqency divided by PRES + 1 */ + + pres = clkin / frequency; + if (pres < 1) + { + pres = 1; + } + else if (pres > (PMC_PCK_PRES_MASK + 1)) + { + pres = PMC_PCK_PRES_MASK + 1; + } + + regval |= PMC_PCK_PRES(pres - 1); + actual = frequency / pres; + +#else /* The the larger smallest divisor that does not exceed the requested * frequency. */ @@ -164,40 +184,41 @@ uint32_t sam_pck_configure(enum pckid_e pckid, enum pckid_clksrc_e clksrc, else if (frequency >= (clkin >> 1)) { regval |= PMC_PCK_PRES_DIV2; - actual = clkin >> 1; + actual = clkin >> 1; } else if (frequency >= (clkin >> 2)) { regval |= PMC_PCK_PRES_DIV4; - actual = clkin >> 2; + actual = clkin >> 2; } else if (frequency >= (clkin >> 3)) { regval |= PMC_PCK_PRES_DIV8; - actual = clkin >> 3; + actual = clkin >> 3; } else if (frequency >= (clkin >> 4)) { regval |= PMC_PCK_PRES_DIV16; - actual = clkin >> 4; + actual = clkin >> 4; } else if (frequency >= (clkin >> 5)) { regval |= PMC_PCK_PRES_DIV32; - actual = clkin >> 5; + actual = clkin >> 5; } else if (frequency >= (clkin >> 6)) { regval |= PMC_PCK_PRES_DIV64; - actual = clkin >> 6; + actual = clkin >> 6; } else { sdbg("ERROR: frequency cannot be realized.\n"); - sdbg(" frequency=%d MCK=%d\n", - frequency, clkin); + sdbg(" frequency=%lu clkin=%lu\n", + (unsigned long)frequency, (unsigned long)clkin); return 0; } +#endif /* Disable the programmable clock, configure the PCK output pin, then set * the selected configuration. diff --git a/arch/arm/src/sama5/sam_pio.c b/arch/arm/src/sama5/sam_pio.c index bc4d8cab50..864a758aef 100644 --- a/arch/arm/src/sama5/sam_pio.c +++ b/arch/arm/src/sama5/sam_pio.c @@ -78,11 +78,22 @@ * contiguous. If not defined, then we need to do a table lookup. */ -#ifndef SAM_PION_VBASE +#if !defined(SAM_PION_VBASE) && SAM_NPIO > 0 const uintptr_t g_piobase[SAM_NPIO] = { - SAM_PIOA_VBASE, SAM_PIOB_VBASE, SAM_PIOC_VBASE, SAM_PIOD_VBASE, + SAM_PIOA_VBASE, +#if SAM_NPIO > 1 + SAM_PIOB_VBASE, +#endif +#if SAM_NPIO > 2 + SAM_PIOC_VBASE, +#endif +#if SAM_NPIO > 3 + SAM_PIOD_VBASE, +#endif +#if SAM_NPIO > 4 SAM_PIOE_VBASE +#endif }; #endif @@ -91,10 +102,22 @@ const uintptr_t g_piobase[SAM_NPIO] = ****************************************************************************/ /* Maps a port number to the standard port character */ -#ifdef CONFIG_DEBUG_GPIO +#if defined(CONFIG_DEBUG_GPIO) && SAM_NPIO > 0 static const char g_portchar[SAM_NPIO] = { - 'A', 'B', 'C', 'D', 'E' + 'A', +#if SAM_NPIO > 1 + 'B', +#endif +#if SAM_NPIO > 2 + 'C', +#endif +#if SAM_NPIO > 3 + 'D', +#endif +#if SAM_NPIO > 4 + 'E' +#endif }; #endif diff --git a/arch/arm/src/sama5/sam_pio.h b/arch/arm/src/sama5/sam_pio.h index d3556b11b9..8b395ebec5 100644 --- a/arch/arm/src/sama5/sam_pio.h +++ b/arch/arm/src/sama5/sam_pio.h @@ -2,7 +2,7 @@ * arch/arm/src/sama5/sam_pio.h * Parallel Input/Output (PIO) definitions for the SAMA5 * - * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2013, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -46,177 +46,28 @@ #include #include +#include + #include "chip/sam_memorymap.h" /************************************************************************************ * Pre-processor Definitions ************************************************************************************/ -/* Configuration ********************************************************************/ -#if !defined(CONFIG_SAMA5_PIOA_IRQ) && !defined(CONFIG_SAMA5_PIOB_IRQ) && \ - !defined(CONFIG_SAMA5_PIOC_IRQ) && !defined(CONFIG_SAMA5_PIOD_IRQ) && \ - !defined(CONFIG_SAMA5_PIOE_IRQ) && !defined(CONFIG_SAMA5_PIOF_IRQ) -# undef CONFIG_SAMA5_PIO_IRQ -#endif +/* Definitions and types customized for each SAMA5Dx familiy */ -#ifndef CONFIG_DEBUG -# undef CONFIG_DEBUG_GPIO -#endif - -#define PIO_HAVE_PULLDOWN 1 -#define PIO_HAVE_PERIPHCD 1 -#define PIO_HAVE_SCHMITT 1 -#define PIO_HAVE_DRIVE 1 - -#define SAM_NPIO 5 /* (5) PIOA-E */ - -/* Bit-encoded input to sam_configpio() ********************************************/ - -/* 32-bit Encoding: - * - * .... .... .MMM CCCC CDDI IISV PPPB BBBB - */ - -/* Input/Output mode: - * - * .... .... .MMM .... .... .... .... .... - */ - -#define PIO_MODE_SHIFT (20) /* Bits 20-22: PIO mode */ -#define PIO_MODE_MASK (7 << PIO_MODE_SHIFT) -# define PIO_INPUT (0 << PIO_MODE_SHIFT) /* Input */ -# define PIO_OUTPUT (1 << PIO_MODE_SHIFT) /* Output */ -# define PIO_PERIPHA (2 << PIO_MODE_SHIFT) /* Controlled by periph A signal */ -# define PIO_PERIPHB (3 << PIO_MODE_SHIFT) /* Controlled by periph B signal */ -# define PIO_PERIPHC (4 << PIO_MODE_SHIFT) /* Controlled by periph C signal */ -# define PIO_PERIPHD (5 << PIO_MODE_SHIFT) /* Controlled by periph D signal */ - -/* These bits set the configuration of the pin: - * NOTE: No definitions for parallel capture mode - * - * .... .... .... CCCC C... .... .... .... - */ - -#define PIO_CFG_SHIFT (15) /* Bits 15-19: PIO configuration bits */ -#define PIO_CFG_MASK (31 << PIO_CFG_SHIFT) -# define PIO_CFG_DEFAULT (0 << PIO_CFG_SHIFT) /* Default, no attribute */ -# define PIO_CFG_PULLUP (1 << PIO_CFG_SHIFT) /* Bit 15: Internal pull-up */ -# define PIO_CFG_PULLDOWN (2 << PIO_CFG_SHIFT) /* Bit 16: Internal pull-down */ -# define PIO_CFG_DEGLITCH (4 << PIO_CFG_SHIFT) /* Bit 17: Internal glitch filter */ -# define PIO_CFG_OPENDRAIN (8 << PIO_CFG_SHIFT) /* Bit 18: Open drain */ -# define PIO_CFG_SCHMITT (16 << PIO_CFG_SHIFT) /* Bit 19: Schmitt trigger */ - -/* Drive Strength: - * - * .... .... .... .... .DD. .... .... .... - */ - -#define PIO_DRIVE_SHIFT (13) /* Bits 13-14: Drive strength */ -#define PIO_DRIVE_MASK (7 << PIO_DRIVE_SHIFT) -# define PIO_DRIVE_LOW (0 << PIO_DRIVE_SHIFT) -# define PIO_DRIVE_MEDIUM (2 << PIO_DRIVE_SHIFT) -# define PIO_DRIVE_HIGH (3 << PIO_DRIVE_SHIFT) - -/* Additional interrupt modes: - * - * .... .... .... .... ...I II.. .... .... - */ - -#define PIO_INT_SHIFT (10) /* Bits 9-12: PIO interrupt bits */ -#define PIO_INT_MASK (7 << PIO_INT_SHIFT) -# define _PIO_INT_AIM (1 << 10) /* Bit 10: Additional Interrupt modes */ -# define _PIO_INT_LEVEL (1 << 9) /* Bit 9: Level detection interrupt */ -# define _PIO_INT_EDGE (0) /* (vs. Edge detection interrupt) */ -# define _PIO_INT_RH (1 << 8) /* Bit 9: Rising edge/High level detection interrupt */ -# define _PIO_INT_FL (0) /* (vs. Falling edge/Low level detection interrupt) */ - -# define PIO_INT_HIGHLEVEL (_PIO_INT_AIM | _PIO_INT_LEVEL | _PIO_INT_RH) -# define PIO_INT_LOWLEVEL (_PIO_INT_AIM | _PIO_INT_LEVEL | _PIO_INT_FL) -# define PIO_INT_RISING (_PIO_INT_AIM | _PIO_INT_EDGE | _PIO_INT_RH) -# define PIO_INT_FALLING (_PIO_INT_AIM | _PIO_INT_EDGE | _PIO_INT_FL) -# define PIO_INT_BOTHEDGES (0) - -/* If the pin is an interrupt, then this determines if the pin is a secure interrupt: - * - * .... .... .... .... .... ..S. .... .... - */ - -#ifdef SAMA5_SAIC -# define PIO_INT_SECURE (1 << 9) /* Bit 9: Secure interrupt */ +#if defined(ATSAMA5D2) +# include "sama5d2x_pio.h" +#elif defined(ATSAMA5D3) || defined(ATSAMA5D4) +# include "sama5d3x4x_pio.h" #else -# define PIO_INT_SECURE (0) +# error Unrecognized SAMA5 architecture #endif -#define PIO_INT_UNSECURE (0) - -/* If the pin is an PIO output, then this identifies the initial output value: - * - * .... .... .... .... .... ...V .... .... - */ - -#define PIO_OUTPUT_SET (1 << 8) /* Bit 8: Initial value of output */ -#define PIO_OUTPUT_CLEAR (0) - -/* This identifies the PIO port: - * - * .... .... .... .... .... .... PPP. .... - */ - -#define PIO_PORT_SHIFT (5) /* Bit 5-7: Port number */ -#define PIO_PORT_MASK (7 << PIO_PORT_SHIFT) -# define PIO_PORT_PIOA (0 << PIO_PORT_SHIFT) -# define PIO_PORT_PIOB (1 << PIO_PORT_SHIFT) -# define PIO_PORT_PIOC (2 << PIO_PORT_SHIFT) -# define PIO_PORT_PIOD (3 << PIO_PORT_SHIFT) -# define PIO_PORT_PIOE (4 << PIO_PORT_SHIFT) - -/* This identifies the bit in the port: - * - * .... .... .... .... .... .... ...B BBBB - */ - -#define PIO_PIN_SHIFT (0) /* Bits 0-4: PIO number: 0-31 */ -#define PIO_PIN_MASK (31 << PIO_PIN_SHIFT) -#define PIO_PIN0 (0 << PIO_PIN_SHIFT) -#define PIO_PIN1 (1 << PIO_PIN_SHIFT) -#define PIO_PIN2 (2 << PIO_PIN_SHIFT) -#define PIO_PIN3 (3 << PIO_PIN_SHIFT) -#define PIO_PIN4 (4 << PIO_PIN_SHIFT) -#define PIO_PIN5 (5 << PIO_PIN_SHIFT) -#define PIO_PIN6 (6 << PIO_PIN_SHIFT) -#define PIO_PIN7 (7 << PIO_PIN_SHIFT) -#define PIO_PIN8 (8 << PIO_PIN_SHIFT) -#define PIO_PIN9 (9 << PIO_PIN_SHIFT) -#define PIO_PIN10 (10 << PIO_PIN_SHIFT) -#define PIO_PIN11 (11 << PIO_PIN_SHIFT) -#define PIO_PIN12 (12 << PIO_PIN_SHIFT) -#define PIO_PIN13 (13 << PIO_PIN_SHIFT) -#define PIO_PIN14 (14 << PIO_PIN_SHIFT) -#define PIO_PIN15 (15 << PIO_PIN_SHIFT) -#define PIO_PIN16 (16 << PIO_PIN_SHIFT) -#define PIO_PIN17 (17 << PIO_PIN_SHIFT) -#define PIO_PIN18 (18 << PIO_PIN_SHIFT) -#define PIO_PIN19 (19 << PIO_PIN_SHIFT) -#define PIO_PIN20 (20 << PIO_PIN_SHIFT) -#define PIO_PIN21 (21 << PIO_PIN_SHIFT) -#define PIO_PIN22 (22 << PIO_PIN_SHIFT) -#define PIO_PIN23 (23 << PIO_PIN_SHIFT) -#define PIO_PIN24 (24 << PIO_PIN_SHIFT) -#define PIO_PIN25 (25 << PIO_PIN_SHIFT) -#define PIO_PIN26 (26 << PIO_PIN_SHIFT) -#define PIO_PIN27 (27 << PIO_PIN_SHIFT) -#define PIO_PIN28 (28 << PIO_PIN_SHIFT) -#define PIO_PIN29 (29 << PIO_PIN_SHIFT) -#define PIO_PIN30 (30 << PIO_PIN_SHIFT) -#define PIO_PIN31 (31 << PIO_PIN_SHIFT) /************************************************************************************ * Public Types ************************************************************************************/ -/* Must be big enough to hold the 32-bit encoding */ - -typedef uint32_t pio_pinset_t; - /* SAM_PION_VBASE will only be defined if the PIO register blocks are contiguous. * If not defined, then we need to do a table lookup. */ diff --git a/arch/arm/src/sama5/sama5d2x_memorymap.c b/arch/arm/src/sama5/sama5d2x_memorymap.c index 38a5ed3d38..8eeb4b34ac 100644 --- a/arch/arm/src/sama5/sama5d2x_memorymap.c +++ b/arch/arm/src/sama5/sama5d2x_memorymap.c @@ -103,7 +103,7 @@ const struct section_mapping_s g_section_mapping[] = */ #ifdef CONFIG_ARCH_LOWVECTORS - { SAM_SRAMREMAP_PSECTION, SAM_SRAMREMAP_vSECTION, + { SAM_SRAMREMAP_PSECTION, SAM_SRAMREMAP_VSECTION, SAM_SRAMREMAP_MMUFLAGS, SAM_SRAMREMAP_NSECTIONS }, #endif @@ -134,7 +134,7 @@ const struct section_mapping_s g_section_mapping[] = SAM_DAP_MMUFLAGS, SAM_DAP_NSECTIONS }, -#if defined(CONFIG_ARCH_CHIP_SAMA5D2) && !defined(CONFIG_ARCH_L2CACHE) +#if defined(CONFIG_ARCH_CHIP_SAMA5D2) && defined(CONFIG_ARCH_L2CACHE) /* The SAMA5D2 features a second 128-Kbyte SRAM that can be allocated * either to the L2 cache controller or used as an internal SRAM. After * reset, this block is connected to the L2 cache controller. The diff --git a/arch/arm/src/sama5/sama5d2x_pio.h b/arch/arm/src/sama5/sama5d2x_pio.h new file mode 100644 index 0000000000..a36beee15e --- /dev/null +++ b/arch/arm/src/sama5/sama5d2x_pio.h @@ -0,0 +1,221 @@ +/************************************************************************************ + * arch/arm/src/sama5/sama5d2x_pio.h + * Parallel Input/Output (PIO) definitions for the SAMA5D2 family + * + * Copyright (C) 2015 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ************************************************************************************/ + +#ifndef __ARCH_ARM_SRC_SAMA5_SAMA5D2X_PIO_H +#define __ARCH_ARM_SRC_SAMA5_SAMA5D2X_PIO_H + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include + +#include +#include + +#include "chip/sam_memorymap.h" + +/************************************************************************************ + * Pre-processor Definitions + ************************************************************************************/ +/* Configuration ********************************************************************/ + +#if !defined(CONFIG_SAMA5_PIOA_IRQ) && !defined(CONFIG_SAMA5_PIOB_IRQ) && \ + !defined(CONFIG_SAMA5_PIOC_IRQ) && !defined(CONFIG_SAMA5_PIOD_IRQ) +# undef CONFIG_SAMA5_PIO_IRQ +#endif + +#ifndef CONFIG_DEBUG +# undef CONFIG_DEBUG_GPIO +#endif + +#define PIO_HAVE_PULLDOWN 1 +#define PIO_HAVE_PERIPHCD 1 +#define PIO_HAVE_SCHMITT 1 +#define PIO_HAVE_DRIVE 1 + +#define SAM_NPIO 4 /* (4) PIOA-D */ + +/* Bit-encoded input to sam_configpio() ********************************************/ + +/* 32-bit Encoding: + * + * .... ...M MMMM CCCC CDDI IISV .PPB BBBB + */ + +/* Input/Output mode: + * + * .... ...M MMMM .... .... .... .... .... + */ + +#define PIO_MODE_SHIFT (20) /* Bits 20-24: PIO mode */ +#define PIO_MODE_MASK (15 << PIO_MODE_SHIFT) +# define PIO_INPUT (0 << PIO_MODE_SHIFT) /* Input */ +# define PIO_OUTPUT (1 << PIO_MODE_SHIFT) /* Output */ +# define PIO_ANALOG (2 << PIO_MODE_SHIFT) /* Analog */ +# define PIO_PERIPHA (3 << PIO_MODE_SHIFT) /* Controlled by periph A signal */ +# define PIO_PERIPHB (4 << PIO_MODE_SHIFT) /* Controlled by periph B signal */ +# define PIO_PERIPHC (5 << PIO_MODE_SHIFT) /* Controlled by periph C signal */ +# define PIO_PERIPHD (6 << PIO_MODE_SHIFT) /* Controlled by periph D signal */ +# define PIO_PERIPHE (7 << PIO_MODE_SHIFT) /* Controlled by periph E signal */ +# define PIO_PERIPHF (8 << PIO_MODE_SHIFT) /* Controlled by periph F signal */ + +/* These bits set the configuration of the pin: + * NOTE: No definitions for parallel capture mode + * + * .... .... .... CCCC C... .... .... .... + */ + +#define PIO_CFG_SHIFT (15) /* Bits 15-19: PIO configuration bits */ +#define PIO_CFG_MASK (31 << PIO_CFG_SHIFT) +# define PIO_CFG_DEFAULT (0 << PIO_CFG_SHIFT) /* Default, no attribute */ +# define PIO_CFG_PULLUP (1 << PIO_CFG_SHIFT) /* Bit 15: Internal pull-up */ +# define PIO_CFG_PULLDOWN (2 << PIO_CFG_SHIFT) /* Bit 16: Internal pull-down */ +# define PIO_CFG_DEGLITCH (4 << PIO_CFG_SHIFT) /* Bit 17: Internal glitch filter */ +# define PIO_CFG_OPENDRAIN (8 << PIO_CFG_SHIFT) /* Bit 18: Open drain */ +# define PIO_CFG_SCHMITT (16 << PIO_CFG_SHIFT) /* Bit 19: Schmitt trigger */ + +/* Drive Strength: + * + * .... .... .... .... .DD. .... .... .... + */ + +#define PIO_DRIVE_SHIFT (13) /* Bits 13-14: Drive strength */ +#define PIO_DRIVE_MASK (7 << PIO_DRIVE_SHIFT) +# define PIO_DRIVE_LOW (0 << PIO_DRIVE_SHIFT) +# define PIO_DRIVE_MEDIUM (2 << PIO_DRIVE_SHIFT) +# define PIO_DRIVE_HIGH (3 << PIO_DRIVE_SHIFT) + +/* Additional interrupt modes: + * + * .... .... .... .... ...I II.. .... .... + */ + +#define PIO_INT_SHIFT (10) /* Bits 9-12: PIO interrupt bits */ +#define PIO_INT_MASK (7 << PIO_INT_SHIFT) +# define _PIO_INT_AIM (1 << 10) /* Bit 10: Additional Interrupt modes */ +# define _PIO_INT_LEVEL (1 << 9) /* Bit 9: Level detection interrupt */ +# define _PIO_INT_EDGE (0) /* (vs. Edge detection interrupt) */ +# define _PIO_INT_RH (1 << 8) /* Bit 9: Rising edge/High level detection interrupt */ +# define _PIO_INT_FL (0) /* (vs. Falling edge/Low level detection interrupt) */ + +# define PIO_INT_HIGHLEVEL (_PIO_INT_AIM | _PIO_INT_LEVEL | _PIO_INT_RH) +# define PIO_INT_LOWLEVEL (_PIO_INT_AIM | _PIO_INT_LEVEL | _PIO_INT_FL) +# define PIO_INT_RISING (_PIO_INT_AIM | _PIO_INT_EDGE | _PIO_INT_RH) +# define PIO_INT_FALLING (_PIO_INT_AIM | _PIO_INT_EDGE | _PIO_INT_FL) +# define PIO_INT_BOTHEDGES (0) + +/* If the pin is an interrupt, then this determines if the pin is a secure interrupt: + * + * .... .... .... .... .... ..S. .... .... + */ + +#ifdef SAMA5_SAIC +# define PIO_INT_SECURE (1 << 9) /* Bit 9: Secure interrupt */ +#else +# define PIO_INT_SECURE (0) +#endif +#define PIO_INT_UNSECURE (0) + +/* If the pin is an PIO output, then this identifies the initial output value: + * + * .... .... .... .... .... ...V .... .... + */ + +#define PIO_OUTPUT_SET (1 << 8) /* Bit 8: Initial value of output */ +#define PIO_OUTPUT_CLEAR (0) + +/* This identifies the PIO port: + * + * .... .... .... .... .... .... .PP. .... + */ + +#define PIO_PORT_SHIFT (5) /* Bit 5-6: Port number */ +#define PIO_PORT_MASK (3 << PIO_PORT_SHIFT) +# define PIO_PORT_PIOA (0 << PIO_PORT_SHIFT) +# define PIO_PORT_PIOB (1 << PIO_PORT_SHIFT) +# define PIO_PORT_PIOC (2 << PIO_PORT_SHIFT) +# define PIO_PORT_PIOD (3 << PIO_PORT_SHIFT) + +/* This identifies the bit in the port: + * + * .... .... .... .... .... .... ...B BBBB + */ + +#define PIO_PIN_SHIFT (0) /* Bits 0-4: PIO number: 0-31 */ +#define PIO_PIN_MASK (31 << PIO_PIN_SHIFT) +#define PIO_PIN0 (0 << PIO_PIN_SHIFT) +#define PIO_PIN1 (1 << PIO_PIN_SHIFT) +#define PIO_PIN2 (2 << PIO_PIN_SHIFT) +#define PIO_PIN3 (3 << PIO_PIN_SHIFT) +#define PIO_PIN4 (4 << PIO_PIN_SHIFT) +#define PIO_PIN5 (5 << PIO_PIN_SHIFT) +#define PIO_PIN6 (6 << PIO_PIN_SHIFT) +#define PIO_PIN7 (7 << PIO_PIN_SHIFT) +#define PIO_PIN8 (8 << PIO_PIN_SHIFT) +#define PIO_PIN9 (9 << PIO_PIN_SHIFT) +#define PIO_PIN10 (10 << PIO_PIN_SHIFT) +#define PIO_PIN11 (11 << PIO_PIN_SHIFT) +#define PIO_PIN12 (12 << PIO_PIN_SHIFT) +#define PIO_PIN13 (13 << PIO_PIN_SHIFT) +#define PIO_PIN14 (14 << PIO_PIN_SHIFT) +#define PIO_PIN15 (15 << PIO_PIN_SHIFT) +#define PIO_PIN16 (16 << PIO_PIN_SHIFT) +#define PIO_PIN17 (17 << PIO_PIN_SHIFT) +#define PIO_PIN18 (18 << PIO_PIN_SHIFT) +#define PIO_PIN19 (19 << PIO_PIN_SHIFT) +#define PIO_PIN20 (20 << PIO_PIN_SHIFT) +#define PIO_PIN21 (21 << PIO_PIN_SHIFT) +#define PIO_PIN22 (22 << PIO_PIN_SHIFT) +#define PIO_PIN23 (23 << PIO_PIN_SHIFT) +#define PIO_PIN24 (24 << PIO_PIN_SHIFT) +#define PIO_PIN25 (25 << PIO_PIN_SHIFT) +#define PIO_PIN26 (26 << PIO_PIN_SHIFT) +#define PIO_PIN27 (27 << PIO_PIN_SHIFT) +#define PIO_PIN28 (28 << PIO_PIN_SHIFT) +#define PIO_PIN29 (29 << PIO_PIN_SHIFT) +#define PIO_PIN30 (30 << PIO_PIN_SHIFT) +#define PIO_PIN31 (31 << PIO_PIN_SHIFT) + +/************************************************************************************ + * Public Types + ************************************************************************************/ + +/* Must be big enough to hold the 32-bit encoding */ + +typedef uint32_t pio_pinset_t; + +#endif /* __ARCH_ARM_SRC_SAMA5_SAMA5D2X_PIO_H */ diff --git a/arch/arm/src/sama5/sama5d3x4x_pio.h b/arch/arm/src/sama5/sama5d3x4x_pio.h new file mode 100644 index 0000000000..63b6615b55 --- /dev/null +++ b/arch/arm/src/sama5/sama5d3x4x_pio.h @@ -0,0 +1,213 @@ +/************************************************************************************ + * arch/arm/src/sama5/sama5d3x4x_pio.h + * Parallel Input/Output (PIO) definitions for the SAMA5D23 and SAMA5D4 families + * + * Copyright (C) 2013, 2015 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ************************************************************************************/ + +#ifndef __ARCH_ARM_SRC_SAMA5_SAMA5D3X4X_PIO_H +#define __ARCH_ARM_SRC_SAMA5_SAMA5D3X4X_PIO_H + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +/************************************************************************************ + * Pre-processor Definitions + ************************************************************************************/ +/* Configuration ********************************************************************/ + +#if !defined(CONFIG_SAMA5_PIOA_IRQ) && !defined(CONFIG_SAMA5_PIOB_IRQ) && \ + !defined(CONFIG_SAMA5_PIOC_IRQ) && !defined(CONFIG_SAMA5_PIOD_IRQ) && \ + !defined(CONFIG_SAMA5_PIOE_IRQ) && !defined(CONFIG_SAMA5_PIOF_IRQ) +# undef CONFIG_SAMA5_PIO_IRQ +#endif + +#ifndef CONFIG_DEBUG +# undef CONFIG_DEBUG_GPIO +#endif + +#define PIO_HAVE_PULLDOWN 1 +#define PIO_HAVE_PERIPHCD 1 +#define PIO_HAVE_SCHMITT 1 +#define PIO_HAVE_DRIVE 1 + +#define SAM_NPIO 5 /* (5) PIOA-E */ + +/* Bit-encoded input to sam_configpio() ********************************************/ + +/* 32-bit Encoding: + * + * .... .... .MMM CCCC CDDI IISV PPPB BBBB + */ + +/* Input/Output mode: + * + * .... .... .MMM .... .... .... .... .... + */ + +#define PIO_MODE_SHIFT (20) /* Bits 20-22: PIO mode */ +#define PIO_MODE_MASK (7 << PIO_MODE_SHIFT) +# define PIO_INPUT (0 << PIO_MODE_SHIFT) /* Input */ +# define PIO_OUTPUT (1 << PIO_MODE_SHIFT) /* Output */ +# define PIO_PERIPHA (2 << PIO_MODE_SHIFT) /* Controlled by periph A signal */ +# define PIO_PERIPHB (3 << PIO_MODE_SHIFT) /* Controlled by periph B signal */ +# define PIO_PERIPHC (4 << PIO_MODE_SHIFT) /* Controlled by periph C signal */ +# define PIO_PERIPHD (5 << PIO_MODE_SHIFT) /* Controlled by periph D signal */ + +/* These bits set the configuration of the pin: + * NOTE: No definitions for parallel capture mode + * + * .... .... .... CCCC C... .... .... .... + */ + +#define PIO_CFG_SHIFT (15) /* Bits 15-19: PIO configuration bits */ +#define PIO_CFG_MASK (31 << PIO_CFG_SHIFT) +# define PIO_CFG_DEFAULT (0 << PIO_CFG_SHIFT) /* Default, no attribute */ +# define PIO_CFG_PULLUP (1 << PIO_CFG_SHIFT) /* Bit 15: Internal pull-up */ +# define PIO_CFG_PULLDOWN (2 << PIO_CFG_SHIFT) /* Bit 16: Internal pull-down */ +# define PIO_CFG_DEGLITCH (4 << PIO_CFG_SHIFT) /* Bit 17: Internal glitch filter */ +# define PIO_CFG_OPENDRAIN (8 << PIO_CFG_SHIFT) /* Bit 18: Open drain */ +# define PIO_CFG_SCHMITT (16 << PIO_CFG_SHIFT) /* Bit 19: Schmitt trigger */ + +/* Drive Strength: + * + * .... .... .... .... .DD. .... .... .... + */ + +#define PIO_DRIVE_SHIFT (13) /* Bits 13-14: Drive strength */ +#define PIO_DRIVE_MASK (7 << PIO_DRIVE_SHIFT) +# define PIO_DRIVE_LOW (0 << PIO_DRIVE_SHIFT) +# define PIO_DRIVE_MEDIUM (2 << PIO_DRIVE_SHIFT) +# define PIO_DRIVE_HIGH (3 << PIO_DRIVE_SHIFT) + +/* Additional interrupt modes: + * + * .... .... .... .... ...I II.. .... .... + */ + +#define PIO_INT_SHIFT (10) /* Bits 9-12: PIO interrupt bits */ +#define PIO_INT_MASK (7 << PIO_INT_SHIFT) +# define _PIO_INT_AIM (1 << 10) /* Bit 10: Additional Interrupt modes */ +# define _PIO_INT_LEVEL (1 << 9) /* Bit 9: Level detection interrupt */ +# define _PIO_INT_EDGE (0) /* (vs. Edge detection interrupt) */ +# define _PIO_INT_RH (1 << 8) /* Bit 9: Rising edge/High level detection interrupt */ +# define _PIO_INT_FL (0) /* (vs. Falling edge/Low level detection interrupt) */ + +# define PIO_INT_HIGHLEVEL (_PIO_INT_AIM | _PIO_INT_LEVEL | _PIO_INT_RH) +# define PIO_INT_LOWLEVEL (_PIO_INT_AIM | _PIO_INT_LEVEL | _PIO_INT_FL) +# define PIO_INT_RISING (_PIO_INT_AIM | _PIO_INT_EDGE | _PIO_INT_RH) +# define PIO_INT_FALLING (_PIO_INT_AIM | _PIO_INT_EDGE | _PIO_INT_FL) +# define PIO_INT_BOTHEDGES (0) + +/* If the pin is an interrupt, then this determines if the pin is a secure interrupt: + * + * .... .... .... .... .... ..S. .... .... + */ + +#ifdef SAMA5_SAIC +# define PIO_INT_SECURE (1 << 9) /* Bit 9: Secure interrupt */ +#else +# define PIO_INT_SECURE (0) +#endif +#define PIO_INT_UNSECURE (0) + +/* If the pin is an PIO output, then this identifies the initial output value: + * + * .... .... .... .... .... ...V .... .... + */ + +#define PIO_OUTPUT_SET (1 << 8) /* Bit 8: Initial value of output */ +#define PIO_OUTPUT_CLEAR (0) + +/* This identifies the PIO port: + * + * .... .... .... .... .... .... PPP. .... + */ + +#define PIO_PORT_SHIFT (5) /* Bit 5-7: Port number */ +#define PIO_PORT_MASK (7 << PIO_PORT_SHIFT) +# define PIO_PORT_PIOA (0 << PIO_PORT_SHIFT) +# define PIO_PORT_PIOB (1 << PIO_PORT_SHIFT) +# define PIO_PORT_PIOC (2 << PIO_PORT_SHIFT) +# define PIO_PORT_PIOD (3 << PIO_PORT_SHIFT) +# define PIO_PORT_PIOE (4 << PIO_PORT_SHIFT) + +/* This identifies the bit in the port: + * + * .... .... .... .... .... .... ...B BBBB + */ + +#define PIO_PIN_SHIFT (0) /* Bits 0-4: PIO number: 0-31 */ +#define PIO_PIN_MASK (31 << PIO_PIN_SHIFT) +#define PIO_PIN0 (0 << PIO_PIN_SHIFT) +#define PIO_PIN1 (1 << PIO_PIN_SHIFT) +#define PIO_PIN2 (2 << PIO_PIN_SHIFT) +#define PIO_PIN3 (3 << PIO_PIN_SHIFT) +#define PIO_PIN4 (4 << PIO_PIN_SHIFT) +#define PIO_PIN5 (5 << PIO_PIN_SHIFT) +#define PIO_PIN6 (6 << PIO_PIN_SHIFT) +#define PIO_PIN7 (7 << PIO_PIN_SHIFT) +#define PIO_PIN8 (8 << PIO_PIN_SHIFT) +#define PIO_PIN9 (9 << PIO_PIN_SHIFT) +#define PIO_PIN10 (10 << PIO_PIN_SHIFT) +#define PIO_PIN11 (11 << PIO_PIN_SHIFT) +#define PIO_PIN12 (12 << PIO_PIN_SHIFT) +#define PIO_PIN13 (13 << PIO_PIN_SHIFT) +#define PIO_PIN14 (14 << PIO_PIN_SHIFT) +#define PIO_PIN15 (15 << PIO_PIN_SHIFT) +#define PIO_PIN16 (16 << PIO_PIN_SHIFT) +#define PIO_PIN17 (17 << PIO_PIN_SHIFT) +#define PIO_PIN18 (18 << PIO_PIN_SHIFT) +#define PIO_PIN19 (19 << PIO_PIN_SHIFT) +#define PIO_PIN20 (20 << PIO_PIN_SHIFT) +#define PIO_PIN21 (21 << PIO_PIN_SHIFT) +#define PIO_PIN22 (22 << PIO_PIN_SHIFT) +#define PIO_PIN23 (23 << PIO_PIN_SHIFT) +#define PIO_PIN24 (24 << PIO_PIN_SHIFT) +#define PIO_PIN25 (25 << PIO_PIN_SHIFT) +#define PIO_PIN26 (26 << PIO_PIN_SHIFT) +#define PIO_PIN27 (27 << PIO_PIN_SHIFT) +#define PIO_PIN28 (28 << PIO_PIN_SHIFT) +#define PIO_PIN29 (29 << PIO_PIN_SHIFT) +#define PIO_PIN30 (30 << PIO_PIN_SHIFT) +#define PIO_PIN31 (31 << PIO_PIN_SHIFT) + +/************************************************************************************ + * Public Types + ************************************************************************************/ + +/* Must be big enough to hold the 32-bit encoding */ + +typedef uint32_t pio_pinset_t; + +#endif /* __ARCH_ARM_SRC_SAMA5_SAMA5D3X4X_PIO_H */