From b3a170538fe8e74012a3bfff1804c52d792249bd Mon Sep 17 00:00:00 2001 From: patacongo Date: Wed, 21 Mar 2007 17:21:26 +0000 Subject: Added support for POSIX timers git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@111 7fd9a85b-ad96-42d3-883c-3090e2eb8679 --- nuttx/sched/clock_internal.h | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) (limited to 'nuttx/sched/clock_internal.h') diff --git a/nuttx/sched/clock_internal.h b/nuttx/sched/clock_internal.h index e97c468b7e..85cb13f065 100644 --- a/nuttx/sched/clock_internal.h +++ b/nuttx/sched/clock_internal.h @@ -1,4 +1,4 @@ -/************************************************************ +/******************************************************************************** * clock_internal.h * * Copyright (C) 2007 Gregory Nutt. All rights reserved. @@ -31,21 +31,21 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************/ + ********************************************************************************/ #ifndef __CLOCK_INTERNAL_H #define __CLOCK_INTERNAL_H -/************************************************************ +/******************************************************************************** * Included Files - ************************************************************/ + ********************************************************************************/ #include #include -/************************************************************ +/******************************************************************************** * Definitions - ************************************************************/ + ********************************************************************************/ /* Timing constants */ @@ -59,7 +59,7 @@ #define MSEC_PER_TICK 10 #define USEC_PER_TICK (MSEC_PER_TICK * USEC_PER_MSEC) #define NSEC_PER_TICK (MSEC_PER_TICK * NSEC_PER_MSEC) -#define TICK_PER_SEC (MSEC_PER_SEC / MSEC_PER_TICK) +#define TICK_PER_SEC (MSEC_PER_SEC / MSEC_PER_TICK) #define MSEC2TICK(msec) (((msec)+(MSEC_PER_TICK/2))/MSEC_PER_TICK) #define USEC2TICK(usec) (((usec)+(USEC_PER_TICK/2))/USEC_PER_TICK) @@ -73,25 +73,29 @@ # define GREG_DAY 15 #endif /* CONFIG_JULIAN_TIME */ -/************************************************************ +/******************************************************************************** * Public Type Definitions - ************************************************************/ + ********************************************************************************/ -/************************************************************ +/******************************************************************************** * Global Variables - ************************************************************/ + ********************************************************************************/ extern volatile uint32 g_system_timer; extern struct timespec g_basetime; -extern uint32 g_tickbias; +extern uint32 g_tickbias; -/************************************************************ +/******************************************************************************** * Public Function Prototypes - ************************************************************/ + ********************************************************************************/ extern void weak_function clock_initialize(void); extern void weak_function clock_timer(void); extern time_t clock_calendar2utc(int year, int month, int day); +extern int clock_abstime2ticks(clockid_t clockid, const struct timespec *abstime, + int *ticks); +extern int clock_time2ticks(const struct timespec *reltime, int *ticks); +extern int clock_ticks2time(int ticks, struct timespec *reltime); #endif /* __CLOCK_INTERNAL_H */ -- cgit v1.2.3