Lines Matching refs:async

55 	struct comedi_async *async = s->async;
59 if (async->prealloc_buf) {
61 vunmap(async->prealloc_buf);
62 async->prealloc_buf = NULL;
63 async->prealloc_bufsz = 0;
67 bm = async->buf_map;
68 async->buf_map = NULL;
143 struct comedi_async *async = s->async;
161 async->buf_map = bm;
170 async->prealloc_buf = buf->virt_addr;
182 async->prealloc_buf = vmap(pages, n_pages, VM_MAP,
226 /* returns s->async->buf_map and increments its kref refcount */
230 struct comedi_async *async = s->async;
234 if (!async)
238 bm = async->buf_map;
251 struct comedi_buf_map *bm = s->async->buf_map;
259 struct comedi_async *async = s->async;
267 if (async->prealloc_buf && async->prealloc_bufsz == new_size)
279 if (!async->prealloc_buf) {
285 async->prealloc_bufsz = new_size;
292 struct comedi_async *async = s->async;
294 async->buf_write_alloc_count = 0;
295 async->buf_write_count = 0;
296 async->buf_read_alloc_count = 0;
297 async->buf_read_count = 0;
299 async->buf_write_ptr = 0;
300 async->buf_read_ptr = 0;
302 async->cur_chan = 0;
303 async->scans_done = 0;
304 async->scan_progress = 0;
305 async->munge_chan = 0;
306 async->munge_count = 0;
307 async->munge_ptr = 0;
309 async->events = 0;
314 struct comedi_async *async = s->async;
315 unsigned int free_end = async->buf_read_count + async->prealloc_bufsz;
317 return free_end - async->buf_write_alloc_count;
322 struct comedi_async *async = s->async;
323 unsigned int free_end = async->buf_read_count + async->prealloc_bufsz;
325 return free_end - async->buf_write_count;
342 struct comedi_async *async = s->async;
348 async->buf_write_alloc_count += nbytes;
351 * ensure the async buffer 'counts' are read and updated
367 struct comedi_async *async = s->async;
371 if (!s->munge || (async->cmd.flags & CMDF_RAWDATA)) {
372 async->munge_count += num_bytes;
382 buf_end = async->prealloc_bufsz - async->munge_ptr;
387 async->prealloc_buf + async->munge_ptr,
388 block_size, async->munge_chan);
392 * async buffer munge_count is incremented
396 async->munge_chan += block_size / num_sample_bytes;
397 async->munge_chan %= async->cmd.chanlist_len;
398 async->munge_count += block_size;
399 async->munge_ptr += block_size;
400 async->munge_ptr %= async->prealloc_bufsz;
409 struct comedi_async *async = s->async;
411 return async->buf_write_alloc_count - async->buf_write_count;
432 struct comedi_async *async = s->async;
438 async->buf_write_count += nbytes;
439 async->buf_write_ptr += nbytes;
440 comedi_buf_munge(s, async->buf_write_count - async->munge_count);
441 if (async->buf_write_ptr >= async->prealloc_bufsz)
442 async->buf_write_ptr %= async->prealloc_bufsz;
461 struct comedi_async *async = s->async;
464 if (!async)
467 num_bytes = async->munge_count - async->buf_read_count;
470 * ensure the async buffer 'counts' are read before we
497 struct comedi_async *async = s->async;
500 available = async->munge_count - async->buf_read_alloc_count;
504 async->buf_read_alloc_count += nbytes;
507 * ensure the async buffer 'counts' are read before we
516 static unsigned int comedi_buf_read_n_allocated(struct comedi_async *async)
518 return async->buf_read_alloc_count - async->buf_read_count;
537 struct comedi_async *async = s->async;
542 * the async read count is incremented
546 allocated = comedi_buf_read_n_allocated(async);
550 async->buf_read_count += nbytes;
551 async->buf_read_ptr += nbytes;
552 async->buf_read_ptr %= async->prealloc_bufsz;
560 struct comedi_async *async = s->async;
561 unsigned int write_ptr = async->buf_write_ptr;
566 if (write_ptr + num_bytes > async->prealloc_bufsz)
567 block_size = async->prealloc_bufsz - write_ptr;
571 memcpy(async->prealloc_buf + write_ptr, data, block_size);
584 struct comedi_async *async = s->async;
585 unsigned int read_ptr = async->buf_read_ptr;
590 src = async->prealloc_buf + read_ptr;
592 if (nbytes >= async->prealloc_bufsz - read_ptr)
593 block_size = async->prealloc_bufsz - read_ptr;
635 s->async->events |= COMEDI_CB_OVERFLOW;
647 s->async->events |= COMEDI_CB_BLOCK;
687 s->async->events |= COMEDI_CB_BLOCK;