source: rtems/cpukit/posix/inline/rtems/posix/priority.inl @ c4c5401

4.104.115
Last change on this file since c4c5401 was c4c5401, checked in by Joel Sherrill <joel.sherrill@…>, on 11/20/08 at 19:19:16

2008-11-20 Joel Sherrill <joel.sherrill@…>

PR 1306/cpukit

  • posix/inline/rtems/posix/priority.inl: Eliminate hard coded numbers in favor of existing macros.
  • Property mode set to 100644
File size: 1.2 KB
Line 
1/**
2 * @file rtems/posix/priority.inl
3 */
4
5/* 
6 *  COPYRIGHT (c) 1989-2007.
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.rtems.com/license/LICENSE.
12 *
13 *  $Id$
14 */
15
16#ifndef _RTEMS_POSIX_PRIORITY_H
17# error "Never use <rtems/posix/priority.inl> directly; include <rtems/posix/priority.h> instead."
18#endif
19
20#ifndef _RTEMS_POSIX_PRIORITY_INL
21#define _RTEMS_POSIX_PRIORITY_INL
22
23/*
24 *  1003.1b-1993,2.2.2.80 definition of priority, p. 19
25 *
26 *  "Numerically higher values represent higher priorities."
27 *
28 *  Thus, RTEMS Core has priorities run in the opposite sense of the POSIX API.
29 */
30
31RTEMS_INLINE_ROUTINE bool _POSIX_Priority_Is_valid(
32  int priority
33)
34{
35  return ((priority >= POSIX_SCHEDULER_MINIMUM_PRIORITY) &&
36          (priority <= POSIX_SCHEDULER_MAXIMUM_PRIORITY));
37
38}
39
40RTEMS_INLINE_ROUTINE Priority_Control _POSIX_Priority_To_core(
41  int priority
42)
43{
44  return (Priority_Control) (POSIX_SCHEDULER_MAXIMUM_PRIORITY - priority + 1);
45}
46
47RTEMS_INLINE_ROUTINE int _POSIX_Priority_From_core(
48  Priority_Control priority
49)
50{
51  return (POSIX_SCHEDULER_MAXIMUM_PRIORITY - priority + 1);
52}
53
54#endif
Note: See TracBrowser for help on using the repository browser.