1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief RTEMS Task API Extensions |
---|
5 | * @ingroup ClassicTasks |
---|
6 | */ |
---|
7 | |
---|
8 | /* |
---|
9 | * COPYRIGHT (c) 1989-2014. |
---|
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/config.h> |
---|
22 | #include <rtems/sysinit.h> |
---|
23 | #include <rtems/rtems/eventimpl.h> |
---|
24 | #include <rtems/rtems/tasksimpl.h> |
---|
25 | #include <rtems/score/threadimpl.h> |
---|
26 | #include <rtems/score/userextimpl.h> |
---|
27 | |
---|
28 | Thread_Information _RTEMS_tasks_Information; |
---|
29 | |
---|
30 | static void _RTEMS_tasks_Start_extension( |
---|
31 | Thread_Control *executing, |
---|
32 | Thread_Control *started |
---|
33 | ) |
---|
34 | { |
---|
35 | RTEMS_API_Control *api; |
---|
36 | |
---|
37 | api = started->API_Extensions[ THREAD_API_RTEMS ]; |
---|
38 | |
---|
39 | _Event_Initialize( &api->Event ); |
---|
40 | _Event_Initialize( &api->System_event ); |
---|
41 | } |
---|
42 | |
---|
43 | User_extensions_Control _RTEMS_tasks_User_extensions = { |
---|
44 | .Callouts = { |
---|
45 | .thread_start = _RTEMS_tasks_Start_extension, |
---|
46 | .thread_restart = _RTEMS_tasks_Start_extension |
---|
47 | } |
---|
48 | }; |
---|
49 | |
---|
50 | static void _RTEMS_tasks_Manager_initialization(void) |
---|
51 | { |
---|
52 | _Thread_Initialize_information( |
---|
53 | &_RTEMS_tasks_Information, /* object information table */ |
---|
54 | OBJECTS_CLASSIC_API, /* object API */ |
---|
55 | OBJECTS_RTEMS_TASKS, /* object class */ |
---|
56 | Configuration_RTEMS_API.maximum_tasks, |
---|
57 | /* maximum objects of this class */ |
---|
58 | false, /* true if the name is a string */ |
---|
59 | RTEMS_MAXIMUM_NAME_LENGTH /* maximum length of an object name */ |
---|
60 | ); |
---|
61 | |
---|
62 | /* |
---|
63 | * Add all the extensions for this API |
---|
64 | */ |
---|
65 | |
---|
66 | _User_extensions_Add_API_set( &_RTEMS_tasks_User_extensions ); |
---|
67 | |
---|
68 | /* |
---|
69 | * Register the MP Process Packet routine. |
---|
70 | */ |
---|
71 | |
---|
72 | #if defined(RTEMS_MULTIPROCESSING) |
---|
73 | _MPCI_Register_packet_processor( |
---|
74 | MP_PACKET_TASKS, |
---|
75 | _RTEMS_tasks_MP_Process_packet |
---|
76 | ); |
---|
77 | #endif |
---|
78 | |
---|
79 | } |
---|
80 | |
---|
81 | RTEMS_SYSINIT_ITEM( |
---|
82 | _RTEMS_tasks_Manager_initialization, |
---|
83 | RTEMS_SYSINIT_CLASSIC_TASKS, |
---|
84 | RTEMS_SYSINIT_ORDER_MIDDLE |
---|
85 | ); |
---|