source: rtems/cpukit/rtems/src/tasks.c @ 1d40d81b

5
Last change on this file since 1d40d81b was 1d40d81b, checked in by Sebastian Huber <sebastian.huber@…>, on May 3, 2016 at 5:38:19 AM

rtems: Remove task variables

Update #2494.
Update #2555.

  • Property mode set to 100644
File size: 3.0 KB
Line 
1/**
2 *  @file
3 *
4 *  @brief RTEMS Task API Extensions
5 *  @ingroup ClassicTasks
6 */
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#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <rtems/config.h>
22#include <rtems/sysinit.h>
23#include <rtems/rtems/asrimpl.h>
24#include <rtems/rtems/eventimpl.h>
25#include <rtems/rtems/tasksimpl.h>
26#include <rtems/score/threadimpl.h>
27#include <rtems/score/userextimpl.h>
28
29Thread_Information _RTEMS_tasks_Information;
30
31/*
32 *  _RTEMS_tasks_Create_extension
33 *
34 *  This routine is an extension routine that is invoked as part
35 *  of creating any type of task or thread in the system.  If the
36 *  task is created via another API, then this routine is invoked
37 *  and this API given the opportunity to initialize its extension
38 *  area.
39 */
40
41static bool _RTEMS_tasks_Create_extension(
42  Thread_Control *executing,
43  Thread_Control *created
44)
45{
46  RTEMS_API_Control *api;
47
48  api = created->API_Extensions[ THREAD_API_RTEMS ];
49
50  _ASR_Create( &api->Signal );
51
52  return true;
53}
54
55/*
56 *  _RTEMS_tasks_Start_extension
57 *
58 *  This extension routine is invoked when a task is started for the
59 *  first time.
60 */
61
62static void _RTEMS_tasks_Start_extension(
63  Thread_Control *executing,
64  Thread_Control *started
65)
66{
67  RTEMS_API_Control *api;
68
69  api = started->API_Extensions[ THREAD_API_RTEMS ];
70
71  _Event_Initialize( &api->Event );
72  _Event_Initialize( &api->System_event );
73}
74
75static void _RTEMS_tasks_Delete_extension(
76  Thread_Control *executing,
77  Thread_Control *deleted
78)
79{
80  RTEMS_API_Control *api;
81
82  api = deleted->API_Extensions[ THREAD_API_RTEMS ];
83
84  _ASR_Destroy( &api->Signal );
85}
86
87User_extensions_Control _RTEMS_tasks_User_extensions = {
88  .Callouts = {
89    .thread_create  = _RTEMS_tasks_Create_extension,
90    .thread_start   = _RTEMS_tasks_Start_extension,
91    .thread_restart = _RTEMS_tasks_Start_extension,
92    .thread_delete  = _RTEMS_tasks_Delete_extension
93  }
94};
95
96static void _RTEMS_tasks_Manager_initialization(void)
97{
98  _Thread_Initialize_information(
99    &_RTEMS_tasks_Information, /* object information table */
100    OBJECTS_CLASSIC_API,       /* object API */
101    OBJECTS_RTEMS_TASKS,       /* object class */
102    Configuration_RTEMS_API.maximum_tasks,
103                               /* maximum objects of this class */
104    false,                     /* true if the name is a string */
105    RTEMS_MAXIMUM_NAME_LENGTH  /* maximum length of an object name */
106  );
107
108  /*
109   *  Add all the extensions for this API
110   */
111
112  _User_extensions_Add_API_set( &_RTEMS_tasks_User_extensions );
113
114  /*
115   *  Register the MP Process Packet routine.
116   */
117
118#if defined(RTEMS_MULTIPROCESSING)
119  _MPCI_Register_packet_processor(
120    MP_PACKET_TASKS,
121    _RTEMS_tasks_MP_Process_packet
122  );
123#endif
124
125}
126
127RTEMS_SYSINIT_ITEM(
128  _RTEMS_tasks_Manager_initialization,
129  RTEMS_SYSINIT_CLASSIC_TASKS,
130  RTEMS_SYSINIT_ORDER_MIDDLE
131);
Note: See TracBrowser for help on using the repository browser.