Linux preempt-rt

Check our new training course

Real-Time Linux with PREEMPT_RT

Check our new training course
with Creative Commons CC-BY-SA
lecture and lab materials

Bootlin logo

Elixir Cross Referencer

 * Copyright (c) 2020 Antony Pavlov <>
 * based on arch/riscv/core/irq_offload.c
 * SPDX-License-Identifier: Apache-2.0

#include <kernel.h>
#include <kernel_structs.h>
#include <kernel_internal.h>
#include <irq.h>
#include <irq_offload.h>

volatile irq_offload_routine_t _offload_routine;
static volatile const void *offload_param;

 * Called by z_mips_enter_irq()
 * Just in case the offload routine itself generates an unhandled
 * exception, clear the offload_routine global before executing.
void z_irq_do_offload(void)
	irq_offload_routine_t tmp;

	if (!_offload_routine) {

	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 ("syscall");