From 1a3bb928b3820b089198afb99bbf410b1f210700 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonny=20Sv=C3=A4rd?= Date: Fri, 25 Feb 2022 16:28:21 +0100 Subject: Add driver async API Add an asynchronous API to the driver. The current synchronous API is now using the new async API internally. The main new functions are ethosu_invoke_async() and ethosu_wait(). Every successfull call to ethosu_invoke_async() must be followed by a call to ethosu_wait() to get the status of the inference. The wait function can be called in a blocking or non-blocking mode by specifying the `block` argument to true/false. The regular synchronous invoke function is implemented as a invoke_async followed by a wait(block=true) call. Short sommary of changes: - Add an internal ethosu_job struct to keep track of inference data and job state. - Use async API in blocking mode for normal flow - Change default semaphore implementation to binary type - Move error prints out of interrupt context - Move ethosu_inference_begin() callback to right before HW invoke - Always call ethosu_inference_end() callback, even in case of errors - On NPU error, do not keep NPU powered after being reset Change-Id: If4c3c46e3c6732a669e17251bd848dea5765a490 --- src/ethosu_device.h | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src/ethosu_device.h') diff --git a/src/ethosu_device.h b/src/ethosu_device.h index cc9ea8b..0b45fd6 100644 --- a/src/ethosu_device.h +++ b/src/ethosu_device.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2021 Arm Limited. All rights reserved. + * Copyright (c) 2019-2022 Arm Limited. All rights reserved. * * SPDX-License-Identifier: Apache-2.0 * @@ -81,13 +81,17 @@ enum ethosu_error_codes ethosu_dev_axi_init(struct ethosu_device *dev); * - All input tensors * - All output tensors * \param[in] num_base_addr Number of base addresses. - * \return \ref ethosu_error_codes */ -enum ethosu_error_codes ethosu_dev_run_command_stream(struct ethosu_device *dev, - const uint8_t *cmd_stream_ptr, - uint32_t cms_length, - const uint64_t *base_addr, - int num_base_addr); +void ethosu_dev_run_command_stream(struct ethosu_device *dev, + const uint8_t *cmd_stream_ptr, + uint32_t cms_length, + const uint64_t *base_addr, + int num_base_addr); + +/** + * Print information on NPU error status + */ +void ethosu_dev_print_err_status(struct ethosu_device *dev); /** * Interrupt handler on device layer -- cgit v1.2.1