blob: b06e9e438f3add49e932db6d6cbc3f81d23b4762 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
/*
* COPYRIGHT (c) 2012-2015
* Cobham Gaisler
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.org/license/LICENSE.
*
*/
#include <bsp.h>
#include <bsp/irq-generic.h>
static inline int bsp_irq_cpu(int irq)
{
#if defined(RTEMS_SMP)
Processor_mask affinity;
bsp_interrupt_get_affinity((rtems_vector_number) irq, &affinity);
return (int) _Processor_mask_Find_last_set(&affinity);
#elif defined(LEON3)
return _LEON3_Get_current_processor();
#else
return 0;
#endif
}
#if !defined(LEON3)
rtems_status_code bsp_interrupt_facility_initialize(void)
{
/* Nothing to do */
return RTEMS_SUCCESSFUL;
}
rtems_status_code bsp_interrupt_vector_is_enabled(
rtems_vector_number vector,
bool *enabled
)
{
bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
bsp_interrupt_assert(enabled != NULL);
*enabled = false;
return RTEMS_UNSATISFIED;
}
void bsp_interrupt_vector_enable(rtems_vector_number vector)
{
bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
BSP_Cpu_Unmask_interrupt(vector, 0);
}
void bsp_interrupt_vector_disable(rtems_vector_number vector)
{
bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
BSP_Cpu_Mask_interrupt(vector, 0);
}
#endif
void BSP_shared_interrupt_mask(int irq)
{
BSP_Cpu_Mask_interrupt(irq, bsp_irq_cpu(irq));
}
void BSP_shared_interrupt_unmask(int irq)
{
BSP_Cpu_Unmask_interrupt(irq, bsp_irq_cpu(irq));
}
void BSP_shared_interrupt_clear(int irq)
{
/* We don't have to interrupt lock here, because the register is only
* written and self clearing
*/
BSP_Clear_interrupt(irq);
}
|