Lines Matching refs:data
49 struct serial_vnd_data *data = dev->data; in is_irq_rx_pending() local
51 return !ring_buf_is_empty(data->read_queue); in is_irq_rx_pending()
56 struct serial_vnd_data *data = dev->data; in is_irq_tx_pending() local
58 return ring_buf_space_get(data->written) != 0; in is_irq_tx_pending()
63 struct serial_vnd_data *data = dev->data; in irq_process() local
68 bool rx_int = rx_rdy && data->irq_rx_enabled; in irq_process()
69 bool tx_int = tx_rdy && data->irq_tx_enabled; in irq_process()
79 if (!data->irq_isr) { in irq_process()
83 data->irq_isr(dev, NULL); in irq_process()
89 struct serial_vnd_data *data = dev->data; in irq_rx_enable() local
91 data->irq_rx_enabled = true; in irq_rx_enable()
98 struct serial_vnd_data *data = dev->data; in irq_rx_disable() local
100 data->irq_rx_enabled = false; in irq_rx_disable()
106 struct serial_vnd_data *data = dev->data; in irq_rx_ready() local
107 bool ready = !ring_buf_is_empty(data->read_queue); in irq_rx_ready()
115 struct serial_vnd_data *data = dev->data; in irq_tx_enable() local
118 data->irq_tx_enabled = true; in irq_tx_enable()
124 struct serial_vnd_data *data = dev->data; in irq_tx_disable() local
126 data->irq_tx_enabled = false; in irq_tx_disable()
132 struct serial_vnd_data *data = dev->data; in irq_tx_ready() local
133 bool ready = (ring_buf_space_get(data->written) != 0); in irq_tx_ready()
142 struct serial_vnd_data *data = dev->data; in irq_callback_set() local
150 if (data->read_buf) { in irq_callback_set()
153 data->async_cb = NULL; in irq_callback_set()
154 data->async_cb_user_data = NULL; in irq_callback_set()
157 data->irq_isr = cb; in irq_callback_set()
163 struct serial_vnd_data *data = dev->data; in fifo_fill() local
164 uint32_t write_len = ring_buf_put(data->written, tx_data, size); in fifo_fill()
166 if (data->callback) { in fifo_fill()
167 data->callback(dev, data->callback_data); in fifo_fill()
174 struct serial_vnd_data *data = dev->data; in fifo_read() local
175 int read_len = ring_buf_get(data->read_queue, rx_data, size); in fifo_read()
185 struct serial_vnd_data *data = dev->data; in serial_vnd_poll_in() local
188 if (data == NULL || data->read_queue == NULL) { in serial_vnd_poll_in()
191 bytes_read = ring_buf_get(data->read_queue, c, 1); in serial_vnd_poll_in()
203 struct serial_vnd_data *data = dev->data; in serial_vnd_poll_out() local
206 if (data == NULL || data->written == NULL) { in serial_vnd_poll_out()
209 ring_buf_put(data->written, &c, 1); in serial_vnd_poll_out()
211 if (data->callback) { in serial_vnd_poll_out()
212 data->callback(dev, data->callback_data); in serial_vnd_poll_out()
223 struct serial_vnd_data *data = dev->data; in serial_vnd_queue_in_data() local
226 if (data == NULL || data->read_queue == NULL) { in serial_vnd_queue_in_data()
229 write_size = ring_buf_put(data->read_queue, c, size); in serial_vnd_queue_in_data()
249 struct serial_vnd_data *data = dev->data; in serial_vnd_out_data_size_get() local
251 if (data == NULL || data->written == NULL) { in serial_vnd_out_data_size_get()
254 return ring_buf_size_get(data->written); in serial_vnd_out_data_size_get()
259 struct serial_vnd_data *data = dev->data; in serial_vnd_read_out_data() local
261 if (data == NULL || data->written == NULL) { in serial_vnd_read_out_data()
264 return ring_buf_get(data->written, out_data, size); in serial_vnd_read_out_data()
269 struct serial_vnd_data *data = dev->data; in serial_vnd_peek_out_data() local
271 if (data == NULL || data->written == NULL) { in serial_vnd_peek_out_data()
274 return ring_buf_peek(data->written, out_data, size); in serial_vnd_peek_out_data()
281 struct serial_vnd_data *data = dev->data; in serial_vnd_set_callback() local
283 if (data == NULL) { in serial_vnd_set_callback()
286 data->callback = callback; in serial_vnd_set_callback()
287 data->callback_data = user_data; in serial_vnd_set_callback()
311 struct serial_vnd_data *data = dev->data; in serial_vnd_callback_set() local
313 if (data == NULL) { in serial_vnd_callback_set()
318 data->irq_isr = NULL; in serial_vnd_callback_set()
321 if (callback == NULL && data->read_buf) { in serial_vnd_callback_set()
325 data->async_cb = callback; in serial_vnd_callback_set()
326 data->async_cb_user_data = user_data; in serial_vnd_callback_set()
334 struct serial_vnd_data *data = dev->data; in serial_vnd_api_tx() local
338 if (data == NULL) { in serial_vnd_api_tx()
342 if (data->async_cb == NULL) { in serial_vnd_api_tx()
346 write_len = ring_buf_put(data->written, tx_data, len); in serial_vnd_api_tx()
347 if (data->callback) { in serial_vnd_api_tx()
348 data->callback(dev, data->callback_data); in serial_vnd_api_tx()
355 .data.tx.buf = tx_data, in serial_vnd_api_tx()
356 .data.tx.len = len, in serial_vnd_api_tx()
358 data->async_cb(dev, &evt, data->async_cb_user_data); in serial_vnd_api_tx()
365 struct serial_vnd_data *data = dev->data; in async_rx_run() local
370 if (!data->read_buf) { in async_rx_run()
374 __ASSERT_NO_MSG(data->async_cb); in async_rx_run()
376 read_remaining = data->read_size - data->read_position; in async_rx_run()
378 read_len = ring_buf_get(data->read_queue, &data->read_buf[data->read_position], in async_rx_run()
384 .data.rx.buf = data->read_buf, in async_rx_run()
385 .data.rx.len = read_len, in async_rx_run()
386 .data.rx.offset = data->read_position, in async_rx_run()
388 data->async_cb(dev, &evt, data->async_cb_user_data); in async_rx_run()
391 data->read_position += read_len; in async_rx_run()
393 if (data->read_position == data->read_size) { in async_rx_run()
394 data->read_buf = NULL; in async_rx_run()
398 data->async_cb(dev, &evt, data->async_cb_user_data); in async_rx_run()
405 struct serial_vnd_data *data = dev->data; in serial_vnd_rx_enable() local
409 if (data == NULL) { in serial_vnd_rx_enable()
413 if (data->async_cb == NULL) { in serial_vnd_rx_enable()
419 data->read_buf = read_buf; in serial_vnd_rx_enable()
420 data->read_size = read_size; in serial_vnd_rx_enable()
421 data->read_position = 0; in serial_vnd_rx_enable()