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

Subversion Repositories openrisc_me

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

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: threadrotatequeue.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_Rotate_Ready_Queue
32
 *
33
 *  This kernel routine will rotate the ready queue.
34
 *  remove the running THREAD from the ready chain
35
 *  and place it immediatly at the rear of this chain.  Reset timeslice
36
 *  and yield the processor functions both use this routine, therefore if
37
 *  reset is TRUE and this is the only thread on the chain then the
38
 *  timeslice counter is reset.  The heir THREAD will be updated if the
39
 *  running is also the currently the heir.
40
 *
41
 *  Input parameters:
42
 *      Priority of the queue we wish to modify.
43
 *
44
 *  Output parameters:  NONE
45
 *
46
 *  INTERRUPT LATENCY:
47
 *    ready chain
48
 *    select heir
49
 */
50
 
51
void _Thread_Rotate_Ready_Queue(
52
  Priority_Control  priority
53
)
54
{
55
  ISR_Level       level;
56
  Thread_Control *executing;
57
  Chain_Control  *ready;
58
  Chain_Node     *node;
59
 
60
  ready     = &_Thread_Ready_chain[ priority ];
61
  executing = _Thread_Executing;
62
 
63
  if ( ready == executing->ready ) {
64
    _Thread_Yield_processor();
65
    return;
66
  }
67
 
68
  _ISR_Disable( level );
69
 
70
  if ( !_Chain_Is_empty( ready ) ) {
71
    if (!_Chain_Has_only_one_node( ready ) ) {
72
      node = _Chain_Get_first_unprotected( ready );
73
      _Chain_Append_unprotected( ready, node );
74
    }
75
  }
76
 
77
  _ISR_Flash( level );
78
 
79
  if ( _Thread_Heir->ready == ready )
80
    _Thread_Heir = (Thread_Control *) ready->first;
81
 
82
  if ( executing != _Thread_Heir )
83
    _Context_Switch_necessary = TRUE;
84
 
85
  _ISR_Enable( level );
86
}
87
 
88
 
89
 
90
 
91
 
92
 

powered by: WebSVN 2.1.0

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