1// Copyright 2017 The Fuchsia Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5#include <lib/async/receiver.h> 6#include <lib/async/task.h> 7#include <lib/async/time.h> 8#include <lib/async/trap.h> 9#include <lib/async/wait.h> 10 11zx_time_t async_now(async_dispatcher_t* dispatcher) { 12 return dispatcher->ops->v1.now(dispatcher); 13} 14 15zx_status_t async_begin_wait(async_dispatcher_t* dispatcher, async_wait_t* wait) { 16 return dispatcher->ops->v1.begin_wait(dispatcher, wait); 17} 18 19zx_status_t async_cancel_wait(async_dispatcher_t* dispatcher, async_wait_t* wait) { 20 return dispatcher->ops->v1.cancel_wait(dispatcher, wait); 21} 22 23zx_status_t async_post_task(async_dispatcher_t* dispatcher, async_task_t* task) { 24 return dispatcher->ops->v1.post_task(dispatcher, task); 25} 26 27zx_status_t async_cancel_task(async_dispatcher_t* dispatcher, async_task_t* task) { 28 return dispatcher->ops->v1.cancel_task(dispatcher, task); 29} 30 31zx_status_t async_queue_packet(async_dispatcher_t* dispatcher, async_receiver_t* receiver, 32 const zx_packet_user_t* data) { 33 return dispatcher->ops->v1.queue_packet(dispatcher, receiver, data); 34} 35 36zx_status_t async_set_guest_bell_trap(async_dispatcher_t* dispatcher, async_guest_bell_trap_t* trap, 37 zx_handle_t guest, zx_vaddr_t addr, size_t length) { 38 return dispatcher->ops->v1.set_guest_bell_trap(dispatcher, trap, guest, addr, length); 39} 40 41zx_status_t async_bind_exception_port(async_dispatcher_t* dispatcher, 42 async_exception_t* exception) { 43 if (dispatcher->ops->version < ASYNC_OPS_V2) 44 return ZX_ERR_NOT_SUPPORTED; 45 return dispatcher->ops->v2.bind_exception_port(dispatcher, exception); 46} 47 48zx_status_t async_unbind_exception_port(async_dispatcher_t* dispatcher, 49 async_exception_t* exception) { 50 if (dispatcher->ops->version < ASYNC_OPS_V2) 51 return ZX_ERR_NOT_SUPPORTED; 52 return dispatcher->ops->v2.unbind_exception_port(dispatcher, exception); 53} 54