OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rtems-20020807/] [cpukit/] [score/] [src/] [thread.c] - Blame information for rev 1774

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1026 ivang
/*
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.OARcorp.com/rtems/license.html.
11
 *
12
 *  thread.c,v 1.50 2002/07/01 22:30:12 joel Exp
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
 
42
void _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
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.