source: rtems/cpukit/include/rtems/rtems/tasksimpl.h @ 0f5b2c09

5
Last change on this file since 0f5b2c09 was b7af3e44, checked in by Sebastian Huber <sebastian.huber@…>, on 11/08/18 at 09:57:21

rtems: Move internal structures to tasksdata.h

Update #3598.

  • Property mode set to 100644
File size: 3.0 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup ClassicTasksImpl
5 *
6 * @brief Classic Tasks Manager Implementation
7 */
8
9/*  COPYRIGHT (c) 1989-2014.
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#ifndef _RTEMS_RTEMS_TASKSIMPL_H
18#define _RTEMS_RTEMS_TASKSIMPL_H
19
20#include <rtems/rtems/tasksdata.h>
21#include <rtems/score/objectimpl.h>
22#include <rtems/score/schedulerimpl.h>
23#include <rtems/score/threadimpl.h>
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
29/**
30 * @defgroup ClassicTasksImpl Classic Tasks Manager Implementation
31 *
32 * @ingroup ClassicTasks
33 *
34 * @{
35 */
36
37/**
38 *  The following instantiates the information control block used to
39 *  manage this class of objects.
40 */
41extern Thread_Information _RTEMS_tasks_Information;
42
43/**
44 *  @brief RTEMS User Task Initialization
45 *
46 *  This routine creates and starts all configured user
47 *  initialization threads.
48 */
49void _RTEMS_tasks_Initialize_user_tasks( void );
50
51RTEMS_INLINE_ROUTINE Thread_Control *_RTEMS_tasks_Allocate(void)
52{
53  _Objects_Allocator_lock();
54
55  _Thread_Kill_zombies();
56
57  return (Thread_Control *)
58    _Objects_Allocate_unprotected( &_RTEMS_tasks_Information.Objects );
59}
60
61/**
62 *  @brief Frees a task control block.
63 *
64 *  This routine frees a task control block to the
65 *  inactive chain of free task control blocks.
66 */
67RTEMS_INLINE_ROUTINE void _RTEMS_tasks_Free (
68  Thread_Control *the_task
69)
70{
71  _Objects_Free(
72    _Objects_Get_information_id( the_task->Object.id ),
73    &the_task->Object
74  );
75}
76
77/**
78 * @brief Converts the RTEMS API priority to the corresponding SuperCore
79 * priority and validates it.
80 *
81 * The RTEMS API system priority is accepted as valid.
82 *
83 * @param[in] scheduler The scheduler instance.
84 * @param[in] priority The RTEMS API priority to convert and validate.
85 * @param[out] valid Indicates if the RTEMS API priority is valid and a
86 *   corresponding SuperCore priority in the specified scheduler instance
87 *   exists.
88 *
89 * @return The corresponding SuperCore priority.
90 */
91RTEMS_INLINE_ROUTINE Priority_Control _RTEMS_Priority_To_core(
92  const Scheduler_Control *scheduler,
93  rtems_task_priority      priority,
94  bool                    *valid
95)
96{
97  *valid = ( priority <= scheduler->maximum_priority );
98
99  return _Scheduler_Map_priority( scheduler, (Priority_Control) priority );
100}
101
102/**
103 * @brief Converts the SuperCore priority to the corresponding RTEMS API
104 * priority.
105 *
106 * @param[in] scheduler The scheduler instance.
107 * @param[in] priority The SuperCore priority to convert.
108 *
109 * @return The corresponding RTEMS API priority.
110 */
111RTEMS_INLINE_ROUTINE rtems_task_priority _RTEMS_Priority_From_core(
112  const Scheduler_Control *scheduler,
113  Priority_Control         priority
114)
115{
116  return (rtems_task_priority)
117    _Scheduler_Unmap_priority( scheduler, priority );
118}
119
120/**@}*/
121
122#if defined(RTEMS_MULTIPROCESSING)
123#include <rtems/rtems/taskmp.h>
124#endif
125
126#ifdef __cplusplus
127}
128#endif
129
130#endif
131/* end of include file */
Note: See TracBrowser for help on using the repository browser.