[sherlock][isp] Add ISP Banjo Iterface

- Included as dependency in ISP driver
- It compiles after adding hacks to use FIDL struct
  definitions

CAM-45 #done

Test: Compiles after including as dependency

Change-Id: I2ad86ab8dcc41d76877be683cd80d52ff9bd055d
diff --git a/zircon/system/banjo/BUILD.gn b/zircon/system/banjo/BUILD.gn
index 9dee731..575f6b3 100644
--- a/zircon/system/banjo/BUILD.gn
+++ b/zircon/system/banjo/BUILD.gn
@@ -35,6 +35,7 @@
     "ddk.protocol.intelgpucore",
     "ddk.protocol.intelhda.codec",
     "ddk.protocol.iommu",
+    "ddk.protocol.isp",
     "ddk.protocol.mailbox",
     "ddk.protocol.mipicsi",
     "ddk.protocol.nand",
@@ -64,8 +65,10 @@
     "ddk.protocol.usb.request",
     "zircon.device.audio",
     "zircon.device.block",
+    "zircon.device.camera",
     "zircon.device.nand",
     "zircon.device.scpi",
+    "zircon.device.sysmem",
     "zircon.hw.pci",
     "zircon.hw.usb",
     "zircon.hw.usb.hub",
diff --git a/zircon/system/banjo/ddk.protocol.isp/BUILD.gn b/zircon/system/banjo/ddk.protocol.isp/BUILD.gn
new file mode 100644
index 0000000..089d289
--- /dev/null
+++ b/zircon/system/banjo/ddk.protocol.isp/BUILD.gn
@@ -0,0 +1,15 @@
+# Copyright 2019 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.
+
+import("$zx/public/gn/banjo.gni")
+
+banjo_library("ddk.protocol.isp") {
+  sources = [
+    "isp.banjo",
+  ]
+  public_deps = [
+    "$zx/system/banjo/zircon.device.camera",
+    "$zx/system/banjo/zircon.device.sysmem",
+  ]
+}
diff --git a/zircon/system/banjo/ddk.protocol.isp/isp.banjo b/zircon/system/banjo/ddk.protocol.isp/isp.banjo
new file mode 100644
index 0000000..1d298ca
--- /dev/null
+++ b/zircon/system/banjo/ddk.protocol.isp/isp.banjo
@@ -0,0 +1,37 @@
+// Copyright 2019 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.
+
+library ddk.protocol.isp;
+using zx;
+using zircon.device.camera;
+using zircon.device.sysmem;
+
+[Layout = "ddk-callback"]
+protocol InputStreamCallback {
+    // This is called by the ISP driver, everytime a frame is ready to be
+    // consumed.
+    FrameReady(uint32 buffer_id);
+};
+
+[Layout = "ddk-protocol"]
+protocol InputStream {
+    // Starts the streaming of frames.
+    Start();
+
+    // Stops the streaming of frames.
+    Stop();
+
+    // Unlocks the specified frame, allowing the driver to reuse the memory.
+    ReleaseFrame(uint32 buffer_id);
+};
+
+[Layout = "ddk-protocol"]
+protocol Isp {
+
+    // Sent by the client to indicate desired stream characteristics.
+    // The driver returns the Stream protocol for this particular stream.
+    CreateInputStream(zircon.device.sysmem.BufferCollectionInfo buffer_collection,
+                      zircon.device.camera.FrameRate rate,
+                      InputStreamCallback stream) -> (zx.status s, InputStream st);
+};
diff --git a/zircon/system/banjo/zircon.device.camera/BUILD.gn b/zircon/system/banjo/zircon.device.camera/BUILD.gn
new file mode 100644
index 0000000..df47b59
--- /dev/null
+++ b/zircon/system/banjo/zircon.device.camera/BUILD.gn
@@ -0,0 +1,11 @@
+# Copyright 2019 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.
+
+import("$zx/public/gn/banjo.gni")
+
+banjo_library("zircon.device.camera") {
+  sources = [
+    "camera.banjo",
+  ]
+}
diff --git a/zircon/system/banjo/zircon.device.camera/camera.banjo b/zircon/system/banjo/zircon.device.camera/camera.banjo
new file mode 100644
index 0000000..5e748ef
--- /dev/null
+++ b/zircon/system/banjo/zircon.device.camera/camera.banjo
@@ -0,0 +1,15 @@
+// Copyright 2019 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.
+
+library zircon.device.camera;
+
+// TODO(ZX-2677): Deleting this file is blocked by banjo being able to consume
+// code generated by fidl.
+// This allows banjo files to use FIDL generated structs. Once ZX-2677 is implemented
+// this will not be needed and can be cleaned up.
+
+[repr = "C"]
+
+struct FrameRate {
+};
diff --git a/zircon/system/banjo/zircon.device.sysmem/BUILD.gn b/zircon/system/banjo/zircon.device.sysmem/BUILD.gn
new file mode 100644
index 0000000..d3169da
--- /dev/null
+++ b/zircon/system/banjo/zircon.device.sysmem/BUILD.gn
@@ -0,0 +1,11 @@
+# Copyright 2019 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.
+
+import("$zx/public/gn/banjo.gni")
+
+banjo_library("zircon.device.sysmem") {
+  sources = [
+    "sysmem.banjo",
+  ]
+}
diff --git a/zircon/system/banjo/zircon.device.sysmem/sysmem.banjo b/zircon/system/banjo/zircon.device.sysmem/sysmem.banjo
new file mode 100644
index 0000000..8bbb6fe
--- /dev/null
+++ b/zircon/system/banjo/zircon.device.sysmem/sysmem.banjo
@@ -0,0 +1,10 @@
+// Copyright 2019 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.
+
+library zircon.device.sysmem;
+
+[repr = "C"]
+
+struct BufferCollectionInfo {
+};
diff --git a/zircon/system/dev/board/astro/BUILD.gn b/zircon/system/dev/board/astro/BUILD.gn
index 996ac44..9db9170 100644
--- a/zircon/system/dev/board/astro/BUILD.gn
+++ b/zircon/system/dev/board/astro/BUILD.gn
@@ -37,6 +37,7 @@
     "$zx/system/fidl/fuchsia-hardware-light:c",
     "$zx/system/fidl/fuchsia-hardware-serial:c",
     "$zx/system/fidl/fuchsia-hardware-thermal:c",
+    "$zx/system/fidl/fuchsia-sysmem:c",
     "$zx/system/ulib/ddk",
     "$zx/system/ulib/sync",
     "$zx/system/ulib/zircon",
diff --git a/zircon/system/dev/board/gauss/BUILD.gn b/zircon/system/dev/board/gauss/BUILD.gn
index 526dc60..ced0cc3 100644
--- a/zircon/system/dev/board/gauss/BUILD.gn
+++ b/zircon/system/dev/board/gauss/BUILD.gn
@@ -22,6 +22,7 @@
     "$zx/system/banjo/ddk.protocol.platform.device",
     "$zx/system/dev/lib/amlogic",
     "$zx/system/dev/pci/designware",
+    "$zx/system/fidl/fuchsia-sysmem:c",
     "$zx/system/ulib/ddk",
     "$zx/system/ulib/sync",
     "$zx/system/ulib/zircon",
diff --git a/zircon/system/dev/board/hikey960/BUILD.gn b/zircon/system/dev/board/hikey960/BUILD.gn
index 39d6648..65ddec0 100644
--- a/zircon/system/dev/board/hikey960/BUILD.gn
+++ b/zircon/system/dev/board/hikey960/BUILD.gn
@@ -22,6 +22,7 @@
     "$zx/system/banjo/ddk.protocol.platform.device",
     "$zx/system/banjo/ddk.protocol.usb.modeswitch",
     "$zx/system/dev/lib/hi3660",
+    "$zx/system/fidl/fuchsia-sysmem:c",
     "$zx/system/ulib/ddk",
     "$zx/system/ulib/sync",
     "$zx/system/ulib/zircon",
diff --git a/zircon/system/dev/board/machina/BUILD.gn b/zircon/system/dev/board/machina/BUILD.gn
index 85bea36..e92b1d8 100644
--- a/zircon/system/dev/board/machina/BUILD.gn
+++ b/zircon/system/dev/board/machina/BUILD.gn
@@ -10,6 +10,7 @@
   deps = [
     "$zx/system/banjo/ddk.protocol.platform.bus",
     "$zx/system/banjo/ddk.protocol.platform.device",
+    "$zx/system/fidl/fuchsia-sysmem:c",
     "$zx/system/ulib/ddk",
     "$zx/system/ulib/zircon",
   ]
diff --git a/zircon/system/dev/board/mt8167s_ref/BUILD.gn b/zircon/system/dev/board/mt8167s_ref/BUILD.gn
index a2866cd..d1cd18a 100644
--- a/zircon/system/dev/board/mt8167s_ref/BUILD.gn
+++ b/zircon/system/dev/board/mt8167s_ref/BUILD.gn
@@ -34,6 +34,7 @@
     "$zx/system/dev/lib/mmio",
     "$zx/system/dev/lib/mt8167",
     "$zx/system/fidl/fuchsia-hardware-thermal:c",
+    "$zx/system/fidl/fuchsia-sysmem:c",
     "$zx/system/ulib/ddk",
     "$zx/system/ulib/ddktl",
     "$zx/system/ulib/fbl",
@@ -79,6 +80,7 @@
     "$zx/system/dev/lib/mmio",
     "$zx/system/dev/lib/mt8167",
     "$zx/system/fidl/fuchsia-hardware-thermal:c",
+    "$zx/system/fidl/fuchsia-sysmem:c",
     "$zx/system/ulib/ddk",
     "$zx/system/ulib/ddktl",
     "$zx/system/ulib/driver",
diff --git a/zircon/system/dev/board/qemu/BUILD.gn b/zircon/system/dev/board/qemu/BUILD.gn
index 6ef24f1..52fb83e 100644
--- a/zircon/system/dev/board/qemu/BUILD.gn
+++ b/zircon/system/dev/board/qemu/BUILD.gn
@@ -10,6 +10,7 @@
   deps = [
     "$zx/system/banjo/ddk.protocol.platform.bus",
     "$zx/system/banjo/ddk.protocol.platform.device",
+    "$zx/system/fidl/fuchsia-sysmem:c",
     "$zx/system/ulib/ddk",
     "$zx/system/ulib/zircon",
   ]
diff --git a/zircon/system/dev/board/sherlock/BUILD.gn b/zircon/system/dev/board/sherlock/BUILD.gn
index 7222008..1bc9e9d 100644
--- a/zircon/system/dev/board/sherlock/BUILD.gn
+++ b/zircon/system/dev/board/sherlock/BUILD.gn
@@ -41,6 +41,7 @@
     "$zx/system/dev/lib/mmio",
     "$zx/system/fidl/fuchsia-hardware-serial:c",
     "$zx/system/fidl/fuchsia-hardware-thermal:c",
+    "$zx/system/fidl/fuchsia-sysmem:c",
     "$zx/system/ulib/ddk",
     "$zx/system/ulib/ddktl",
     "$zx/system/ulib/fbl",
diff --git a/zircon/system/dev/board/vim2/BUILD.gn b/zircon/system/dev/board/vim2/BUILD.gn
index e49c007..2120840 100644
--- a/zircon/system/dev/board/vim2/BUILD.gn
+++ b/zircon/system/dev/board/vim2/BUILD.gn
@@ -35,6 +35,7 @@
     "$zx/system/dev/lib/mmio",
     "$zx/system/fidl/fuchsia-hardware-serial:c",
     "$zx/system/fidl/fuchsia-hardware-thermal:c",
+    "$zx/system/fidl/fuchsia-sysmem:c",
     "$zx/system/ulib/ddk",
     "$zx/system/ulib/ddktl",
     "$zx/system/ulib/sync",
diff --git a/zircon/system/dev/board/x86/BUILD.gn b/zircon/system/dev/board/x86/BUILD.gn
index 214b2df..e8d652e 100644
--- a/zircon/system/dev/board/x86/BUILD.gn
+++ b/zircon/system/dev/board/x86/BUILD.gn
@@ -70,6 +70,7 @@
     "$zx/system/banjo/ddk.protocol.sysmem",
     "$zx/system/fidl/fuchsia-hardware-power:c",
     "$zx/system/fidl/fuchsia-hardware-thermal:c",
+    "$zx/system/fidl/fuchsia-sysmem:c",
     "$zx/system/ulib/ddk",
     "$zx/system/ulib/ddktl",
     "$zx/system/ulib/fbl",
diff --git a/zircon/system/dev/camera/arm-isp/BUILD.gn b/zircon/system/dev/camera/arm-isp/BUILD.gn
index 1264c95..3763192 100644
--- a/zircon/system/dev/camera/arm-isp/BUILD.gn
+++ b/zircon/system/dev/camera/arm-isp/BUILD.gn
@@ -4,8 +4,8 @@
 
 driver("arm-isp") {
   sources = [
-    "arm-isp.cpp",
     "arm-isp-test.cpp",
+    "arm-isp.cpp",
     "init_sequences.cpp",
     "modules/dma-format.cc",
     "modules/dma-mgr.cc",
@@ -18,13 +18,14 @@
     "$zx/system/banjo/ddk.protocol.composite",
     "$zx/system/banjo/ddk.protocol.gpio",
     "$zx/system/banjo/ddk.protocol.i2c",
+    "$zx/system/banjo/ddk.protocol.isp",
     "$zx/system/banjo/ddk.protocol.mipicsi",
     "$zx/system/banjo/ddk.protocol.platform.bus",
     "$zx/system/banjo/ddk.protocol.platform.device",
     "$zx/system/banjo/ddk.protocol.sysmem",
     "$zx/system/dev/lib/mmio",
-    "$zx/system/fidl/fuchsia-hardware-camera:c",
     "$zx/system/fidl/fuchsia-camera-test:c",
+    "$zx/system/fidl/fuchsia-hardware-camera:c",
     "$zx/system/fidl/fuchsia-sysmem:c",
     "$zx/system/ulib/ddk",
     "$zx/system/ulib/ddktl",
diff --git a/zircon/system/public/zircon/device/camera.h b/zircon/system/public/zircon/device/camera.h
new file mode 100644
index 0000000..08f171cb
--- /dev/null
+++ b/zircon/system/public/zircon/device/camera.h
@@ -0,0 +1,17 @@
+// Copyright 2019 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.
+
+#ifndef SYSROOT_ZIRCON_DEVICE_CAMERA_H_
+#define SYSROOT_ZIRCON_DEVICE_CAMERA_H_
+
+#include <ddk/metadata.h>
+#include <fuchsia/camera/common/c/fidl.h>
+
+// TODO(ZX-2677): Deleting this file is blocked by banjo being able to consume
+// code generated by fidl.
+// This allows banjo files to use FIDL generated structs. Once ZX-2677 is implemented
+// this will not be needed and can be cleaned up.
+typedef fuchsia_camera_common_FrameRate frame_rate_t;
+
+#endif // SYSROOT_ZIRCON_DEVICE_SYSMEM_H_
diff --git a/zircon/system/public/zircon/device/sysmem.h b/zircon/system/public/zircon/device/sysmem.h
index 200cd05..9ce8eea 100644
--- a/zircon/system/public/zircon/device/sysmem.h
+++ b/zircon/system/public/zircon/device/sysmem.h
@@ -6,6 +6,7 @@
 #define SYSROOT_ZIRCON_DEVICE_SYSMEM_H_
 
 #include <ddk/metadata.h>
+#include <fuchsia/sysmem/c/fidl.h>
 
 // "SyM"
 #define SYSMEM_METADATA (0x53794d00 | DEVICE_METADATA_PRIVATE)
@@ -16,4 +17,8 @@
     uint64_t protected_memory_size;
 } sysmem_metadata_t;
 
+// TODO(ZX-2677): Deleting this file is blocked by banjo being able to consume
+// code generated by fidl.
+typedef fuchsia_sysmem_BufferCollectionInfo buffer_collection_info_t;
+
 #endif  // SYSROOT_ZIRCON_DEVICE_SYSMEM_H_