GPIO_PIN_TO_OFFSET
return omgpio_pin_read(sc, GPIO_PIN_TO_OFFSET(gpio));
omgpio_pin_write(sc, GPIO_PIN_TO_OFFSET(gpio), GPIO_PIN_HIGH);
omgpio_pin_write(sc, GPIO_PIN_TO_OFFSET(gpio), GPIO_PIN_LOW);
omgpio_pin_dir_write(sc, GPIO_PIN_TO_OFFSET(gpio), dir);
return (reg >> GPIO_PIN_TO_OFFSET(pin)) & 0x1;
1 << GPIO_PIN_TO_OFFSET(pin));
1 << GPIO_PIN_TO_OFFSET(pin));
reg |= 1 << GPIO_PIN_TO_OFFSET(gpio);
reg &= ~(1 << GPIO_PIN_TO_OFFSET(gpio));
if (reg & (1 << GPIO_PIN_TO_OFFSET(gpio)))
WRITE4(sc, sc->sc_regs.irqstatus0, 1 << GPIO_PIN_TO_OFFSET(gpio));
WRITE4(sc, sc->sc_regs.irqstatus_clear0, 1 << GPIO_PIN_TO_OFFSET(gpio));
WRITE4(sc, sc->sc_regs.irqstatus_set0, 1 << GPIO_PIN_TO_OFFSET(gpio));
bit = 1 << GPIO_PIN_TO_OFFSET(gpio);
if (sc->sc_handlers[GPIO_PIN_TO_OFFSET(gpio)] != NULL)
gpio, sc->sc_handlers[GPIO_PIN_TO_OFFSET(gpio)]->ih_name,
sc->sc_handlers[GPIO_PIN_TO_OFFSET(gpio)] = ih;
ih = sc->sc_handlers[GPIO_PIN_TO_OFFSET(gpio)];
sc->sc_handlers[GPIO_PIN_TO_OFFSET(gpio)] = NULL;