aboutsummaryrefslogtreecommitdiff
path: root/src/ethosu_driver.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ethosu_driver.c')
-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)