1 | /* |
---|
2 | * i386 interrupt macros. |
---|
3 | * |
---|
4 | * Formerly contained in and extracted from libcpu/i386/cpu.h |
---|
5 | * |
---|
6 | * COPYRIGHT (c) 1998 valette@crf.canon.fr |
---|
7 | * |
---|
8 | * The license and distribution terms for this file may be |
---|
9 | * found in the file LICENSE in this distribution or at |
---|
10 | * http://www.rtems.com/license/LICENSE. |
---|
11 | * |
---|
12 | * $Id$ |
---|
13 | * |
---|
14 | * Applications must not include this file directly. |
---|
15 | */ |
---|
16 | |
---|
17 | #ifndef _rtems_score_interrupts_h |
---|
18 | #define _rtems_score_interrupts_h |
---|
19 | |
---|
20 | #ifndef ASM |
---|
21 | |
---|
22 | struct __rtems_raw_irq_connect_data__; |
---|
23 | |
---|
24 | typedef void (*rtems_raw_irq_hdl) (void); |
---|
25 | typedef void (*rtems_raw_irq_enable) (const struct __rtems_raw_irq_connect_data__*); |
---|
26 | typedef void (*rtems_raw_irq_disable) (const struct __rtems_raw_irq_connect_data__*); |
---|
27 | typedef int (*rtems_raw_irq_is_enabled) (const struct __rtems_raw_irq_connect_data__*); |
---|
28 | |
---|
29 | /* |
---|
30 | * Interrupt Level Macros |
---|
31 | */ |
---|
32 | |
---|
33 | #define i386_disable_interrupts( _level ) \ |
---|
34 | { \ |
---|
35 | asm volatile ( "pushf ; \ |
---|
36 | cli ; \ |
---|
37 | pop %0" \ |
---|
38 | : "=rm" ((_level)) \ |
---|
39 | ); \ |
---|
40 | } |
---|
41 | |
---|
42 | #define i386_enable_interrupts( _level ) \ |
---|
43 | { \ |
---|
44 | asm volatile ( "push %0 ; \ |
---|
45 | popf" \ |
---|
46 | : : "rm" ((_level)) : "cc" \ |
---|
47 | ); \ |
---|
48 | } |
---|
49 | |
---|
50 | #define i386_flash_interrupts( _level ) \ |
---|
51 | { \ |
---|
52 | asm volatile ( "push %0 ; \ |
---|
53 | popf ; \ |
---|
54 | cli" \ |
---|
55 | : : "rm" ((_level)) : "cc" \ |
---|
56 | ); \ |
---|
57 | } |
---|
58 | |
---|
59 | #define i386_get_interrupt_level( _level ) \ |
---|
60 | do { \ |
---|
61 | register uint32_t _eflags; \ |
---|
62 | \ |
---|
63 | asm volatile ( "pushf ; \ |
---|
64 | pop %0" \ |
---|
65 | : "=rm" ((_eflags)) \ |
---|
66 | ); \ |
---|
67 | \ |
---|
68 | _level = (_eflags & EFLAGS_INTR_ENABLE) ? 0 : 1; \ |
---|
69 | } while (0) |
---|
70 | |
---|
71 | #define _CPU_ISR_Disable( _level ) i386_disable_interrupts( _level ) |
---|
72 | #define _CPU_ISR_Enable( _level ) i386_enable_interrupts( _level ) |
---|
73 | |
---|
74 | #endif |
---|
75 | #endif |
---|