source: rtems/cpukit/rtems/src/ratemontimeout.c @ 811804fe

4.104.114.84.95
Last change on this file since 811804fe was 5f9b3db, checked in by Joel Sherrill <joel.sherrill@…>, on 05/17/99 at 23:03:07

Split Rate Monotonic Manager into one routine per file.

  • Property mode set to 100644
File size: 2.1 KB
Line 
1/*
2 *  Rate Monotonic Manager
3 *
4 *
5 *  COPYRIGHT (c) 1989-1998.
6 *  On-Line Applications Research Corporation (OAR).
7 *  Copyright assigned to U.S. Government, 1994.
8 *
9 *  The license and distribution terms for this file may be
10 *  found in the file LICENSE in this distribution or at
11 *  http://www.OARcorp.com/rtems/license.html.
12 *
13 *  $Id$
14 */
15
16#include <rtems/system.h>
17#include <rtems/rtems/status.h>
18#include <rtems/rtems/support.h>
19#include <rtems/score/isr.h>
20#include <rtems/score/object.h>
21#include <rtems/rtems/ratemon.h>
22#include <rtems/score/thread.h>
23
24/*PAGE
25 *
26 *  _Rate_monotonic_Timeout
27 *
28 *  This routine processes a period ending.  If the owning thread
29 *  is waiting for the period, that thread is unblocked and the
30 *  period reinitiated.  Otherwise, the period is expired.
31 *  This routine is called by the watchdog handler.
32 *
33 *  Input parameters:
34 *    id - period id
35 *
36 *  Output parameters: NONE
37 */
38
39void _Rate_monotonic_Timeout(
40  Objects_Id  id,
41  void       *ignored
42)
43{
44  Rate_monotonic_Control *the_period;
45  Objects_Locations       location;
46  Thread_Control         *the_thread;
47
48  the_period = _Rate_monotonic_Get( id, &location );
49  switch ( location ) {
50    case OBJECTS_REMOTE:  /* impossible */
51    case OBJECTS_ERROR:
52      break;
53
54    case OBJECTS_LOCAL:
55      the_thread = the_period->owner;
56      if ( _States_Is_waiting_for_period( the_thread->current_state ) &&
57            the_thread->Wait.id == the_period->Object.id ) {
58        _Thread_Unblock( the_thread );
59        the_period->owner_ticks_executed_at_period =
60          the_thread->ticks_executed;
61
62        the_period->time_at_period = _Watchdog_Ticks_since_boot;
63
64        _Watchdog_Reset( &the_period->Timer );
65      } else if ( the_period->state == RATE_MONOTONIC_OWNER_IS_BLOCKING ) {
66        the_period->state = RATE_MONOTONIC_EXPIRED_WHILE_BLOCKING;
67        the_period->owner_ticks_executed_at_period =
68          the_thread->ticks_executed;
69
70        the_period->time_at_period = _Watchdog_Ticks_since_boot;
71        _Watchdog_Reset( &the_period->Timer );
72      } else
73        the_period->state = RATE_MONOTONIC_EXPIRED;
74      _Thread_Unnest_dispatch();
75      break;
76  }
77}
Note: See TracBrowser for help on using the repository browser.