source: rtems/c/src/exec/score/macros/rtems/score/priority.inl @ 6b45e470

4.104.114.84.95
Last change on this file since 6b45e470 was 6b45e470, checked in by Joel Sherrill <joel.sherrill@…>, on 08/22/95 at 16:44:49

Merged PowerPC port as submitted by Andy Bray of I-CUBED, Ltd
(andy@…). This initial submission is known
to work on the IBM 403. It is thought to work on the Motorola
601, 603, and 604 although this remains to be tested.

Another user -- Doug Currie (e@…) -- is interested in
this work and will be testing it on the 604 using the Metrowerks
C compiler and a different format assembly language.

  • Property mode set to 100644
File size: 3.2 KB
Line 
1/*  priority.inl
2 *
3 *  This file contains the macro implementation of all inlined routines
4 *  in the Priority Handler.
5 *
6 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
7 *  On-Line Applications Research Corporation (OAR).
8 *  All rights assigned to U.S. Government, 1994.
9 *
10 *  This material may be reproduced by or for the U.S. Government pursuant
11 *  to the copyright license under the clause at DFARS 252.227-7013.  This
12 *  notice must appear in all copies of this file and its derivatives.
13 *
14 *  $Id$
15 */
16
17#ifndef __PRIORITY_inl
18#define __PRIORITY_inl
19
20#include <rtems/bitfield.h>
21
22/*PAGE
23 *
24 *  _Priority_Handler_initialization
25 *
26 */
27
28#define _Priority_Handler_initialization() \
29  { \
30    unsigned32 index; \
31    \
32    _Priority_Major_bit_map = 0; \
33    for ( index=0 ; index <16 ; index++ ) \
34       _Priority_Bit_map[ index ] = 0; \
35  }
36
37/*PAGE
38 *
39 *  _Priority_Is_valid
40 *
41 */
42
43#define _Priority_Is_valid( _the_priority ) \
44  (  ( (_the_priority) >= RTEMS_MINIMUM_PRIORITY ) && \
45     ( (_the_priority) <= RTEMS_MAXIMUM_PRIORITY ) )
46
47/*PAGE
48 *
49 *  _Priority_Major
50 *
51 */
52
53#define _Priority_Major( _the_priority ) ( (_the_priority) / 16 )
54
55/*PAGE
56 *
57 *  _Priority_Minor
58 *
59 */
60
61#define _Priority_Minor( _the_priority ) ( (_the_priority) % 16 )
62
63/*PAGE
64 *
65 *  _Priority_Add_to_bit_map
66 *
67 */
68
69#define _Priority_Add_to_bit_map( _the_priority_map ) \
70   { \
71     *(_the_priority_map)->minor |= (_the_priority_map)->ready_minor; \
72     _Priority_Major_bit_map     |= (_the_priority_map)->ready_major; \
73   }
74
75/*PAGE
76 *
77 *  _Priority_Remove_from_bit_map
78 *
79 */
80
81#define _Priority_Remove_from_bit_map( _the_priority_map ) \
82   { \
83     *(_the_priority_map)->minor &= (_the_priority_map)->block_minor; \
84     if ( *(_the_priority_map)->minor == 0 ) \
85       _Priority_Major_bit_map &= (_the_priority_map)->block_major; \
86   }
87
88/*PAGE
89 *
90 *  _Priority_Get_highest
91 *
92 */
93
94#define _Priority_Get_highest( _high_priority ) \
95  { \
96    Priority_Bit_map_control minor; \
97    Priority_Bit_map_control major; \
98    \
99    _Bitfield_Find_first_bit( _Priority_Major_bit_map, major ); \
100    _Bitfield_Find_first_bit( _Priority_Bit_map[major], minor ); \
101    \
102    (_high_priority) = (_CPU_Priority_Bits_index( major ) * 16) +  \
103                       _CPU_Priority_Bits_index( minor ); \
104  }
105
106/*PAGE
107 *
108 *  _Priority_Initialize_information
109 *
110 */
111
112#define _Priority_Initialize_information( \
113     _the_priority_map, _new_priority ) \
114  { \
115    Priority_Bit_map_control _major; \
116    Priority_Bit_map_control _minor; \
117    Priority_Bit_map_control _mask;  \
118    \
119    _major = _Priority_Major( (_new_priority) ); \
120    _minor = _Priority_Minor( (_new_priority) ); \
121    \
122    (_the_priority_map)->minor =  \
123      &_Priority_Bit_map[ _CPU_Priority_Bits_index(_major) ]; \
124    \
125    _mask = _CPU_Priority_Mask( _major ); \
126    (_the_priority_map)->ready_major = _mask; \
127    (_the_priority_map)->block_major = ~_mask; \
128    \
129    _mask = _CPU_Priority_Mask( _minor ); \
130    (_the_priority_map)->ready_minor = _mask; \
131    (_the_priority_map)->block_minor = ~_mask; \
132  }
133
134/*PAGE
135 *
136 *  _Priority_Is_group_empty
137 *
138 */
139
140#define _Priority_Is_group_empty ( _the_priority ) \
141  ( (_the_priority) == 0 )
142
143#endif
144/* end of include file */
Note: See TracBrowser for help on using the repository browser.