OK so constants are better than macro's as they speak straight in "C" but I do many things in macro's:
#include <avr/io.h>
#define BIT_GET(p,m) ((p) & (BIT(m)))
#define BIT_S(p,m) ((p) |= (BIT(m)))
#define BIT_C(p,m) ((p) &= ~(BIT(m)))
#define BIT_FLIP(p,m) ((p) ^= (BIT(m))) // p is the register, m is the bit name
#define BIT_WRITE(c,p,m) (c ? BIT_S(p, BIT(m)) : BIT_C(p, BIT(m)))
#define BIT(x) (0x01 << (x))
#define LONGBIT(x) ((unsigned long)0x00000001 << (x))
#define BIT1(p,m) ((p) |= (BIT(m)))
#define BIT0(p,m) ((p) &= ~(BIT(m)))
// PortA setup and manipulation
#define PA0_INPUT PORTA.DIRCLR = 0x01
#define PA1_INPUT PORTA.DIRCLR = 0x02
#define PA2_INPUT PORTA.DIRCLR = 0x04
#define PA3_INPUT PORTA.DIRCLR = 0x08
#define PA4_INPUT PORTA.DIRCLR = 0x10
#define PA5_INPUT PORTA.DIRCLR = 0x20
#define PA6_INPUT PORTA.DIRCLR = 0x40
#define PA7_INPUT PORTA.DIRCLR = 0x80
#define IS_PA0_LOW !BIT_GET(PORTA.IN, 0)
#define IS_PA1_LOW !BIT_GET(PORTA.IN, 1)
#define IS_PA2_LOW !BIT_GET(PORTA.IN, 2)
#define IS_PA3_LOW !BIT_GET(PORTA.IN, 3)
#define IS_PA4_LOW !BIT_GET(PORTA.IN, 4)
#define IS_PA5_LOW !BIT_GET(PORTA.IN, 5)
#define IS_PA6_LOW !BIT_GET(PORTA.IN, 6)
#define IS_PA7_LOW !BIT_GET(PORTA.IN, 7)
#define IS_PA0_HI BIT_GET(PORTA.IN, 0)
#define IS_PA1_HI BIT_GET(PORTA.IN, 1)
#define IS_PA2_HI BIT_GET(PORTA.IN, 2)
#define IS_PA3_HI BIT_GET(PORTA.IN, 3)
#define IS_PA4_HI BIT_GET(PORTA.IN, 4)
#define IS_PA5_HI BIT_GET(PORTA.IN, 5)
#define IS_PA6_HI BIT_GET(PORTA.IN, 6)
#define IS_PA7_HI BIT_GET(PORTA.IN, 7)
#define PA0_OUTPUT PORTA.DIRSET = 0x01
#define PA1_OUTPUT PORTA.DIRSET = 0x02
#define PA2_OUTPUT PORTA.DIRSET = 0x04
#define PA3_OUTPUT PORTA.DIRSET = 0x08
#define PA4_OUTPUT PORTA.DIRSET = 0x10
#define PA5_OUTPUT PORTA.DIRSET = 0x20
#define PA6_OUTPUT PORTA.DIRSET = 0x40
#define PA7_OUTPUT PORTA.DIRSET = 0x80
#define PA0_HI PORTA.OUTSET = 0x01
#define PA1_HI PORTA.OUTSET = 0x02
#define PA2_HI PORTA.OUTSET = 0x04
#define PA3_HI PORTA.OUTSET = 0x08
#define PA4_HI PORTA.OUTSET = 0x10
#define PA5_HI PORTA.OUTSET = 0x20
#define PA6_HI PORTA.OUTSET = 0x40
#define PA7_HI PORTA.OUTSET = 0x80
#define PA0_LOW PORTA.OUTCLR = 0x01
#define PA1_LOW PORTA.OUTCLR = 0x02
#define PA2_LOW PORTA.OUTCLR = 0x04
#define PA3_LOW PORTA.OUTCLR = 0x08
#define PA4_LOW PORTA.OUTCLR = 0x10
#define PA5_LOW PORTA.OUTCLR = 0x20
#define PA6_LOW PORTA.OUTCLR = 0x40
#define PA7_LOW PORTA.OUTCLR = 0x80
// PORTA SLEW RATE
#define PORTA_SLEWRATE_ON BIT1(PORTA.PORTCTRL, SRL)
#define PORTA_SLEWRATE_OFF BIT0(PORTA.PORTCTRL, SRL)
// PA0 setup
#define PA0_MODE_INVERTED BIT1(PORTA.PIN0CTRL, INVEN)
#define PA0_MODE_NON_INVERTED BIT0(PORTA.PIN0CTRL, INVEN)
#define PA0_PULLUP_ON BIT1(PORTA.PIN0CTRL, PULLUPEN)
#define PA0_PULLUP_OFF BIT0(PORTA.PIN0CTRL, PULLUPEN)
#define PA0_INT_OFF BIT0(PORTA.PIN0CTRL, ISC2); BIT0(PORTA.PIN0CTRL, ICS1); BIT0(PORTA.PIN0CTRL, ICS0);
#define PA0_INT_BOTHEDGES BIT0(PORTA.PIN0CTRL, ISC2); BIT0(PORTA.PIN0CTRL, ICS1); BIT1(PORTA.PIN0CTRL, ICS0);
#define PA0_INT_RISING BIT0(PORTA.PIN0CTRL, ISC2); BIT1(PORTA.PIN0CTRL, ICS1); BIT0(PORTA.PIN0CTRL, ICS0);
#define PA0_INT_FALLING BIT0(PORTA.PIN0CTRL, ISC2); BIT1(PORTA.PIN0CTRL, ICS1); BIT1(PORTA.PIN0CTRL, ICS0);
#define PA0_INT_INPUT_DISABLE BIT1(PORTA.PIN0CTRL, ISC2); BIT0(PORTA.PIN0CTRL, ICS1); BIT0(PORTA.PIN0CTRL, ICS0);
#define PA0_INT_LEVEL BIT1(PORTA.PIN0CTRL, ISC2); BIT0(PORTA.PIN0CTRL, ICS1); BIT1(PORTA.PIN0CTRL, ICS0);
// PA1 setup
#define PA1_MODE_INVERTED BIT1(PORTA.PIN1CTRL, INVEN)
#define PA1_MODE_NON_INVERTED BIT0(PORTA.PIN1CTRL, INVEN)
#define PA1_PULLUP_ON BIT1(PORTA.PIN1CTRL, PULLUPEN)
#define PA1_PULLUP_OFF BIT0(PORTA.PIN1CTRL, PULLUPEN)
#define PA1_INT_OFF BIT0(PORTA.PIN1CTRL, ISC2); BIT0(PORTA.PIN1CTRL, ICS1); BIT0(PORTA.PIN1CTRL, ICS0);
#define PA1_INT_BOTHEDGES BIT0(PORTA.PIN1CTRL, ISC2); BIT0(PORTA.PIN1CTRL, ICS1); BIT1(PORTA.PIN1CTRL, ICS0);
#define PA1_INT_RISING BIT0(PORTA.PIN1CTRL, ISC2); BIT1(PORTA.PIN1CTRL, ICS1); BIT0(PORTA.PIN1CTRL, ICS0);
#define PA1_INT_FALLING BIT0(PORTA.PIN1CTRL, ISC2); BIT1(PORTA.PIN1CTRL, ICS1); BIT1(PORTA.PIN1CTRL, ICS0);
#define PA1_INT_INPUT_DISABLE BIT1(PORTA.PIN1CTRL, ISC2); BIT0(PORTA.PIN1CTRL, ICS1); BIT0(PORTA.PIN1CTRL, ICS0);
#define PA1_INT_LEVEL BIT1(PORTA.PIN1CTRL, ISC2); BIT0(PORTA.PIN1CTRL, ICS1); BIT1(PORTA.PIN1CTRL, ICS0);
// PA2 setup
#define PA2_MODE_INVERTED BIT1(PORTA.PIN2CTRL, INVEN)
#define PA2_MODE_NON_INVERTED BIT0(PORTA.PIN2CTRL, INVEN)
#define PA2_PULLUP_ON BIT1(PORTA.PIN2CTRL, PULLUPEN)
#define PA2_PULLUP_OFF BIT0(PORTA.PIN2CTRL, PULLUPEN)
#define PA2_INT_OFF BIT0(PORTA.PIN2CTRL, ISC2); BIT0(PORTA.PIN2CTRL, ICS1); BIT0(PORTA.PIN2CTRL, ICS0);
#define PA2_INT_BOTHEDGES BIT0(PORTA.PIN2CTRL, ISC2); BIT0(PORTA.PIN2CTRL, ICS1); BIT1(PORTA.PIN2CTRL, ICS0);
#define PA2_INT_RISING BIT0(PORTA.PIN2CTRL, ISC2); BIT1(PORTA.PIN2CTRL, ICS1); BIT0(PORTA.PIN2CTRL, ICS0);
#define PA2_INT_FALLING BIT0(PORTA.PIN2CTRL, ISC2); BIT1(PORTA.PIN2CTRL, ICS1); BIT1(PORTA.PIN2CTRL, ICS0);
#define PA2_INT_INPUT_DISABLE BIT1(PORTA.PIN2CTRL, ISC2); BIT0(PORTA.PIN2CTRL, ICS1); BIT0(PORTA.PIN2CTRL, ICS0);
#define PA2_INT_LEVEL BIT1(PORTA.PIN2CTRL, ISC2); BIT0(PORTA.PIN2CTRL, ICS1); BIT1(PORTA.PIN2CTRL, ICS0);
// PA3 setup
#define PA3_MODE_INVERTED BIT1(PORTA.PIN3CTRL, INVEN)
#define PA3_MODE_NON_INVERTED BIT0(PORTA.PIN3CTRL, INVEN)
#define PA3_PULLUP_ON BIT1(PORTA.PIN3CTRL, PULLUPEN)
#define PA3_PULLUP_OFF BIT0(PORTA.PIN3CTRL, PULLUPEN)
#define PA3_INT_OFF BIT0(PORTA.PIN3CTRL, ISC2); BIT0(PORTA.PIN3CTRL, ICS1); BIT0(PORTA.PIN3CTRL, ICS0);
#define PA3_INT_BOTHEDGES BIT0(PORTA.PIN3CTRL, ISC2); BIT0(PORTA.PIN3CTRL, ICS1); BIT1(PORTA.PIN3CTRL, ICS0);
#define PA3_INT_RISING BIT0(PORTA.PIN3CTRL, ISC2); BIT1(PORTA.PIN3CTRL, ICS1); BIT0(PORTA.PIN3CTRL, ICS0);
#define PA3_INT_FALLING BIT0(PORTA.PIN3CTRL, ISC2); BIT1(PORTA.PIN3CTRL, ICS1); BIT1(PORTA.PIN3CTRL, ICS0);
#define PA3_INT_INPUT_DISABLE BIT1(PORTA.PIN3CTRL, ISC2); BIT0(PORTA.PIN3CTRL, ICS1); BIT0(PORTA.PIN3CTRL, ICS0);
#define PA3_INT_LEVEL BIT1(PORTA.PIN3CTRL, ISC2); BIT0(PORTA.PIN3CTRL, ICS1); BIT1(PORTA.PIN3CTRL, ICS0);
// PA4 setup
#define PA4_MODE_INVERTED BIT1(PORTA.PIN4CTRL, INVEN)
#define PA4_MODE_NON_INVERTED BIT0(PORTA.PIN4CTRL, INVEN)
#define PA4_PULLUP_ON BIT1(PORTA.PIN4CTRL, PULLUPEN)
#define PA4_PULLUP_OFF BIT0(PORTA.PIN4CTRL, PULLUPEN)
#define PA4_INT_OFF BIT0(PORTA.PIN4CTRL, ISC2); BIT0(PORTA.PIN4CTRL, ICS1); BIT0(PORTA.PIN4CTRL, ICS0);
#define PA4_INT_BOTHEDGES BIT0(PORTA.PIN4CTRL, ISC2); BIT0(PORTA.PIN4CTRL, ICS1); BIT1(PORTA.PIN4CTRL, ICS0);
#define PA4_INT_RISING BIT0(PORTA.PIN4CTRL, ISC2); BIT1(PORTA.PIN4CTRL, ICS1); BIT0(PORTA.PIN4CTRL, ICS0);
#define PA4_INT_FALLING BIT0(PORTA.PIN4CTRL, ISC2); BIT1(PORTA.PIN4CTRL, ICS1); BIT1(PORTA.PIN4CTRL, ICS0);
#define PA4_INT_INPUT_DISABLE BIT1(PORTA.PIN4CTRL, ISC2); BIT0(PORTA.PIN4CTRL, ICS1); BIT0(PORTA.PIN4CTRL, ICS0);
#define PA4_INT_LEVEL BIT1(PORTA.PIN4CTRL, ISC2); BIT0(PORTA.PIN4CTRL, ICS1); BIT1(PORTA.PIN4CTRL, ICS0);
// PA5 setup
#define PA5_MODE_INVERTED BIT1(PORTA.PIN5CTRL, INVEN)
#define PA5_MODE_NON_INVERTED BIT0(PORTA.PIN5CTRL, INVEN)
#define PA5_PULLUP_ON BIT1(PORTA.PIN5CTRL, PULLUPEN)
#define PA5_PULLUP_OFF BIT0(PORTA.PIN5CTRL, PULLUPEN)
#define PA5_INT_OFF BIT0(PORTA.PIN5CTRL, ISC2); BIT0(PORTA.PIN5CTRL, ICS1); BIT0(PORTA.PIN5CTRL, ICS0);
#define PA5_INT_BOTHEDGES BIT0(PORTA.PIN5CTRL, ISC2); BIT0(PORTA.PIN5CTRL, ICS1); BIT1(PORTA.PIN5CTRL, ICS0);
#define PA5_INT_RISING BIT0(PORTA.PIN5CTRL, ISC2); BIT1(PORTA.PIN5CTRL, ICS1); BIT0(PORTA.PIN5CTRL, ICS0);
#define PA5_INT_FALLING BIT0(PORTA.PIN5CTRL, ISC2); BIT1(PORTA.PIN5CTRL, ICS1); BIT1(PORTA.PIN5CTRL, ICS0);
#define PA5_INT_INPUT_DISABLE BIT1(PORTA.PIN5CTRL, ISC2); BIT0(PORTA.PIN5CTRL, ICS1); BIT0(PORTA.PIN5CTRL, ICS0);
#define PA5_INT_LEVEL BIT1(PORTA.PIN5CTRL, ISC2); BIT0(PORTA.PIN5CTRL, ICS1); BIT1(PORTA.PIN5CTRL, ICS0);
// PA6 setup
#define PA6_MODE_INVERTED BIT1(PORTA.PIN6CTRL, INVEN)
#define PA6_MODE_NON_INVERTED BIT0(PORTA.PIN6CTRL, INVEN)
#define PA6_PULLUP_ON BIT1(PORTA.PIN6CTRL, PULLUPEN)
#define PA6_PULLUP_OFF BIT0(PORTA.PIN6CTRL, PULLUPEN)
#define PA6_INT_OFF BIT0(PORTA.PIN6CTRL, ISC2); BIT0(PORTA.PIN6CTRL, ICS1); BIT0(PORTA.PIN6CTRL, ICS0);
#define PA6_INT_BOTHEDGES BIT0(PORTA.PIN6CTRL, ISC2); BIT0(PORTA.PIN6CTRL, ICS1); BIT1(PORTA.PIN6CTRL, ICS0);
#define PA6_INT_RISING BIT0(PORTA.PIN6CTRL, ISC2); BIT1(PORTA.PIN6CTRL, ICS1); BIT0(PORTA.PIN6CTRL, ICS0);
#define PA6_INT_FALLING BIT0(PORTA.PIN6CTRL, ISC2); BIT1(PORTA.PIN6CTRL, ICS1); BIT1(PORTA.PIN6CTRL, ICS0);
#define PA6_INT_INPUT_DISABLE BIT1(PORTA.PIN6CTRL, ISC2); BIT0(PORTA.PIN6CTRL, ICS1); BIT0(PORTA.PIN6CTRL, ICS0);
#define PA6_INT_LEVEL BIT1(PORTA.PIN6CTRL, ISC2); BIT0(PORTA.PIN6CTRL, ICS1); BIT1(PORTA.PIN6CTRL, ICS0);
// PA7 setup
#define PA7_MODE_INVERTED BIT1(PORTA.PIN7CTRL, INVEN)
#define PA7_MODE_NON_INVERTED BIT0(PORTA.PIN7CTRL, INVEN)
#define PA7_PULLUP_ON BIT1(PORTA.PIN7CTRL, PULLUPEN)
#define PA7_PULLUP_OFF BIT0(PORTA.PIN7CTRL, PULLUPEN)
#define PA7_INT_OFF BIT0(PORTA.PIN7CTRL, ISC2); BIT0(PORTA.PIN7CTRL, ICS1); BIT0(PORTA.PIN7CTRL, ICS0);
#define PA7_INT_BOTHEDGES BIT0(PORTA.PIN7CTRL, ISC2); BIT0(PORTA.PIN7CTRL, ICS1); BIT1(PORTA.PIN7CTRL, ICS0);
#define PA7_INT_RISING BIT0(PORTA.PIN7CTRL, ISC2); BIT1(PORTA.PIN7CTRL, ICS1); BIT0(PORTA.PIN7CTRL, ICS0);
#define PA7_INT_FALLING BIT0(PORTA.PIN7CTRL, ISC2); BIT1(PORTA.PIN7CTRL, ICS1); BIT1(PORTA.PIN7CTRL, ICS0);
#define PA7_INT_INPUT_DISABLE BIT1(PORTA.PIN7CTRL, ISC2); BIT0(PORTA.PIN7CTRL, ICS1); BIT0(PORTA.PIN7CTRL, ICS0);
#define PA7_INT_LEVEL BIT1(PORTA.PIN7CTRL, ISC2); BIT0(PORTA.PIN7CTRL, ICS1); BIT1(PORTA.PIN7CTRL, ICS0);
repeat for as many ports as necessary.