1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief Initialize Thread Handler |
---|
5 | * @ingroup ScoreThread |
---|
6 | */ |
---|
7 | |
---|
8 | /* |
---|
9 | * COPYRIGHT (c) 1989-2011. |
---|
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/score/threadimpl.h> |
---|
22 | #include <rtems/score/interr.h> |
---|
23 | |
---|
24 | void _Thread_Handler_initialization(void) |
---|
25 | { |
---|
26 | uint32_t ticks_per_timeslice = |
---|
27 | rtems_configuration_get_ticks_per_timeslice(); |
---|
28 | uint32_t maximum_extensions = |
---|
29 | rtems_configuration_get_maximum_extensions(); |
---|
30 | rtems_stack_allocate_init_hook stack_allocate_init_hook = |
---|
31 | rtems_configuration_get_stack_allocate_init_hook(); |
---|
32 | #if defined(RTEMS_MULTIPROCESSING) |
---|
33 | uint32_t maximum_proxies = |
---|
34 | _Configuration_MP_table->maximum_proxies; |
---|
35 | #endif |
---|
36 | |
---|
37 | if ( rtems_configuration_get_stack_allocate_hook() == NULL || |
---|
38 | rtems_configuration_get_stack_free_hook() == NULL) |
---|
39 | _Terminate( |
---|
40 | INTERNAL_ERROR_CORE, |
---|
41 | true, |
---|
42 | INTERNAL_ERROR_BAD_STACK_HOOK |
---|
43 | ); |
---|
44 | |
---|
45 | if ( stack_allocate_init_hook != NULL ) |
---|
46 | (*stack_allocate_init_hook)( rtems_configuration_get_stack_space_size() ); |
---|
47 | |
---|
48 | _Thread_Dispatch_necessary = false; |
---|
49 | _Thread_Executing = NULL; |
---|
50 | _Thread_Heir = NULL; |
---|
51 | #if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE ) |
---|
52 | _Thread_Allocated_fp = NULL; |
---|
53 | #endif |
---|
54 | |
---|
55 | _Thread_Maximum_extensions = maximum_extensions; |
---|
56 | |
---|
57 | _Thread_Ticks_per_timeslice = ticks_per_timeslice; |
---|
58 | |
---|
59 | #if defined(RTEMS_MULTIPROCESSING) |
---|
60 | _Thread_MP_Handler_initialization( maximum_proxies ); |
---|
61 | #endif |
---|
62 | |
---|
63 | /* |
---|
64 | * Initialize the internal class of threads. We need an IDLE thread |
---|
65 | * per CPU in an SMP system. In addition, if this is a loosely |
---|
66 | * coupled multiprocessing system, account for the MPCI Server Thread. |
---|
67 | */ |
---|
68 | _Objects_Initialize_information( |
---|
69 | &_Thread_Internal_information, |
---|
70 | OBJECTS_INTERNAL_API, |
---|
71 | OBJECTS_INTERNAL_THREADS, |
---|
72 | _Thread_Get_maximum_internal_threads(), |
---|
73 | sizeof( Thread_Control ), |
---|
74 | /* size of this object's control block */ |
---|
75 | false, /* true if names for this object are strings */ |
---|
76 | 8 /* maximum length of each object's name */ |
---|
77 | #if defined(RTEMS_MULTIPROCESSING) |
---|
78 | , |
---|
79 | false, /* true if this is a global object class */ |
---|
80 | NULL /* Proxy extraction support callout */ |
---|
81 | #endif |
---|
82 | ); |
---|
83 | |
---|
84 | } |
---|