1 | /* |
---|
2 | * Rate Monotonic Manager -- Delete a Period |
---|
3 | * |
---|
4 | * COPYRIGHT (c) 1989-2007. |
---|
5 | * On-Line Applications Research Corporation (OAR). |
---|
6 | * |
---|
7 | * The license and distribution terms for this file may be |
---|
8 | * found in the file LICENSE in this distribution or at |
---|
9 | * http://www.rtems.com/license/LICENSE. |
---|
10 | * |
---|
11 | * $Id$ |
---|
12 | */ |
---|
13 | |
---|
14 | #if HAVE_CONFIG_H |
---|
15 | #include "config.h" |
---|
16 | #endif |
---|
17 | |
---|
18 | #include <rtems/system.h> |
---|
19 | #include <rtems/rtems/status.h> |
---|
20 | #include <rtems/rtems/support.h> |
---|
21 | #include <rtems/score/isr.h> |
---|
22 | #include <rtems/score/object.h> |
---|
23 | #include <rtems/rtems/ratemon.h> |
---|
24 | #include <rtems/score/thread.h> |
---|
25 | |
---|
26 | /* |
---|
27 | * rtems_rate_monotonic_delete |
---|
28 | * |
---|
29 | * This directive allows a thread to delete a rate monotonic timer. |
---|
30 | * |
---|
31 | * Input parameters: |
---|
32 | * id - rate monotonic id |
---|
33 | * |
---|
34 | * Output parameters: |
---|
35 | * RTEMS_SUCCESSFUL - if successful |
---|
36 | * error code - if unsuccessful |
---|
37 | */ |
---|
38 | |
---|
39 | rtems_status_code rtems_rate_monotonic_delete( |
---|
40 | rtems_id id |
---|
41 | ) |
---|
42 | { |
---|
43 | Rate_monotonic_Control *the_period; |
---|
44 | Objects_Locations location; |
---|
45 | |
---|
46 | the_period = _Rate_monotonic_Get( id, &location ); |
---|
47 | switch ( location ) { |
---|
48 | |
---|
49 | case OBJECTS_LOCAL: |
---|
50 | _Objects_Close( &_Rate_monotonic_Information, &the_period->Object ); |
---|
51 | (void) _Watchdog_Remove( &the_period->Timer ); |
---|
52 | the_period->state = RATE_MONOTONIC_INACTIVE; |
---|
53 | _Rate_monotonic_Free( the_period ); |
---|
54 | _Scheduler_Release_job(the_period->owner, 0); |
---|
55 | _Thread_Enable_dispatch(); |
---|
56 | return RTEMS_SUCCESSFUL; |
---|
57 | |
---|
58 | #if defined(RTEMS_MULTIPROCESSING) |
---|
59 | case OBJECTS_REMOTE: /* should never return this */ |
---|
60 | #endif |
---|
61 | case OBJECTS_ERROR: |
---|
62 | break; |
---|
63 | } |
---|
64 | |
---|
65 | return RTEMS_INVALID_ID; |
---|
66 | } |
---|