Branch data Line data Source code
1 : : /*
2 : : * Copyright (c) 2019 Oticon A/S
3 : : *
4 : : * SPDX-License-Identifier: Apache-2.0
5 : : */
6 : :
7 : : #include <zephyr/arch/posix/posix_soc_if.h>
8 : : #include "board_irq.h"
9 : :
10 : : #ifdef CONFIG_IRQ_OFFLOAD
11 : : #include <zephyr/irq_offload.h>
12 : :
13 : : void arch_irq_offload(irq_offload_routine_t routine, const void *parameter)
14 : : {
15 : : posix_irq_offload(routine, parameter);
16 : : }
17 : :
18 : : void arch_irq_offload_init(void)
19 : : {
20 : : /* Nothing to be done for this architecture */
21 : : }
22 : : #endif
23 : :
24 : 1 : void arch_irq_enable(unsigned int irq)
25 : : {
26 : 1 : posix_irq_enable(irq);
27 : 1 : }
28 : :
29 : 0 : void arch_irq_disable(unsigned int irq)
30 : : {
31 : 0 : posix_irq_disable(irq);
32 : 0 : }
33 : :
34 : 0 : int arch_irq_is_enabled(unsigned int irq)
35 : : {
36 : 0 : return posix_irq_is_enabled(irq);
37 : : }
38 : :
39 : : #ifdef CONFIG_DYNAMIC_INTERRUPTS
40 : : /**
41 : : * Configure a dynamic interrupt.
42 : : *
43 : : * Use this instead of IRQ_CONNECT() if arguments cannot be known at build time.
44 : : *
45 : : * @param irq IRQ line number
46 : : * @param priority Interrupt priority
47 : : * @param routine Interrupt service routine
48 : : * @param parameter ISR parameter
49 : : * @param flags Arch-specific IRQ configuration flags
50 : : *
51 : : * @return The vector assigned to this interrupt
52 : : */
53 : : int arch_irq_connect_dynamic(unsigned int irq, unsigned int priority,
54 : : void (*routine)(const void *parameter),
55 : : const void *parameter, uint32_t flags)
56 : : {
57 : : posix_isr_declare(irq, (int)flags, routine, parameter);
58 : : posix_irq_priority_set(irq, priority, flags);
59 : : return irq;
60 : : }
61 : : #endif /* CONFIG_DYNAMIC_INTERRUPTS */
|