From 68b5c91c22d11f3410f520cfb69ce6c5848f2f4a Mon Sep 17 00:00:00 2001 From: Kristofer Jonsson Date: Mon, 14 Nov 2022 10:52:38 +0100 Subject: Update header file documentation Update documentation in driver header file. Some functions were inconsistently returning boolean status. These functions have been updated to return integer status, with 0 on success and negative error code on failure. Change-Id: Ie044bf5b4f2daaff348e698fa6147472dbc582a9 --- src/ethosu_driver.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/ethosu_driver.c') diff --git a/src/ethosu_driver.c b/src/ethosu_driver.c index 11c51f6..4ddcb6c 100644 --- a/src/ethosu_driver.c +++ b/src/ethosu_driver.c @@ -344,7 +344,7 @@ static int handle_command_stream(struct ethosu_driver *drv, const uint8_t *cmd_s } // Request power gating disabled during inference run - if (!ethosu_request_power(drv)) + if (ethosu_request_power(drv)) { LOG_ERR("Failed to request power"); return -1; @@ -437,13 +437,13 @@ void ethosu_deinit(struct ethosu_driver *drv) drv->dev = NULL; } -bool ethosu_soft_reset(struct ethosu_driver *drv) +int ethosu_soft_reset(struct ethosu_driver *drv) { // Soft reset the NPU if (ethosu_dev_soft_reset(drv->dev) != ETHOSU_SUCCESS) { LOG_ERR("Failed to soft-reset NPU"); - return false; + return -1; } // Update power and clock gating after the soft reset @@ -451,24 +451,24 @@ bool ethosu_soft_reset(struct ethosu_driver *drv) drv->power_request_counter > 0 ? ETHOSU_CLOCK_Q_DISABLE : ETHOSU_CLOCK_Q_ENABLE, drv->power_request_counter > 0 ? ETHOSU_POWER_Q_DISABLE : ETHOSU_POWER_Q_ENABLE); - return true; + return 0; } -bool ethosu_request_power(struct ethosu_driver *drv) +int ethosu_request_power(struct ethosu_driver *drv) { // Check if this is the first power request, increase counter if (drv->power_request_counter++ == 0) { // Always reset to a known state. Changes to requested // security state/privilege mode if necessary. - if (ethosu_soft_reset(drv) == false) + if (ethosu_soft_reset(drv)) { LOG_ERR("Failed to request power for Ethos-U"); drv->power_request_counter--; - return false; + return -1; } } - return true; + return 0; } void ethosu_release_power(struct ethosu_driver *drv) -- cgit v1.2.1