Lines Matching +full:line +full:- +full:name

4  * SPDX-License-Identifier: Apache-2.0
12 #include <zephyr/dt-bindings/interrupt-controller/infineon-xmc4xxx-intc.h>
24 /* unset on a negative edge (or vice-versa depending on the configuration). The value of */
29 /* dts/arm/infineon/xmc4xxx_x_x-intc.dtsi. The configurations are stored in the opaque array */
31 /* dt-bindings/interrupt-controller/infineon-xmc4xxx-intc.h. */
34 /* if fn is NULL it implies the interrupt line has not been allocated */
60 struct intc_xmc4xxx_data *data = dev->data; in intc_xmc4xxx_gpio_enable_interrupt()
61 const struct intc_xmc4xxx_config *config = dev->config; in intc_xmc4xxx_gpio_enable_interrupt()
62 int ret = -ENOTSUP; in intc_xmc4xxx_gpio_enable_interrupt()
69 int port_map, pin_map, line, eru_src, eru_ch; in intc_xmc4xxx_gpio_enable_interrupt() local
79 line = XMC4XXX_INTC_GET_LINE(port_line_mapping[i]); in intc_xmc4xxx_gpio_enable_interrupt()
80 cb = &data->cb[line]; in intc_xmc4xxx_gpio_enable_interrupt()
81 if (cb->fn) { in intc_xmc4xxx_gpio_enable_interrupt()
82 /* It's already used. Continue search for available line */ in intc_xmc4xxx_gpio_enable_interrupt()
84 ret = -EBUSY; in intc_xmc4xxx_gpio_enable_interrupt()
89 eru_ch = line & 0x3; in intc_xmc4xxx_gpio_enable_interrupt()
98 return -EINVAL; in intc_xmc4xxx_gpio_enable_interrupt()
101 cb->port_id = port_id; in intc_xmc4xxx_gpio_enable_interrupt()
102 cb->pin = pin; in intc_xmc4xxx_gpio_enable_interrupt()
103 cb->mode = mode; in intc_xmc4xxx_gpio_enable_interrupt()
104 cb->fn = fn; in intc_xmc4xxx_gpio_enable_interrupt()
105 cb->data = user_data; in intc_xmc4xxx_gpio_enable_interrupt()
116 eru = config->eru_regs[line >> 2]; in intc_xmc4xxx_gpio_enable_interrupt()
133 eru->EXICON_b[eru_ch].FL = 1; in intc_xmc4xxx_gpio_enable_interrupt()
135 *(uint32_t *)(NVIC_ISPR_BASE) |= BIT(line + 1); in intc_xmc4xxx_gpio_enable_interrupt()
147 const struct intc_xmc4xxx_config *config = dev->config; in intc_xmc4xxx_gpio_disable_interrupt()
148 struct intc_xmc4xxx_data *data = dev->data; in intc_xmc4xxx_gpio_disable_interrupt()
151 for (int line = 0; line < ARRAY_SIZE(data->cb); line++) { in intc_xmc4xxx_gpio_disable_interrupt() local
154 cb = &data->cb[line]; in intc_xmc4xxx_gpio_disable_interrupt()
155 eru_ch = line & 0x3; in intc_xmc4xxx_gpio_disable_interrupt()
156 if (cb->fn && cb->port_id == port_id && cb->pin == pin) { in intc_xmc4xxx_gpio_disable_interrupt()
157 XMC_ERU_t *eru = config->eru_regs[line >> 2]; in intc_xmc4xxx_gpio_disable_interrupt()
159 cb->fn = NULL; in intc_xmc4xxx_gpio_disable_interrupt()
161 eru->EXICON_b[eru_ch].PE = 0; in intc_xmc4xxx_gpio_disable_interrupt()
163 eru->EXICON_b[eru_ch].FL = 0; in intc_xmc4xxx_gpio_disable_interrupt()
168 return -EINVAL; in intc_xmc4xxx_gpio_disable_interrupt()
173 int line = (int)arg; in intc_xmc4xxx_isr() local
175 struct intc_xmc4xxx_data *data = dev->data; in intc_xmc4xxx_isr()
176 const struct intc_xmc4xxx_config *config = dev->config; in intc_xmc4xxx_isr()
177 struct isr_cb *cb = &data->cb[line]; in intc_xmc4xxx_isr()
178 XMC_ERU_t *eru = config->eru_regs[line >> 2]; in intc_xmc4xxx_isr()
179 int eru_ch = line & 0x3; in intc_xmc4xxx_isr()
181 /* The callback function may actually disable the interrupt and set cb->fn = NULL */ in intc_xmc4xxx_isr()
184 /* in the same callback which could potentially set cb->fn again. */ in intc_xmc4xxx_isr()
185 while (cb->fn) { in intc_xmc4xxx_isr()
186 cb->fn(cb->data, cb->pin); in intc_xmc4xxx_isr()
188 if (cb->mode == GPIO_INT_MODE_LEVEL && eru->EXICON_b[eru_ch].FL == 1) { in intc_xmc4xxx_isr()
196 #define INTC_IRQ_CONNECT_ENABLE(name, line_number) \ argument
197 COND_CODE_1(DT_INST_IRQ_HAS_NAME(0, name), \
198 (IRQ_CONNECT(DT_INST_IRQ_BY_NAME(0, name, irq), \
199 DT_INST_IRQ_BY_NAME(0, name, priority), intc_xmc4xxx_isr, (void *)line_number, 0); \
200 irq_enable(DT_INST_IRQ_BY_NAME(0, name, irq));), ())
204 /* connect irqs only if they defined by name in the dts */ in intc_xmc4xxx_init()