1 | /** |
---|
2 | * @file rtems/rtems/modes.h |
---|
3 | */ |
---|
4 | |
---|
5 | /* |
---|
6 | * This include file contains all constants and structures associated |
---|
7 | * with the RTEMS thread and RTEMS_ASR modes. |
---|
8 | * |
---|
9 | * COPYRIGHT (c) 1989-1999. |
---|
10 | * On-Line Applications Research Corporation (OAR). |
---|
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.com/license/LICENSE. |
---|
15 | * |
---|
16 | * $Id$ |
---|
17 | */ |
---|
18 | |
---|
19 | #ifndef __RTEMS_MODES_h |
---|
20 | #define __RTEMS_MODES_h |
---|
21 | |
---|
22 | #ifdef __cplusplus |
---|
23 | extern "C" { |
---|
24 | #endif |
---|
25 | |
---|
26 | #include <rtems/score/isr.h> |
---|
27 | |
---|
28 | /* |
---|
29 | * The following type defines the control block used to manage |
---|
30 | * each a mode set. |
---|
31 | */ |
---|
32 | |
---|
33 | typedef uint32_t Modes_Control; |
---|
34 | |
---|
35 | /* |
---|
36 | * The following constants define the individual modes and masks |
---|
37 | * which may be used to compose a mode set and to alter modes. |
---|
38 | */ |
---|
39 | |
---|
40 | #define RTEMS_ALL_MODE_MASKS 0x0000ffff |
---|
41 | |
---|
42 | #define RTEMS_DEFAULT_MODES 0x00000000 |
---|
43 | #define RTEMS_CURRENT_MODE 0 |
---|
44 | |
---|
45 | #define RTEMS_PREEMPT_MASK 0x00000100 /* preemption bit */ |
---|
46 | #define RTEMS_TIMESLICE_MASK 0x00000200 /* timeslice bit */ |
---|
47 | #define RTEMS_ASR_MASK 0x00000400 /* RTEMS_ASR enable bit */ |
---|
48 | #define RTEMS_INTERRUPT_MASK CPU_MODES_INTERRUPT_MASK |
---|
49 | |
---|
50 | #define RTEMS_PREEMPT 0x00000000 /* enable preemption */ |
---|
51 | #define RTEMS_NO_PREEMPT 0x00000100 /* disable preemption */ |
---|
52 | |
---|
53 | #define RTEMS_NO_TIMESLICE 0x00000000 /* disable timeslicing */ |
---|
54 | #define RTEMS_TIMESLICE 0x00000200 /* enable timeslicing */ |
---|
55 | |
---|
56 | #define RTEMS_ASR 0x00000000 /* enable RTEMS_ASR */ |
---|
57 | #define RTEMS_NO_ASR 0x00000400 /* disable RTEMS_ASR */ |
---|
58 | |
---|
59 | /* |
---|
60 | * The number of bits for interrupt levels is CPU dependent. |
---|
61 | * RTEMS supports 0 to 256 levels in bits 0-7 of the mode. |
---|
62 | */ |
---|
63 | |
---|
64 | /*PAGE |
---|
65 | * |
---|
66 | * RTEMS_INTERRUPT_LEVEL |
---|
67 | * |
---|
68 | * DESCRIPTION: |
---|
69 | * |
---|
70 | * This function returns the processor dependent interrupt |
---|
71 | * level which corresponds to the requested interrupt level. |
---|
72 | * |
---|
73 | * NOTE: RTEMS supports 256 interrupt levels using the least |
---|
74 | * significant eight bits of MODES.CONTROL. On any |
---|
75 | * particular CPU, fewer than 256 levels may be supported. |
---|
76 | */ |
---|
77 | |
---|
78 | #define RTEMS_INTERRUPT_LEVEL( _mode_set ) \ |
---|
79 | ( (_mode_set) & RTEMS_INTERRUPT_MASK ) |
---|
80 | |
---|
81 | |
---|
82 | #ifndef __RTEMS_APPLICATION__ |
---|
83 | #include <rtems/rtems/modes.inl> |
---|
84 | #endif |
---|
85 | |
---|
86 | #ifdef __cplusplus |
---|
87 | } |
---|
88 | #endif |
---|
89 | |
---|
90 | #endif |
---|
91 | /* end of include file */ |
---|