1 // Copyright 2018 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 <ddk/debug.h> 6 #include <ddk/device.h> 7 #include <ddk/platform-defs.h> 8 #include <ddk/protocol/platform/bus.h> 9 10 #include "test.h" 11 12 namespace board_test { 13 GpioInit()14zx_status_t TestBoard::GpioInit() { 15 pbus_dev_t gpio_dev = {}; 16 gpio_dev.name = "gpio"; 17 gpio_dev.vid = PDEV_VID_TEST; 18 gpio_dev.pid = PDEV_PID_PBUS_TEST; 19 gpio_dev.did = PDEV_DID_TEST_GPIO; 20 21 zx_status_t status = pbus_.ProtocolDeviceAdd(ZX_PROTOCOL_GPIO_IMPL, &gpio_dev); 22 if (status != ZX_OK) { 23 zxlogf(ERROR, "%s: ProtocolDeviceAdd failed %d\n", __FUNCTION__, status); 24 return status; 25 } 26 27 return ZX_OK; 28 } 29 30 } // namespace board_test 31