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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [exec/] [score/] [src/] [thread.c] - Blame information for rev 279

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

Line No. Rev Author Line
1 30 unneback
/*
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
 *  $Id: thread.c,v 1.2 2001-09-27 11:59:34 chris 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
  _Thread_Allocated_fp      = NULL;
67
 
68
  _Thread_Do_post_task_switch_extension = 0;
69
 
70
  _Thread_Maximum_extensions = maximum_extensions;
71
 
72
  _Thread_Ticks_per_timeslice  = ticks_per_timeslice;
73
 
74
  _Thread_Ready_chain = (Chain_Control *) _Workspace_Allocate_or_fatal_error(
75
    (PRIORITY_MAXIMUM + 1) * sizeof(Chain_Control)
76
  );
77
 
78
  for ( index=0; index <= PRIORITY_MAXIMUM ; index++ )
79
    _Chain_Initialize_empty( &_Thread_Ready_chain[ index ] );
80
 
81
#if defined(RTEMS_MULTIPROCESSING)
82
  _Thread_MP_Handler_initialization( maximum_proxies );
83
#endif
84
 
85
  /*
86
   *  Initialize this class of objects.
87
   */
88
 
89
  _Objects_Initialize_information(
90
    &_Thread_Internal_information,
91
    OBJECTS_INTERNAL_THREADS,
92
    FALSE,
93
    ( _System_state_Is_multiprocessing ) ?  2 : 1,
94
    sizeof( Thread_Control ),
95
    TRUE,
96
    8,
97
    TRUE
98
  );
99
 
100
}
101
 

powered by: WebSVN 2.1.0

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