Lines Matching refs:pin

35  * available as a GPIO pin.  Pins 64-127 are sent to the PL (FPGA) section of
125 /* Get a specific pin's capabilities. */
127 zy7_gpio_pin_getcaps(device_t dev, uint32_t pin, uint32_t *caps)
130 if (!VALID_PIN(pin))
138 /* Get a specific pin's name. */
140 zy7_gpio_pin_getname(device_t dev, uint32_t pin, char *name)
143 if (!VALID_PIN(pin))
146 if (pin < NUM_MIO_PINS) {
147 snprintf(name, GPIOMAXNAME, "MIO_%d", pin);
150 snprintf(name, GPIOMAXNAME, "EMIO_%d", pin - EMIO_PIN);
157 /* Get a specific pin's current in/out/tri state. */
159 zy7_gpio_pin_getflags(device_t dev, uint32_t pin, uint32_t *flags)
163 if (!VALID_PIN(pin))
168 if ((RD4(sc, ZY7_GPIO_DIRM(pin >> 5)) & (1 << (pin & 31))) != 0) {
170 if ((RD4(sc, ZY7_GPIO_OEN(pin >> 5)) & (1 << (pin & 31))) == 0)
183 /* Set a specific pin's in/out/tri state. */
185 zy7_gpio_pin_setflags(device_t dev, uint32_t pin, uint32_t flags)
189 if (!VALID_PIN(pin))
196 WR4(sc, ZY7_GPIO_DIRM(pin >> 5),
197 RD4(sc, ZY7_GPIO_DIRM(pin >> 5)) | (1 << (pin & 31)));
200 WR4(sc, ZY7_GPIO_OEN(pin >> 5),
201 RD4(sc, ZY7_GPIO_OEN(pin >> 5)) &
202 ~(1 << (pin & 31)));
204 WR4(sc, ZY7_GPIO_OEN(pin >> 5),
205 RD4(sc, ZY7_GPIO_OEN(pin >> 5)) |
206 (1 << (pin & 31)));
209 WR4(sc, ZY7_GPIO_DIRM(pin >> 5),
210 RD4(sc, ZY7_GPIO_DIRM(pin >> 5)) & ~(1 << (pin & 31)));
211 WR4(sc, ZY7_GPIO_OEN(pin >> 5),
212 RD4(sc, ZY7_GPIO_OEN(pin >> 5)) & ~(1 << (pin & 31)));
220 /* Set a specific output pin's value. */
222 zy7_gpio_pin_set(device_t dev, uint32_t pin, unsigned int value)
226 if (!VALID_PIN(pin) || value > 1)
230 if ((pin & 16) != 0)
231 WR4(sc, ZY7_GPIO_MASK_DATA_MSW(pin >> 5),
232 (0xffff0000 ^ (0x10000 << (pin & 15))) |
233 (value << (pin & 15)));
235 WR4(sc, ZY7_GPIO_MASK_DATA_LSW(pin >> 5),
236 (0xffff0000 ^ (0x10000 << (pin & 15))) |
237 (value << (pin & 15)));
242 /* Get a specific pin's input value. */
244 zy7_gpio_pin_get(device_t dev, uint32_t pin, unsigned int *value)
248 if (!VALID_PIN(pin))
251 *value = (RD4(sc, ZY7_GPIO_DATA_RO(pin >> 5)) >> (pin & 31)) & 1;
256 /* Toggle a pin's output value. */
258 zy7_gpio_pin_toggle(device_t dev, uint32_t pin)
262 if (!VALID_PIN(pin))
267 WR4(sc, ZY7_GPIO_DATA(pin >> 5),
268 RD4(sc, ZY7_GPIO_DATA(pin >> 5)) ^ (1 << (pin & 31)));