Change create network UAPI to take a user buffer

To not allow the buffer for a network instance to be changed after
creation, the create network UAPI will now take the network model data
as a user buffer. The content of the user buffer is copied into an
internally allocated DMA buffer that cannot be accessed by the user.

This breaks the current API so the Linux kernel NPU driver version and
the driver library version have been given major version bumps. All the
tests, documentation and other applications affected by the changes have
been updated accordingly.

Change-Id: I25c785d75a24794c3db632e4abe5cfbb1c7ac190
Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
diff --git a/driver_library/include/ethosu.hpp b/driver_library/include/ethosu.hpp
index 47c1868..eaa1ce7 100644
--- a/driver_library/include/ethosu.hpp
+++ b/driver_library/include/ethosu.hpp
@@ -39,12 +39,12 @@
 
 namespace EthosU {
 
-constexpr uint32_t DRIVER_LIBRARY_VERSION_MAJOR = 2;
+constexpr uint32_t DRIVER_LIBRARY_VERSION_MAJOR = 3;
 constexpr uint32_t DRIVER_LIBRARY_VERSION_MINOR = 0;
 constexpr uint32_t DRIVER_LIBRARY_VERSION_PATCH = 0;
 
-constexpr uint32_t MAX_SUPPORTED_KERNEL_DRIVER_MAJOR_VERSION = 2;
-constexpr uint32_t MIN_SUPPORTED_KERNEL_DRIVER_MAJOR_VERSION = 2;
+constexpr uint32_t MAX_SUPPORTED_KERNEL_DRIVER_MAJOR_VERSION = 3;
+constexpr uint32_t MIN_SUPPORTED_KERNEL_DRIVER_MAJOR_VERSION = 3;
 
 class Exception : public std::exception {
 public:
@@ -168,12 +168,11 @@
 
 class Network {
 public:
-    Network(const Device &device, std::shared_ptr<Buffer> &buffer);
+    Network(const Device &device, const unsigned char *networkData, size_t networkSize);
     Network(const Device &device, const unsigned index);
     virtual ~Network() noexcept(false);
 
     int ioctl(unsigned long cmd, void *data = nullptr);
-    std::shared_ptr<Buffer> getBuffer();
     const std::vector<size_t> &getIfmDims() const;
     size_t getIfmSize() const;
     const std::vector<size_t> &getOfmDims() const;
@@ -183,7 +182,6 @@
     void collectNetworkInfo();
 
     int fd;
-    std::shared_ptr<Buffer> buffer;
     std::vector<size_t> ifmDims;
     std::vector<size_t> ofmDims;
 };