aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/ethosu_driver.h51
-rw-r--r--src/ethosu_driver.c32
2 files changed, 33 insertions, 50 deletions
diff --git a/include/ethosu_driver.h b/include/ethosu_driver.h
index 96822e0..e492f91 100644
--- a/include/ethosu_driver.h
+++ b/include/ethosu_driver.h
@@ -103,59 +103,42 @@ extern struct ethosu_driver ethosu_drv;
/**
* Initialize the Ethos-U driver.
*/
-int ethosu_init_v4(struct ethosu_driver *drv,
- const void *base_address,
- const void *fast_memory,
- const size_t fast_memory_size,
- uint32_t secure_enable,
- uint32_t privilege_enable);
-
-#define ethosu_init(base_address) ethosu_init_v3(base_address, NULL, 0, 0, 0)
-#define ethosu_init_v2(base_address, fast_memory, fast_memory_size) \
- ethosu_init_v3(base_address, fast_memory, fast_memory_size, 0, 0)
-#define ethosu_init_v3(base_address, fast_memory, fast_memory_size, secure_enable, privilege_enable) \
- ethosu_init_v4(&ethosu_drv, base_address, fast_memory, fast_memory_size, secure_enable, privilege_enable)
+int ethosu_init(struct ethosu_driver *drv,
+ const void *base_address,
+ const void *fast_memory,
+ const size_t fast_memory_size,
+ uint32_t secure_enable,
+ uint32_t privilege_enable);
/**
* Get Ethos-U version.
*/
-int ethosu_get_version_v2(struct ethosu_driver *drv, struct ethosu_version *version);
-
-#define ethosu_get_version(version) ethosu_get_version_v2(&ethosu_drv, version)
+int ethosu_get_version(struct ethosu_driver *drv, struct ethosu_version *version);
/**
* Invoke Vela command stream.
*/
-int ethosu_invoke_v3(struct ethosu_driver *drv,
- const void *custom_data_ptr,
- const int custom_data_size,
- const uint64_t *base_addr,
- const size_t *base_addr_size,
- const int num_base_addr);
-
-#define ethosu_invoke(custom_data_ptr, custom_data_size, base_addr, num_base_addr) \
- ethosu_invoke_v2(custom_data_ptr, custom_data_size, base_addr, NULL, num_base_addr)
+int ethosu_invoke(struct ethosu_driver *drv,
+ const void *custom_data_ptr,
+ const int custom_data_size,
+ const uint64_t *base_addr,
+ const size_t *base_addr_size,
+ const int num_base_addr);
/**
* Abort Ethos-U inference.
*/
-void ethosu_abort_v2(struct ethosu_driver *drv);
-
-#define ethosu_abort(void) ethosu_abort_v2(&ethosu_drv)
+void ethosu_abort(struct ethosu_driver *drv);
/**
* Interrupt handler do be called on IRQ from Ethos-U
*/
-void ethosu_irq_handler_v2(struct ethosu_driver *drv);
-
-#define ethosu_irq_handler(void) ethosu_irq_handler_v2(&ethosu_drv)
+void ethosu_irq_handler(struct ethosu_driver *drv);
/**
* Set Ethos-U power mode.
*/
-void ethosu_set_power_mode_v2(struct ethosu_driver *drv, bool always_on);
-
-#define ethosu_set_power_mode(always_on) ethosu_set_power_mode_v2(&ethosu_drv, always_on)
+void ethosu_set_power_mode(struct ethosu_driver *drv, bool always_on);
/**
* Register a driver for multiNPU usage
@@ -195,7 +178,7 @@ static inline int ethosu_invoke_v2(const void *custom_data_ptr,
const int num_base_addr)
{
struct ethosu_driver *drv = ethosu_reserve_driver();
- int result = ethosu_invoke_v3(drv, custom_data_ptr, custom_data_size, base_addr, base_addr_size, num_base_addr);
+ int result = ethosu_invoke(drv, custom_data_ptr, custom_data_size, base_addr, base_addr_size, num_base_addr);
ethosu_release_driver(drv);
return result;
}
diff --git a/src/ethosu_driver.c b/src/ethosu_driver.c
index 22c15c2..1442621 100644
--- a/src/ethosu_driver.c
+++ b/src/ethosu_driver.c
@@ -216,7 +216,7 @@ void __attribute__((weak)) ethosu_semaphore_give(void *sem)
static int ethosu_soft_reset_and_restore(struct ethosu_driver *drv);
-void __attribute__((weak)) ethosu_irq_handler_v2(struct ethosu_driver *drv)
+void __attribute__((weak)) ethosu_irq_handler(struct ethosu_driver *drv)
{
uint8_t irq_raised = 0;
@@ -273,12 +273,12 @@ static void dump_command_stream(const uint32_t *cmd_stream, const int cms_length
static void npu_axi_init(struct ethosu_driver *drv);
static struct ethosu_driver *ethosu_find_and_reserve_driver(void);
-int ethosu_init_v4(struct ethosu_driver *drv,
- const void *base_address,
- const void *fast_memory,
- const size_t fast_memory_size,
- uint32_t secure_enable,
- uint32_t privilege_enable)
+int ethosu_init(struct ethosu_driver *drv,
+ const void *base_address,
+ const void *fast_memory,
+ const size_t fast_memory_size,
+ uint32_t secure_enable,
+ uint32_t privilege_enable)
{
int return_code = 0;
@@ -336,7 +336,7 @@ int ethosu_init_v4(struct ethosu_driver *drv,
return return_code;
}
-int ethosu_get_version_v2(struct ethosu_driver *drv, struct ethosu_version *version)
+int ethosu_get_version(struct ethosu_driver *drv, struct ethosu_version *version)
{
int return_code = 0;
@@ -370,12 +370,12 @@ int ethosu_get_version_v2(struct ethosu_driver *drv, struct ethosu_version *vers
return return_code;
}
-int ethosu_invoke_v3(struct ethosu_driver *drv,
- const void *custom_data_ptr,
- const int custom_data_size,
- const uint64_t *base_addr,
- const size_t *base_addr_size,
- const int num_base_addr)
+int ethosu_invoke(struct ethosu_driver *drv,
+ const void *custom_data_ptr,
+ const int custom_data_size,
+ const uint64_t *base_addr,
+ const size_t *base_addr_size,
+ const int num_base_addr)
{
const struct custom_data_s *data_ptr = custom_data_ptr;
const struct custom_data_s *data_end = custom_data_ptr + custom_data_size;
@@ -505,12 +505,12 @@ int ethosu_invoke_v3(struct ethosu_driver *drv,
return return_code;
}
-void ethosu_abort_v2(struct ethosu_driver *drv)
+void ethosu_abort(struct ethosu_driver *drv)
{
drv->abort_inference = true;
}
-void ethosu_set_power_mode_v2(struct ethosu_driver *drv, bool always_on)
+void ethosu_set_power_mode(struct ethosu_driver *drv, bool always_on)
{
drv->dev_power_always_on = always_on;