Lines Matching +full:16 +full:- +full:pin
4 * SPDX-License-Identifier: Apache-2.0
13 #include <zephyr/dt-bindings/gpio/infineon-xmc4xxx-gpio.h>
42 return -ENOTSUP; in gpio_xmc4xxx_convert_flags()
46 return -ENOTSUP; in gpio_xmc4xxx_convert_flags()
50 pin_config->mode = XMC_GPIO_MODE_INPUT_TRISTATE; in gpio_xmc4xxx_convert_flags()
52 pin_config->mode = XMC_GPIO_MODE_INPUT_PULL_DOWN; in gpio_xmc4xxx_convert_flags()
55 pin_config->mode = XMC_GPIO_MODE_INPUT_PULL_UP; in gpio_xmc4xxx_convert_flags()
61 return -EINVAL; in gpio_xmc4xxx_convert_flags()
65 pin_config->mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL; in gpio_xmc4xxx_convert_flags()
67 pin_config->mode = XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN; in gpio_xmc4xxx_convert_flags()
70 pin_config->output_level = XMC_GPIO_OUTPUT_LEVEL_LOW; in gpio_xmc4xxx_convert_flags()
73 pin_config->output_level = XMC_GPIO_OUTPUT_LEVEL_HIGH; in gpio_xmc4xxx_convert_flags()
76 pin_config->output_strength = XMC_GPIO_OUTPUT_STRENGTH_STRONG_MEDIUM_EDGE; in gpio_xmc4xxx_convert_flags()
78 pin_config->output_strength = ds - 1; in gpio_xmc4xxx_convert_flags()
85 static int gpio_xmc4xxx_pin_configure(const struct device *dev, gpio_pin_t pin, gpio_flags_t flags) in gpio_xmc4xxx_pin_configure() argument
87 const struct gpio_xmc4xxx_config *config = dev->config; in gpio_xmc4xxx_pin_configure()
88 XMC_GPIO_PORT_t *port = config->port; in gpio_xmc4xxx_pin_configure()
90 gpio_port_pins_t pin_mask = config->common.port_pin_mask; in gpio_xmc4xxx_pin_configure()
93 if ((BIT(pin) & pin_mask) == 0) { in gpio_xmc4xxx_pin_configure()
94 return -EINVAL; in gpio_xmc4xxx_pin_configure()
99 return -EINVAL; in gpio_xmc4xxx_pin_configure()
107 XMC_GPIO_Init(port, pin, &pin_config); in gpio_xmc4xxx_pin_configure()
112 static void gpio_xmc4xxx_isr(const struct device *dev, int pin) in gpio_xmc4xxx_isr() argument
114 struct gpio_xmc4xxx_data *data = dev->data; in gpio_xmc4xxx_isr()
116 gpio_fire_callbacks(&data->callbacks, dev, BIT(pin)); in gpio_xmc4xxx_isr()
121 static int gpio_xmc4xxx_pin_interrupt_configure(const struct device *dev, gpio_pin_t pin, in gpio_xmc4xxx_pin_interrupt_configure() argument
124 const struct gpio_xmc4xxx_config *config = dev->config; in gpio_xmc4xxx_pin_interrupt_configure()
125 int port_id = PORT_TO_PORT_ID(config->port); in gpio_xmc4xxx_pin_interrupt_configure()
128 return intc_xmc4xxx_gpio_enable_interrupt(port_id, pin, mode, trig, in gpio_xmc4xxx_pin_interrupt_configure()
131 return intc_xmc4xxx_gpio_disable_interrupt(port_id, pin); in gpio_xmc4xxx_pin_interrupt_configure()
133 return -EINVAL; in gpio_xmc4xxx_pin_interrupt_configure()
140 const struct gpio_xmc4xxx_config *config = dev->config; in gpio_xmc4xxx_get_raw()
141 XMC_GPIO_PORT_t *port = config->port; in gpio_xmc4xxx_get_raw()
142 gpio_port_pins_t pin_mask = config->common.port_pin_mask; in gpio_xmc4xxx_get_raw()
144 *value = port->IN & pin_mask; in gpio_xmc4xxx_get_raw()
152 struct gpio_xmc4xxx_data *data = dev->data; in gpio_xmc4xxx_manage_callback()
154 return gpio_manage_callback(&data->callbacks, callback, set); in gpio_xmc4xxx_manage_callback()
161 const struct gpio_xmc4xxx_config *config = dev->config; in gpio_xmc4xxx_set_masked_raw()
162 XMC_GPIO_PORT_t *port = config->port; in gpio_xmc4xxx_set_masked_raw()
163 gpio_port_pins_t pin_mask = config->common.port_pin_mask; in gpio_xmc4xxx_set_masked_raw()
167 /* OMR - output modification register. Upper 16 bits is used to clear pins */ in gpio_xmc4xxx_set_masked_raw()
168 port->OMR = (value & mask) | (~value & mask) << 16; in gpio_xmc4xxx_set_masked_raw()
174 const struct gpio_xmc4xxx_config *config = dev->config; in gpio_xmc4xxx_set_bits_raw()
175 XMC_GPIO_PORT_t *port = config->port; in gpio_xmc4xxx_set_bits_raw()
176 gpio_port_pins_t pin_mask = config->common.port_pin_mask; in gpio_xmc4xxx_set_bits_raw()
178 port->OMR = pins & pin_mask; in gpio_xmc4xxx_set_bits_raw()
184 const struct gpio_xmc4xxx_config *config = dev->config; in gpio_xmc4xxx_clear_bits_raw()
185 XMC_GPIO_PORT_t *port = config->port; in gpio_xmc4xxx_clear_bits_raw()
187 port->OMR = pins << 16; in gpio_xmc4xxx_clear_bits_raw()
193 const struct gpio_xmc4xxx_config *config = dev->config; in gpio_xmc4xxx_toggle_bits()
194 XMC_GPIO_PORT_t *port = config->port; in gpio_xmc4xxx_toggle_bits()
195 gpio_port_pins_t pin_mask = config->common.port_pin_mask; in gpio_xmc4xxx_toggle_bits()
198 port->OMR = pins | pins << 16; in gpio_xmc4xxx_toggle_bits()