source: rtems/cpukit/score/src/thread.c @ d7c3883

4.115
Last change on this file since d7c3883 was e79093a, checked in by Joel Sherrill <joel.sherrill@…>, on 04/04/11 at 16:40:00

2011-04-04 Joel Sherrill <joel.sherrilL@…>

PR 1773/cpukit

  • sapi/include/confdefs.h, sapi/src/exinit.c, score/include/rtems/bspsmp.h, score/src/percpu.c, score/src/thread.c: Rename rtems_smp_maximum_processor to rtems_configuration_smp_maximum_processor. Eliminate printk().
  • Property mode set to 100644
File size: 3.3 KB
Line 
1/*
2 *  Thread Handler
3 *
4 *
5 *  COPYRIGHT (c) 1989-2011.
6 *  On-Line Applications Research Corporation (OAR).
7 *
8 *  The license and distribution terms for this file may be
9 *  found in the file LICENSE in this distribution or at
10 *  http://www.rtems.com/license/LICENSE.
11 *
12 *  $Id$
13 */
14
15#if HAVE_CONFIG_H
16#include "config.h"
17#endif
18
19#include <rtems/system.h>
20#include <rtems/config.h>
21#include <rtems/score/apiext.h>
22#include <rtems/score/context.h>
23#include <rtems/score/interr.h>
24#include <rtems/score/isr.h>
25#include <rtems/score/object.h>
26#include <rtems/score/priority.h>
27#include <rtems/score/scheduler.h>
28#include <rtems/score/states.h>
29#include <rtems/score/sysstate.h>
30#include <rtems/score/thread.h>
31#include <rtems/score/threadq.h>
32#include <rtems/score/userext.h>
33#include <rtems/score/wkspace.h>
34#include <rtems/config.h>
35
36#if defined(RTEMS_SMP)
37  #include <rtems/bspsmp.h>
38#endif
39
40/*
41 *  _Thread_Handler_initialization
42 *
43 *  This routine initializes all thread manager related data structures.
44 *
45 *  Input parameters:   NONE
46 *
47 *  Output parameters:  NONE
48 */
49
50void _Thread_Handler_initialization(void)
51{
52  uint32_t     ticks_per_timeslice;
53  uint32_t     maximum_extensions;
54  uint32_t     maximum_internal_threads;
55  #if defined(RTEMS_MULTIPROCESSING)
56    uint32_t   maximum_proxies;
57  #endif
58
59  ticks_per_timeslice = Configuration.ticks_per_timeslice;
60  maximum_extensions  = Configuration.maximum_extensions;
61  #if defined(RTEMS_MULTIPROCESSING)
62    maximum_proxies   =  _Configuration_MP_table->maximum_proxies;
63  #endif
64  /*
65   * BOTH stacks hooks must be set or both must be NULL.
66   * Do not allow mixture.
67   */
68    if ( !( (!Configuration.stack_allocate_hook)
69            == (!Configuration.stack_free_hook) ) )
70    _Internal_error_Occurred(
71      INTERNAL_ERROR_CORE,
72      true,
73      INTERNAL_ERROR_BAD_STACK_HOOK
74    );
75
76  _Thread_Dispatch_necessary = false;
77  _Thread_Executing         = NULL;
78  _Thread_Heir              = NULL;
79#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
80  _Thread_Allocated_fp      = NULL;
81#endif
82
83  _Thread_Maximum_extensions = maximum_extensions;
84
85  _Thread_Ticks_per_timeslice  = ticks_per_timeslice;
86
87  #if defined(RTEMS_MULTIPROCESSING)
88    _Thread_MP_Handler_initialization( maximum_proxies );
89  #endif
90
91  /*
92   *  Initialize the internal class of threads.  We need an IDLE thread
93   *  per CPU in an SMP system.  In addition, if this is a loosely
94   *  coupled multiprocessing system, account for the MPCI Server Thread.
95   */
96  #if defined(RTEMS_SMP)
97    maximum_internal_threads = rtems_configuration_smp_maximum_processors;
98  #else
99    maximum_internal_threads = 1;
100  #endif
101
102  #if defined(RTEMS_MULTIPROCESSING)
103    if ( _System_state_Is_multiprocessing )
104      maximum_internal_threads += 1;
105  #endif
106
107  _Objects_Initialize_information(
108    &_Thread_Internal_information,
109    OBJECTS_INTERNAL_API,
110    OBJECTS_INTERNAL_THREADS,
111    maximum_internal_threads,
112    sizeof( Thread_Control ),
113                                /* size of this object's control block */
114    false,                      /* true if names for this object are strings */
115    8                           /* maximum length of each object's name */
116    #if defined(RTEMS_MULTIPROCESSING)
117      ,
118      false,                      /* true if this is a global object class */
119      NULL                        /* Proxy extraction support callout */
120    #endif
121  );
122
123}
Note: See TracBrowser for help on using the repository browser.