source: rtems/cpukit/score/src/thread.c @ 632e4306

4.104.115
Last change on this file since 632e4306 was aae7f1a1, checked in by Ralf Corsepius <ralf.corsepius@…>, on 12/22/08 at 05:52:32

Eliminate TRUE/FALSE.

  • Property mode set to 100644
File size: 3.1 KB
Line 
1/*
2 *  Thread Handler
3 *
4 *
5 *  COPYRIGHT (c) 1989-2008.
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/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/states.h>
28#include <rtems/score/sysstate.h>
29#include <rtems/score/thread.h>
30#include <rtems/score/threadq.h>
31#include <rtems/score/userext.h>
32#include <rtems/score/wkspace.h>
33#include <rtems/config.h>
34
35/*PAGE
36 *
37 *  _Thread_Handler_initialization
38 *
39 *  This routine initializes all thread manager related data structures.
40 *
41 *  Input parameters:   NONE
42 *
43 *  Output parameters:  NONE
44 */
45
46void _Thread_Handler_initialization(void)
47{
48  uint32_t     index;
49  uint32_t     ticks_per_timeslice;
50  uint32_t     maximum_extensions;
51  #if defined(RTEMS_MULTIPROCESSING)
52    uint32_t   maximum_proxies;
53  #endif
54
55  ticks_per_timeslice = Configuration.ticks_per_timeslice;
56  maximum_extensions  = Configuration.maximum_extensions;
57  #if defined(RTEMS_MULTIPROCESSING)
58    maximum_proxies   =  _Configuration_MP_table->maximum_proxies;
59  #endif
60  /*
61   * BOTH stacks hooks must be set or both must be NULL.
62   * Do not allow mixture.
63   */
64    if ( !( (!Configuration.stack_allocate_hook)
65            == (!Configuration.stack_free_hook) ) )
66    _Internal_error_Occurred(
67      INTERNAL_ERROR_CORE,
68      true,
69      INTERNAL_ERROR_BAD_STACK_HOOK
70    );
71
72  _Context_Switch_necessary = false;
73  _Thread_Executing         = NULL;
74  _Thread_Heir              = NULL;
75#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
76  _Thread_Allocated_fp      = NULL;
77#endif
78
79  _Thread_Do_post_task_switch_extension = 0;
80
81  _Thread_Maximum_extensions = maximum_extensions;
82
83  _Thread_Ticks_per_timeslice  = ticks_per_timeslice;
84
85  _Thread_Ready_chain = (Chain_Control *) _Workspace_Allocate_or_fatal_error(
86    (PRIORITY_MAXIMUM + 1) * sizeof(Chain_Control)
87  );
88
89  for ( index=0; index <= PRIORITY_MAXIMUM ; index++ )
90    _Chain_Initialize_empty( &_Thread_Ready_chain[ index ] );
91
92#if defined(RTEMS_MULTIPROCESSING)
93  _Thread_MP_Handler_initialization( maximum_proxies );
94#endif
95
96  /*
97   *  Initialize this class of objects.
98   */
99
100  _Objects_Initialize_information(
101    &_Thread_Internal_information,
102    OBJECTS_INTERNAL_API,
103    OBJECTS_INTERNAL_THREADS,
104#if defined(RTEMS_MULTIPROCESSING)
105    ( _System_state_Is_multiprocessing ) ?  2 : 1,
106#else
107    1,
108#endif
109    sizeof( Thread_Control ),
110                                /* size of this object's control block */
111    true,                       /* true if names for this object are strings */
112    8                           /* maximum length of each object's name */
113#if defined(RTEMS_MULTIPROCESSING)
114    ,
115    false,                      /* true if this is a global object class */
116    NULL                        /* Proxy extraction support callout */
117#endif
118  );
119
120}
Note: See TracBrowser for help on using the repository browser.