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/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;