Lines Matching +full:gpio +full:- +full:n
4 * SPDX-License-Identifier: Apache-2.0
11 #include <zephyr/drivers/gpio.h>
23 #undef __GPIO_H__ /* Zephyr and CC32XX SDK gpio.h conflict */
24 #include <driverlib/gpio.h>
29 #include <zephyr/drivers/gpio/gpio_utils.h>
50 /* base address of GPIO port */
52 /* GPIO port number */
72 const struct gpio_cc32xx_config *gpio_config = port->config; in gpio_cc32xx_config()
73 unsigned long port_base = gpio_config->port_base; in gpio_cc32xx_config()
76 return -ENOTSUP; in gpio_cc32xx_config()
80 return -ENOTSUP; in gpio_cc32xx_config()
84 return -ENOTSUP; in gpio_cc32xx_config()
87 MAP_PinTypeGPIO(pinTable[gpio_config->port_num * 8 + pin], in gpio_cc32xx_config()
106 const struct gpio_cc32xx_config *gpio_config = port->config; in gpio_cc32xx_port_get_raw()
107 unsigned long port_base = gpio_config->port_base; in gpio_cc32xx_port_get_raw()
119 const struct gpio_cc32xx_config *gpio_config = port->config; in gpio_cc32xx_port_set_masked_raw()
120 unsigned long port_base = gpio_config->port_base; in gpio_cc32xx_port_set_masked_raw()
130 const struct gpio_cc32xx_config *gpio_config = port->config; in gpio_cc32xx_port_set_bits_raw()
131 unsigned long port_base = gpio_config->port_base; in gpio_cc32xx_port_set_bits_raw()
141 const struct gpio_cc32xx_config *gpio_config = port->config; in gpio_cc32xx_port_clear_bits_raw()
142 unsigned long port_base = gpio_config->port_base; in gpio_cc32xx_port_clear_bits_raw()
152 const struct gpio_cc32xx_config *gpio_config = port->config; in gpio_cc32xx_port_toggle_bits()
153 unsigned long port_base = gpio_config->port_base; in gpio_cc32xx_port_toggle_bits()
169 const struct gpio_cc32xx_config *gpio_config = port->config; in gpio_cc32xx_pin_interrupt_configure()
170 unsigned long port_base = gpio_config->port_base; in gpio_cc32xx_pin_interrupt_configure()
173 __ASSERT(pin < 8, "Invalid pin number - only 8 pins per port"); in gpio_cc32xx_pin_interrupt_configure()
178 * to level-based in gpio_cc32xx_pin_interrupt_configure()
211 struct gpio_cc32xx_data *data = dev->data; in gpio_cc32xx_manage_callback()
213 return gpio_manage_callback(&data->callbacks, callback, set); in gpio_cc32xx_manage_callback()
218 const struct gpio_cc32xx_config *config = dev->config; in gpio_cc32xx_port_isr()
219 struct gpio_cc32xx_data *data = dev->data; in gpio_cc32xx_port_isr()
223 int_status = (uint32_t)MAP_GPIOIntStatus(config->port_base, 1); in gpio_cc32xx_port_isr()
225 /* Clear GPIO Interrupt */ in gpio_cc32xx_port_isr()
226 MAP_GPIOIntClear(config->port_base, int_status); in gpio_cc32xx_port_isr()
229 gpio_fire_callbacks(&data->callbacks, dev, int_status); in gpio_cc32xx_port_isr()
232 static DEVICE_API(gpio, api_funcs) = {
243 #define GPIO_CC32XX_INIT_FUNC(n) \ argument
244 static int gpio_cc32xx_a##n##_init(const struct device *dev) \
248 IRQ_CONNECT(DT_INST_IRQN(n), DT_INST_IRQ(n, priority), \
249 gpio_cc32xx_port_isr, DEVICE_DT_INST_GET(n), \
252 MAP_IntPendClear(DT_INST_IRQN(n) + 16); \
253 irq_enable(DT_INST_IRQN(n)); \
258 #define GPIO_CC32XX_DEVICE_INIT(n) \ argument
259 DEVICE_DT_INST_DEFINE(n, gpio_cc32xx_a##n##_init, \
260 NULL, &gpio_cc32xx_a##n##_data, \
261 &gpio_cc32xx_a##n##_config, \
265 #define GPIO_CC32XX_INIT(n) \ argument
266 static const struct gpio_cc32xx_config gpio_cc32xx_a##n##_config = { \
268 .port_pin_mask = GPIO_PORT_PIN_MASK_FROM_DT_INST(n), \
270 .port_base = DT_INST_REG_ADDR(n), \
271 .port_num = n \
274 static struct gpio_cc32xx_data gpio_cc32xx_a##n##_data; \
276 GPIO_CC32XX_INIT_FUNC(n) \
278 GPIO_CC32XX_DEVICE_INIT(n);