source: rtems/cpukit/rtems/src/ratemoncancel.c @ 1095ec1

4.104.114.84.95
Last change on this file since 1095ec1 was 1095ec1, checked in by Ralf Corsepius <ralf.corsepius@…>, on 01/18/05 at 09:03:45

Include config.h.

  • Property mode set to 100644
File size: 1.6 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.rtems.com/license/LICENSE.
11 *
12 *  $Id$
13 */
14
15#if HAVE_CONFIG_H
16#include "config.h"
17#endif
18
19#include <rtems/system.h>
20#include <rtems/rtems/status.h>
21#include <rtems/rtems/support.h>
22#include <rtems/score/isr.h>
23#include <rtems/score/object.h>
24#include <rtems/rtems/ratemon.h>
25#include <rtems/score/thread.h>
26
27/*PAGE
28 *
29 *  rtems_rate_monotonic_cancel
30 *
31 *  This directive allows a thread to cancel a rate monotonic timer.
32 *
33 *  Input parameters:
34 *    id - rate monotonic id
35 *
36 *  Output parameters:
37 *    RTEMS_SUCCESSFUL - if successful and caller is not the owning thread
38 *    error code       - if unsuccessful
39 */
40
41rtems_status_code rtems_rate_monotonic_cancel(
42  Objects_Id id
43)
44{
45  Rate_monotonic_Control *the_period;
46  Objects_Locations       location;
47
48  the_period = _Rate_monotonic_Get( id, &location );
49  switch ( location ) {
50    case OBJECTS_REMOTE:
51      return RTEMS_INTERNAL_ERROR;  /* should never return this */
52
53    case OBJECTS_ERROR:
54      return RTEMS_INVALID_ID;
55
56    case OBJECTS_LOCAL:
57      if ( !_Thread_Is_executing( the_period->owner ) ) {
58        _Thread_Enable_dispatch();
59        return RTEMS_NOT_OWNER_OF_RESOURCE;
60      }
61      (void) _Watchdog_Remove( &the_period->Timer );
62      the_period->state = RATE_MONOTONIC_INACTIVE;
63      _Thread_Enable_dispatch();
64      return RTEMS_SUCCESSFUL;
65  }
66
67  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
68}
Note: See TracBrowser for help on using the repository browser.