1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief RTEMS Get Timer Information |
---|
5 | * @ingroup ClassicTimer |
---|
6 | */ |
---|
7 | |
---|
8 | /* |
---|
9 | * COPYRIGHT (c) 1989-2007. |
---|
10 | * On-Line Applications Research Corporation (OAR). |
---|
11 | * |
---|
12 | * The license and distribution terms for this file may be |
---|
13 | * found in the file LICENSE in this distribution or at |
---|
14 | * http://www.rtems.com/license/LICENSE. |
---|
15 | */ |
---|
16 | |
---|
17 | #if HAVE_CONFIG_H |
---|
18 | #include "config.h" |
---|
19 | #endif |
---|
20 | |
---|
21 | #include <rtems/system.h> |
---|
22 | #include <rtems/rtems/status.h> |
---|
23 | #include <rtems/rtems/support.h> |
---|
24 | #include <rtems/score/object.h> |
---|
25 | #include <rtems/score/thread.h> |
---|
26 | #include <rtems/rtems/timer.h> |
---|
27 | #include <rtems/score/tod.h> |
---|
28 | #include <rtems/score/watchdog.h> |
---|
29 | |
---|
30 | rtems_status_code rtems_timer_get_information( |
---|
31 | rtems_id id, |
---|
32 | rtems_timer_information *the_info |
---|
33 | ) |
---|
34 | { |
---|
35 | Timer_Control *the_timer; |
---|
36 | Objects_Locations location; |
---|
37 | |
---|
38 | if ( !the_info ) |
---|
39 | return RTEMS_INVALID_ADDRESS; |
---|
40 | |
---|
41 | the_timer = _Timer_Get( id, &location ); |
---|
42 | switch ( location ) { |
---|
43 | |
---|
44 | case OBJECTS_LOCAL: |
---|
45 | the_info->the_class = the_timer->the_class; |
---|
46 | the_info->initial = the_timer->Ticker.initial; |
---|
47 | the_info->start_time = the_timer->Ticker.start_time; |
---|
48 | the_info->stop_time = the_timer->Ticker.stop_time; |
---|
49 | _Thread_Enable_dispatch(); |
---|
50 | return RTEMS_SUCCESSFUL; |
---|
51 | |
---|
52 | #if defined(RTEMS_MULTIPROCESSING) |
---|
53 | case OBJECTS_REMOTE: /* should never return this */ |
---|
54 | #endif |
---|
55 | case OBJECTS_ERROR: |
---|
56 | break; |
---|
57 | } |
---|
58 | |
---|
59 | return RTEMS_INVALID_ID; |
---|
60 | } |
---|