source: rtems/cpukit/rtems/src/ratemontimeout.c @ b541e1f

4.104.114.84.95
Last change on this file since b541e1f was bebf0438, checked in by Joel Sherrill <joel.sherrill@…>, on 09/29/00 at 14:48:17

2000-09-29 Stephan Merker <merker@…>

  • include/rtems/rtems/ratemon.h, src/ratemonperiod.c, src/ratemontimeout.c: Add next_length field so period length can be changed by the the sequence period(X), period(not X) with no intervening cancel or expiration.
  • Property mode set to 100644
File size: 2.3 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  /*
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}
Note: See TracBrowser for help on using the repository browser.