/**
 * \file
 *
 * \brief Xplained I/O Expansion Header Pin Mapping
 *
 * The Atmel Xplained evaluation boards have four 10-pin, 100mil headers that
 * are used to access spare analog and digital pins on the board
 * microcontroller.  This file provides a common set of definitions mapping
 * the Xplained expansion header \c J1, \c J2, \c J3, and \c J4 pins to spare
 * pins on the board microcontroller.  Software can then use these common
 * definitions to configure I/O for peripherals and expansion boards connected
 * to the Xplained header blocks.
 *
 * Copyright (C) 2011 Atmel Corporation. All rights reserved.
 *
 * \page License
 *
 * 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. The name of Atmel may not be used to endorse or promote products derived
 * from this software without specific prior written permission.
 *
 * 4. This software may only be redistributed and used in connection with an
 * Atmel AVR product.
 *
 * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
 * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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 _xplained_headers_h_
#define _xplained_headers_h_

#include <gpio.h>

#ifdef __cplusplus
extern "C" {
#endif


#if (BOARD == UC3_A3_XPLAINED)
#   define XPLD_HEADER_J1_PIN1  (AVR32_PIN_PA25)
#   define XPLD_HEADER_J1_PIN2  (AVR32_PIN_PA26)
#   define XPLD_HEADER_J1_PIN3  (AVR32_PIN_PX57)
#   define XPLD_HEADER_J1_PIN4  (AVR32_PIN_PX58)
#   define XPLD_HEADER_J1_PIN5  (AVR32_PIN_PB09)
#   define XPLD_HEADER_J1_PIN6  (AVR32_PIN_PB10)
#   define XPLD_HEADER_J1_PIN7  (AVR32_PIN_PB08)
#   define XPLD_HEADER_J1_PIN8  (AVR32_PIN_PB07)

#   define XPLD_HEADER_J2_PIN1  (AVR32_PIN_PA21)
#   define XPLD_HEADER_J2_PIN2  (AVR32_PIN_PA22)
#   define XPLD_HEADER_J2_PIN3  (AVR32_PIN_PA23)
#   define XPLD_HEADER_J2_PIN4  (AVR32_PIN_PA24)
#   define XPLD_HEADER_J2_PIN5  (AVR32_PIN_PA20)
#   define XPLD_HEADER_J2_PIN6  (AVR32_PIN_PA19)
#   define XPLD_HEADER_J2_PIN7  (AVR32_PIN_PA18)
#   define XPLD_HEADER_J2_PIN8  (AVR32_PIN_PA17)

#   define XPLD_HEADER_J3_PIN1  (AVR32_PIN_PA31)
#   define XPLD_HEADER_J3_PIN2  (AVR32_PIN_PA30)
#   define XPLD_HEADER_J3_PIN3  (AVR32_PIN_PA29)
#   define XPLD_HEADER_J3_PIN4  (AVR32_PIN_PA28)
#   define XPLD_HEADER_J3_PIN5  (AVR32_PIN_PA27)
#   define XPLD_HEADER_J3_PIN6  (AVR32_PIN_PB00)
#   define XPLD_HEADER_J3_PIN7  (AVR32_PIN_PB04)
#   define XPLD_HEADER_J3_PIN8  (AVR32_PIN_PX19)

#   define XPLD_HEADER_J4_PIN1  (AVR32_PIN_PA15)
#   define XPLD_HEADER_J4_PIN2  (AVR32_PIN_PA14)
#   define XPLD_HEADER_J4_PIN3  (AVR32_PIN_PA05)
#   define XPLD_HEADER_J4_PIN4  (AVR32_PIN_PA06)
#   define XPLD_HEADER_J4_PIN5  (AVR32_PIN_PA07)
#   define XPLD_HEADER_J4_PIN6  (AVR32_PIN_PA10)
#   define XPLD_HEADER_J4_PIN7  (AVR32_PIN_PA11)
#   define XPLD_HEADER_J4_PIN8  (AVR32_PIN_PA08)
#elif (BOARD == UC3_C2_XPLAINED)
#   error (UC3-C2 Xplained):  missing I/O expansion pin map
#elif (BOARD == UC3_L0_XPLAINED)
#   define XPLD_HEADER_J1_PIN1  (AVR32_PIN_PA21)
#   define XPLD_HEADER_J1_PIN2  (AVR32_PIN_PB05)
#   define XPLD_HEADER_J1_PIN3  (AVR32_PIN_PB11)
#   define XPLD_HEADER_J1_PIN4  (AVR32_PIN_PB10)
#   define XPLD_HEADER_J1_PIN5  (AVR32_PIN_PA08)
#   define XPLD_HEADER_J1_PIN6  (AVR32_PIN_PB03)
#   define XPLD_HEADER_J1_PIN7  (AVR32_PIN_PB02)
#   define XPLD_HEADER_J1_PIN8  (AVR32_PIN_PB01)

#   define XPLD_HEADER_J2_PIN1  (AVR32_PIN_PA14)
#   define XPLD_HEADER_J2_PIN2  (AVR32_PIN_PA15)
#   define XPLD_HEADER_J2_PIN3  (AVR32_PIN_PA16)
#   define XPLD_HEADER_J2_PIN4  (AVR32_PIN_PA18)
#   define XPLD_HEADER_J2_PIN5  (AVR32_PIN_PB07)
#   define XPLD_HEADER_J2_PIN6  (AVR32_PIN_PB08)
#   define XPLD_HEADER_J2_PIN7  (AVR32_PIN_PB06)
#   define XPLD_HEADER_J2_PIN8  (AVR32_PIN_PB19)

#   define XPLD_HEADER_J3_PIN1  (AVR32_PIN_PA13)
#   define XPLD_HEADER_J3_PIN2  (AVR32_PIN_PA17)
#   define XPLD_HEADER_J3_PIN3  (AVR32_PIN_PA20)
#   define XPLD_HEADER_J3_PIN4  (AVR32_PIN_PA22)
#   define XPLD_HEADER_J3_PIN5  (AVR32_PIN_PB12)
#   define XPLD_HEADER_J3_PIN6  (AVR32_PIN_PB09)
#   define XPLD_HEADER_J3_PIN7  (AVR32_PIN_PB04)
#   define XPLD_HEADER_J3_PIN8  (AVR32_PIN_PA11)

#   define XPLD_HEADER_J4_PIN1  (AVR32_PIN_PA21)
#   define XPLD_HEADER_J4_PIN2  (AVR32_PIN_PB05)
#   define XPLD_HEADER_J4_PIN3  (AVR32_PIN_PB11)
#   define XPLD_HEADER_J4_PIN4  (AVR32_PIN_PB10)
#   define XPLD_HEADER_J4_PIN5  (AVR32_PIN_PB00)
#   define XPLD_HEADER_J4_PIN6  (AVR32_PIN_PB03)
#   define XPLD_HEADER_J4_PIN7  (AVR32_PIN_PB02)
#   define XPLD_HEADER_J4_PIN8  (AVR32_PIN_PB01)
#elif (BOARD == XMEGA_A1_XPLAINED)
#   define XPLD_HEADER_J1_PIN1  IOPORT_CREATE_PIN(PORTF,0)
#   define XPLD_HEADER_J1_PIN2  IOPORT_CREATE_PIN(PORTF,1)
#   define XPLD_HEADER_J1_PIN3  IOPORT_CREATE_PIN(PORTF,2)
#   define XPLD_HEADER_J1_PIN4  IOPORT_CREATE_PIN(PORTF,3)
#   define XPLD_HEADER_J1_PIN5  IOPORT_CREATE_PIN(PORTF,4)
#   define XPLD_HEADER_J1_PIN6  IOPORT_CREATE_PIN(PORTF,5)
#   define XPLD_HEADER_J1_PIN7  IOPORT_CREATE_PIN(PORTF,6)
#   define XPLD_HEADER_J1_PIN8  IOPORT_CREATE_PIN(PORTF,7)

#   define XPLD_HEADER_J2_PIN1  IOPORT_CREATE_PIN(PORTA,0)
#   define XPLD_HEADER_J2_PIN2  IOPORT_CREATE_PIN(PORTA,1)
#   define XPLD_HEADER_J2_PIN3  IOPORT_CREATE_PIN(PORTA,2)
#   define XPLD_HEADER_J2_PIN4  IOPORT_CREATE_PIN(PORTA,3)
#   define XPLD_HEADER_J2_PIN5  IOPORT_CREATE_PIN(PORTA,4)
#   define XPLD_HEADER_J2_PIN6  IOPORT_CREATE_PIN(PORTA,5)
#   define XPLD_HEADER_J2_PIN7  IOPORT_CREATE_PIN(PORTA,6)
#   define XPLD_HEADER_J2_PIN8  IOPORT_CREATE_PIN(PORTA,7)

#   define XPLD_HEADER_J3_PIN1  IOPORT_CREATE_PIN(PORTD,0)
#   define XPLD_HEADER_J3_PIN2  IOPORT_CREATE_PIN(PORTD,1)
#   define XPLD_HEADER_J3_PIN3  IOPORT_CREATE_PIN(PORTD,2)
#   define XPLD_HEADER_J3_PIN4  IOPORT_CREATE_PIN(PORTD,3)
#   define XPLD_HEADER_J3_PIN5  IOPORT_CREATE_PIN(PORTD,4)
#   define XPLD_HEADER_J3_PIN6  IOPORT_CREATE_PIN(PORTD,5)
#   define XPLD_HEADER_J3_PIN7  IOPORT_CREATE_PIN(PORTR,0)
#   define XPLD_HEADER_J3_PIN8  IOPORT_CREATE_PIN(PORTR,1)

#   define XPLD_HEADER_J4_PIN1  IOPORT_CREATE_PIN(PORTC,0)
#   define XPLD_HEADER_J4_PIN2  IOPORT_CREATE_PIN(PORTC,1)
#   define XPLD_HEADER_J4_PIN3  IOPORT_CREATE_PIN(PORTC,2)
#   define XPLD_HEADER_J4_PIN4  IOPORT_CREATE_PIN(PORTC,3)
#   define XPLD_HEADER_J4_PIN5  IOPORT_CREATE_PIN(PORTC,4)
#   define XPLD_HEADER_J4_PIN6  IOPORT_CREATE_PIN(PORTC,5)
#   define XPLD_HEADER_J4_PIN7  IOPORT_CREATE_PIN(PORTC,6)
#   define XPLD_HEADER_J4_PIN8  IOPORT_CREATE_PIN(PORTC,7)
#elif (BOARD == XMEGA_B1_XPLAINED)
#   error (XMEGA-B1 Xplained):  missing I/O expansion pin map
#endif


#ifdef __cplusplus
}
#endif

#endif /* _xplained_headers_h_ */
