OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [exec/] [rtems/] [src/] [ratemontimeout.c] - Blame information for rev 410

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

Line No. Rev Author Line
1 30 unneback
/*
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
 *  $Id: ratemontimeout.c,v 1.2 2001-09-27 11:59:19 chris 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
  the_period = _Rate_monotonic_Get( id, &location );
48
  switch ( location ) {
49
    case OBJECTS_REMOTE:  /* impossible */
50
    case OBJECTS_ERROR:
51
      break;
52
 
53
    case OBJECTS_LOCAL:
54
      the_thread = the_period->owner;
55
      if ( _States_Is_waiting_for_period( the_thread->current_state ) &&
56
            the_thread->Wait.id == the_period->Object.id ) {
57
        _Thread_Unblock( the_thread );
58
        the_period->owner_ticks_executed_at_period =
59
          the_thread->ticks_executed;
60
 
61
        the_period->time_at_period = _Watchdog_Ticks_since_boot;
62
 
63
        _Watchdog_Reset( &the_period->Timer );
64
      } else if ( the_period->state == RATE_MONOTONIC_OWNER_IS_BLOCKING ) {
65
        the_period->state = RATE_MONOTONIC_EXPIRED_WHILE_BLOCKING;
66
        the_period->owner_ticks_executed_at_period =
67
          the_thread->ticks_executed;
68
 
69
        the_period->time_at_period = _Watchdog_Ticks_since_boot;
70
        _Watchdog_Reset( &the_period->Timer );
71
      } else
72
        the_period->state = RATE_MONOTONIC_EXPIRED;
73
      _Thread_Unnest_dispatch();
74
      break;
75
  }
76
}

powered by: WebSVN 2.1.0

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