aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKristofer Jonsson <kristofer.jonsson@arm.com>2022-11-14 10:52:38 +0100
committerKristofer Jonsson <kristofer.jonsson@arm.com>2022-11-14 16:02:18 +0100
commit68b5c91c22d11f3410f520cfb69ce6c5848f2f4a (patch)
tree43712e76e4ce0e26e63b36f360101d7b33121d9c /src
parent9670332f1e5b286bffe12ad024f1b97995a23bcb (diff)
downloadethos-u-core-driver-68b5c91c22d11f3410f520cfb69ce6c5848f2f4a.tar.gz
Update header file documentation22.11-rc222.11
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
Diffstat (limited to 'src')
-rw-r--r--src/ethosu_driver.c16
1 files changed, 8 insertions, 8 deletions
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)