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 #pragma once
6 
7 #include <ddk/device.h>
8 
9 #include <ddktl/device.h>
10 #include <ddktl/protocol/platform/bus.h>
11 
12 #include <fbl/macros.h>
13 
14 #include <threads.h>
15 
16 namespace board_test {
17 
18 class TestBoard;
19 using TestBoardType = ddk::Device<TestBoard>;
20 
21 // This is the main class for the platform bus driver.
22 class TestBoard : public TestBoardType {
23 public:
TestBoard(zx_device_t * parent,pbus_protocol_t * pbus)24     explicit TestBoard(zx_device_t* parent, pbus_protocol_t* pbus)
25         : TestBoardType(parent), pbus_(pbus) {}
26 
27     static zx_status_t Create(zx_device_t* parent);
28 
29     // Device protocol implementation.
30     void DdkRelease();
31 
32 private:
33     DISALLOW_COPY_ASSIGN_AND_MOVE(TestBoard);
34 
35     zx_status_t Start();
36     zx_status_t GpioInit();
37     zx_status_t TestInit();
38     int Thread();
39 
40     ddk::PBusProtocolClient pbus_;
41     thrd_t thread_;
42 };
43 
44 } // namespace board_test
45 
46 __BEGIN_CDECLS
47 zx_status_t test_bind(void* ctx, zx_device_t* parent);
48 __END_CDECLS
49