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

4.104.114.84.95
Last change on this file since 3127180 was 3127180, checked in by Ralf Corsepius <ralf.corsepius@…>, on 03/29/04 at 12:51:43

2004-04-29 Ralf Corsepius <ralf_corsepius@…>

  • score/src/Unlimited.txt, score/src/chain.c, score/src/coremsg.c, score/src/coremsgbroadcast.c, score/src/coremsgclose.c, score/src/coremsgflush.c, score/src/coremsgflushsupp.c, score/src/coremsgseize.c, score/src/coremsgsubmit.c, score/src/coremutex.c, score/src/coremutexflush.c, score/src/coresem.c, score/src/coresemflush.c, score/src/coretod.c, score/src/coretodtickle.c, score/src/coretodtoseconds.c, score/src/coretodvalidate.c, score/src/heap.c, score/src/heapallocate.c, score/src/heapextend.c, score/src/heapfree.c, score/src/heapsizeofuserarea.c, score/src/interr.c, score/src/iterateoverthreads.c, score/src/mpci.c, score/src/object.c, score/src/objectallocate.c, score/src/objectallocatebyindex.c, score/src/objectclearname.c, score/src/objectcomparenameraw.c, score/src/objectcomparenamestring.c, score/src/objectcopynameraw.c, score/src/objectcopynamestring.c, score/src/objectextendinformation.c, score/src/objectfree.c, score/src/objectget.c, score/src/objectgetbyindex.c, score/src/objectgetisr.c, score/src/objectgetnoprotection.c, score/src/objectidtoname.c, score/src/objectinitializeinformation.c, score/src/objectmp.c, score/src/objectnametoid.c, score/src/objectshrinkinformation.c, score/src/thread.c, score/src/threadcreateidle.c, score/src/threadget.c, score/src/threadidlebody.c, score/src/threadinitialize.c, score/src/threadmp.c, score/src/threadq.c, score/src/threadqdequeuepriority.c, score/src/threadqenqueuepriority.c, score/src/threadqfirstpriority.c, score/src/threadqflush.c, score/src/threadreset.c, score/src/threadrestart.c, score/src/threadsettransient.c, score/src/threadstackallocate.c, score/src/threadstart.c, score/src/userext.c, score/src/watchdoginsert.c, score/src/wkspace.c: Convert to using c99 fixed size types.
  • Property mode set to 100644
File size: 2.8 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#include <rtems/system.h>
16#include <rtems/score/apiext.h>
17#include <rtems/score/context.h>
18#include <rtems/score/interr.h>
19#include <rtems/score/isr.h>
20#include <rtems/score/object.h>
21#include <rtems/score/priority.h>
22#include <rtems/score/states.h>
23#include <rtems/score/sysstate.h>
24#include <rtems/score/thread.h>
25#include <rtems/score/threadq.h>
26#include <rtems/score/userext.h>
27#include <rtems/score/wkspace.h>
28
29/*PAGE
30 *
31 *  _Thread_Handler_initialization
32 *
33 *  This routine initializes all thread manager related data structures.
34 *
35 *  Input parameters:
36 *    ticks_per_timeslice - clock ticks per quantum
37 *    maximum_proxies     - number of proxies to initialize
38 *
39 *  Output parameters:  NONE
40 */
41
42void _Thread_Handler_initialization(
43  uint32_t     ticks_per_timeslice,
44  uint32_t     maximum_extensions,
45  uint32_t     maximum_proxies
46)
47{
48  uint32_t        index;
49
50  /*
51   * BOTH stacks hooks must be set or both must be NULL.
52   * Do not allow mixture.
53   */
54
55  if ( !( ( _CPU_Table.stack_allocate_hook == 0 )
56       == ( _CPU_Table.stack_free_hook == 0 ) ) )
57    _Internal_error_Occurred(
58      INTERNAL_ERROR_CORE,
59      TRUE,
60      INTERNAL_ERROR_BAD_STACK_HOOK
61    );
62
63  _Context_Switch_necessary = FALSE;
64  _Thread_Executing         = NULL;
65  _Thread_Heir              = NULL;
66#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
67  _Thread_Allocated_fp      = NULL;
68#endif
69
70  _Thread_Do_post_task_switch_extension = 0;
71
72  _Thread_Maximum_extensions = maximum_extensions;
73
74  _Thread_Ticks_per_timeslice  = ticks_per_timeslice;
75
76  _Thread_Ready_chain = (Chain_Control *) _Workspace_Allocate_or_fatal_error(
77    (PRIORITY_MAXIMUM + 1) * sizeof(Chain_Control)
78  );
79
80  for ( index=0; index <= PRIORITY_MAXIMUM ; index++ )
81    _Chain_Initialize_empty( &_Thread_Ready_chain[ index ] );
82
83#if defined(RTEMS_MULTIPROCESSING)
84  _Thread_MP_Handler_initialization( maximum_proxies );
85#endif
86
87  /*
88   *  Initialize this class of objects.
89   */
90 
91  _Objects_Initialize_information(
92    &_Thread_Internal_information,
93    OBJECTS_INTERNAL_API,
94    OBJECTS_INTERNAL_THREADS,
95    ( _System_state_Is_multiprocessing ) ?  2 : 1,
96    sizeof( Thread_Control ),
97                                /* size of this object's control block */
98    TRUE,                       /* TRUE if names for this object are strings */
99    8                           /* maximum length of each object's name */
100#if defined(RTEMS_MULTIPROCESSING)
101    ,
102    FALSE,                      /* TRUE if this is a global object class */
103    NULL                        /* Proxy extraction support callout */
104#endif
105  );
106
107}
108
Note: See TracBrowser for help on using the repository browser.