source: rtems/cpukit/rtems/src/ratemontimeout.c @ 4bf1801

4.104.114.84.95
Last change on this file since 4bf1801 was 08311cc3, checked in by Joel Sherrill <joel.sherrill@…>, on 11/17/99 at 17:51:34

Updated copyright notice.

  • Property mode set to 100644
File size: 2.1 KB
Line 
1/*
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$
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
38void _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}
Note: See TracBrowser for help on using the repository browser.