Skip to content

Commit aa5207a

Browse files
committed
drivers: mbox: nrf_vevif_task_rx: Fix indexing in rx_set_enabled
Fixes VEVIF task receiver driver to work correctly on both nRF7120 and nRF54h20 by correcting the mapping between Task IDs and Interrupts. Signed-off-by: Erdem Simsek <[email protected]>
1 parent 13f0ae1 commit aa5207a

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

drivers/mbox/mbox_nrf_vevif_task_rx.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,13 @@ static const uint8_t vevif_irqs[VEVIF_TASKS_NUM] = {
4040
static void vevif_task_rx_isr(const void *parameter)
4141
{
4242
uint8_t channel = *(uint8_t *)parameter;
43-
uint8_t idx = channel - TASKS_IDX_MIN;
43+
uint8_t task_id = channel;
44+
uint8_t idx = task_id - TASKS_IDX_MIN;
4445

45-
nrf_vpr_csr_vevif_tasks_clear(BIT(channel));
46+
nrf_vpr_csr_vevif_tasks_clear(BIT(task_id));
4647

4748
if (cbs.cb[idx] != NULL) {
48-
cbs.cb[idx](DEVICE_DT_INST_GET(0), channel, cbs.user_data[idx], NULL);
49+
cbs.cb[idx](DEVICE_DT_INST_GET(0), task_id, cbs.user_data[idx], NULL);
4950
}
5051
}
5152

@@ -65,12 +66,13 @@ static int vevif_task_rx_register_callback(const struct device *dev, uint32_t id
6566
mbox_callback_t cb, void *user_data)
6667
{
6768
ARG_UNUSED(dev);
68-
uint8_t idx = id - TASKS_IDX_MIN;
6969

7070
if (!vevif_task_rx_is_task_valid(id)) {
7171
return -EINVAL;
7272
}
7373

74+
uint8_t idx = id - TASKS_IDX_MIN;
75+
7476
cbs.cb[idx] = cb;
7577
cbs.user_data[idx] = user_data;
7678

@@ -80,12 +82,13 @@ static int vevif_task_rx_register_callback(const struct device *dev, uint32_t id
8082
static int vevif_task_rx_set_enabled(const struct device *dev, uint32_t id, bool enable)
8183
{
8284
ARG_UNUSED(dev);
83-
uint8_t idx = id - TASKS_IDX_MIN;
8485

8586
if (!vevif_task_rx_is_task_valid(id)) {
8687
return -EINVAL;
8788
}
8889

90+
uint8_t idx = id - vevif_irqs[0];
91+
8992
if (enable) {
9093
if ((cbs.enabled_mask & BIT(id)) != 0U) {
9194
return -EALREADY;

0 commit comments

Comments
 (0)