1 | /* |
---|
2 | * RTEMS Task Manager |
---|
3 | * |
---|
4 | * |
---|
5 | * COPYRIGHT (c) 1989-1999. |
---|
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.OARcorp.com/rtems/license.html. |
---|
11 | * |
---|
12 | * $Id$ |
---|
13 | */ |
---|
14 | |
---|
15 | #include <rtems/system.h> |
---|
16 | #include <rtems/rtems/status.h> |
---|
17 | #include <rtems/rtems/support.h> |
---|
18 | #include <rtems/rtems/modes.h> |
---|
19 | #include <rtems/score/object.h> |
---|
20 | #include <rtems/score/stack.h> |
---|
21 | #include <rtems/score/states.h> |
---|
22 | #include <rtems/rtems/tasks.h> |
---|
23 | #include <rtems/score/thread.h> |
---|
24 | #include <rtems/score/threadq.h> |
---|
25 | #include <rtems/score/tod.h> |
---|
26 | #include <rtems/score/userext.h> |
---|
27 | #include <rtems/score/wkspace.h> |
---|
28 | #include <rtems/score/apiext.h> |
---|
29 | #include <rtems/score/sysstate.h> |
---|
30 | |
---|
31 | /*PAGE |
---|
32 | * |
---|
33 | * _RTEMS_tasks_Initialize_user_tasks |
---|
34 | * |
---|
35 | * This routine creates and starts all configured user |
---|
36 | * initialzation threads. |
---|
37 | * |
---|
38 | * Input parameters: NONE |
---|
39 | * |
---|
40 | * Output parameters: NONE |
---|
41 | */ |
---|
42 | |
---|
43 | void _RTEMS_tasks_Initialize_user_tasks( void ) |
---|
44 | { |
---|
45 | unsigned32 index; |
---|
46 | unsigned32 maximum; |
---|
47 | rtems_id id; |
---|
48 | rtems_status_code return_value; |
---|
49 | rtems_initialization_tasks_table *user_tasks; |
---|
50 | |
---|
51 | /* |
---|
52 | * NOTE: This is slightly different from the Ada implementation. |
---|
53 | */ |
---|
54 | |
---|
55 | user_tasks = _RTEMS_tasks_User_initialization_tasks; |
---|
56 | maximum = _RTEMS_tasks_Number_of_initialization_tasks; |
---|
57 | |
---|
58 | if ( !user_tasks || maximum == 0 ) |
---|
59 | return; |
---|
60 | |
---|
61 | for ( index=0 ; index < maximum ; index++ ) { |
---|
62 | return_value = rtems_task_create( |
---|
63 | user_tasks[ index ].name, |
---|
64 | user_tasks[ index ].initial_priority, |
---|
65 | user_tasks[ index ].stack_size, |
---|
66 | user_tasks[ index ].mode_set, |
---|
67 | user_tasks[ index ].attribute_set, |
---|
68 | &id |
---|
69 | ); |
---|
70 | |
---|
71 | if ( !rtems_is_status_successful( return_value ) ) |
---|
72 | _Internal_error_Occurred( INTERNAL_ERROR_RTEMS_API, TRUE, return_value ); |
---|
73 | |
---|
74 | return_value = rtems_task_start( |
---|
75 | id, |
---|
76 | user_tasks[ index ].entry_point, |
---|
77 | user_tasks[ index ].argument |
---|
78 | ); |
---|
79 | |
---|
80 | if ( !rtems_is_status_successful( return_value ) ) |
---|
81 | _Internal_error_Occurred( INTERNAL_ERROR_RTEMS_API, TRUE, return_value ); |
---|
82 | } |
---|
83 | } |
---|