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

4.104.115
Last change on this file since e660f86 was e660f86, checked in by Joel Sherrill <joel.sherrill@…>, on 07/04/09 at 19:45:18

2009-07-04 Joel Sherrill <joel.sherrill@…>

  • rtems/src/taskinitusers.c: Restructure to eliminate dead check -- loop will not be executed when 0 tasks. Also improved comments and eliminated a local variable.
  • Property mode set to 100644
File size: 2.4 KB
Line 
1/*
2 *  RTEMS Task Manager
3 *
4 *
5 *  COPYRIGHT (c) 1989-2008.
6 *  On-Line Applications Research Corporation (OAR).
7 *
8 *  The license and distribution terms for this file may be
9 *  found in the file LICENSE in this distribution or at
10 *  http://www.rtems.com/license/LICENSE.
11 *
12 *  $Id$
13 */
14
15#if HAVE_CONFIG_H
16#include "config.h"
17#endif
18
19#include <rtems/system.h>
20#include <rtems/config.h>
21#include <rtems/rtems/status.h>
22#include <rtems/rtems/support.h>
23#include <rtems/rtems/modes.h>
24#include <rtems/score/object.h>
25#include <rtems/rtems/rtemsapi.h>
26#include <rtems/score/stack.h>
27#include <rtems/score/states.h>
28#include <rtems/rtems/tasks.h>
29#include <rtems/score/thread.h>
30#include <rtems/score/threadq.h>
31#include <rtems/score/tod.h>
32#include <rtems/score/userext.h>
33#include <rtems/score/wkspace.h>
34#include <rtems/score/apiext.h>
35#include <rtems/score/sysstate.h>
36
37/*PAGE
38 *
39 *  _RTEMS_tasks_Initialize_user_tasks_body
40 *
41 *  This routine creates and starts all configured user
42 *  initialzation threads.
43 *
44 *  Input parameters: NONE
45 *
46 *  Output parameters:  NONE
47 */
48
49void _RTEMS_tasks_Initialize_user_tasks_body( void )
50{
51  uint32_t                          index;
52  uint32_t                          maximum;
53  rtems_id                          id;
54  rtems_status_code                 return_value;
55  rtems_initialization_tasks_table *user_tasks;
56
57  /*
58   *  Move information into local variables
59   */
60  user_tasks = Configuration_RTEMS_API.User_initialization_tasks_table;
61  maximum    = Configuration_RTEMS_API.number_of_initialization_tasks;
62
63  /*
64   *  Verify that we have a set of user tasks to iterate
65   */
66  if ( !user_tasks )
67    return;
68
69  /*
70   *  Now iterate over the initialization tasks and create/start them.
71   */
72  for ( index=0 ; index < maximum ; index++ ) {
73    return_value = rtems_task_create(
74      user_tasks[ index ].name,
75      user_tasks[ index ].initial_priority,
76      user_tasks[ index ].stack_size,
77      user_tasks[ index ].mode_set,
78      user_tasks[ index ].attribute_set,
79      &id
80    );
81    if ( !rtems_is_status_successful( return_value ) )
82      _Internal_error_Occurred( INTERNAL_ERROR_RTEMS_API, true, return_value );
83
84    return_value = rtems_task_start(
85      id,
86      user_tasks[ index ].entry_point,
87      user_tasks[ index ].argument
88    );
89    if ( !rtems_is_status_successful( return_value ) )
90      _Internal_error_Occurred( INTERNAL_ERROR_RTEMS_API, true, return_value );
91  }
92}
Note: See TracBrowser for help on using the repository browser.