modules: hal_ethos_u: update module revision

Updated revision for hal_ethos_u module, and adapted
ethosu_semaphore_take function prototype accordingly in order to align
with changes in the NPU driver

Signed-off-by: Ledion Daja <ledion.daja@arm.com>
This commit is contained in:
Ledion Daja 2024-02-01 12:39:15 +01:00 committed by Carles Cufí
parent 557e5969f3
commit 4c25482ef6
2 changed files with 37 additions and 25 deletions

View file

@ -1,9 +1,10 @@
/* /*
* Copyright 2021-2022 Arm Limited and/or its affiliates <open-source-office@arm.com> * SPDX-FileCopyrightText: <text>Copyright 2021-2022, 2024 Arm Limited and/or its
* * affiliates <open-source-office@arm.com></text>
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
#include "zephyr/sys_clock.h"
#include <zephyr/device.h> #include <zephyr/device.h>
#include <zephyr/devicetree.h> #include <zephyr/devicetree.h>
#include <zephyr/init.h> #include <zephyr/init.h>
@ -72,13 +73,26 @@ void *ethosu_semaphore_create(void)
return (void *)sem; return (void *)sem;
} }
int ethosu_semaphore_take(void *sem) int ethosu_semaphore_take(void *sem, uint64_t timeout)
{ {
int status; int status;
status = k_sem_take((struct k_sem *)sem, K_FOREVER); status = k_sem_take((struct k_sem *)sem, (timeout == ETHOSU_SEMAPHORE_WAIT_FOREVER)
? K_FOREVER
: Z_TIMEOUT_TICKS(timeout));
if (status != 0) { if (status != 0) {
LOG_ERR("Failed to take semaphore with error - %d", status); /* The Ethos-U driver expects the semaphore implementation to never fail except for
* when a timeout occurs, and the current ethosu_semaphore_take implementation makes
* no distinction, in terms of return codes, between a timeout and other semaphore
* take failures. Also, note that a timeout is virtually indistinguishable from
* other failures if the driver logging is disabled. Handling errors other than a
* timeout is therefore not covered here and is deferred to the application
* developer if necessary.
*/
if (status != -EAGAIN) {
LOG_ERR("Failed to take semaphore with error - %d", status);
}
return -1; return -1;
} }
@ -136,25 +150,23 @@ static int ethosu_zephyr_init(const struct device *dev)
return 0; return 0;
} }
#define ETHOSU_DEVICE_INIT(n) \ #define ETHOSU_DEVICE_INIT(n) \
static struct ethosu_data ethosu_data_##n; \ static struct ethosu_data ethosu_data_##n; \
\ \
static void ethosu_zephyr_irq_config_##n(void) \ static void ethosu_zephyr_irq_config_##n(void) \
{ \ { \
IRQ_CONNECT(DT_INST_IRQN(n), \ IRQ_CONNECT(DT_INST_IRQN(n), DT_INST_IRQ(n, priority), ethosu_zephyr_irq_handler, \
DT_INST_IRQ(n, priority), \ DEVICE_DT_INST_GET(n), 0); \
ethosu_zephyr_irq_handler, \ irq_enable(DT_INST_IRQN(n)); \
DEVICE_DT_INST_GET(n), 0); \ } \
irq_enable(DT_INST_IRQN(n)); \ \
} \ static const struct ethosu_dts_info ethosu_dts_info_##n = { \
\ .base_addr = (void *)DT_INST_REG_ADDR(n), \
static const struct ethosu_dts_info ethosu_dts_info_##n = { \ .secure_enable = DT_INST_PROP(n, secure_enable), \
.base_addr = (void *)DT_INST_REG_ADDR(n), \ .privilege_enable = DT_INST_PROP(n, privilege_enable), \
.secure_enable = DT_INST_PROP(n, secure_enable), \ .irq_config = &ethosu_zephyr_irq_config_##n, \
.privilege_enable = DT_INST_PROP(n, privilege_enable), \ }; \
.irq_config = &ethosu_zephyr_irq_config_##n, \ \
}; \
\
DEVICE_DT_INST_DEFINE(n, ethosu_zephyr_init, NULL, &ethosu_data_##n, &ethosu_dts_info_##n, \ DEVICE_DT_INST_DEFINE(n, ethosu_zephyr_init, NULL, &ethosu_data_##n, &ethosu_dts_info_##n, \
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, NULL); POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, NULL);

View file

@ -158,7 +158,7 @@ manifest:
groups: groups:
- hal - hal
- name: hal_ethos_u - name: hal_ethos_u
revision: 90ada2ea5681b2a2722a10d2898eac34c2510791 revision: 8e2cf756b474eff9a32a9bdf1775d9620f1eadcf
path: modules/hal/ethos_u path: modules/hal/ethos_u
groups: groups:
- hal - hal