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 | rtems_stack_allocate_init_hook stack_allocate_init_hook = |
---|
29 | rtems_configuration_get_stack_allocate_init_hook(); |
---|
30 | #if defined(RTEMS_MULTIPROCESSING) |
---|
31 | uint32_t maximum_proxies = |
---|
32 | _Configuration_MP_table->maximum_proxies; |
---|
33 | #endif |
---|
34 | |
---|
35 | if ( rtems_configuration_get_stack_allocate_hook() == NULL || |
---|
36 | rtems_configuration_get_stack_free_hook() == NULL) |
---|
37 | _Terminate( |
---|
38 | INTERNAL_ERROR_CORE, |
---|
39 | true, |
---|
40 | INTERNAL_ERROR_BAD_STACK_HOOK |
---|
41 | ); |
---|
42 | |
---|
43 | if ( stack_allocate_init_hook != NULL ) |
---|
44 | (*stack_allocate_init_hook)( rtems_configuration_get_stack_space_size() ); |
---|
45 | |
---|
46 | _Thread_Dispatch_necessary = false; |
---|
47 | _Thread_Executing = NULL; |
---|
48 | _Thread_Heir = NULL; |
---|
49 | #if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE ) |
---|
50 | _Thread_Allocated_fp = NULL; |
---|
51 | #endif |
---|
52 | |
---|
53 | #if defined(RTEMS_MULTIPROCESSING) |
---|
54 | _Thread_MP_Handler_initialization( maximum_proxies ); |
---|
55 | #endif |
---|
56 | |
---|
57 | /* |
---|
58 | * Initialize the internal class of threads. We need an IDLE thread |
---|
59 | * per CPU in an SMP system. In addition, if this is a loosely |
---|
60 | * coupled multiprocessing system, account for the MPCI Server Thread. |
---|
61 | */ |
---|
62 | _Objects_Initialize_information( |
---|
63 | &_Thread_Internal_information, |
---|
64 | OBJECTS_INTERNAL_API, |
---|
65 | OBJECTS_INTERNAL_THREADS, |
---|
66 | _Thread_Get_maximum_internal_threads(), |
---|
67 | _Thread_Control_size, /* size of this object's control block */ |
---|
68 | false, /* true if names for this object are strings */ |
---|
69 | 8 /* maximum length of each object's name */ |
---|
70 | #if defined(RTEMS_MULTIPROCESSING) |
---|
71 | , |
---|
72 | false, /* true if this is a global object class */ |
---|
73 | NULL /* Proxy extraction support callout */ |
---|
74 | #endif |
---|
75 | ); |
---|
76 | |
---|
77 | } |
---|