MCPcopy Create free account
hub / github.com/F-Stack/f-stack / mv_gpio_value_get

Function mv_gpio_value_get

freebsd/arm/mv/gpio.c:1016–1036  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1014}
1015
1016static uint32_t
1017mv_gpio_value_get(device_t dev, uint32_t pin, uint8_t exclude_polar)
1018{
1019 uint32_t reg, polar_reg, reg_val, polar_reg_val;
1020 struct mv_gpio_softc *sc;
1021 sc = (struct mv_gpio_softc *)device_get_softc(dev);
1022
1023 if (pin >= sc->pin_num)
1024 return (0);
1025
1026 reg = GPIO_DATA_IN;
1027 polar_reg = GPIO_DATA_IN_POLAR;
1028
1029 reg_val = mv_gpio_reg_read(dev, reg);
1030
1031 if (exclude_polar) {
1032 polar_reg_val = mv_gpio_reg_read(dev, polar_reg);
1033 return ((reg_val & GPIO(pin)) ^ (polar_reg_val & GPIO(pin)));
1034 } else
1035 return (reg_val & GPIO(pin));
1036}
1037
1038static void
1039mv_gpio_value_set(device_t dev, uint32_t pin, uint8_t val)

Callers 4

mv_gpio_double_edge_initFunction · 0.85
mv_gpio_debounce_initFunction · 0.85
mv_gpio_debounceFunction · 0.85
mv_gpio_inFunction · 0.85

Calls 2

device_get_softcFunction · 0.85
mv_gpio_reg_readFunction · 0.85

Tested by

no test coverage detected