RTEMS
taskinitusers.c
Go to the documentation of this file.
1 
9 /*
10  * COPYRIGHT (c) 1989-2008.
11  * On-Line Applications Research Corporation (OAR).
12  *
13  * The license and distribution terms for this file may be
14  * found in the file LICENSE in this distribution or at
15  * http://www.rtems.org/license/LICENSE.
16  */
17 
18 #ifdef HAVE_CONFIG_H
19 #include "config.h"
20 #endif
21 
22 #include <rtems/rtems/tasksimpl.h>
23 #include <rtems/score/assert.h>
24 #include <rtems/score/threadimpl.h>
25 #include <rtems/score/interr.h>
26 
28 {
29  rtems_id id;
30  rtems_status_code return_value;
31  const rtems_initialization_tasks_table *user_task;
32  rtems_task_entry entry_point;
33 
34  user_task = &_RTEMS_tasks_User_task_table;
35  return_value = rtems_task_create(
36  user_task->name,
37  user_task->initial_priority,
38  user_task->stack_size,
39  user_task->mode_set,
40  user_task->attribute_set,
41  &id
42  );
43  if ( !rtems_is_status_successful( return_value ) ) {
44  _Internal_error( INTERNAL_ERROR_RTEMS_INIT_TASK_CREATE_FAILED );
45  }
46 
47  entry_point = user_task->entry_point;
48  if ( entry_point == NULL ) {
49  _Internal_error( INTERNAL_ERROR_RTEMS_INIT_TASK_ENTRY_IS_NULL );
50  }
51 
52  return_value = rtems_task_start(
53  id,
54  entry_point,
55  user_task->argument
56  );
57  _Assert( rtems_is_status_successful( return_value ) );
58  (void) return_value;
59 
62 }
Constants and Prototypes Related to the Internal Error Handler.
void _RTEMS_tasks_Initialize_user_task(void)
System initialization handler to create and start the first user task.
Definition: taskinitusers.c:27
rtems_task_argument argument
%
Definition: tasks.h:921
rtems_attribute attribute_set
%
Definition: tasks.h:900
rtems_status_code rtems_task_start(rtems_id id, rtems_task_entry entry_point, rtems_task_argument argument)
%
Definition: taskstart.c:25
Information for the Assert Handler.
rtems_status_code
This enumeration provides status codes for directives of the Classic API.
Definition: status.h:82
Objects_Id _Thread_Global_constructor
Object identifier of the global constructor thread.
Definition: threadhandler.c:53
rtems_task_priority initial_priority
%
Definition: tasks.h:893
rtems_task_entry entry_point
%
Definition: tasks.h:907
rtems_task(* rtems_task_entry)(rtems_task_argument)
This type defines the entry point of an RTEMS task.
Definition: tasks.h:222
rtems_status_code rtems_task_create(rtems_name name, rtems_task_priority initial_priority, size_t stack_size, rtems_mode initial_modes, rtems_attribute attribute_set, rtems_id *id)
Creates a task object.
Objects_Id rtems_id
Values of this type identify an RTEMS object.
Definition: types.h:99
void _Internal_error(Internal_errors_Core_list core_error) RTEMS_NO_RETURN
Terminates the system with an INTERNAL_ERROR_CORE fatal source and the specified core error code...
Definition: interr.c:51
Inlined Routines from the Thread Handler.
static bool rtems_is_status_successful(rtems_status_code status_code)
Returns true, if the status code is equal to RTEMS_SUCCESSFUL, otherwise returns false.
Definition: status.h:339
const rtems_initialization_tasks_table _RTEMS_tasks_User_task_table
Initialization table for the first user task.
#define _Assert(_e)
Assertion similar to assert() controlled via RTEMS_DEBUG instead of NDEBUG.
Definition: assert.h:100
Classic Tasks Manager Implementation.