OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

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

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: ratemoncancel.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
 *  rtems_rate_monotonic_cancel
26
 *
27
 *  This directive allows a thread to cancel a rate monotonic timer.
28
 *
29
 *  Input parameters:
30
 *    id - rate monotonic id
31
 *
32
 *  Output parameters:
33
 *    RTEMS_SUCCESSFUL - if successful and caller is not the owning thread
34
 *    error code        - if unsuccessful
35
 */
36
 
37
rtems_status_code rtems_rate_monotonic_cancel(
38
  Objects_Id id
39
)
40
{
41
  Rate_monotonic_Control *the_period;
42
  Objects_Locations              location;
43
 
44
  the_period = _Rate_monotonic_Get( id, &location );
45
  switch ( location ) {
46
    case OBJECTS_REMOTE:
47
      return RTEMS_INTERNAL_ERROR;  /* should never return this */
48
 
49
    case OBJECTS_ERROR:
50
      return RTEMS_INVALID_ID;
51
 
52
    case OBJECTS_LOCAL:
53
      if ( !_Thread_Is_executing( the_period->owner ) ) {
54
        _Thread_Enable_dispatch();
55
        return RTEMS_NOT_OWNER_OF_RESOURCE;
56
      }
57
      (void) _Watchdog_Remove( &the_period->Timer );
58
      the_period->state = RATE_MONOTONIC_INACTIVE;
59
      _Thread_Enable_dispatch();
60
      return RTEMS_SUCCESSFUL;
61
  }
62
 
63
  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
64
}

powered by: WebSVN 2.1.0

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