source: rtems/cpukit/rtems/include/rtems/rtems/clock.h @ 4b6546f0

4.104.114.84.95
Last change on this file since 4b6546f0 was 4b6546f0, checked in by Joel Sherrill <joel.sherrill@…>, on 03/28/07 at 19:56:14

2007-03-28 Chris Johns <chrisj@…>

  • rtems/Makefile.am, rtems/include/rtems/rtems/clock.h, score/include/rtems/score/watchdog.h: Add support for a handler to obtain the number of nanoseconds since the last clock tick. The primary interface for this is rtems_clock_set_nanoseconds_extension. Subsequent commits from Joel will redo the TOD support to use this capability.
  • rtems/src/clocksetnsecshandler.c: New file.
  • Property mode set to 100644
File size: 2.8 KB
Line 
1/**
2 * @file rtems/rtems/clock.h
3 */
4
5/*
6 *  This include file contains all the constants and structures associated
7 *  with the Clock Manager.  This manager provides facilities to set, obtain,
8 *  and continually update the current date and time.
9 *
10 *  This manager provides directives to:
11 *
12 *     + set the current date and time
13 *     + obtain the current date and time
14 *     + set the nanoseconds since last clock tick handler
15 *     + announce a clock tick
16 *
17 *  COPYRIGHT (c) 1989-2007.
18 *  On-Line Applications Research Corporation (OAR).
19 *
20 *  The license and distribution terms for this file may be
21 *  found in the file LICENSE in this distribution or at
22 *  http://www.rtems.com/license/LICENSE.
23 *
24 *  $Id$
25 */
26
27#ifndef _RTEMS_RTEMS_CLOCK_H
28#define _RTEMS_RTEMS_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#include <rtems/score/tod.h>
35#include <rtems/rtems/types.h>
36
37/*
38 *  List of things which can be returned by the rtems_clock_get directive.
39 */
40
41typedef enum {
42  RTEMS_CLOCK_GET_TOD,
43  RTEMS_CLOCK_GET_SECONDS_SINCE_EPOCH,
44  RTEMS_CLOCK_GET_TICKS_SINCE_BOOT,
45  RTEMS_CLOCK_GET_TICKS_PER_SECOND,
46  RTEMS_CLOCK_GET_TIME_VALUE
47} rtems_clock_get_options;
48
49/*
50 *  Standard flavor style to return TOD in for a rtems_clock_get option.
51 */
52
53typedef struct {
54  uint32_t    seconds;
55  uint32_t    microseconds;
56} rtems_clock_time_value;
57
58/*
59 *  Type for the nanoseconds since last tick BSP extension.
60 */
61typedef Watchdog_Nanoseconds_since_last_tick_routine
62  rtems_nanoseconds_extension_routine;
63
64/*
65 *  rtems_clock_get
66 *
67 *  DESCRIPTION:
68 *
69 *  This routine implements the rtems_clock_get directive.  It returns
70 *  one of the following:
71 *    + current time of day
72 *    + seconds since epoch
73 *    + ticks since boot
74 *    + ticks per second
75 */
76
77rtems_status_code rtems_clock_get(
78  rtems_clock_get_options  option,
79  void              *time_buffer
80);
81
82/*
83 *  rtems_clock_set
84 *
85 *  DESCRIPTION:
86 *
87 *  This routine implements the rtems_clock_set directive.  It sets
88 *  the current time of day to that in the time_buffer record.
89 */
90
91rtems_status_code rtems_clock_set(
92  rtems_time_of_day *time_buffer
93);
94
95/*
96 *  rtems_clock_tick
97 *
98 *  DESCRIPTION:
99 *
100 *  This routine implements the rtems_clock_tick directive.  It is invoked
101 *  to inform RTEMS of the occurrence of a clock tick.
102 */
103
104rtems_status_code rtems_clock_tick( void );
105
106/*
107 *  rtems_clock_set_nanoseconds_extension
108 *
109 *  DESCRIPTION:
110 *
111 *  This directive sets the BSP provided nanoseconds since last tick
112 *  extension.
113 *
114 *  Input parameters:
115 *    routine - pointer to the extension routine
116 *
117 *  Output parameters:
118 *    RTEMS_SUCCESSFUL - if successful
119 *    error code        - if unsuccessful
120 */
121rtems_status_code rtems_clock_set_nanoseconds_extension(
122  rtems_nanoseconds_extension_routine routine
123);
124
125#ifdef __cplusplus
126}
127#endif
128
129#endif
130/* end of include file */
Note: See TracBrowser for help on using the repository browser.