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.OARcorp.com/rtems/license.html. |
---|
11 | * |
---|
12 | * $Id$ |
---|
13 | */ |
---|
14 | |
---|
15 | #include <rtems/system.h> |
---|
16 | #include <rtems/rtems/status.h> |
---|
17 | #include <rtems/rtems/support.h> |
---|
18 | #include <rtems/score/object.h> |
---|
19 | #include <rtems/score/thread.h> |
---|
20 | #include <rtems/rtems/timer.h> |
---|
21 | #include <rtems/score/tod.h> |
---|
22 | #include <rtems/score/watchdog.h> |
---|
23 | |
---|
24 | /*PAGE |
---|
25 | * |
---|
26 | * rtems_timer_get_information |
---|
27 | * |
---|
28 | * This directive allows a thread to obtain information about a timer. |
---|
29 | * |
---|
30 | * Input parameters: |
---|
31 | * id - timer id |
---|
32 | * the_info - pointer to timer information block |
---|
33 | * |
---|
34 | * Output parameters: |
---|
35 | * *the_info - region information block filled in |
---|
36 | * RTEMS_SUCCESSFUL - if successful |
---|
37 | * error code - if unsuccessful |
---|
38 | * |
---|
39 | */ |
---|
40 | |
---|
41 | rtems_status_code rtems_timer_get_information( |
---|
42 | Objects_Id id, |
---|
43 | rtems_timer_information *the_info |
---|
44 | ) |
---|
45 | { |
---|
46 | Timer_Control *the_timer; |
---|
47 | Objects_Locations location; |
---|
48 | |
---|
49 | if ( !the_info ) |
---|
50 | return RTEMS_INVALID_ADDRESS; |
---|
51 | |
---|
52 | the_timer = _Timer_Get( id, &location ); |
---|
53 | switch ( location ) { |
---|
54 | case OBJECTS_REMOTE: /* should never return this */ |
---|
55 | return RTEMS_INTERNAL_ERROR; |
---|
56 | |
---|
57 | case OBJECTS_ERROR: |
---|
58 | return RTEMS_INVALID_ID; |
---|
59 | |
---|
60 | case OBJECTS_LOCAL: |
---|
61 | the_info->the_class = the_timer->the_class; |
---|
62 | the_info->initial = the_timer->Ticker.initial; |
---|
63 | the_info->start_time = the_timer->Ticker.start_time; |
---|
64 | the_info->stop_time = the_timer->Ticker.stop_time; |
---|
65 | _Thread_Enable_dispatch(); |
---|
66 | return RTEMS_SUCCESSFUL; |
---|
67 | } |
---|
68 | |
---|
69 | return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ |
---|
70 | } |
---|