RTEMS
ratemoncancel.c
Go to the documentation of this file.
1 
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 #ifdef HAVE_CONFIG_H
19 #include "config.h"
20 #endif
21 
23 
24 void _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;
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 
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 );
66  }
67 
68  _Rate_monotonic_Cancel( the_period, executing, &lock_context );
69  return RTEMS_SUCCESSFUL;
70 }
Thread queue context for the thread queue methods.
Definition: threadq.h:198
Watchdog_Control Timer
Protects the rate monotonic period state.
Definition: ratemondata.h:79
static __inline__ void _Scheduler_Cancel_job(Thread_Control *the_thread, Priority_Node *priority_node, Thread_queue_Context *queue_context)
Cancels a job of a thread with respect to the scheduler.
#define _ISR_lock_ISR_enable(_context)
Restores the saved interrupt state of the ISR lock context.
Definition: isrlock.h:416
Thread_Control * owner
Definition: ratemondata.h:100
This status code indicates successful completion.
Definition: status.h:86
static __inline__ Per_CPU_Control * _Thread_Dispatch_disable_critical(const ISR_lock_Context *lock_context)
Disables thread dispatching inside a critical section (interrupts disabled).
rtems_status_code
This enumeration provides status codes for directives of the Classic API.
Definition: status.h:82
Per CPU Core Structure.
Definition: percpu.h:347
rtems_status_code rtems_rate_monotonic_cancel(rtems_id id)
%
Definition: ratemoncancel.c:49
void _Thread_Priority_update(Thread_queue_Context *queue_context)
Updates the priority of all threads in the set.
rtems_rate_monotonic_period_states state
Definition: ratemondata.h:82
void _Thread_Dispatch_enable(Per_CPU_Control *cpu_self)
Enables thread dispatching.
static __inline__ void _Watchdog_Per_CPU_remove_ticks(Watchdog_Control *the_watchdog)
Removes the watchdog from the cpu and the scheduled watchdogs.
Definition: watchdogimpl.h:670
The following structure defines the control block used to manage each period.
Definition: ratemondata.h:69
This status code indicates that an object identifier was invalid.
Definition: status.h:106
This status code indicates that the caller was not the owner of the resource.
Definition: status.h:211
Objects_Id rtems_id
Values of this type identify an RTEMS object.
Definition: types.h:99
Classic Rate Monotonic Scheduler Implementation.
Local ISR lock context for acquire and release pairs.
Definition: isrlock.h:65
Priority_Node Priority
A priority node for use by the scheduler job release and cancel operations.
Definition: ratemondata.h:88