Lines Matching refs:async
55 struct comedi_async *async = s->async; in __comedi_buf_free() local
59 if (async->prealloc_buf) { in __comedi_buf_free()
61 vunmap(async->prealloc_buf); in __comedi_buf_free()
62 async->prealloc_buf = NULL; in __comedi_buf_free()
63 async->prealloc_bufsz = 0; in __comedi_buf_free()
67 bm = async->buf_map; in __comedi_buf_free()
68 async->buf_map = NULL; in __comedi_buf_free()
143 struct comedi_async *async = s->async; in __comedi_buf_alloc() local
161 async->buf_map = bm; in __comedi_buf_alloc()
170 async->prealloc_buf = buf->virt_addr; in __comedi_buf_alloc()
182 async->prealloc_buf = vmap(pages, n_pages, VM_MAP, in __comedi_buf_alloc()
230 struct comedi_async *async = s->async; in comedi_buf_map_from_subdev_get() local
234 if (!async) in comedi_buf_map_from_subdev_get()
238 bm = async->buf_map; in comedi_buf_map_from_subdev_get()
251 struct comedi_buf_map *bm = s->async->buf_map; in comedi_buf_is_mmapped()
259 struct comedi_async *async = s->async; in comedi_buf_alloc() local
267 if (async->prealloc_buf && async->prealloc_bufsz == new_size) in comedi_buf_alloc()
279 if (!async->prealloc_buf) { in comedi_buf_alloc()
285 async->prealloc_bufsz = new_size; in comedi_buf_alloc()
292 struct comedi_async *async = s->async; in comedi_buf_reset() local
294 async->buf_write_alloc_count = 0; in comedi_buf_reset()
295 async->buf_write_count = 0; in comedi_buf_reset()
296 async->buf_read_alloc_count = 0; in comedi_buf_reset()
297 async->buf_read_count = 0; in comedi_buf_reset()
299 async->buf_write_ptr = 0; in comedi_buf_reset()
300 async->buf_read_ptr = 0; in comedi_buf_reset()
302 async->cur_chan = 0; in comedi_buf_reset()
303 async->scans_done = 0; in comedi_buf_reset()
304 async->scan_progress = 0; in comedi_buf_reset()
305 async->munge_chan = 0; in comedi_buf_reset()
306 async->munge_count = 0; in comedi_buf_reset()
307 async->munge_ptr = 0; in comedi_buf_reset()
309 async->events = 0; in comedi_buf_reset()
314 struct comedi_async *async = s->async; in comedi_buf_write_n_unalloc() local
315 unsigned int free_end = async->buf_read_count + async->prealloc_bufsz; in comedi_buf_write_n_unalloc()
317 return free_end - async->buf_write_alloc_count; in comedi_buf_write_n_unalloc()
322 struct comedi_async *async = s->async; in comedi_buf_write_n_available() local
323 unsigned int free_end = async->buf_read_count + async->prealloc_bufsz; in comedi_buf_write_n_available()
325 return free_end - async->buf_write_count; in comedi_buf_write_n_available()
342 struct comedi_async *async = s->async; in comedi_buf_write_alloc() local
348 async->buf_write_alloc_count += nbytes; in comedi_buf_write_alloc()
367 struct comedi_async *async = s->async; in comedi_buf_munge() local
371 if (!s->munge || (async->cmd.flags & CMDF_RAWDATA)) { in comedi_buf_munge()
372 async->munge_count += num_bytes; in comedi_buf_munge()
382 buf_end = async->prealloc_bufsz - async->munge_ptr; in comedi_buf_munge()
387 async->prealloc_buf + async->munge_ptr, in comedi_buf_munge()
388 block_size, async->munge_chan); in comedi_buf_munge()
396 async->munge_chan += block_size / num_sample_bytes; in comedi_buf_munge()
397 async->munge_chan %= async->cmd.chanlist_len; in comedi_buf_munge()
398 async->munge_count += block_size; in comedi_buf_munge()
399 async->munge_ptr += block_size; in comedi_buf_munge()
400 async->munge_ptr %= async->prealloc_bufsz; in comedi_buf_munge()
409 struct comedi_async *async = s->async; in comedi_buf_write_n_allocated() local
411 return async->buf_write_alloc_count - async->buf_write_count; in comedi_buf_write_n_allocated()
432 struct comedi_async *async = s->async; in comedi_buf_write_free() local
438 async->buf_write_count += nbytes; in comedi_buf_write_free()
439 async->buf_write_ptr += nbytes; in comedi_buf_write_free()
440 comedi_buf_munge(s, async->buf_write_count - async->munge_count); in comedi_buf_write_free()
441 if (async->buf_write_ptr >= async->prealloc_bufsz) in comedi_buf_write_free()
442 async->buf_write_ptr %= async->prealloc_bufsz; in comedi_buf_write_free()
461 struct comedi_async *async = s->async; in comedi_buf_read_n_available() local
464 if (!async) in comedi_buf_read_n_available()
467 num_bytes = async->munge_count - async->buf_read_count; in comedi_buf_read_n_available()
497 struct comedi_async *async = s->async; in comedi_buf_read_alloc() local
500 available = async->munge_count - async->buf_read_alloc_count; in comedi_buf_read_alloc()
504 async->buf_read_alloc_count += nbytes; in comedi_buf_read_alloc()
516 static unsigned int comedi_buf_read_n_allocated(struct comedi_async *async) in comedi_buf_read_n_allocated() argument
518 return async->buf_read_alloc_count - async->buf_read_count; in comedi_buf_read_n_allocated()
537 struct comedi_async *async = s->async; in comedi_buf_read_free() local
546 allocated = comedi_buf_read_n_allocated(async); in comedi_buf_read_free()
550 async->buf_read_count += nbytes; in comedi_buf_read_free()
551 async->buf_read_ptr += nbytes; in comedi_buf_read_free()
552 async->buf_read_ptr %= async->prealloc_bufsz; in comedi_buf_read_free()
560 struct comedi_async *async = s->async; in comedi_buf_memcpy_to() local
561 unsigned int write_ptr = async->buf_write_ptr; in comedi_buf_memcpy_to()
566 if (write_ptr + num_bytes > async->prealloc_bufsz) in comedi_buf_memcpy_to()
567 block_size = async->prealloc_bufsz - write_ptr; in comedi_buf_memcpy_to()
571 memcpy(async->prealloc_buf + write_ptr, data, block_size); in comedi_buf_memcpy_to()
584 struct comedi_async *async = s->async; in comedi_buf_memcpy_from() local
585 unsigned int read_ptr = async->buf_read_ptr; in comedi_buf_memcpy_from()
590 src = async->prealloc_buf + read_ptr; in comedi_buf_memcpy_from()
592 if (nbytes >= async->prealloc_bufsz - read_ptr) in comedi_buf_memcpy_from()
593 block_size = async->prealloc_bufsz - read_ptr; in comedi_buf_memcpy_from()
635 s->async->events |= COMEDI_CB_OVERFLOW; in comedi_buf_write_samples()
647 s->async->events |= COMEDI_CB_BLOCK; in comedi_buf_write_samples()
687 s->async->events |= COMEDI_CB_BLOCK; in comedi_buf_read_samples()