diff options
Diffstat (limited to 'include/ethosu_driver.h')
-rw-r--r-- | include/ethosu_driver.h | 48 |
1 files changed, 42 insertions, 6 deletions
diff --git a/include/ethosu_driver.h b/include/ethosu_driver.h index d47b676..70e3110 100644 --- a/include/ethosu_driver.h +++ b/include/ethosu_driver.h @@ -45,6 +45,8 @@ struct ethosu_driver size_t fast_memory_size; bool status_error; bool dev_power_always_on; + struct ethosu_driver *next; + bool reserved; }; struct ethosu_version_id @@ -90,7 +92,8 @@ extern struct ethosu_driver ethosu_drv; /** * Initialize the Ethos-U driver. */ -int ethosu_init_v3(const void *base_address, +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, @@ -99,16 +102,21 @@ int ethosu_init_v3(const void *base_address, #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(ðosu_drv, base_address, fast_memory, fast_memory_size, secure_enable, privilege_enable) /** * Get Ethos-U version. */ -int ethosu_get_version(struct ethosu_version *version); +int ethosu_get_version_v2(struct ethosu_driver *drv, struct ethosu_version *version); + +#define ethosu_get_version(version) ethosu_get_version_v2(ðosu_drv, version) /** * Invoke Vela command stream. */ -int ethosu_invoke_v2(const void *custom_data_ptr, +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, @@ -116,21 +124,49 @@ int ethosu_invoke_v2(const void *custom_data_ptr, #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) +#define ethosu_invoke_v2(custom_data_ptr, custom_data_size, base_addr, base_addr_size, num_base_addr) \ + ethosu_invoke_v3(ðosu_drv, custom_data_ptr, custom_data_size, base_addr, base_addr_size, num_base_addr) /** * Abort Ethos-U inference. */ -void ethosu_abort(void); +void ethosu_abort_v2(struct ethosu_driver *drv); + +#define ethosu_abort(void) ethosu_abort_v2(ðosu_drv) /** * Interrupt handler do be called on IRQ from Ethos-U */ -void ethosu_irq_handler(void); +void ethosu_irq_handler_v2(struct ethosu_driver *drv); + +#define ethosu_irq_handler(void) ethosu_irq_handler_v2(ðosu_drv) /** * Set Ethos-U power mode. */ -void ethosu_set_power_mode(bool); +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(ðosu_drv, 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); + +/** + * Find, reserve, and return the first available driver + */ +struct ethosu_driver *ethosu_reserve_driver(void); + +/** + * Change driver status to available + */ +void ethosu_release_driver(struct ethosu_driver *drv); #ifdef __cplusplus } |