2020-10-17 02:53:59 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2019-2020 Cobham Gaisler AB
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
2022-05-06 16:49:15 +08:00
|
|
|
#include <zephyr/kernel.h>
|
|
|
|
#include <zephyr/kernel_structs.h>
|
|
|
|
#include <zephyr/irq.h>
|
|
|
|
#include <zephyr/irq_offload.h>
|
2020-10-17 02:53:59 +08:00
|
|
|
|
|
|
|
volatile irq_offload_routine_t _offload_routine;
|
|
|
|
static volatile const void *offload_param;
|
|
|
|
|
|
|
|
void z_irq_do_offload(void)
|
|
|
|
{
|
|
|
|
irq_offload_routine_t tmp;
|
|
|
|
|
|
|
|
if (!_offload_routine) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
tmp = _offload_routine;
|
|
|
|
_offload_routine = NULL;
|
|
|
|
|
|
|
|
tmp((const void *)offload_param);
|
|
|
|
}
|
|
|
|
|
|
|
|
void arch_irq_offload(irq_offload_routine_t routine, const void *parameter)
|
|
|
|
{
|
|
|
|
unsigned int key;
|
|
|
|
|
|
|
|
key = irq_lock();
|
|
|
|
_offload_routine = routine;
|
|
|
|
offload_param = parameter;
|
|
|
|
|
|
|
|
/* Generate irq offload trap */
|
|
|
|
__asm__ volatile ("ta 13");
|
|
|
|
|
|
|
|
irq_unlock(key);
|
|
|
|
}
|