| 1014 | } |
| 1015 | |
| 1016 | static uint32_t |
| 1017 | mv_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 | |
| 1038 | static void |
| 1039 | mv_gpio_value_set(device_t dev, uint32_t pin, uint8_t val) |
no test coverage detected