Lines Matching +full:tx +full:- +full:mask

4  * SPDX-License-Identifier: Apache-2.0
53 const struct spi_buf_set tx = { in write_state() local
68 int result = spi_write_dt(&config->bus, &tx); in write_state()
80 const struct bd8lb600fs_config *config = dev->config; in bd8lb600fs_pin_configure()
81 struct bd8lb600fs_drv_data *drv_data = dev->data; in bd8lb600fs_pin_configure()
85 return -EWOULDBLOCK; in bd8lb600fs_pin_configure()
90 return -EINVAL; in bd8lb600fs_pin_configure()
95 return -ENOTSUP; in bd8lb600fs_pin_configure()
100 return -ENOTSUP; in bd8lb600fs_pin_configure()
105 return -ENOTSUP; in bd8lb600fs_pin_configure()
110 return -ENOTSUP; in bd8lb600fs_pin_configure()
115 return -ENOTSUP; in bd8lb600fs_pin_configure()
120 return -ENOTSUP; in bd8lb600fs_pin_configure()
123 k_mutex_lock(&drv_data->lock, K_FOREVER); in bd8lb600fs_pin_configure()
126 WRITE_BIT(drv_data->state, pin, 0); in bd8lb600fs_pin_configure()
128 WRITE_BIT(drv_data->state, pin, 1); in bd8lb600fs_pin_configure()
131 WRITE_BIT(drv_data->configured, pin, 1); in bd8lb600fs_pin_configure()
133 int result = write_state(config, drv_data->state); in bd8lb600fs_pin_configure()
135 k_mutex_unlock(&drv_data->lock); in bd8lb600fs_pin_configure()
143 return -ENOTSUP; in bd8lb600fs_port_get_raw()
146 static int bd8lb600fs_port_set_masked_raw(const struct device *dev, uint32_t mask, uint32_t value) in bd8lb600fs_port_set_masked_raw() argument
148 const struct bd8lb600fs_config *config = dev->config; in bd8lb600fs_port_set_masked_raw()
149 struct bd8lb600fs_drv_data *drv_data = dev->data; in bd8lb600fs_port_set_masked_raw()
153 return -EWOULDBLOCK; in bd8lb600fs_port_set_masked_raw()
156 k_mutex_lock(&drv_data->lock, K_FOREVER); in bd8lb600fs_port_set_masked_raw()
157 drv_data->state = (drv_data->state & ~mask) | (mask & value); in bd8lb600fs_port_set_masked_raw()
159 int result = write_state(config, drv_data->state); in bd8lb600fs_port_set_masked_raw()
161 k_mutex_unlock(&drv_data->lock); in bd8lb600fs_port_set_masked_raw()
166 static int bd8lb600fs_port_set_bits_raw(const struct device *dev, uint32_t mask) in bd8lb600fs_port_set_bits_raw() argument
168 return bd8lb600fs_port_set_masked_raw(dev, mask, mask); in bd8lb600fs_port_set_bits_raw()
171 static int bd8lb600fs_port_clear_bits_raw(const struct device *dev, uint32_t mask) in bd8lb600fs_port_clear_bits_raw() argument
173 return bd8lb600fs_port_set_masked_raw(dev, mask, 0); in bd8lb600fs_port_clear_bits_raw()
176 static int bd8lb600fs_port_toggle_bits(const struct device *dev, uint32_t mask) in bd8lb600fs_port_toggle_bits() argument
178 const struct bd8lb600fs_config *config = dev->config; in bd8lb600fs_port_toggle_bits()
179 struct bd8lb600fs_drv_data *drv_data = dev->data; in bd8lb600fs_port_toggle_bits()
183 return -EWOULDBLOCK; in bd8lb600fs_port_toggle_bits()
186 k_mutex_lock(&drv_data->lock, K_FOREVER); in bd8lb600fs_port_toggle_bits()
187 drv_data->state ^= mask; in bd8lb600fs_port_toggle_bits()
189 int result = write_state(config, drv_data->state); in bd8lb600fs_port_toggle_bits()
191 k_mutex_unlock(&drv_data->lock); in bd8lb600fs_port_toggle_bits()
207 const struct bd8lb600fs_config *config = dev->config; in bd8lb600fs_init()
208 struct bd8lb600fs_drv_data *drv_data = dev->data; in bd8lb600fs_init()
210 if (!spi_is_ready_dt(&config->bus)) { in bd8lb600fs_init()
211 LOG_ERR("SPI bus %s not ready", config->bus.bus->name); in bd8lb600fs_init()
212 return -ENODEV; in bd8lb600fs_init()
215 int result = k_mutex_init(&drv_data->lock); in bd8lb600fs_init()
222 result = gpio_pin_configure_dt(&config->gpio_reset, GPIO_OUTPUT_ACTIVE); in bd8lb600fs_init()
230 gpio_pin_set_dt(&config->gpio_reset, 0); in bd8lb600fs_init()