FreeBSD/sys/arm/xilinx/zy7_gpio.c
/* Set a specific output pin's value. */
Set a specific output pin's value.
Set a specific output pin ' s value .
static int
zy7_gpio_pin_set(device_t dev, uint32_t pin, unsigned int value)
{
	struct zy7_gpio_softc *sc = device_get_softc(dev);
	if (!VALID_PIN(pin) || value > 1)
		return (EINVAL);
	if ((pin & 16) != 0)
		WR4(sc, ZY7_GPIO_MASK_DATA_MSW(pin >> 5),
		    (0xffff0000 ^ (0x10000 << (pin & 15))) |
		    (value << (pin & 15)));
	else
		WR4(sc, ZY7_GPIO_MASK_DATA_LSW(pin >> 5),
		    (0xffff0000 ^ (0x10000 << (pin & 15))) |
		    (value << (pin & 15)));
	return (0);
}
static int zy7_gpio_pin_set ( device_t dev , uint32_t pin , unsigned int value ) { struct zy7_gpio_softc * sc = device_get_softc ( dev ) ; if ( ! VALID_PIN ( pin ) || value > 1 ) return ( EINVAL ) ; if ( ( pin & 16 ) != 0 ) WR4 ( sc , ZY7_GPIO_MASK_DATA_MSW ( pin >> 5 ) , ( 0xffff0000 ^ ( 0x10000 << ( pin & 15 ) ) ) | ( value << ( pin & 15 ) ) ) ; else WR4 ( sc , ZY7_GPIO_MASK_DATA_LSW ( pin >> 5 ) , ( 0xffff0000 ^ ( 0x10000 << ( pin & 15 ) ) ) | ( value << ( pin & 15 ) ) ) ; return ( 0 ) ; }
Set a specific output pin's value.
Set a specific output pin ' s value .
/* Fancy register tricks allow atomic set or reset. */