source: rtems/cpukit/include/rtems/rtems/tasksimpl.h @ 21275b58

5
Last change on this file since 21275b58 was 21275b58, checked in by Sebastian Huber <sebastian.huber@…>, on 11/22/18 at 18:14:51

score: Static Objects_Information initialization

Statically allocate the objects information together with the initial
set of objects either via <rtems/confdefs.h>. Provide default object
informations with zero objects via librtemscpu.a. This greatly
simplifies the workspace size estimate. RTEMS applications which do not
use the unlimited objects option are easier to debug since all objects
reside now in statically allocated objects of the right types.

Close #3621.

  • Property mode set to 100644
File size: 2.8 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 *  @brief RTEMS User Task Initialization
39 *
40 *  This routine creates and starts all configured user
41 *  initialization threads.
42 */
43void _RTEMS_tasks_Initialize_user_tasks( void );
44
45RTEMS_INLINE_ROUTINE Thread_Control *_RTEMS_tasks_Allocate(void)
46{
47  _Objects_Allocator_lock();
48
49  _Thread_Kill_zombies();
50
51  return (Thread_Control *)
52    _Objects_Allocate_unprotected( &_RTEMS_tasks_Information.Objects );
53}
54
55/**
56 *  @brief Frees a task control block.
57 *
58 *  This routine frees a task control block to the
59 *  inactive chain of free task control blocks.
60 */
61RTEMS_INLINE_ROUTINE void _RTEMS_tasks_Free (
62  Thread_Control *the_task
63)
64{
65  _Objects_Free(
66    _Objects_Get_information_id( the_task->Object.id ),
67    &the_task->Object
68  );
69}
70
71/**
72 * @brief Converts the RTEMS API priority to the corresponding SuperCore
73 * priority and validates it.
74 *
75 * The RTEMS API system priority is accepted as valid.
76 *
77 * @param[in] scheduler The scheduler instance.
78 * @param[in] priority The RTEMS API priority to convert and validate.
79 * @param[out] valid Indicates if the RTEMS API priority is valid and a
80 *   corresponding SuperCore priority in the specified scheduler instance
81 *   exists.
82 *
83 * @return The corresponding SuperCore priority.
84 */
85RTEMS_INLINE_ROUTINE Priority_Control _RTEMS_Priority_To_core(
86  const Scheduler_Control *scheduler,
87  rtems_task_priority      priority,
88  bool                    *valid
89)
90{
91  *valid = ( priority <= scheduler->maximum_priority );
92
93  return _Scheduler_Map_priority( scheduler, (Priority_Control) priority );
94}
95
96/**
97 * @brief Converts the SuperCore priority to the corresponding RTEMS API
98 * priority.
99 *
100 * @param[in] scheduler The scheduler instance.
101 * @param[in] priority The SuperCore priority to convert.
102 *
103 * @return The corresponding RTEMS API priority.
104 */
105RTEMS_INLINE_ROUTINE rtems_task_priority _RTEMS_Priority_From_core(
106  const Scheduler_Control *scheduler,
107  Priority_Control         priority
108)
109{
110  return (rtems_task_priority)
111    _Scheduler_Unmap_priority( scheduler, priority );
112}
113
114/**@}*/
115
116#if defined(RTEMS_MULTIPROCESSING)
117#include <rtems/rtems/taskmp.h>
118#endif
119
120#ifdef __cplusplus
121}
122#endif
123
124#endif
125/* end of include file */
Note: See TracBrowser for help on using the repository browser.