Lines Matching +full:pullup +full:- +full:mask

5  * SPDX-License-Identifier: Apache-2.0
13 #include <zephyr/dt-bindings/gpio/nxp-kinetis-gpio.h>
38 const struct gpio_mcux_config *config = dev->config; in gpio_mcux_configure()
39 GPIO_Type *gpio_base = config->gpio_base; in gpio_mcux_configure()
40 PORT_Type *port_base = config->port_base; in gpio_mcux_configure()
41 uint32_t mask = 0U; in gpio_mcux_configure() local
45 if (pin >= ARRAY_SIZE(port_base->PCR)) { in gpio_mcux_configure()
46 return -EINVAL; in gpio_mcux_configure()
50 return -ENOTSUP; in gpio_mcux_configure()
54 return -ENOTSUP; in gpio_mcux_configure()
61 * 0 - pin is input, 1 - pin is output in gpio_mcux_configure()
66 gpio_base->PDDR &= ~BIT(pin); in gpio_mcux_configure()
70 gpio_base->PSOR = BIT(pin); in gpio_mcux_configure()
72 gpio_base->PCOR = BIT(pin); in gpio_mcux_configure()
74 gpio_base->PDDR |= BIT(pin); in gpio_mcux_configure()
77 return -ENOTSUP; in gpio_mcux_configure()
81 mask |= PORT_PCR_MUX_MASK; in gpio_mcux_configure()
89 /* Now do the PORT module. Figure out the pullup/pulldown in gpio_mcux_configure()
92 mask |= PORT_PCR_PE_MASK | PORT_PCR_PS_MASK; in gpio_mcux_configure()
95 /* Enable the pull and select the pullup resistor. */ in gpio_mcux_configure()
100 * the pullup resistor. in gpio_mcux_configure()
110 mask |= PORT_PCR_DSE_MASK; in gpio_mcux_configure()
117 return -ENOTSUP; in gpio_mcux_configure()
122 port_base->PCR[pin] = (port_base->PCR[pin] & ~mask) | pcr; in gpio_mcux_configure()
129 const struct gpio_mcux_config *config = dev->config; in gpio_mcux_port_get_raw()
130 GPIO_Type *gpio_base = config->gpio_base; in gpio_mcux_port_get_raw()
132 *value = gpio_base->PDIR; in gpio_mcux_port_get_raw()
138 uint32_t mask, in gpio_mcux_port_set_masked_raw() argument
141 const struct gpio_mcux_config *config = dev->config; in gpio_mcux_port_set_masked_raw()
142 GPIO_Type *gpio_base = config->gpio_base; in gpio_mcux_port_set_masked_raw()
144 gpio_base->PDOR = (gpio_base->PDOR & ~mask) | (mask & value); in gpio_mcux_port_set_masked_raw()
150 uint32_t mask) in gpio_mcux_port_set_bits_raw() argument
152 const struct gpio_mcux_config *config = dev->config; in gpio_mcux_port_set_bits_raw()
153 GPIO_Type *gpio_base = config->gpio_base; in gpio_mcux_port_set_bits_raw()
155 gpio_base->PSOR = mask; in gpio_mcux_port_set_bits_raw()
161 uint32_t mask) in gpio_mcux_port_clear_bits_raw() argument
163 const struct gpio_mcux_config *config = dev->config; in gpio_mcux_port_clear_bits_raw()
164 GPIO_Type *gpio_base = config->gpio_base; in gpio_mcux_port_clear_bits_raw()
166 gpio_base->PCOR = mask; in gpio_mcux_port_clear_bits_raw()
171 static int gpio_mcux_port_toggle_bits(const struct device *dev, uint32_t mask) in gpio_mcux_port_toggle_bits() argument
173 const struct gpio_mcux_config *config = dev->config; in gpio_mcux_port_toggle_bits()
174 GPIO_Type *gpio_base = config->gpio_base; in gpio_mcux_port_toggle_bits()
176 gpio_base->PTOR = mask; in gpio_mcux_port_toggle_bits()
219 const struct gpio_mcux_config *config = dev->config; in gpio_mcux_pin_interrupt_configure()
220 GPIO_Type *gpio_base = config->gpio_base; in gpio_mcux_pin_interrupt_configure()
221 PORT_Type *port_base = config->port_base; in gpio_mcux_pin_interrupt_configure()
224 if (pin >= ARRAY_SIZE(port_base->PCR)) { in gpio_mcux_pin_interrupt_configure()
225 return -EINVAL; in gpio_mcux_pin_interrupt_configure()
230 ((gpio_base->PDDR & BIT(pin)) != 0)) { in gpio_mcux_pin_interrupt_configure()
231 return -EINVAL; in gpio_mcux_pin_interrupt_configure()
236 ((config->flags & GPIO_INT_ENABLE) == 0U)) { in gpio_mcux_pin_interrupt_configure()
237 return -ENOTSUP; in gpio_mcux_pin_interrupt_configure()
242 port_base->PCR[pin] = (port_base->PCR[pin] & ~PORT_PCR_IRQC_MASK) | pcr; in gpio_mcux_pin_interrupt_configure()
250 struct gpio_mcux_data *data = dev->data; in gpio_mcux_manage_callback()
252 return gpio_manage_callback(&data->callbacks, callback, set); in gpio_mcux_manage_callback()
257 const struct gpio_mcux_config *config = dev->config; in gpio_mcux_port_isr()
258 struct gpio_mcux_data *data = dev->data; in gpio_mcux_port_isr()
261 int_status = config->port_base->ISFR; in gpio_mcux_port_isr()
264 config->port_base->ISFR = int_status; in gpio_mcux_port_isr()
266 gpio_fire_callbacks(&data->callbacks, dev, int_status); in gpio_mcux_port_isr()
273 const struct gpio_mcux_config *config = dev->config; in gpio_mcux_port_get_direction()
274 GPIO_Type *gpio_base = config->gpio_base; in gpio_mcux_port_get_direction()
276 map &= config->common.port_pin_mask; in gpio_mcux_port_get_direction()
279 *inputs = map & (~gpio_base->PDDR); in gpio_mcux_port_get_direction()
283 *outputs = map & gpio_base->PDDR; in gpio_mcux_port_get_direction()