Spring clean/refactor of NPU driver

These changes mostly focus on creating a better structure
for the driver. Creating a better separation between driver
and device(s).

A short summary of what this commit contains:

    - Move driver specific defines from device to driver
    - Prefix device functions with ethosu_dev
    - Remove device specific register access' from driver
    - Remove device specific debug/dump functions
    - Add function prototypes for weak functions
    - Remove legacy ARM_NPU_STUB support
    - Rename ethosu_device.c to ethosu_device_u55.c
    - Remove redundant irq handler prototype
    - Remove (deprecated) hardcoded instance ethosu_drv

    - Simplify versioning API
      Split driver version and hardware version/information so
      that driver version can be queried without a driver instance.

    - Improve and simplify logging
      Make warning the new default severity level to print and
      reduce severity levels to:
        err
        warning
        info
        debug

    - Add severity prefix to log lines. Error messages print file
      and line number, debug messages print function by default.
    - Clarify some log messages

    - Small optimizations and bugfixes

Change-Id: I2dfbfc3a40d7eca133c82f187f422325e1e6d314
diff --git a/include/ethosu_driver.h b/include/ethosu_driver.h
index e492f91..30d707f 100644
--- a/include/ethosu_driver.h
+++ b/include/ethosu_driver.h
@@ -34,54 +34,44 @@
 #endif
 
 /******************************************************************************
+ * Defines
+ ******************************************************************************/
+
+#define ETHOSU_DRIVER_VERSION_MAJOR 0  ///< Driver major version
+#define ETHOSU_DRIVER_VERSION_MINOR 16 ///< Driver minor version
+#define ETHOSU_DRIVER_VERSION_PATCH 0  ///< Driver patch version
+
+/******************************************************************************
  * Types
  ******************************************************************************/
 
 struct ethosu_driver
 {
     struct ethosu_device dev;
-    bool abort_inference;
+    struct ethosu_driver *next;
+    void *semaphore;
     uint64_t fast_memory;
     size_t fast_memory_size;
     bool status_error;
+    bool abort_inference;
     bool dev_power_always_on;
-    struct ethosu_driver *next;
     bool reserved;
     volatile bool irq_triggered;
-    void *semaphore;
     uint8_t clock_request;
     uint8_t power_request;
 };
 
-struct ethosu_version_id
+struct ethosu_driver_version
 {
-    // Ethos-U id
-    uint8_t version_status;
-    uint8_t version_minor;
-    uint8_t version_major;
-    uint8_t product_major;
-    uint8_t arch_patch_rev;
-    uint8_t arch_minor_rev;
-    uint8_t arch_major_rev;
-
-    // Driver Version
-    uint8_t driver_patch_rev;
-    uint8_t driver_minor_rev;
-    uint8_t driver_major_rev;
+    uint8_t major;
+    uint8_t minor;
+    uint8_t patch;
 };
 
-struct ethosu_version_config
+struct ethosu_hw_info
 {
-    uint8_t macs_per_cc;
-    uint8_t cmd_stream_version;
-    uint8_t shram_size;
-    uint8_t custom_dma;
-};
-
-struct ethosu_version
-{
-    struct ethosu_version_id id;
-    struct ethosu_version_config cfg;
+    struct ethosu_id version;
+    struct ethosu_config cfg;
 };
 
 enum ethosu_request_clients
@@ -91,10 +81,43 @@
 };
 
 /******************************************************************************
- * Variables
+ * Prototypes (weak functions in driver)
  ******************************************************************************/
 
-extern struct ethosu_driver ethosu_drv;
+/**
+ * Interrupt handler to be called on IRQ from Ethos-U
+ */
+void ethosu_irq_handler(struct ethosu_driver *drv);
+
+/*
+ * Flush/clean the data cache by address and size. Passing NULL as p argument
+ * expects the whole cache to be flushed.
+ */
+
+void ethosu_flush_dcache(uint32_t *p, size_t bytes);
+/*
+ * Invalidate the data cache by address and size. Passing NULL as p argument
+ * expects the whole cache to be invalidated.
+ */
+void ethosu_invalidate_dcache(uint32_t *p, size_t bytes);
+
+/*
+ * Minimal sempahore and mutex implementation for baremetal applications. See
+ * ethosu_driver.c.
+ */
+void *ethosu_mutex_create(void);
+void ethosu_mutex_lock(void *mutex);
+void ethosu_mutex_unlock(void *mutex);
+void *ethosu_semaphore_create(void);
+void ethosu_semaphore_take(void *sem);
+void ethosu_semaphore_give(void *sem);
+
+/*
+ * Callbacks for begin/end of inference. inference_data pointer is set in the
+ * ethosu_invoke() call, referenced as custom_data_ptr.
+ */
+void ethosu_inference_begin(struct ethosu_driver *drv, const void *inference_data);
+void ethosu_inference_end(struct ethosu_driver *drv, const void *inference_data);
 
 /******************************************************************************
  * Prototypes
@@ -111,9 +134,14 @@
                 uint32_t privilege_enable);
 
 /**
- * Get Ethos-U version.
+ * Get Ethos-U driver version.
  */
-int ethosu_get_version(struct ethosu_driver *drv, struct ethosu_version *version);
+void ethosu_get_driver_version(struct ethosu_driver_version *ver);
+
+/**
+ * Get Ethos-U hardware information.
+ */
+void ethosu_get_hw_info(struct ethosu_driver *drv, struct ethosu_hw_info *hw);
 
 /**
  * Invoke Vela command stream.
@@ -131,26 +159,11 @@
 void ethosu_abort(struct ethosu_driver *drv);
 
 /**
- * Interrupt handler do be called on IRQ from Ethos-U
- */
-void ethosu_irq_handler(struct ethosu_driver *drv);
-
-/**
  * Set Ethos-U power mode.
  */
 void ethosu_set_power_mode(struct ethosu_driver *drv, bool always_on);
 
 /**
- *  Register a driver for multiNPU usage
- */
-int ethosu_register_driver(struct ethosu_driver *drv);
-
-/**
- * Deregister a driver from multiNPU usage
- */
-int ethosu_deregister_driver(struct ethosu_driver *drv);
-
-/**
  * Reserves a driver to execute inference with
  */
 struct ethosu_driver *ethosu_reserve_driver(void);