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

Last change on this file since a6eef8b was a6eef8b, checked in by Joel Sherrill <joel.sherrill@…>, on 09/04/03 at 18:52:48

2003-09-04 Joel Sherrill <joel@…>

  • apiext.c, chain.c, coremsg.c, coremsgbroadcast.c, coremsgclose.c, coremsgflush.c, coremsgflushsupp.c, coremsgflushwait.c, coremsginsert.c, coremsgseize.c, coremsgsubmit.c, coremutex.c, coremutexflush.c, coremutexseize.c, coremutexsurrender.c, coresem.c, coresemflush.c, coresemseize.c, coresemsurrender.c, coretod.c, coretodset.c, coretodtickle.c, coretodtoseconds.c, coretodvalidate.c, heap.c, heapallocate.c, heapextend.c, heapfree.c, heapgetinfo.c, heapsizeofuserarea.c, heapwalk.c, interr.c, isr.c, mpci.c, object.c, objectallocate.c, objectallocatebyindex.c, objectclearname.c, objectcomparenameraw.c, objectcomparenamestring.c, objectcopynameraw.c, objectcopynamestring.c, objectextendinformation.c, objectfree.c, objectget.c, objectgetbyindex.c, objectgetisr.c, objectgetnext.c, objectgetnoprotection.c, objectinitializeinformation.c, objectmp.c, objectnametoid.c, objectshrinkinformation.c, thread.c, threadchangepriority.c, threadclearstate.c, threadclose.c, threadcreateidle.c, threaddelayended.c, threaddispatch.c, threadevaluatemode.c, threadget.c, threadhandler.c, threadidlebody.c, threadinitialize.c, threadloadenv.c, threadmp.c, threadq.c, threadqdequeue.c, threadqdequeuefifo.c, threadqdequeuepriority.c, threadqenqueue.c, threadqenqueuefifo.c, threadqenqueuepriority.c, threadqextract.c, threadqextractfifo.c, threadqextractpriority.c, threadqextractwithproxy.c, threadqfirst.c, threadqfirstfifo.c, threadqfirstpriority.c, threadqflush.c, threadqtimeout.c, threadready.c, threadreset.c, threadresettimeslice.c, threadrestart.c, threadresume.c, threadrotatequeue.c, threadsetpriority.c, threadsetstate.c, threadsettransient.c, threadstackallocate.c, threadstackfree.c, threadstart.c, threadstartmultitasking.c, threadsuspend.c, threadtickletimeslice.c, threadyieldprocessor.c, userext.c, watchdog.c, watchdogadjust.c, watchdoginsert.c, watchdogremove.c, watchdogtickle.c, wkspace.c: URL for license changed.
  • 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  unsigned32   ticks_per_timeslice,
44  unsigned32   maximum_extensions,
45  unsigned32   maximum_proxies
46)
47{
48  unsigned32      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.