source: rtems/cpukit/score/src/thread.c @ 37c7bfcb

4.104.114.84.95
Last change on this file since 37c7bfcb was a8eed23, checked in by Ralf Corsepius <ralf.corsepius@…>, on 01/27/05 at 05:57:05

Include config.h.

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