1 | /* |
---|
2 | * RTEMS support for Blackfin interrupt controller |
---|
3 | * |
---|
4 | * COPYRIGHT (c) 2008 Kallisti Labs, Los Gatos, CA, USA |
---|
5 | * written by Allan Hessenflow <allanh@kallisti.com> |
---|
6 | * |
---|
7 | * The license and distribution terms for this file may be |
---|
8 | * found in the file LICENSE in this distribution or at |
---|
9 | * http://www.rtems.org/license/LICENSE. |
---|
10 | */ |
---|
11 | |
---|
12 | #ifndef _interrupt_h_ |
---|
13 | #define _interrupt_h_ |
---|
14 | |
---|
15 | /* Some rules for using this module: |
---|
16 | |
---|
17 | SIC_IARx registers must not be changed after calling |
---|
18 | bfin_interrupt_init(). |
---|
19 | |
---|
20 | The bfin_isr structures must stick around for as long as the isr is |
---|
21 | registered. |
---|
22 | |
---|
23 | For any interrupt source (SIC bit) that could be shared, it is only |
---|
24 | safe to disable an ISR through this module if the ultimate source is |
---|
25 | also disabled (the ultimate source must be disabled prior to disabling |
---|
26 | it through this module, and must remain disabled until after enabling |
---|
27 | it through this module). |
---|
28 | |
---|
29 | For any source that is shared with modules that cannot be disabled, |
---|
30 | give careful thought to the control of those interrupts. |
---|
31 | bfin_interrupt_enable_all() or bfin_interrupt_enable_global() can |
---|
32 | be used to help solve the problems caused by that. |
---|
33 | |
---|
34 | |
---|
35 | Note that this module does not provide prioritization. It is assumed |
---|
36 | that the priorities afforded by the CEC are sufficient. If finer |
---|
37 | grained priority control is required then this wlll need to be |
---|
38 | redesigned. |
---|
39 | */ |
---|
40 | |
---|
41 | |
---|
42 | #ifdef __cplusplus |
---|
43 | extern "C" { |
---|
44 | #endif |
---|
45 | |
---|
46 | /* source is the source to the SIC (the bit number in SIC_ISR). isr is |
---|
47 | the function that will be called when the interrupt is active. */ |
---|
48 | typedef struct bfin_isr_s { |
---|
49 | int source; |
---|
50 | void (*isr)(int source); |
---|
51 | /* the following are for internal use only */ |
---|
52 | uint32_t mask; |
---|
53 | int vector; |
---|
54 | struct bfin_isr_s *next; |
---|
55 | } bfin_isr_t; |
---|
56 | |
---|
57 | /* If non-default mapping is desired, the BSP should set the SIC_IARx |
---|
58 | registers prior to calling this. */ |
---|
59 | void bfin_interrupt_init(void); |
---|
60 | |
---|
61 | /* ISR starts out disabled */ |
---|
62 | void bfin_interrupt_register(bfin_isr_t *isr); |
---|
63 | void bfin_interrupt_unregister(bfin_isr_t *isr); |
---|
64 | |
---|
65 | /* enable/disable specific ISR */ |
---|
66 | void bfin_interrupt_enable(bfin_isr_t *isr, bool enable); |
---|
67 | |
---|
68 | /* atomically enable/disable all ISRs attached to specified source */ |
---|
69 | void bfin_interrupt_enable_all(int source, bool enable); |
---|
70 | |
---|
71 | /* disable a source independently of the individual ISR enables (starts |
---|
72 | out all enabled) */ |
---|
73 | void bfin_interrupt_enable_global(int source, bool enable); |
---|
74 | |
---|
75 | #ifdef __cplusplus |
---|
76 | } |
---|
77 | #endif |
---|
78 | |
---|
79 | #endif /* _interrupt_h_ */ |
---|
80 | |
---|