OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rtems-20020807/] [cpukit/] [score/] [macros/] [rtems/] [score/] [priority.inl] - Blame information for rev 1780

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1026 ivang
/*  priority.inl
2
 *
3
 *  This file contains the macro implementation of all inlined routines
4
 *  in the Priority Handler.
5
 *
6
 *  COPYRIGHT (c) 1989-1999.
7
 *  On-Line Applications Research Corporation (OAR).
8
 *
9
 *  The license and distribution terms for this file may be
10
 *  found in the file LICENSE in this distribution or at
11
 *  http://www.OARcorp.com/rtems/license.html.
12
 *
13
 *  priority.inl,v 1.11 1999/11/17 17:50:38 joel Exp
14
 */
15
 
16
#ifndef __PRIORITY_inl
17
#define __PRIORITY_inl
18
 
19
#include 
20
 
21
/*PAGE
22
 *
23
 *  _Priority_Handler_initialization
24
 *
25
 */
26
 
27
#define _Priority_Handler_initialization() \
28
  { \
29
    unsigned32 index; \
30
    \
31
    _Priority_Major_bit_map = 0; \
32
    for ( index=0 ; index <16 ; index++ ) \
33
       _Priority_Bit_map[ index ] = 0; \
34
  }
35
 
36
/*PAGE
37
 *
38
 *  _Priority_Is_valid
39
 *
40
 */
41
 
42
  /*
43
   *  Since PRIORITY_MINIMUM is 0 and priorities are stored unsigned,
44
   *  then checking for less than 0 is unnecessary.
45
   */
46
 
47
#define _Priority_Is_valid( _the_priority ) \
48
  (  (_the_priority) <= PRIORITY_MAXIMUM )
49
 
50
/*PAGE
51
 *
52
 *  _Priority_Major
53
 *
54
 */
55
 
56
#define _Priority_Major( _the_priority ) ( (_the_priority) / 16 )
57
 
58
/*PAGE
59
 *
60
 *  _Priority_Minor
61
 *
62
 */
63
 
64
#define _Priority_Minor( _the_priority ) ( (_the_priority) % 16 )
65
 
66
#if ( CPU_USE_GENERIC_BITFIELD_CODE == TRUE )
67
 
68
/*PAGE
69
 *
70
 *  _Priority_Mask
71
 *
72
 */
73
 
74
#define _Priority_Mask( _bit_number ) \
75
  (0x8000 >> _bit_number)
76
 
77
/*PAGE
78
 *
79
 *  _Priority_Bits_index
80
 *
81
 */
82
 
83
#define _Priority_Bits_index( _bit_number ) \
84
  (_bit_number)
85
 
86
#endif
87
 
88
/*PAGE
89
 *
90
 *  _Priority_Add_to_bit_map
91
 *
92
 */
93
 
94
#define _Priority_Add_to_bit_map( _the_priority_map ) \
95
   { \
96
     *(_the_priority_map)->minor |= (_the_priority_map)->ready_minor; \
97
     _Priority_Major_bit_map     |= (_the_priority_map)->ready_major; \
98
   }
99
 
100
/*PAGE
101
 *
102
 *  _Priority_Remove_from_bit_map
103
 *
104
 */
105
 
106
#define _Priority_Remove_from_bit_map( _the_priority_map ) \
107
   { \
108
     *(_the_priority_map)->minor &= (_the_priority_map)->block_minor; \
109
     if ( *(_the_priority_map)->minor == 0 ) \
110
       _Priority_Major_bit_map &= (_the_priority_map)->block_major; \
111
   }
112
 
113
/*PAGE
114
 *
115
 *  _Priority_Get_highest
116
 *
117
 */
118
 
119
#define _Priority_Get_highest( _high_priority ) \
120
  { \
121
    Priority_Bit_map_control minor; \
122
    Priority_Bit_map_control major; \
123
    \
124
    _Bitfield_Find_first_bit( _Priority_Major_bit_map, major ); \
125
    _Bitfield_Find_first_bit( _Priority_Bit_map[major], minor ); \
126
    \
127
    (_high_priority) = (_Priority_Bits_index( major ) * 16) +  \
128
                        _Priority_Bits_index( minor ); \
129
  }
130
 
131
/*PAGE
132
 *
133
 *  _Priority_Initialize_information
134
 *
135
 */
136
 
137
#define _Priority_Initialize_information( \
138
     _the_priority_map, _new_priority ) \
139
  { \
140
    Priority_Bit_map_control _major; \
141
    Priority_Bit_map_control _minor; \
142
    Priority_Bit_map_control _mask;  \
143
    \
144
    _major = _Priority_Major( (_new_priority) ); \
145
    _minor = _Priority_Minor( (_new_priority) ); \
146
    \
147
    (_the_priority_map)->minor =  \
148
      &_Priority_Bit_map[ _Priority_Bits_index(_major) ]; \
149
    \
150
    _mask = _Priority_Mask( _major ); \
151
    (_the_priority_map)->ready_major = _mask; \
152
    (_the_priority_map)->block_major = ~_mask; \
153
    \
154
    _mask = _Priority_Mask( _minor ); \
155
    (_the_priority_map)->ready_minor = _mask; \
156
    (_the_priority_map)->block_minor = ~_mask; \
157
  }
158
 
159
/*PAGE
160
 *
161
 *  _Priority_Is_group_empty
162
 *
163
 */
164
 
165
#define _Priority_Is_group_empty ( _the_priority ) \
166
  ( (_the_priority) == 0 )
167
 
168
#endif
169
/* end of include file */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.