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

4.104.114.95
Last change on this file since dd0e6bf was 9221838, checked in by Joel Sherrill <joel.sherrill@…>, on 11/28/07 at 22:04:31

2007-11-28 Joel Sherrill <joel.sherrill@…>

  • sapi/src/exinit.c, score/include/rtems/score/object.h, score/include/rtems/score/thread.h, score/src/object.c, score/src/thread.c: Conditionally compile out more code that is specific to multiprocessor configurations.
  • Property mode set to 100644
File size: 2.9 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
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#if defined(RTEMS_MULTIPROCESSING)
50  ,
51  uint32_t     maximum_proxies
52#endif
53)
54{
55  uint32_t        index;
56
57  /*
58   * BOTH stacks hooks must be set or both must be NULL.
59   * Do not allow mixture.
60   */
61
62  if ( !( ( _CPU_Table.stack_allocate_hook == 0 )
63       == ( _CPU_Table.stack_free_hook == 0 ) ) )
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    ( _System_state_Is_multiprocessing ) ?  2 : 1,
103    sizeof( Thread_Control ),
104                                /* size of this object's control block */
105    TRUE,                       /* TRUE if names for this object are strings */
106    8                           /* maximum length of each object's name */
107#if defined(RTEMS_MULTIPROCESSING)
108    ,
109    FALSE,                      /* TRUE if this is a global object class */
110    NULL                        /* Proxy extraction support callout */
111#endif
112  );
113
114}
Note: See TracBrowser for help on using the repository browser.