OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [compat/] [posix/] [current/] [include/] [time.h] - Blame information for rev 786

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
#ifndef CYGONCE_POSIX_TIME_H
2
#define CYGONCE_POSIX_TIME_H
3
/*=============================================================================
4
//
5
//      time.h
6
//
7
//      POSIX time header
8
//
9
//=============================================================================
10
// ####ECOSGPLCOPYRIGHTBEGIN####
11
// -------------------------------------------
12
// This file is part of eCos, the Embedded Configurable Operating System.
13
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
14
//
15
// eCos is free software; you can redistribute it and/or modify it under
16
// the terms of the GNU General Public License as published by the Free
17
// Software Foundation; either version 2 or (at your option) any later
18
// version.
19
//
20
// eCos is distributed in the hope that it will be useful, but WITHOUT
21
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
22
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
23
// for more details.
24
//
25
// You should have received a copy of the GNU General Public License
26
// along with eCos; if not, write to the Free Software Foundation, Inc.,
27
// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
28
//
29
// As a special exception, if other files instantiate templates or use
30
// macros or inline functions from this file, or you compile this file
31
// and link it with other works to produce a work based on this file,
32
// this file does not by itself cause the resulting work to be covered by
33
// the GNU General Public License. However the source code for this file
34
// must still be made available in accordance with section (3) of the GNU
35
// General Public License v2.
36
//
37
// This exception does not invalidate any other reasons why a work based
38
// on this file might be covered by the GNU General Public License.
39
// -------------------------------------------
40
// ####ECOSGPLCOPYRIGHTEND####
41
//=============================================================================
42
//#####DESCRIPTIONBEGIN####
43
//
44
// Author(s):     nickg
45
// Contributors:  nickg, jlarmour
46
// Date:          2000-03-17
47
// Purpose:       POSIX time header
48
// Description:   This header contains all the definitions needed to support
49
//                the POSIX timer and timer API under eCos.
50
//
51
// Usage:         Do not include this file directly - instead include <time.h>
52
//
53
//
54
//####DESCRIPTIONEND####
55
//
56
//===========================================================================*/
57
 
58
#include <pkgconf/posix.h>
59
#include <cyg/infra/cyg_type.h>
60
 
61
/*---------------------------------------------------------------------------*/
62
/* Types for timers and clocks */
63
 
64
typedef int clockid_t;
65
 
66
#ifdef CYGPKG_POSIX_TIMERS
67
typedef int timer_t;
68
 
69
/* forward declaration - if the app uses it it will have to include
70
 * signal.h anyway
71
 */
72
struct sigevent;
73
#endif
74
 
75
/*---------------------------------------------------------------------------*/
76
/* Structures */
77
 
78
struct timespec
79
{
80
    time_t      tv_sec;
81
    long        tv_nsec;
82
};
83
 
84
#ifdef CYGPKG_POSIX_TIMERS
85
struct itimerspec
86
{
87
    struct timespec     it_interval;
88
    struct timespec     it_value;
89
};
90
#endif
91
 
92
/*---------------------------------------------------------------------------*/
93
/* Manifest constants */
94
 
95
#define CLOCK_REALTIME          0
96
 
97
#ifdef CYGPKG_POSIX_TIMERS
98
#define TIMER_ABSTIME           1
99
#endif
100
 
101
/*---------------------------------------------------------------------------*/
102
/* Clock functions */
103
 
104
/* Set the clocks current time */
105
__externC int clock_settime( clockid_t clock_id, const struct timespec *tp);
106
 
107
/* Get the clocks current time */
108
__externC int clock_gettime( clockid_t clock_id, struct timespec *tp);
109
 
110
/* Get the clocks resolution */
111
__externC int clock_getres( clockid_t clock_id, struct timespec *tp);
112
 
113
 
114
/*---------------------------------------------------------------------------*/
115
/* Timer functions */
116
 
117
#ifdef CYGPKG_POSIX_TIMERS
118
 
119
/* Create a timer based on the given clock. */
120
__externC int timer_create( clockid_t clock_id,
121
                            struct sigevent *evp,
122
                            timer_t *timer_id);
123
 
124
/* Delete the timer */
125
__externC int timer_delete( timer_t timer_id );
126
 
127
/* Set the expiration time of the timer. */
128
__externC int timer_settime( timer_t timerid, int flags,
129
                             const struct itimerspec *value,
130
                             struct itimerspec *ovalue );
131
 
132
/* Get current timer values */
133
__externC int timer_gettime( timer_t timerid, struct itimerspec *value );
134
 
135
/* Get number of missed triggers */
136
__externC int timer_getoverrun( timer_t timerid );
137
 
138
#endif
139
 
140
/*---------------------------------------------------------------------------*/
141
/* Nanosleep */
142
 
143
/* Sleep for the given time. */
144
__externC int nanosleep( const struct timespec *rqtp,
145
                         struct timespec *rmtp);
146
 
147
 
148
/*---------------------------------------------------------------------------*/
149
#endif /* ifndef CYGONCE_POSIX_TIME_H */
150
/* End of time.h */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.