source: rtems/cpukit/score/src/thread.c @ 02d989c

4.104.114.9
Last change on this file since 02d989c was 22ce0881, checked in by Joel Sherrill <joel.sherrill@…>, on Aug 7, 2008 at 6:23:48 PM

2008-08-07 Joel Sherrill <joel.sherrill@…>

  • score/include/rtems/score/sysstate.h, score/inline/rtems/score/sysstate.inl, score/src/thread.c: Make _System_state_Is_multiprocessing unused when multiprocessing is not enabled. Saves one more variable from single processor configuration.
  • Property mode set to 100644
File size: 3.0 KB
Line 
1/*
2 *  Thread Handler
3 *
4 *
5 *  COPYRIGHT (c) 1989-2007.
6 *  On-Line Applications Research Corporation (OAR).
7 *
8 *  The license and distribution terms for this file may be
9 *  found in 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/score/apiext.h>
21#include <rtems/score/context.h>
22#include <rtems/score/interr.h>
23#include <rtems/score/isr.h>
24#include <rtems/score/object.h>
25#include <rtems/score/priority.h>
26#include <rtems/score/states.h>
27#include <rtems/score/sysstate.h>
28#include <rtems/score/thread.h>
29#include <rtems/score/threadq.h>
30#include <rtems/score/userext.h>
31#include <rtems/score/wkspace.h>
32#include <rtems/config.h>
33
34/*PAGE
35 *
36 *  _Thread_Handler_initialization
37 *
38 *  This routine initializes all thread manager related data structures.
39 *
40 *  Input parameters:
41 *    ticks_per_timeslice - clock ticks per quantum
42 *    maximum_proxies     - number of proxies to initialize
43 *
44 *  Output parameters:  NONE
45 */
46
47void _Thread_Handler_initialization(
48  uint32_t     ticks_per_timeslice,
49  uint32_t     maximum_extensions
50#if defined(RTEMS_MULTIPROCESSING)
51  ,
52  uint32_t     maximum_proxies
53#endif
54)
55{
56  uint32_t        index;
57
58  /*
59   * BOTH stacks hooks must be set or both must be NULL.
60   * Do not allow mixture.
61   */
62    if ( !( (!_Configuration_Table->stack_allocate_hook)
63            == (!_Configuration_Table->stack_free_hook) ) )
64    _Internal_error_Occurred(
65      INTERNAL_ERROR_CORE,
66      TRUE,
67      INTERNAL_ERROR_BAD_STACK_HOOK
68    );
69
70  _Context_Switch_necessary = FALSE;
71  _Thread_Executing         = NULL;
72  _Thread_Heir              = NULL;
73#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
74  _Thread_Allocated_fp      = NULL;
75#endif
76
77  _Thread_Do_post_task_switch_extension = 0;
78
79  _Thread_Maximum_extensions = maximum_extensions;
80
81  _Thread_Ticks_per_timeslice  = ticks_per_timeslice;
82
83  _Thread_Ready_chain = (Chain_Control *) _Workspace_Allocate_or_fatal_error(
84    (PRIORITY_MAXIMUM + 1) * sizeof(Chain_Control)
85  );
86
87  for ( index=0; index <= PRIORITY_MAXIMUM ; index++ )
88    _Chain_Initialize_empty( &_Thread_Ready_chain[ index ] );
89
90#if defined(RTEMS_MULTIPROCESSING)
91  _Thread_MP_Handler_initialization( maximum_proxies );
92#endif
93
94  /*
95   *  Initialize this class of objects.
96   */
97
98  _Objects_Initialize_information(
99    &_Thread_Internal_information,
100    OBJECTS_INTERNAL_API,
101    OBJECTS_INTERNAL_THREADS,
102#if defined(RTEMS_MULTIPROCESSING)
103    ( _System_state_Is_multiprocessing ) ?  2 : 1,
104#else
105    1,
106#endif
107    sizeof( Thread_Control ),
108                                /* size of this object's control block */
109    TRUE,                       /* TRUE if names for this object are strings */
110    8                           /* maximum length of each object's name */
111#if defined(RTEMS_MULTIPROCESSING)
112    ,
113    FALSE,                      /* TRUE if this is a global object class */
114    NULL                        /* Proxy extraction support callout */
115#endif
116  );
117
118}
Note: See TracBrowser for help on using the repository browser.