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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rtems-20020807/] [cpukit/] [rtems/] [src/] [ratemontimeout.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1026 ivang
/*
2
 *  Rate Monotonic Manager
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 the file LICENSE in this distribution or at
10
 *  http://www.OARcorp.com/rtems/license.html.
11
 *
12
 *  ratemontimeout.c,v 1.3 2000/09/29 14:48:17 joel Exp
13
 */
14
 
15
#include <rtems/system.h>
16
#include <rtems/rtems/status.h>
17
#include <rtems/rtems/support.h>
18
#include <rtems/score/isr.h>
19
#include <rtems/score/object.h>
20
#include <rtems/rtems/ratemon.h>
21
#include <rtems/score/thread.h>
22
 
23
/*PAGE
24
 *
25
 *  _Rate_monotonic_Timeout
26
 *
27
 *  This routine processes a period ending.  If the owning thread
28
 *  is waiting for the period, that thread is unblocked and the
29
 *  period reinitiated.  Otherwise, the period is expired.
30
 *  This routine is called by the watchdog handler.
31
 *
32
 *  Input parameters:
33
 *    id - period id
34
 *
35
 *  Output parameters: NONE
36
 */
37
 
38
void _Rate_monotonic_Timeout(
39
  Objects_Id  id,
40
  void       *ignored
41
)
42
{
43
  Rate_monotonic_Control *the_period;
44
  Objects_Locations       location;
45
  Thread_Control         *the_thread;
46
 
47
  /*
48
   *  When we get here, the Timer is already off the chain so we do not
49
   *  have to worry about that -- hence no _Watchdog_Remove().
50
   */
51
 
52
  the_period = _Rate_monotonic_Get( id, &location );
53
  switch ( location ) {
54
    case OBJECTS_REMOTE:  /* impossible */
55
    case OBJECTS_ERROR:
56
      break;
57
 
58
    case OBJECTS_LOCAL:
59
      the_thread = the_period->owner;
60
      if ( _States_Is_waiting_for_period( the_thread->current_state ) &&
61
            the_thread->Wait.id == the_period->Object.id ) {
62
        _Thread_Unblock( the_thread );
63
        the_period->owner_ticks_executed_at_period =
64
          the_thread->ticks_executed;
65
 
66
        the_period->time_at_period = _Watchdog_Ticks_since_boot;
67
 
68
        _Watchdog_Insert_ticks( &the_period->Timer, the_period->next_length );
69
      } else if ( the_period->state == RATE_MONOTONIC_OWNER_IS_BLOCKING ) {
70
        the_period->state = RATE_MONOTONIC_EXPIRED_WHILE_BLOCKING;
71
        the_period->owner_ticks_executed_at_period =
72
          the_thread->ticks_executed;
73
 
74
        the_period->time_at_period = _Watchdog_Ticks_since_boot;
75
        _Watchdog_Insert_ticks( &the_period->Timer, the_period->next_length );
76
      } else
77
        the_period->state = RATE_MONOTONIC_EXPIRED;
78
      _Thread_Unnest_dispatch();
79
      break;
80
  }
81
}

powered by: WebSVN 2.1.0

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