summaryrefslogtreecommitdiffstats
path: root/cpukit/itron/src/task.c
blob: 7c242676cee670b0e04634b6d39f0a8af3f09c5c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
/*
 *  COPYRIGHT (c) 1989-2008.
 *  On-Line Applications Research Corporation (OAR).
 *
 *  The license and distribution terms for this file may be
 *  found in the file LICENSE in this distribution or at
 *  http://www.rtems.com/license/LICENSE.
 *
 *  $Id$
 */

#if HAVE_CONFIG_H
#include "config.h"
#endif

#include <rtems/itron.h>
#include <rtems/config.h>
#include <rtems/score/thread.h>
#include <rtems/score/userext.h>
#include <rtems/score/wkspace.h>
#include <rtems/score/apiext.h>
#include <rtems/score/apimutex.h>
#include <rtems/score/sysstate.h>

#include <rtems/itron/task.h>

#if 0
/*
 *  _ITRON_Task_Create_extension
 *
 *  This routine is an extension routine that is invoked as part
 *  of creating any type of task or thread in the system.  If the
 *  task is created via another API, then this routine is invoked
 *  and this API given the opportunity to initialize its extension
 *  area.
 */

bool _ITRON_Task_Create_extension(
  Thread_Control *executing,
  Thread_Control *created
)
{
  /*
   *  Until we actually put data in this structure, do not even
   *  allocate it.
   */
#if 0
  ITRON_API_Control *api;

  api = _Workspace_Allocate( sizeof( ITRON_API_Control ) );

  if ( !api )
    return false;

  created->API_Extensions[ THREAD_API_ITRON ] = api;
#else
  created->API_Extensions[ THREAD_API_ITRON ] = NULL;
#endif

  /*
   *  Initialize the ITRON API extension
   */

  return true;
}

/*
 *  _ITRON_Task_Delete_extension
 *
 *  This extension routine is invoked when a task is deleted.
 */

User_extensions_routine _ITRON_Task_Delete_extension(
  Thread_Control *executing,
  Thread_Control *deleted
)
{
  /*
   *  Until we actually put data in this structure, do not even
   *  allocate it.
   */
#if 0
  (void) _Workspace_Free( deleted->API_Extensions[ THREAD_API_ITRON ] );

  deleted->API_Extensions[ THREAD_API_ITRON ] = NULL;
#endif
}
#endif

/*
 *  _ITRON_Task_Initialize_user_tasks
 *
 *  This routine creates and starts all configured user
 *  initialzation threads.
 */

void _ITRON_Task_Initialize_user_tasks( void )
{
  if ( _ITRON_Initialize_user_tasks_p )
    (*_ITRON_Initialize_user_tasks_p)();
}

/*
 *  At this point in time, the ITRON API does not need any other
 *  extensions.  See the POSIX and RTEMS API extensions for
 *  examples of how they can be used.
 */

/*
 *  Extension Tables
 */

API_extensions_Control _ITRON_Task_API_extensions = {
  { NULL, NULL },
  #if defined(FUNCTIONALITY_NOT_CURRENTLY_USED_BY_ANY_API)
    NULL,                                   /* predriver */
  #endif
  _ITRON_Task_Initialize_user_tasks,        /* postdriver */
  NULL                                      /* post switch */
};

/*
 *  Until ITRON needs this, do not even declare it.
 */
#if 0
User_extensions_Control _ITRON_Task_User_extensions = {
  { NULL, NULL },
  { { NULL, NULL }, NULL },
  {
    _ITRON_Task_Create_extension,             /* create */
    NULL,                                     /* start */
    NULL,                                     /* restart */
    _ITRON_Task_Delete_extension,             /* delete */
    NULL,                                     /* switch */
    NULL,                                     /* begin */
    NULL,                                     /* exitted */
    NULL                                      /* fatal */
  }
};
#endif

/*
 *  _ITRON_Task_Manager_initialization
 *
 *  This routine initializes all Task Manager related data structures.
 *
 *  Input parameters:
 *    maximum_tasks       - number of tasks to initialize
 *
 *  Output parameters:  NONE
 */

void _ITRON_Task_Manager_initialization(void)
{

  _Objects_Initialize_information(
    &_ITRON_Task_Information,   /* object information table */
    OBJECTS_ITRON_API,          /* object API */
    OBJECTS_ITRON_TASKS,        /* object class */
    Configuration_ITRON_API.maximum_tasks,
                                /* maximum objects of this class */
    sizeof( Thread_Control ),   /* size of this object's control block */
    FALSE,                      /* TRUE if names for this object are strings */
    ITRON_MAXIMUM_NAME_LENGTH   /* maximum length of each object's name */
#if defined(RTEMS_MULTIPROCESSING)
    ,
    FALSE,                      /* TRUE if this is a global object class */
    NULL                        /* Proxy extraction support callout */
#endif
  );

  /*
   *  Until ITRON needs this, do not even declare it.
   */
  #if 0
    /*
     *  Add all the extensions for this API
     */
    _User_extensions_Add_API_set( &_ITRON_Task_User_extensions );
  #endif

  _API_extensions_Add( &_ITRON_Task_API_extensions );

}