Lines Matching +full:reg +full:- +full:rc
5 * SPDX-License-Identifier: Apache-2.0
13 #include <zephyr/dt-bindings/gpio/atmel-sam0-gpio.h>
47 gpio_fire_callbacks(&data->callbacks, data->dev, pins); in gpio_sam0_isr()
54 const struct gpio_sam0_config *config = dev->config; in gpio_sam0_config()
55 struct gpio_sam0_data *data = dev->data; in gpio_sam0_config()
56 PortGroup *regs = config->regs; in gpio_sam0_config()
58 .reg = 0, in gpio_sam0_config()
62 return -ENOTSUP; in gpio_sam0_config()
72 return -ENOTSUP; in gpio_sam0_config()
76 regs->OUTCLR.reg = BIT(pin); in gpio_sam0_config()
78 regs->OUTSET.reg = BIT(pin); in gpio_sam0_config()
80 regs->DIRSET.reg = BIT(pin); in gpio_sam0_config()
83 regs->DIRCLR.reg = BIT(pin); in gpio_sam0_config()
89 regs->OUTSET.reg = BIT(pin); in gpio_sam0_config()
91 regs->OUTCLR.reg = BIT(pin); in gpio_sam0_config()
97 WRITE_BIT(data->debounce, pin, in gpio_sam0_config()
101 /* Write the now-built pin configuration */ in gpio_sam0_config()
102 regs->PINCFG[pin] = pincfg; in gpio_sam0_config()
110 const struct gpio_sam0_config *config = dev->config; in gpio_sam0_port_get_raw()
112 *value = config->regs->IN.reg; in gpio_sam0_port_get_raw()
121 const struct gpio_sam0_config *config = dev->config; in gpio_sam0_port_set_masked_raw()
122 uint32_t out = config->regs->OUT.reg; in gpio_sam0_port_set_masked_raw()
124 config->regs->OUT.reg = (out & ~mask) | (value & mask); in gpio_sam0_port_set_masked_raw()
132 const struct gpio_sam0_config *config = dev->config; in gpio_sam0_port_set_bits_raw()
134 config->regs->OUTSET.reg = pins; in gpio_sam0_port_set_bits_raw()
142 const struct gpio_sam0_config *config = dev->config; in gpio_sam0_port_clear_bits_raw()
144 config->regs->OUTCLR.reg = pins; in gpio_sam0_port_clear_bits_raw()
152 const struct gpio_sam0_config *config = dev->config; in gpio_sam0_port_toggle_bits()
154 config->regs->OUTTGL.reg = pins; in gpio_sam0_port_toggle_bits()
166 const struct gpio_sam0_config *config = dev->config; in gpio_sam0_pin_interrupt_configure()
167 struct gpio_sam0_data *const data = dev->data; in gpio_sam0_pin_interrupt_configure()
168 PortGroup *regs = config->regs; in gpio_sam0_pin_interrupt_configure()
170 .reg = regs->PINCFG[pin].reg, in gpio_sam0_pin_interrupt_configure()
173 int rc = 0; in gpio_sam0_pin_interrupt_configure() local
175 data->dev = dev; in gpio_sam0_pin_interrupt_configure()
180 rc = sam0_eic_disable_interrupt(config->id, pin); in gpio_sam0_pin_interrupt_configure()
181 if (rc == -EBUSY) { in gpio_sam0_pin_interrupt_configure()
183 rc = 0; in gpio_sam0_pin_interrupt_configure()
185 if (rc == 0) { in gpio_sam0_pin_interrupt_configure()
186 rc = sam0_eic_release(config->id, pin); in gpio_sam0_pin_interrupt_configure()
196 * the pin is configured as input-only. in gpio_sam0_pin_interrupt_configure()
199 || ((regs->DIR.reg & BIT(pin)) != 0)) { in gpio_sam0_pin_interrupt_configure()
200 rc = -ENOTSUP; in gpio_sam0_pin_interrupt_configure()
207 regs->PMUX[pin / 2U].bit.PMUXO = PORT_PMUX_PMUXE_A_Val; in gpio_sam0_pin_interrupt_configure()
209 regs->PMUX[pin / 2U].bit.PMUXE = PORT_PMUX_PMUXE_A_Val; in gpio_sam0_pin_interrupt_configure()
227 rc = -EINVAL; in gpio_sam0_pin_interrupt_configure()
231 if (rc == 0) { in gpio_sam0_pin_interrupt_configure()
232 rc = sam0_eic_acquire(config->id, pin, trigger, in gpio_sam0_pin_interrupt_configure()
233 (data->debounce & BIT(pin)) != 0, in gpio_sam0_pin_interrupt_configure()
236 if (rc == 0) { in gpio_sam0_pin_interrupt_configure()
237 rc = sam0_eic_enable_interrupt(config->id, pin); in gpio_sam0_pin_interrupt_configure()
242 rc = -EINVAL; in gpio_sam0_pin_interrupt_configure()
246 if (rc == 0) { in gpio_sam0_pin_interrupt_configure()
248 regs->PINCFG[pin] = pincfg; in gpio_sam0_pin_interrupt_configure()
251 return rc; in gpio_sam0_pin_interrupt_configure()
258 struct gpio_sam0_data *const data = dev->data; in gpio_sam0_manage_callback()
260 return gpio_manage_callback(&data->callbacks, callback, set); in gpio_sam0_manage_callback()
265 const struct gpio_sam0_config *config = dev->config; in gpio_sam0_get_pending_int()
267 return sam0_eic_interrupt_pending(config->id); in gpio_sam0_get_pending_int()