aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJonny Svärd <jonny.svaerd@arm.com>2023-12-18 17:19:15 +0100
committerJonny Svärd <jonny.svaerd@arm.com>2023-12-19 12:54:45 +0100
commita2732ecd9cb5f5ad76b34a01b4c9b03297c845b8 (patch)
treeb8bb840b5b4bedaa5196c12ebd3933c5359e646b /include
parent0189cd2b334b2d88302d13d6003c50a642db0bb5 (diff)
downloadethos-u-core-driver-a2732ecd9cb5f5ad76b34a01b4c9b03297c845b8.tar.gz
Support timeout for interrupt semaphore24.02-rc124.02
Introduce ETHOSU_INFERENCE_TIMEOUT CMake variable to set an arbitrary timeout value that will be sent as argument to ethosu_semaphore_take() for the interrupt semaphore. Adding the ability to have a timeout for an inference. (Defaults to no timeout/wait forever.) Implement a placeholder mutex for the baremetal example and add error checks for mutex_create() call. Change-Id: Ia74391620340a27c23dc3d15f9ba742c674c8bfa Signed-off-by: Jonny Svärd <jonny.svaerd@arm.com>
Diffstat (limited to 'include')
-rw-r--r--include/ethosu_driver.h20
1 files changed, 17 insertions, 3 deletions
diff --git a/include/ethosu_driver.h b/include/ethosu_driver.h
index 9c9f173..7d55500 100644
--- a/include/ethosu_driver.h
+++ b/include/ethosu_driver.h
@@ -41,6 +41,12 @@ extern "C" {
#define ETHOSU_DRIVER_VERSION_MINOR 16 ///< Driver minor version
#define ETHOSU_DRIVER_VERSION_PATCH 0 ///< Driver patch version
+#define ETHOSU_SEMAPHORE_WAIT_FOREVER (UINT64_MAX)
+
+#ifndef ETHOSU_SEMAPHORE_WAIT_INFERENCE
+#define ETHOSU_SEMAPHORE_WAIT_INFERENCE ETHOSU_SEMAPHORE_WAIT_FOREVER
+#endif
+
/******************************************************************************
* Types
******************************************************************************/
@@ -55,9 +61,17 @@ enum ethosu_job_state
ETHOSU_JOB_DONE
};
+enum ethosu_job_result
+{
+ ETHOSU_JOB_RESULT_OK = 0,
+ ETHOSU_JOB_RESULT_TIMEOUT,
+ ETHOSU_JOB_RESULT_ERROR
+};
+
struct ethosu_job
{
volatile enum ethosu_job_state state;
+ volatile enum ethosu_job_result result;
const void *custom_data_ptr;
int custom_data_size;
const uint64_t *base_addr;
@@ -75,7 +89,6 @@ struct ethosu_driver
uint64_t fast_memory;
size_t fast_memory_size;
uint32_t power_request_counter;
- bool status_error;
bool reserved;
};
@@ -161,9 +174,10 @@ int ethosu_mutex_unlock(void *mutex);
* Take semaphore.
*
* @param sem Pointer to semaphore handle
- * @returns 0 on success, else negative error code
+ * @param timeout Timeout value (unit impl. defined)
+ * @returns 0 on success else negative error code
*/
-int ethosu_semaphore_take(void *sem);
+int ethosu_semaphore_take(void *sem, uint64_t timeout);
/**
* Give semaphore.