Lines Matching +full:key +full:- +full:int

4  * SPDX-License-Identifier: Apache-2.0
43 const struct neorv32_gpio_config *config = dev->config; in neorv32_gpio_read()
45 return sys_read32(config->input); in neorv32_gpio_read()
50 const struct neorv32_gpio_config *config = dev->config; in neorv32_gpio_write()
52 sys_write32(val, config->output); in neorv32_gpio_write()
55 static int neorv32_gpio_pin_configure(const struct device *dev, gpio_pin_t pin, in neorv32_gpio_pin_configure()
58 const struct neorv32_gpio_config *config = dev->config; in neorv32_gpio_pin_configure()
59 struct neorv32_gpio_data *data = dev->data; in neorv32_gpio_pin_configure()
60 unsigned int key; in neorv32_gpio_pin_configure() local
62 if (!(BIT(pin) & config->common.port_pin_mask)) { in neorv32_gpio_pin_configure()
63 return -EINVAL; in neorv32_gpio_pin_configure()
67 return -ENOTSUP; in neorv32_gpio_pin_configure()
71 return -ENOTSUP; in neorv32_gpio_pin_configure()
75 key = irq_lock(); in neorv32_gpio_pin_configure()
78 data->output |= BIT(pin); in neorv32_gpio_pin_configure()
80 data->output &= ~BIT(pin); in neorv32_gpio_pin_configure()
83 neorv32_gpio_write(dev, data->output); in neorv32_gpio_pin_configure()
84 irq_unlock(key); in neorv32_gpio_pin_configure()
90 static int neorv32_gpio_port_get_raw(const struct device *dev, in neorv32_gpio_port_get_raw()
97 static int neorv32_gpio_port_set_masked_raw(const struct device *dev, in neorv32_gpio_port_set_masked_raw()
101 struct neorv32_gpio_data *data = dev->data; in neorv32_gpio_port_set_masked_raw()
102 unsigned int key; in neorv32_gpio_port_set_masked_raw() local
104 key = irq_lock(); in neorv32_gpio_port_set_masked_raw()
105 data->output = (data->output & ~mask) | (mask & value); in neorv32_gpio_port_set_masked_raw()
106 neorv32_gpio_write(dev, data->output); in neorv32_gpio_port_set_masked_raw()
107 irq_unlock(key); in neorv32_gpio_port_set_masked_raw()
112 static int neorv32_gpio_port_set_bits_raw(const struct device *dev, in neorv32_gpio_port_set_bits_raw()
115 struct neorv32_gpio_data *data = dev->data; in neorv32_gpio_port_set_bits_raw()
116 unsigned int key; in neorv32_gpio_port_set_bits_raw() local
118 key = irq_lock(); in neorv32_gpio_port_set_bits_raw()
119 data->output |= pins; in neorv32_gpio_port_set_bits_raw()
120 neorv32_gpio_write(dev, data->output); in neorv32_gpio_port_set_bits_raw()
121 irq_unlock(key); in neorv32_gpio_port_set_bits_raw()
126 static int neorv32_gpio_port_clear_bits_raw(const struct device *dev, in neorv32_gpio_port_clear_bits_raw()
129 struct neorv32_gpio_data *data = dev->data; in neorv32_gpio_port_clear_bits_raw()
130 unsigned int key; in neorv32_gpio_port_clear_bits_raw() local
132 key = irq_lock(); in neorv32_gpio_port_clear_bits_raw()
133 data->output &= ~pins; in neorv32_gpio_port_clear_bits_raw()
134 neorv32_gpio_write(dev, data->output); in neorv32_gpio_port_clear_bits_raw()
135 irq_unlock(key); in neorv32_gpio_port_clear_bits_raw()
140 static int neorv32_gpio_port_toggle_bits(const struct device *dev, in neorv32_gpio_port_toggle_bits()
143 struct neorv32_gpio_data *data = dev->data; in neorv32_gpio_port_toggle_bits()
144 unsigned int key; in neorv32_gpio_port_toggle_bits() local
146 key = irq_lock(); in neorv32_gpio_port_toggle_bits()
147 data->output ^= pins; in neorv32_gpio_port_toggle_bits()
148 neorv32_gpio_write(dev, data->output); in neorv32_gpio_port_toggle_bits()
149 irq_unlock(key); in neorv32_gpio_port_toggle_bits()
154 static int neorv32_gpio_manage_callback(const struct device *dev, in neorv32_gpio_manage_callback()
162 return -ENOTSUP; in neorv32_gpio_manage_callback()
170 static int neorv32_gpio_init(const struct device *dev) in neorv32_gpio_init()
172 const struct neorv32_gpio_config *config = dev->config; in neorv32_gpio_init()
173 struct neorv32_gpio_data *data = dev->data; in neorv32_gpio_init()
175 int err; in neorv32_gpio_init()
177 if (!device_is_ready(config->syscon)) { in neorv32_gpio_init()
179 return -EINVAL; in neorv32_gpio_init()
182 err = syscon_read_reg(config->syscon, NEORV32_SYSINFO_FEATURES, &features); in neorv32_gpio_init()
185 return -EIO; in neorv32_gpio_init()
190 return -ENODEV; in neorv32_gpio_init()
193 neorv32_gpio_write(dev, data->output); in neorv32_gpio_init()