Lines Matching refs:async

53 	struct comedi_async *async = s->async;  in __comedi_buf_free()  local
57 async->prealloc_bufsz = 0; in __comedi_buf_free()
59 bm = async->buf_map; in __comedi_buf_free()
60 async->buf_map = NULL; in __comedi_buf_free()
122 struct comedi_async *async = s->async; in __comedi_buf_alloc() local
137 async->buf_map = bm; in __comedi_buf_alloc()
139 async->prealloc_bufsz = n_pages << PAGE_SHIFT; in __comedi_buf_alloc()
183 struct comedi_async *async = s->async; in comedi_buf_map_from_subdev_get() local
187 if (!async) in comedi_buf_map_from_subdev_get()
191 bm = async->buf_map; in comedi_buf_map_from_subdev_get()
204 struct comedi_buf_map *bm = s->async->buf_map; in comedi_buf_is_mmapped()
212 struct comedi_async *async = s->async; in comedi_buf_alloc() local
220 if (async->prealloc_bufsz == new_size) in comedi_buf_alloc()
231 if (!async->prealloc_bufsz) in comedi_buf_alloc()
240 struct comedi_async *async = s->async; in comedi_buf_reset() local
242 async->buf_write_alloc_count = 0; in comedi_buf_reset()
243 async->buf_write_count = 0; in comedi_buf_reset()
244 async->buf_read_alloc_count = 0; in comedi_buf_reset()
245 async->buf_read_count = 0; in comedi_buf_reset()
247 async->buf_write_ptr = 0; in comedi_buf_reset()
248 async->buf_read_ptr = 0; in comedi_buf_reset()
250 async->cur_chan = 0; in comedi_buf_reset()
251 async->scans_done = 0; in comedi_buf_reset()
252 async->scan_progress = 0; in comedi_buf_reset()
253 async->munge_chan = 0; in comedi_buf_reset()
254 async->munge_count = 0; in comedi_buf_reset()
255 async->munge_ptr = 0; in comedi_buf_reset()
257 async->events = 0; in comedi_buf_reset()
262 struct comedi_async *async = s->async; in comedi_buf_write_n_unalloc() local
263 unsigned int free_end = async->buf_read_count + async->prealloc_bufsz; in comedi_buf_write_n_unalloc()
265 return free_end - async->buf_write_alloc_count; in comedi_buf_write_n_unalloc()
270 struct comedi_async *async = s->async; in comedi_buf_write_n_available() local
271 unsigned int free_end = async->buf_read_count + async->prealloc_bufsz; in comedi_buf_write_n_available()
273 return free_end - async->buf_write_count; in comedi_buf_write_n_available()
290 struct comedi_async *async = s->async; in comedi_buf_write_alloc() local
296 async->buf_write_alloc_count += nbytes; in comedi_buf_write_alloc()
315 struct comedi_async *async = s->async; in comedi_buf_munge() local
316 struct comedi_buf_page *buf_page_list = async->buf_map->page_list; in comedi_buf_munge()
320 if (!s->munge || (async->cmd.flags & CMDF_RAWDATA)) { in comedi_buf_munge()
321 async->munge_count += num_bytes; in comedi_buf_munge()
332 unsigned int page = async->munge_ptr >> PAGE_SHIFT; in comedi_buf_munge()
333 unsigned int offset = offset_in_page(async->munge_ptr); in comedi_buf_munge()
338 block_size, async->munge_chan); in comedi_buf_munge()
346 async->munge_chan += block_size / num_sample_bytes; in comedi_buf_munge()
347 async->munge_chan %= async->cmd.chanlist_len; in comedi_buf_munge()
348 async->munge_count += block_size; in comedi_buf_munge()
349 async->munge_ptr += block_size; in comedi_buf_munge()
350 if (async->munge_ptr == async->prealloc_bufsz) in comedi_buf_munge()
351 async->munge_ptr = 0; in comedi_buf_munge()
360 struct comedi_async *async = s->async; in comedi_buf_write_n_allocated() local
362 return async->buf_write_alloc_count - async->buf_write_count; in comedi_buf_write_n_allocated()
383 struct comedi_async *async = s->async; in comedi_buf_write_free() local
389 async->buf_write_count += nbytes; in comedi_buf_write_free()
390 async->buf_write_ptr += nbytes; in comedi_buf_write_free()
391 comedi_buf_munge(s, async->buf_write_count - async->munge_count); in comedi_buf_write_free()
392 if (async->buf_write_ptr >= async->prealloc_bufsz) in comedi_buf_write_free()
393 async->buf_write_ptr %= async->prealloc_bufsz; in comedi_buf_write_free()
412 struct comedi_async *async = s->async; in comedi_buf_read_n_available() local
415 if (!async) in comedi_buf_read_n_available()
418 num_bytes = async->munge_count - async->buf_read_count; in comedi_buf_read_n_available()
448 struct comedi_async *async = s->async; in comedi_buf_read_alloc() local
451 available = async->munge_count - async->buf_read_alloc_count; in comedi_buf_read_alloc()
455 async->buf_read_alloc_count += nbytes; in comedi_buf_read_alloc()
467 static unsigned int comedi_buf_read_n_allocated(struct comedi_async *async) in comedi_buf_read_n_allocated() argument
469 return async->buf_read_alloc_count - async->buf_read_count; in comedi_buf_read_n_allocated()
488 struct comedi_async *async = s->async; in comedi_buf_read_free() local
497 allocated = comedi_buf_read_n_allocated(async); in comedi_buf_read_free()
501 async->buf_read_count += nbytes; in comedi_buf_read_free()
502 async->buf_read_ptr += nbytes; in comedi_buf_read_free()
503 async->buf_read_ptr %= async->prealloc_bufsz; in comedi_buf_read_free()
511 struct comedi_async *async = s->async; in comedi_buf_memcpy_to() local
512 struct comedi_buf_page *buf_page_list = async->buf_map->page_list; in comedi_buf_memcpy_to()
513 unsigned int write_ptr = async->buf_write_ptr; in comedi_buf_memcpy_to()
530 if (write_ptr == async->prealloc_bufsz) in comedi_buf_memcpy_to()
538 struct comedi_async *async = s->async; in comedi_buf_memcpy_from() local
539 struct comedi_buf_page *buf_page_list = async->buf_map->page_list; in comedi_buf_memcpy_from()
540 unsigned int read_ptr = async->buf_read_ptr; in comedi_buf_memcpy_from()
556 if (read_ptr == async->prealloc_bufsz) in comedi_buf_memcpy_from()
592 s->async->events |= COMEDI_CB_OVERFLOW; in comedi_buf_write_samples()
604 s->async->events |= COMEDI_CB_BLOCK; in comedi_buf_write_samples()
644 s->async->events |= COMEDI_CB_BLOCK; in comedi_buf_read_samples()