1 | /* |
---|
2 | * Timer Manager - rtems_timer_get_information directive |
---|
3 | * |
---|
4 | * |
---|
5 | * COPYRIGHT (c) 1989-2002. |
---|
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/object.h> |
---|
23 | #include <rtems/score/thread.h> |
---|
24 | #include <rtems/rtems/timer.h> |
---|
25 | #include <rtems/score/tod.h> |
---|
26 | #include <rtems/score/watchdog.h> |
---|
27 | |
---|
28 | /*PAGE |
---|
29 | * |
---|
30 | * rtems_timer_get_information |
---|
31 | * |
---|
32 | * This directive allows a thread to obtain information about a timer. |
---|
33 | * |
---|
34 | * Input parameters: |
---|
35 | * id - timer id |
---|
36 | * the_info - pointer to timer information block |
---|
37 | * |
---|
38 | * Output parameters: |
---|
39 | * *the_info - region information block filled in |
---|
40 | * RTEMS_SUCCESSFUL - if successful |
---|
41 | * error code - if unsuccessful |
---|
42 | * |
---|
43 | */ |
---|
44 | |
---|
45 | rtems_status_code rtems_timer_get_information( |
---|
46 | Objects_Id id, |
---|
47 | rtems_timer_information *the_info |
---|
48 | ) |
---|
49 | { |
---|
50 | Timer_Control *the_timer; |
---|
51 | Objects_Locations location; |
---|
52 | |
---|
53 | if ( !the_info ) |
---|
54 | return RTEMS_INVALID_ADDRESS; |
---|
55 | |
---|
56 | the_timer = _Timer_Get( id, &location ); |
---|
57 | switch ( location ) { |
---|
58 | case OBJECTS_REMOTE: /* should never return this */ |
---|
59 | return RTEMS_INTERNAL_ERROR; |
---|
60 | |
---|
61 | case OBJECTS_ERROR: |
---|
62 | return RTEMS_INVALID_ID; |
---|
63 | |
---|
64 | case OBJECTS_LOCAL: |
---|
65 | the_info->the_class = the_timer->the_class; |
---|
66 | the_info->initial = the_timer->Ticker.initial; |
---|
67 | the_info->start_time = the_timer->Ticker.start_time; |
---|
68 | the_info->stop_time = the_timer->Ticker.stop_time; |
---|
69 | _Thread_Enable_dispatch(); |
---|
70 | return RTEMS_SUCCESSFUL; |
---|
71 | } |
---|
72 | |
---|
73 | return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ |
---|
74 | } |
---|