source: rtems/cpukit/rtems/src/taskinitusers.c @ e266d13

5
Last change on this file since e266d13 was 3bc12a8f, checked in by Sebastian Huber <sebastian.huber@…>, on 01/26/16 at 10:16:56

Delete unused API extensions

  • Property mode set to 100644
File size: 3.0 KB
Line 
1/**
2 * @file
3 *
4 * @brief _RTEMS_tasks_Initialize_user_tasks_body
5 * @ingroup ClassicTasks Tasks
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/system.h>
22#include <rtems/config.h>
23#include <rtems/rtems/status.h>
24#include <rtems/rtems/support.h>
25#include <rtems/rtems/modes.h>
26#include <rtems/score/assert.h>
27#include <rtems/score/stack.h>
28#include <rtems/rtems/tasksimpl.h>
29#include <rtems/score/thread.h>
30#include <rtems/score/wkspace.h>
31
32static void _RTEMS_Global_construction( rtems_task_argument arg )
33{
34  Thread_Control           *executing = _Thread_Get_executing();
35  Thread_Entry_information  entry = executing->Start.Entry;
36
37  entry.Kinds.Numeric.entry =
38    Configuration_RTEMS_API.User_initialization_tasks_table[ 0 ].entry_point;
39
40  (void) arg;
41  _Thread_Global_construction( executing, &entry );
42}
43
44/*
45 *  _RTEMS_tasks_Initialize_user_tasks_body
46 *
47 *  This routine creates and starts all configured user
48 *  initialization threads.
49 *
50 *  Input parameters: NONE
51 *
52 *  Output parameters:  NONE
53 */
54
55void _RTEMS_tasks_Initialize_user_tasks_body( void )
56{
57  uint32_t                          index;
58  uint32_t                          maximum;
59  rtems_id                          id;
60  rtems_status_code                 return_value;
61  rtems_initialization_tasks_table *user_tasks;
62  bool                              register_global_construction;
63  rtems_task_entry                  entry_point;
64
65  /*
66   *  Move information into local variables
67   */
68  user_tasks = Configuration_RTEMS_API.User_initialization_tasks_table;
69  maximum    = Configuration_RTEMS_API.number_of_initialization_tasks;
70
71  /*
72   *  Verify that we have a set of user tasks to iterate
73   */
74  if ( !user_tasks )
75    return;
76
77  register_global_construction = true;
78
79  /*
80   *  Now iterate over the initialization tasks and create/start them.
81   */
82  for ( index=0 ; index < maximum ; index++ ) {
83    return_value = rtems_task_create(
84      user_tasks[ index ].name,
85      user_tasks[ index ].initial_priority,
86      user_tasks[ index ].stack_size,
87      user_tasks[ index ].mode_set,
88      user_tasks[ index ].attribute_set,
89      &id
90    );
91    if ( !rtems_is_status_successful( return_value ) )
92      _Terminate( INTERNAL_ERROR_RTEMS_API, true, return_value );
93
94    entry_point = user_tasks[ index ].entry_point;
95    if ( entry_point == NULL ) {
96      _Terminate(
97        INTERNAL_ERROR_CORE,
98        false,
99        INTERNAL_ERROR_RTEMS_INIT_TASK_ENTRY_IS_NULL
100      );
101    }
102
103    if ( register_global_construction ) {
104      register_global_construction = false;
105      entry_point = _RTEMS_Global_construction;
106    }
107
108    return_value = rtems_task_start(
109      id,
110      entry_point,
111      user_tasks[ index ].argument
112    );
113    _Assert( rtems_is_status_successful( return_value ) );
114    (void) return_value;
115  }
116}
Note: See TracBrowser for help on using the repository browser.