1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief Intel I386 Interrupt Macros |
---|
5 | * |
---|
6 | * Formerly contained in and extracted from libcpu/i386/cpu.h |
---|
7 | */ |
---|
8 | |
---|
9 | /* |
---|
10 | * COPYRIGHT (c) 1998 valette@crf.canon.fr |
---|
11 | * |
---|
12 | * The license and distribution terms for this file may be |
---|
13 | * found in the file LICENSE in this distribution or at |
---|
14 | * http://www.rtems.org/license/LICENSE. |
---|
15 | * |
---|
16 | * Applications must not include this file directly. |
---|
17 | */ |
---|
18 | |
---|
19 | /** |
---|
20 | * @defgroup RTEMSScoreCPUi386Interrupt Processor Dependent Interrupt Management |
---|
21 | * |
---|
22 | * @ingroup RTEMSScoreCPUi386 |
---|
23 | * |
---|
24 | * @brief i386 Interrupt Management |
---|
25 | */ |
---|
26 | /**@{**/ |
---|
27 | |
---|
28 | #ifndef _RTEMS_SCORE_INTERRUPTS_H |
---|
29 | #define _RTEMS_SCORE_INTERRUPTS_H |
---|
30 | |
---|
31 | #ifndef ASM |
---|
32 | |
---|
33 | struct __rtems_raw_irq_connect_data__; |
---|
34 | |
---|
35 | typedef void (*rtems_raw_irq_hdl) (void); |
---|
36 | typedef void (*rtems_raw_irq_enable) (const struct __rtems_raw_irq_connect_data__*); |
---|
37 | typedef void (*rtems_raw_irq_disable) (const struct __rtems_raw_irq_connect_data__*); |
---|
38 | typedef int (*rtems_raw_irq_is_enabled) (const struct __rtems_raw_irq_connect_data__*); |
---|
39 | |
---|
40 | /** |
---|
41 | * @name Interrupt Level Macros |
---|
42 | * |
---|
43 | */ |
---|
44 | /**@{**/ |
---|
45 | #if !defined(I386_DISABLE_INLINE_ISR_DISABLE_ENABLE) |
---|
46 | #define i386_disable_interrupts( _level ) \ |
---|
47 | { \ |
---|
48 | __asm__ volatile ( "pushf ; \ |
---|
49 | cli ; \ |
---|
50 | pop %0" \ |
---|
51 | : "=rm" ((_level)) \ |
---|
52 | ); \ |
---|
53 | } |
---|
54 | |
---|
55 | #define i386_enable_interrupts( _level ) \ |
---|
56 | { \ |
---|
57 | __asm__ volatile ( "push %0 ; \ |
---|
58 | popf" \ |
---|
59 | : : "rm" ((_level)) : "cc" \ |
---|
60 | ); \ |
---|
61 | } |
---|
62 | |
---|
63 | #define i386_flash_interrupts( _level ) \ |
---|
64 | { \ |
---|
65 | __asm__ volatile ( "push %0 ; \ |
---|
66 | popf ; \ |
---|
67 | cli" \ |
---|
68 | : : "rm" ((_level)) : "cc" \ |
---|
69 | ); \ |
---|
70 | } |
---|
71 | |
---|
72 | #define i386_get_interrupt_level( _level ) \ |
---|
73 | do { \ |
---|
74 | uint32_t _eflags; \ |
---|
75 | \ |
---|
76 | __asm__ volatile ( "pushf ; \ |
---|
77 | pop %0" \ |
---|
78 | : "=rm" ((_eflags)) \ |
---|
79 | ); \ |
---|
80 | \ |
---|
81 | _level = (_eflags & EFLAGS_INTR_ENABLE) ? 0 : 1; \ |
---|
82 | } while (0) |
---|
83 | #else |
---|
84 | uint32_t i386_disable_interrupts( void ); |
---|
85 | void i386_enable_interrupts(uint32_t level); |
---|
86 | void i386_flash_interrupts(uint32_t level); |
---|
87 | void i386_set_interrupt_level(uint32_t new_level); |
---|
88 | uint32_t i386_get_interrupt_level( void ); |
---|
89 | #endif /* PARAVIRT */ |
---|
90 | |
---|
91 | /** @} */ |
---|
92 | |
---|
93 | /**@}**/ |
---|
94 | #endif |
---|
95 | #endif |
---|