2019-10-07 21:51:00 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2019 Oticon A/S
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
2022-05-06 16:49:15 +08:00
|
|
|
#include <zephyr/arch/posix/posix_soc_if.h>
|
2019-10-07 21:51:00 +08:00
|
|
|
#include "board_irq.h"
|
|
|
|
|
2019-10-04 06:20:41 +08:00
|
|
|
#ifdef CONFIG_IRQ_OFFLOAD
|
2022-05-25 23:31:28 +08:00
|
|
|
#include <zephyr/irq_offload.h>
|
2019-10-25 20:54:17 +08:00
|
|
|
|
2020-07-10 16:57:23 +08:00
|
|
|
void arch_irq_offload(irq_offload_routine_t routine, const void *parameter)
|
2019-10-07 21:51:00 +08:00
|
|
|
{
|
|
|
|
posix_irq_offload(routine, parameter);
|
|
|
|
}
|
2019-10-04 06:20:41 +08:00
|
|
|
#endif
|
|
|
|
|
2019-11-08 04:43:29 +08:00
|
|
|
void arch_irq_enable(unsigned int irq)
|
2019-10-04 06:20:41 +08:00
|
|
|
{
|
|
|
|
posix_irq_enable(irq);
|
|
|
|
}
|
|
|
|
|
2019-11-08 04:43:29 +08:00
|
|
|
void arch_irq_disable(unsigned int irq)
|
2019-10-04 06:20:41 +08:00
|
|
|
{
|
|
|
|
posix_irq_disable(irq);
|
|
|
|
}
|
|
|
|
|
2019-11-08 04:43:29 +08:00
|
|
|
int arch_irq_is_enabled(unsigned int irq)
|
2019-10-04 06:20:41 +08:00
|
|
|
{
|
|
|
|
return posix_irq_is_enabled(irq);
|
|
|
|
}
|
2019-10-07 21:51:00 +08:00
|
|
|
|
|
|
|
#ifdef CONFIG_DYNAMIC_INTERRUPTS
|
|
|
|
/**
|
|
|
|
* Configure a dynamic interrupt.
|
|
|
|
*
|
|
|
|
* Use this instead of IRQ_CONNECT() if arguments cannot be known at build time.
|
|
|
|
*
|
|
|
|
* @param irq IRQ line number
|
|
|
|
* @param priority Interrupt priority
|
|
|
|
* @param routine Interrupt service routine
|
|
|
|
* @param parameter ISR parameter
|
|
|
|
* @param flags Arch-specific IRQ configuration flags
|
|
|
|
*
|
|
|
|
* @return The vector assigned to this interrupt
|
|
|
|
*/
|
2019-11-08 04:43:29 +08:00
|
|
|
int arch_irq_connect_dynamic(unsigned int irq, unsigned int priority,
|
2020-07-10 20:17:51 +08:00
|
|
|
void (*routine)(const void *parameter),
|
|
|
|
const void *parameter, uint32_t flags)
|
2019-10-07 21:51:00 +08:00
|
|
|
{
|
|
|
|
posix_isr_declare(irq, (int)flags, routine, parameter);
|
|
|
|
posix_irq_priority_set(irq, priority, flags);
|
|
|
|
return irq;
|
|
|
|
}
|
|
|
|
#endif /* CONFIG_DYNAMIC_INTERRUPTS */
|