source: rtems/cpukit/score/src/thread.c @ 5618c37a

4.115
Last change on this file since 5618c37a was 5618c37a, checked in by Sebastian Huber <sebastian.huber@…>, on 07/24/13 at 13:14:48

score: Create thread implementation header

Move implementation specific parts of thread.h and thread.inl into new
header file threadimpl.h. The thread.h contains now only the
application visible API.

Remove superfluous header file includes from various files.

  • Property mode set to 100644
File size: 2.8 KB
Line 
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.com/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#include <rtems/score/sysstate.h>
24#include <rtems/config.h>
25
26void _Thread_Handler_initialization(void)
27{
28  uint32_t ticks_per_timeslice =
29    rtems_configuration_get_ticks_per_timeslice();
30  uint32_t maximum_extensions =
31    rtems_configuration_get_maximum_extensions();
32  rtems_stack_allocate_init_hook stack_allocate_init_hook =
33    rtems_configuration_get_stack_allocate_init_hook();
34  uint32_t     maximum_internal_threads;
35  #if defined(RTEMS_MULTIPROCESSING)
36    uint32_t maximum_proxies =
37      _Configuration_MP_table->maximum_proxies;
38  #endif
39
40  if ( rtems_configuration_get_stack_allocate_hook() == NULL ||
41       rtems_configuration_get_stack_free_hook() == NULL)
42    _Internal_error_Occurred(
43      INTERNAL_ERROR_CORE,
44      true,
45      INTERNAL_ERROR_BAD_STACK_HOOK
46    );
47
48  if ( stack_allocate_init_hook != NULL )
49    (*stack_allocate_init_hook)( rtems_configuration_get_stack_space_size() );
50
51  _Thread_Dispatch_necessary = false;
52  _Thread_Executing         = NULL;
53  _Thread_Heir              = NULL;
54#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
55  _Thread_Allocated_fp      = NULL;
56#endif
57
58  _Thread_Maximum_extensions = maximum_extensions;
59
60  _Thread_Ticks_per_timeslice  = ticks_per_timeslice;
61
62  #if defined(RTEMS_MULTIPROCESSING)
63    _Thread_MP_Handler_initialization( maximum_proxies );
64  #endif
65
66  /*
67   *  Initialize the internal class of threads.  We need an IDLE thread
68   *  per CPU in an SMP system.  In addition, if this is a loosely
69   *  coupled multiprocessing system, account for the MPCI Server Thread.
70   */
71  maximum_internal_threads = rtems_configuration_get_maximum_processors();
72
73  #if defined(RTEMS_MULTIPROCESSING)
74    if ( _System_state_Is_multiprocessing )
75      maximum_internal_threads += 1;
76  #endif
77
78  _Objects_Initialize_information(
79    &_Thread_Internal_information,
80    OBJECTS_INTERNAL_API,
81    OBJECTS_INTERNAL_THREADS,
82    maximum_internal_threads,
83    sizeof( Thread_Control ),
84                                /* size of this object's control block */
85    false,                      /* true if names for this object are strings */
86    8                           /* maximum length of each object's name */
87    #if defined(RTEMS_MULTIPROCESSING)
88      ,
89      false,                      /* true if this is a global object class */
90      NULL                        /* Proxy extraction support callout */
91    #endif
92  );
93
94}
Note: See TracBrowser for help on using the repository browser.