Lines Matching refs:async
56 struct comedi_async *async = s->async; in __comedi_buf_free() local
60 if (async->prealloc_buf) { in __comedi_buf_free()
62 vunmap(async->prealloc_buf); in __comedi_buf_free()
63 async->prealloc_buf = NULL; in __comedi_buf_free()
64 async->prealloc_bufsz = 0; in __comedi_buf_free()
68 bm = async->buf_map; in __comedi_buf_free()
69 async->buf_map = NULL; in __comedi_buf_free()
144 struct comedi_async *async = s->async; in __comedi_buf_alloc() local
162 async->buf_map = bm; in __comedi_buf_alloc()
171 async->prealloc_buf = buf->virt_addr; in __comedi_buf_alloc()
183 async->prealloc_buf = vmap(pages, n_pages, VM_MAP, in __comedi_buf_alloc()
231 struct comedi_async *async = s->async; in comedi_buf_map_from_subdev_get() local
235 if (!async) in comedi_buf_map_from_subdev_get()
239 bm = async->buf_map; in comedi_buf_map_from_subdev_get()
252 struct comedi_buf_map *bm = s->async->buf_map; in comedi_buf_is_mmapped()
260 struct comedi_async *async = s->async; in comedi_buf_alloc() local
268 if (async->prealloc_buf && async->prealloc_bufsz == new_size) in comedi_buf_alloc()
280 if (!async->prealloc_buf) { in comedi_buf_alloc()
286 async->prealloc_bufsz = new_size; in comedi_buf_alloc()
293 struct comedi_async *async = s->async; in comedi_buf_reset() local
295 async->buf_write_alloc_count = 0; in comedi_buf_reset()
296 async->buf_write_count = 0; in comedi_buf_reset()
297 async->buf_read_alloc_count = 0; in comedi_buf_reset()
298 async->buf_read_count = 0; in comedi_buf_reset()
300 async->buf_write_ptr = 0; in comedi_buf_reset()
301 async->buf_read_ptr = 0; in comedi_buf_reset()
303 async->cur_chan = 0; in comedi_buf_reset()
304 async->scans_done = 0; in comedi_buf_reset()
305 async->scan_progress = 0; in comedi_buf_reset()
306 async->munge_chan = 0; in comedi_buf_reset()
307 async->munge_count = 0; in comedi_buf_reset()
308 async->munge_ptr = 0; in comedi_buf_reset()
310 async->events = 0; in comedi_buf_reset()
315 struct comedi_async *async = s->async; in comedi_buf_write_n_unalloc() local
316 unsigned int free_end = async->buf_read_count + async->prealloc_bufsz; in comedi_buf_write_n_unalloc()
318 return free_end - async->buf_write_alloc_count; in comedi_buf_write_n_unalloc()
323 struct comedi_async *async = s->async; in comedi_buf_write_n_available() local
324 unsigned int free_end = async->buf_read_count + async->prealloc_bufsz; in comedi_buf_write_n_available()
326 return free_end - async->buf_write_count; in comedi_buf_write_n_available()
343 struct comedi_async *async = s->async; in comedi_buf_write_alloc() local
349 async->buf_write_alloc_count += nbytes; in comedi_buf_write_alloc()
368 struct comedi_async *async = s->async; in comedi_buf_munge() local
372 if (!s->munge || (async->cmd.flags & CMDF_RAWDATA)) { in comedi_buf_munge()
373 async->munge_count += num_bytes; in comedi_buf_munge()
383 buf_end = async->prealloc_bufsz - async->munge_ptr; in comedi_buf_munge()
388 async->prealloc_buf + async->munge_ptr, in comedi_buf_munge()
389 block_size, async->munge_chan); in comedi_buf_munge()
397 async->munge_chan += block_size / num_sample_bytes; in comedi_buf_munge()
398 async->munge_chan %= async->cmd.chanlist_len; in comedi_buf_munge()
399 async->munge_count += block_size; in comedi_buf_munge()
400 async->munge_ptr += block_size; in comedi_buf_munge()
401 async->munge_ptr %= async->prealloc_bufsz; in comedi_buf_munge()
410 struct comedi_async *async = s->async; in comedi_buf_write_n_allocated() local
412 return async->buf_write_alloc_count - async->buf_write_count; in comedi_buf_write_n_allocated()
433 struct comedi_async *async = s->async; in comedi_buf_write_free() local
439 async->buf_write_count += nbytes; in comedi_buf_write_free()
440 async->buf_write_ptr += nbytes; in comedi_buf_write_free()
441 comedi_buf_munge(s, async->buf_write_count - async->munge_count); in comedi_buf_write_free()
442 if (async->buf_write_ptr >= async->prealloc_bufsz) in comedi_buf_write_free()
443 async->buf_write_ptr %= async->prealloc_bufsz; in comedi_buf_write_free()
462 struct comedi_async *async = s->async; in comedi_buf_read_n_available() local
465 if (!async) in comedi_buf_read_n_available()
468 num_bytes = async->munge_count - async->buf_read_count; in comedi_buf_read_n_available()
498 struct comedi_async *async = s->async; in comedi_buf_read_alloc() local
501 available = async->munge_count - async->buf_read_alloc_count; in comedi_buf_read_alloc()
505 async->buf_read_alloc_count += nbytes; in comedi_buf_read_alloc()
517 static unsigned int comedi_buf_read_n_allocated(struct comedi_async *async) in comedi_buf_read_n_allocated() argument
519 return async->buf_read_alloc_count - async->buf_read_count; in comedi_buf_read_n_allocated()
538 struct comedi_async *async = s->async; in comedi_buf_read_free() local
547 allocated = comedi_buf_read_n_allocated(async); in comedi_buf_read_free()
551 async->buf_read_count += nbytes; in comedi_buf_read_free()
552 async->buf_read_ptr += nbytes; in comedi_buf_read_free()
553 async->buf_read_ptr %= async->prealloc_bufsz; in comedi_buf_read_free()
561 struct comedi_async *async = s->async; in comedi_buf_memcpy_to() local
562 unsigned int write_ptr = async->buf_write_ptr; in comedi_buf_memcpy_to()
567 if (write_ptr + num_bytes > async->prealloc_bufsz) in comedi_buf_memcpy_to()
568 block_size = async->prealloc_bufsz - write_ptr; in comedi_buf_memcpy_to()
572 memcpy(async->prealloc_buf + write_ptr, data, block_size); in comedi_buf_memcpy_to()
585 struct comedi_async *async = s->async; in comedi_buf_memcpy_from() local
586 unsigned int read_ptr = async->buf_read_ptr; in comedi_buf_memcpy_from()
591 src = async->prealloc_buf + read_ptr; in comedi_buf_memcpy_from()
593 if (nbytes >= async->prealloc_bufsz - read_ptr) in comedi_buf_memcpy_from()
594 block_size = async->prealloc_bufsz - read_ptr; in comedi_buf_memcpy_from()
636 s->async->events |= COMEDI_CB_OVERFLOW; in comedi_buf_write_samples()
648 s->async->events |= COMEDI_CB_BLOCK; in comedi_buf_write_samples()
688 s->async->events |= COMEDI_CB_BLOCK; in comedi_buf_read_samples()