Network info

Add UAPI and core message that allows user space space to fetch
information about network models built into the firmware.

Change-Id: Ic92529bce3edd0a5499e691a566bd065da2a72ad
diff --git a/driver_library/CMakeLists.txt b/driver_library/CMakeLists.txt
index 4444357..41eb115 100644
--- a/driver_library/CMakeLists.txt
+++ b/driver_library/CMakeLists.txt
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2020 Arm Limited. All rights reserved.
+# Copyright (c) 2020,2022 Arm Limited.
 #
 # SPDX-License-Identifier: Apache-2.0
 #
diff --git a/driver_library/include/ethosu.hpp b/driver_library/include/ethosu.hpp
index 0738aa2..e4fd4f1 100644
--- a/driver_library/include/ethosu.hpp
+++ b/driver_library/include/ethosu.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020-2022 Arm Limited. All rights reserved.
+ * Copyright (c) 2020-2022 Arm Limited.
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -161,7 +161,7 @@
 class Network {
 public:
     Network(const Device &device, std::shared_ptr<Buffer> &buffer);
-    Network(const Device &device, const std::string &model, const unsigned index);
+    Network(const Device &device, const unsigned index);
     virtual ~Network();
 
     int ioctl(unsigned long cmd, void *data = nullptr);
diff --git a/driver_library/src/ethosu.cpp b/driver_library/src/ethosu.cpp
index 16d2db0..f792399 100644
--- a/driver_library/src/ethosu.cpp
+++ b/driver_library/src/ethosu.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020-2022 Arm Limited. All rights reserved.
+ * Copyright (c) 2020-2022 Arm Limited.
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -305,7 +305,7 @@
     }
 }
 
-Network::Network(const Device &device, const string &model, const unsigned index) : fd(-1) {
+Network::Network(const Device &device, const unsigned index) : fd(-1) {
     // Create buffer handle
     ethosu_uapi_network_create uapi;
     uapi.type  = ETHOSU_UAPI_NETWORK_INDEX;
@@ -313,22 +313,16 @@
     fd         = device.ioctl(ETHOSU_IOCTL_NETWORK_CREATE, static_cast<void *>(&uapi));
 
     try {
-        // Open file
-        ifstream ifs(model, std::ios::binary);
-        if (!ifs.is_open()) {
-            throw Exception("Failed to open model file.");
+        ethosu_uapi_network_info info;
+        ioctl(ETHOSU_IOCTL_NETWORK_INFO, static_cast<void *>(&info));
+
+        for (uint32_t i = 0; i < info.ifm_count; i++) {
+            ifmDims.push_back(info.ifm_size[i]);
         }
 
-        // Get file size
-        ifs.seekg(0, ios_base::end);
-        size_t size = ifs.tellg();
-        ifs.seekg(0, ios_base::beg);
-
-        // Read data into buffer
-        vector<char> buffer(size);
-        ifs.read(buffer.data(), size);
-
-        parseModel(buffer.data());
+        for (uint32_t i = 0; i < info.ofm_count; i++) {
+            ofmDims.push_back(info.ofm_size[i]);
+        }
     } catch (...) {
         eclose(fd);
         throw;
diff --git a/driver_library/src/ethosu_stub.cpp b/driver_library/src/ethosu_stub.cpp
index 428d276..d85f653 100644
--- a/driver_library/src/ethosu_stub.cpp
+++ b/driver_library/src/ethosu_stub.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020-2021 Arm Limited. All rights reserved.
+ * Copyright (c) 2020-2022 Arm Limited.
  *
  * SPDX-License-Identifier: Apache-2.0
  *