blob: 68ea68af8c4cc38f14e22300d479ed4dc7c39c5f [file] [log] [blame]
// Copyright 2021 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 "src/example_driver/example_driver.h"
#include <lib/ddk/debug.h>
#include <lib/ddk/driver.h>
#include <lib/ddk/platform-defs.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <threads.h>
#include <unistd.h>
#include <zircon/hw/usb.h>
#include <zircon/listnode.h>
#include <memory>
#include <ddktl/device.h>
#include <ddktl/fidl.h>
#include "src/example_driver/example_driver_bind.h"
namespace example_driver {
zx_status_t ExampleDriver::Bind(void* ctx, zx_device_t* dev) {
zxlogf(ERROR, " **** Hello world **** ");
std::unique_ptr<ExampleDriver> driver = std::make_unique<ExampleDriver>(dev);
driver->Bind();
driver.release();
return ZX_OK;
}
zx_status_t ExampleDriver::Bind() { return DdkAdd("example_driver"); }
void ExampleDriver::DdkInit(ddk::InitTxn txn) { txn.Reply(ZX_OK); }
void ExampleDriver::DdkUnbind(ddk::UnbindTxn txn) { txn.Reply(); }
void ExampleDriver::DdkRelease() { delete this; }
static zx_driver_ops_t driver_ops = []() -> zx_driver_ops_t {
zx_driver_ops_t ops = {};
ops.version = DRIVER_OPS_VERSION;
ops.bind = ExampleDriver::Bind;
return ops;
}();
} // namespace example_driver
ZIRCON_DRIVER(example_driver, example_driver::driver_ops, "zircon", "0.1");