Lines Matching +full:16 +full:- +full:pin

4  * SPDX-License-Identifier: Apache-2.0
16 #include <zephyr/dt-bindings/gpio/numicro-gpio.h>
19 #define MODE_PIN_SHIFT(pin) ((pin) * 2) argument
20 #define MODE_MASK(pin) (3 << MODE_PIN_SHIFT(pin)) argument
21 #define DINOFF_PIN_SHIFT(pin) ((pin) + 16) argument
22 #define DINOFF_MASK(pin) (1 << DINOFF_PIN_SHIFT(pin)) argument
23 #define PUSEL_PIN_SHIFT(pin) ((pin) * 2) argument
24 #define PUSEL_MASK(pin) (3 << PUSEL_PIN_SHIFT(pin)) argument
50 gpio_pin_t pin, gpio_flags_t flags) in gpio_numicro_configure() argument
52 const struct gpio_numicro_config *cfg = dev->config; in gpio_numicro_configure()
53 GPIO_T * const regs = cfg->regs; in gpio_numicro_configure()
61 /* Pin mode */ in gpio_numicro_configure()
70 return -ENOTSUP; in gpio_numicro_configure()
103 regs->MODE = (regs->MODE & ~MODE_MASK(pin)) | in gpio_numicro_configure()
104 (mode << MODE_PIN_SHIFT(pin)); in gpio_numicro_configure()
105 regs->DBEN = (regs->DBEN & ~BIT(pin)) | (debounce_enable << pin); in gpio_numicro_configure()
106 regs->SMTEN = (regs->SMTEN & ~BIT(pin)) | (schmitt_enable << pin); in gpio_numicro_configure()
107 regs->DINOFF = (regs->DINOFF & ~DINOFF_MASK(pin)) | in gpio_numicro_configure()
108 (disable_input_path << DINOFF_PIN_SHIFT(pin)); in gpio_numicro_configure()
109 regs->PUSEL = (regs->PUSEL & ~PUSEL_MASK(pin)) | in gpio_numicro_configure()
110 (bias << PUSEL_PIN_SHIFT(pin)); in gpio_numicro_configure()
117 const struct gpio_numicro_config *cfg = dev->config; in gpio_numicro_port_get_raw()
119 *value = cfg->regs->PIN & PORT_PIN_MASK; in gpio_numicro_port_get_raw()
128 const struct gpio_numicro_config *cfg = dev->config; in gpio_numicro_port_set_masked_raw()
130 cfg->regs->DATMSK = ~mask; in gpio_numicro_port_set_masked_raw()
131 cfg->regs->DOUT = value; in gpio_numicro_port_set_masked_raw()
139 const struct gpio_numicro_config *cfg = dev->config; in gpio_numicro_port_set_bits_raw()
141 cfg->regs->DATMSK = ~mask; in gpio_numicro_port_set_bits_raw()
142 cfg->regs->DOUT = PORT_PIN_MASK; in gpio_numicro_port_set_bits_raw()
150 const struct gpio_numicro_config *cfg = dev->config; in gpio_numicro_port_clear_bits_raw()
152 cfg->regs->DATMSK = ~mask; in gpio_numicro_port_clear_bits_raw()
153 cfg->regs->DOUT = 0; in gpio_numicro_port_clear_bits_raw()
160 const struct gpio_numicro_config *cfg = dev->config; in gpio_numicro_port_toggle_bits()
162 cfg->regs->DATMSK = 0; in gpio_numicro_port_toggle_bits()
163 cfg->regs->DOUT ^= mask; in gpio_numicro_port_toggle_bits()
169 gpio_pin_t pin, enum gpio_int_mode mode, in gpio_numicro_pin_interrupt_configure() argument
172 const struct gpio_numicro_config *cfg = dev->config; in gpio_numicro_pin_interrupt_configure()
174 struct gpio_numicro_data *data = dev->data; in gpio_numicro_pin_interrupt_configure()
178 uint32_t int_level_mask = BIT(pin) | BIT(pin + 16); in gpio_numicro_pin_interrupt_configure()
182 cfg->regs->INTEN &= ~(BIT(pin) | BIT(pin + 16)); in gpio_numicro_pin_interrupt_configure()
185 cfg->regs->INTEN |= data->interrupt_en_reg_bak & (BIT(pin) | BIT(pin + 16)); in gpio_numicro_pin_interrupt_configure()
195 int_level = BIT(pin); in gpio_numicro_pin_interrupt_configure()
198 int_level = BIT(pin + 16); in gpio_numicro_pin_interrupt_configure()
201 int_level = BIT(pin) | BIT(pin + 16); in gpio_numicro_pin_interrupt_configure()
206 cfg->regs->INTTYPE = (cfg->regs->INTTYPE & ~BIT(pin)) | (int_type << pin); in gpio_numicro_pin_interrupt_configure()
207 cfg->regs->INTEN = (cfg->regs->INTEN & ~int_level_mask) | int_level; in gpio_numicro_pin_interrupt_configure()
209 data->interrupt_en_reg_bak = cfg->regs->INTEN; in gpio_numicro_pin_interrupt_configure()
219 struct gpio_numicro_data *data = dev->data; in gpio_numicro_manage_callback()
221 return gpio_manage_callback(&data->callbacks, callback, set); in gpio_numicro_manage_callback()
226 const struct gpio_numicro_config *cfg = dev->config; in gpio_numicro_isr()
227 struct gpio_numicro_data *data = dev->data; in gpio_numicro_isr()
230 int_status = cfg->regs->INTSRC; in gpio_numicro_isr()
233 cfg->regs->INTSRC = int_status; in gpio_numicro_isr()
235 gpio_fire_callbacks(&data->callbacks, dev, int_status); in gpio_numicro_isr()