blob: a688e41e710858067e4d4aef21831ff04c1b457a [file] [log] [blame]
// Copyright 2018 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <lib/zx/interrupt.h>
#include <zircon/syscalls.h>
namespace zx {
#if ENABLE_NEW_IRQ_API
zx_status_t interrupt::create(const resource& resource, uint32_t vector,
uint32_t options, interrupt* result) {
zx_handle_t h;
zx_status_t status = zx_irq_create(resource.get(), vector, options, &h);
if (status < 0) {
result->reset(ZX_HANDLE_INVALID);
} else {
result->reset(h);
}
return status;
}
#else
zx_status_t interrupt::create(const resource& resource, uint32_t options, interrupt* result) {
zx_handle_t h;
zx_status_t status = zx_interrupt_create(resource.get(), options, &h);
if (status < 0) {
result->reset(ZX_HANDLE_INVALID);
} else {
result->reset(h);
}
return status;
}
#endif
} // namespace zx