source: rtems/cpukit/rtems/src/ratemoncancel.c @ 66cb142

Last change on this file since 66cb142 was 9480815a, checked in by Sebastian Huber <sebastian.huber@…>, on Dec 21, 2017 at 1:36:52 PM

score: Introduce new monotonic clock

Rename PER_CPU_WATCHDOG_MONOTONIC to PER_CPU_WATCHDOG_TICKS. Add new
PER_CPU_WATCHDOG_MONOTONIC which is based on the system uptime (measured
by timecounter).

Close #3264.

  • Property mode set to 100644
File size: 1.7 KB
Line 
1/**
2 *  @file
3 *
4 *  @brief RTEMS Rate Monotonic Cancel
5 *  @ingroup ClassicRateMon
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2007.
10 *  On-Line Applications Research Corporation (OAR).
11 *  Copyright (c) 2016 embedded brains GmbH.
12 *
13 *  The license and distribution terms for this file may be
14 *  found in the file LICENSE in this distribution or at
15 *  http://www.rtems.org/license/LICENSE.
16 */
17
18#if HAVE_CONFIG_H
19#include "config.h"
20#endif
21
22#include <rtems/rtems/ratemonimpl.h>
23
24void _Rate_monotonic_Cancel(
25  Rate_monotonic_Control *the_period,
26  Thread_Control         *owner,
27  ISR_lock_Context       *lock_context
28)
29{
30  Per_CPU_Control      *cpu_self;
31  Thread_queue_Context  queue_context;
32
33  _Rate_monotonic_Acquire_critical( the_period, lock_context );
34
35  _Watchdog_Per_CPU_remove_ticks( &the_period->Timer );
36  the_period->state = RATE_MONOTONIC_INACTIVE;
37  _Scheduler_Cancel_job(
38    the_period->owner,
39    &the_period->Priority,
40    &queue_context
41  );
42
43  cpu_self = _Thread_Dispatch_disable_critical( lock_context );
44  _Rate_monotonic_Release( the_period, lock_context );
45  _Thread_Priority_update( &queue_context );
46  _Thread_Dispatch_enable( cpu_self );
47}
48
49rtems_status_code rtems_rate_monotonic_cancel(
50  rtems_id id
51)
52{
53  Rate_monotonic_Control *the_period;
54  ISR_lock_Context        lock_context;
55  Thread_Control         *executing;
56
57  the_period = _Rate_monotonic_Get( id, &lock_context );
58  if ( the_period == NULL ) {
59    return RTEMS_INVALID_ID;
60  }
61
62  executing = _Thread_Executing;
63  if ( executing != the_period->owner ) {
64    _ISR_lock_ISR_enable( &lock_context );
65    return RTEMS_NOT_OWNER_OF_RESOURCE;
66  }
67
68  _Rate_monotonic_Cancel( the_period, executing, &lock_context );
69  return RTEMS_SUCCESSFUL;
70}
Note: See TracBrowser for help on using the repository browser.