MPFGPIO_GPIN
val = (HREAD4(sc, MPFGPIO_GPIN) >> pin) & 1;
state = (HREAD4(sc, MPFGPIO_GPIN) >> pin) & 1;