Lines Matching refs:io_ctx
76 struct iio_usb_io_context io_ctx; member
83 struct iio_usb_io_context io_ctx; member
122 static int usb_io_context_init(struct iio_usb_io_context *io_ctx) in usb_io_context_init() argument
124 io_ctx->lock = iio_mutex_create(); in usb_io_context_init()
125 if (!io_ctx->lock) in usb_io_context_init()
131 static void usb_io_context_exit(struct iio_usb_io_context *io_ctx) in usb_io_context_exit() argument
133 if (io_ctx->lock) { in usb_io_context_exit()
134 iio_mutex_destroy(io_ctx->lock); in usb_io_context_exit()
135 io_ctx->lock = NULL; in usb_io_context_exit()
143 &ctx->pdata->io_ctx, major, minor, git_tag); in usb_get_version()
206 dev->pdata->io_ctx.ep = ep; in usb_reserve_ep_unlocked()
239 pdata->io_ctx.cancelled = false; in usb_open()
248 ret = usb_open_pipe(ctx_pdata, pdata->io_ctx.ep->pipe_id); in usb_open()
260 ret = iiod_client_open_unlocked(ctx_pdata->iiod_client, &pdata->io_ctx, in usb_open()
268 &pdata->io_ctx, remote_timeout); in usb_open()
276 usb_close_pipe(ctx_pdata, pdata->io_ctx.ep->pipe_id); in usb_open()
296 ret = iiod_client_close_unlocked(ctx_pdata->iiod_client, &pdata->io_ctx, in usb_close()
302 usb_close_pipe(ctx_pdata, pdata->io_ctx.ep->pipe_id); in usb_close()
319 &pdata->io_ctx, dev, dst, len, mask, words); in usb_read()
333 &pdata->io_ctx, dev, src, len); in usb_write()
345 &pdata->io_ctx, dev, NULL, attr, in usb_read_dev_attr()
355 &pdata->io_ctx, dev, NULL, attr, in usb_write_dev_attr()
365 &pdata->io_ctx, chn->dev, chn, attr, in usb_read_chn_attr()
375 &pdata->io_ctx, chn->dev, chn, attr, in usb_write_chn_attr()
385 &pdata->io_ctx, dev, nb_blocks); in usb_set_kernel_buffers_count()
395 &pdata->io_ctx, remote_timeout); in usb_set_timeout()
406 usb_io_context_exit(&ctx->pdata->io_ctx); in usb_shutdown()
423 usb_io_context_exit(&dev->pdata->io_ctx); in usb_shutdown()
500 iio_mutex_lock(ppdata->io_ctx.lock); in usb_cancel()
501 if (ppdata->io_ctx.transfer && !ppdata->io_ctx.cancelled) in usb_cancel()
502 libusb_cancel_transfer(ppdata->io_ctx.transfer); in usb_cancel()
503 ppdata->io_ctx.cancelled = true; in usb_cancel()
504 iio_mutex_unlock(ppdata->io_ctx.lock); in usb_cancel()
531 struct iio_usb_io_context *io_ctx, unsigned int ep_type, in usb_sync_transfer() argument
551 ep = io_ctx->ep->addr_in; in usb_sync_transfer()
553 ep = io_ctx->ep->addr_out; in usb_sync_transfer()
561 iio_mutex_lock(io_ctx->lock); in usb_sync_transfer()
562 if (io_ctx->cancelled) { in usb_sync_transfer()
587 io_ctx->transfer = transfer; in usb_sync_transfer()
589 iio_mutex_unlock(io_ctx->lock); in usb_sync_transfer()
626 iio_mutex_lock(io_ctx->lock); in usb_sync_transfer()
627 io_ctx->transfer = NULL; in usb_sync_transfer()
628 iio_mutex_unlock(io_ctx->lock); in usb_sync_transfer()
918 ret = usb_io_context_init(&pdata->io_ctx); in usb_create_context()
923 pdata->io_ctx.ep = &pdata->io_endpoints[0]; in usb_create_context()
924 pdata->io_ctx.ep->in_use = true; in usb_create_context()
940 ctx = iiod_client_create_context(pdata->iiod_client, &pdata->io_ctx); in usb_create_context()
962 ret = usb_io_context_init(&dev->pdata->io_ctx); in usb_create_context()
981 usb_io_context_exit(&pdata->io_ctx); in usb_create_context()