FreeBSD/sys/powerpc/mpc85xx/mpc85xx_gpio.c
/* Toggle a pin's output value. */
Toggle a pin's output value.
Toggle a pin ' s output value .
static int
mpc85xx_gpio_pin_toggle(device_t dev, uint32_t pin)
{
	struct mpc85xx_gpio_softc *sc = device_get_softc(dev);
	uint32_t val;
	if (!VALID_PIN(pin))
		return (EINVAL);
	GPIO_LOCK(sc);
	val = bus_read_4(sc->out_res, 0);
	val ^= (1 << (31 - pin));
	bus_write_4(sc->out_res, 0, val);
	GPIO_UNLOCK(sc);
	return (0);
}
static int mpc85xx_gpio_pin_toggle ( device_t dev , uint32_t pin ) { struct mpc85xx_gpio_softc * sc = device_get_softc ( dev ) ; uint32_t val ; if ( ! VALID_PIN ( pin ) ) return ( EINVAL ) ; GPIO_LOCK ( sc ) ; val = bus_read_4 ( sc -> out_res , 0 ) ; val ^= ( 1 << ( 31 - pin ) ) ; bus_write_4 ( sc -> out_res , 0 , val ) ; GPIO_UNLOCK ( sc ) ; return ( 0 ) ; }
Toggle a pin's output value.
Toggle a pin ' s output value .