source: rtems/cpukit/posix/src/psxpriorityisvalid.c @ 77ff5599

5
Last change on this file since 77ff5599 was 77ff5599, checked in by Sebastian Huber <sebastian.huber@…>, on 06/10/16 at 06:48:54

score: Introduce map priority scheduler operation

Introduce map/unmap priority scheduler operations to map thread priority
values from/to the user domain to/from the scheduler domain. Use the
map priority operation to validate the thread priority. The EDF
schedulers use this new operation to distinguish between normal
priorities and priorities obtain through a job release.

Update #2173.
Update #2556.

  • Property mode set to 100644
File size: 1.4 KB
Line 
1/**
2 *  @file
3 *
4 *  @brief POSIX Is Priority Valid
5 *  @ingroup POSIX_PRIORITY
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2008.
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.org/license/LICENSE.
15 */
16
17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <rtems/posix/priorityimpl.h>
22#include <rtems/score/schedulerimpl.h>
23
24int _POSIX_Priority_Get_maximum( const Scheduler_Control *scheduler )
25{
26  if ( scheduler->maximum_priority < INT_MAX ) {
27    return (int) scheduler->maximum_priority - 1;
28  } else {
29    return INT_MAX;
30  }
31}
32
33Priority_Control _POSIX_Priority_To_core(
34  const Scheduler_Control *scheduler,
35  int                      posix_priority,
36  bool                    *valid
37)
38{
39  Priority_Control core_posix_priority;
40  Priority_Control core_priority;
41
42  core_posix_priority = (Priority_Control) posix_priority;
43  core_priority = scheduler->maximum_priority - core_posix_priority;
44
45  *valid = ( posix_priority >= POSIX_SCHEDULER_MINIMUM_PRIORITY
46    && core_posix_priority < scheduler->maximum_priority );
47
48  return _Scheduler_Map_priority( scheduler, core_priority );
49}
50
51int _POSIX_Priority_From_core(
52  const Scheduler_Control *scheduler,
53  Priority_Control         core_priority
54)
55{
56  core_priority = _Scheduler_Unmap_priority( scheduler, core_priority );
57
58  return (int) ( scheduler->maximum_priority - core_priority );
59}
Note: See TracBrowser for help on using the repository browser.