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