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

4.104.114.84.95
Last change on this file since 6b45e470 was ac7d5ef0, checked in by Joel Sherrill <joel.sherrill@…>, on 05/11/95 at 17:39:37

Initial revision

  • Property mode set to 100644
File size: 3.2 KB
Line 
1/*  priority.inl
2 *
3 *  This file contains the static inline implementation of all inlined
4 *  routines 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
28STATIC INLINE void _Priority_Handler_initialization( void )
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
43STATIC INLINE boolean _Priority_Is_valid (
44  rtems_task_priority the_priority
45)
46{
47  return (  ( the_priority >= RTEMS_MINIMUM_PRIORITY ) &&
48            ( the_priority <= RTEMS_MAXIMUM_PRIORITY ) );
49}
50
51/*PAGE
52 *
53 *  _Priority_Major
54 *
55 */
56
57STATIC INLINE unsigned32 _Priority_Major (
58  rtems_task_priority the_priority
59)
60{
61  return ( the_priority / 16 );
62}
63
64/*PAGE
65 *
66 *  _Priority_Minor
67 *
68 */
69
70STATIC INLINE unsigned32 _Priority_Minor (
71  rtems_task_priority the_priority
72)
73{
74  return ( the_priority % 16 );
75}
76
77/*PAGE
78 *
79 *  _Priority_Add_to_bit_map
80 *
81 */
82
83STATIC INLINE void _Priority_Add_to_bit_map (
84  Priority_Information *the_priority_map
85)
86{
87  *the_priority_map->minor |= the_priority_map->ready_minor;
88  _Priority_Major_bit_map  |= the_priority_map->ready_major;
89}
90
91/*PAGE
92 *
93 *  _Priority_Remove_from_bit_map
94 *
95 */
96
97STATIC INLINE void _Priority_Remove_from_bit_map (
98  Priority_Information *the_priority_map
99)
100{
101  *the_priority_map->minor &= the_priority_map->block_minor;
102  if ( *the_priority_map->minor == 0 )
103    _Priority_Major_bit_map &= the_priority_map->block_major;
104}
105
106/*PAGE
107 *
108 *  _Priority_Get_highest
109 *
110 */
111
112STATIC INLINE rtems_task_priority _Priority_Get_highest( void )
113{
114  Priority_Bit_map_control minor;
115  Priority_Bit_map_control major;
116
117  _Bitfield_Find_first_bit( _Priority_Major_bit_map, major );
118  _Bitfield_Find_first_bit( _Priority_Bit_map[major], minor );
119
120  return (_CPU_Priority_Bits_index( major ) << 4) +
121          _CPU_Priority_Bits_index( minor );
122}
123
124/*PAGE
125 *
126 *  _Priority_Initialize_information
127 *
128 */
129
130STATIC INLINE void _Priority_Initialize_information(
131  Priority_Information *the_priority_map,
132  rtems_task_priority      new_priority
133)
134{
135  Priority_Bit_map_control major;
136  Priority_Bit_map_control minor;
137  Priority_Bit_map_control mask;
138
139  major = _Priority_Major( new_priority );
140  minor = _Priority_Minor( new_priority );
141
142  the_priority_map->minor =
143    &_Priority_Bit_map[ _CPU_Priority_Bits_index(major) ];
144
145  mask = _CPU_Priority_Mask( major );
146  the_priority_map->ready_major = mask;
147  the_priority_map->block_major = ~mask;
148
149  mask = _CPU_Priority_Mask( minor );
150  the_priority_map->ready_minor = mask;
151  the_priority_map->block_minor = ~mask;
152}
153
154/*PAGE
155 *
156 *  _Priority_Is_group_empty
157 *
158 */
159
160STATIC INLINE boolean _Priority_Is_group_empty (
161  rtems_task_priority      the_priority
162)
163{
164  return the_priority == 0;
165}
166
167#endif
168/* end of include file */
Note: See TracBrowser for help on using the repository browser.