Remove clock_systimer32 and clock_systimer64. There is now only clock_systimer

This commit is contained in:
Gregory Nutt 2016-01-21 16:49:24 -06:00
parent b04e2ea021
commit 032ad1b70b
9 changed files with 37 additions and 139 deletions

View File

@ -11338,4 +11338,6 @@
systime_t to represent the 32- or 64-bit system timer (2016-01-21).
* sched/clock/clock_systimespec.c: Fix an error in a time
conversion (2016-01-21).
* include/nuttx/clock.h: Get rid of clock_systimer32() and
clock_systime64(). There is now only clock_systimer() (2016-01-21).

View File

@ -165,14 +165,6 @@
#define TICK2DSEC(tick) (((tick)+(TICK_PER_DSEC/2))/TICK_PER_DSEC) /* Rounds */
#define TICK2SEC(tick) (((tick)+(TICK_PER_SEC/2))/TICK_PER_SEC) /* Rounds */
/* Select the access to the system timer using its natural with */
#ifdef CONFIG_SYSTEM_TIME64
# define clock_systimer() clock_systimer64()
#else
# define clock_systimer() clock_systimer32()
#endif
/****************************************************************************
* Public Types
****************************************************************************/
@ -214,18 +206,8 @@ extern "C"
*/
#ifdef __HAVE_KERNEL_GLOBALS
# ifdef CONFIG_SYSTEM_TIME64
EXTERN volatile uint64_t g_system_timer;
#define clock_systimer32() (uint32_t)(g_system_timer & 0x00000000ffffffff)
#define clock_systimer64() g_system_timer
# else
EXTERN volatile uint32_t g_system_timer;
#define clock_systimer32() g_system_timer
# endif
EXTERN volatile systime_t g_system_timer;
# define clock_systimer() g_system_timer
#endif
/****************************************************************************
@ -265,13 +247,13 @@ void clock_synchronize(void);
#endif
/****************************************************************************
* Function: clock_systimer32
* Function: clock_systimer
*
* Description:
* Return the current value of the 32-bit system timer counter. Indirect
* access to the system timer counter is required through this function if
* the execution environment does not have direct access to kernel global
* data
* Return the current value of the 32/64-bit system timer counter.
* Indirect access to the system timer counter is required through this
* function if the execution environment does not have direct access to
* kernel globaldata
*
* Parameters:
* None
@ -284,34 +266,7 @@ void clock_synchronize(void);
****************************************************************************/
#ifndef __HAVE_KERNEL_GLOBALS
# ifdef CONFIG_SYSTEM_TIME64
# define clock_systimer32() (uint32_t)(clock_systimer64() & 0x00000000ffffffff)
# else
uint32_t clock_systimer32(void);
# endif
#endif
/****************************************************************************
* Function: clock_systimer64
*
* Description:
* Return the current value of the 64-bit system timer counter. Indirect
* access to the system timer counter is required through this function if
* the execution environment does not have direct access to kernel global
* data
*
* Parameters:
* None
*
* Return Value:
* The current value of the system timer counter
*
* Assumptions:
*
****************************************************************************/
#if !defined(__HAVE_KERNEL_GLOBALS) && defined(CONFIG_SYSTEM_TIME64)
uint64_t clock_systimer64(void);
systime_t clock_systimer(void);
#endif
/****************************************************************************

View File

@ -211,11 +211,7 @@
* NuttX configuration.
*/
#ifdef CONFIG_SYSTEM_TIME64
# define SYS_clock_systimer64 (__SYS_clock+0)
#else
# define SYS_clock_systimer32 (__SYS_clock+0)
#endif
#define SYS_clock_systimer (__SYS_clock+0)
#define SYS_clock_getres (__SYS_clock+1)
#define SYS_clock_gettime (__SYS_clock+2)
#define SYS_clock_settime (__SYS_clock+3)

View File

@ -51,8 +51,7 @@
****************************************************************************/
/* See nuttx/clock.h */
#undef clock_systimer32
#undef clock_systimer64
#undef clock_systimer
/****************************************************************************
* Private Data
@ -63,10 +62,10 @@
****************************************************************************/
/****************************************************************************
* Name: clock_systimer32
* Name: clock_systimer
*
* Description:
* Return the current value of the 32-bit system timer counter
* Return the current value of the 32/64-bit system timer counter
*
* Parameters:
* None
@ -78,57 +77,10 @@
*
****************************************************************************/
uint32_t clock_systimer32(void)
systime_t clock_systimer(void)
{
#ifdef CONFIG_SCHED_TICKLESS
struct timespec ts;
uint64_t tmp;
/* Get the time from the platform specific hardware */
(void)up_timer_gettime(&ts);
/* Convert to a 64- then 32-bit value */
tmp = MSEC2TICK(1000 * (uint64_t)ts.tv_sec + (uint64_t)ts.tv_nsec / 1000000);
return (uint32_t)(tmp & 0x00000000ffffffff);
#else
#ifdef CONFIG_SYSTEM_TIME64
/* Return the current system time truncated to 32-bits */
return (uint32_t)(g_system_timer & 0x00000000ffffffff);
#else
/* Return the current system time */
return g_system_timer;
#endif
#endif
}
/****************************************************************************
* Name: clock_systimer64
*
* Description:
* Return the current value of the 64-bit system timer counter
*
* Parameters:
* None
*
* Return Value:
* The current value of the system timer counter
*
* Assumptions:
*
****************************************************************************/
#ifdef CONFIG_SYSTEM_TIME64
uint64_t clock_systimer64(void)
{
#ifdef CONFIG_SCHED_TICKLESS
struct timespec ts;
/* Get the time from the platform specific hardware */
@ -139,10 +91,23 @@ uint64_t clock_systimer64(void)
return USEC2TICK(1000000 * (uint64_t)ts.tv_sec + (uint64_t)ts.tv_nsec / 1000);
#else
struct timespec ts;
uint64_t tmp;
/* Get the time from the platform specific hardware */
(void)up_timer_gettime(&ts);
/* Convert to a 64- then 32-bit value */
tmp = MSEC2TICK(1000 * (uint64_t)ts.tv_sec + (uint64_t)ts.tv_nsec / 1000000);
return (systime_t)(tmp & 0x00000000ffffffff);
#endif
#else
/* Return the current system time */
return g_system_timer;
#endif
}
#endif

View File

@ -11,8 +11,7 @@
"clock_getres","time.h","","int","clockid_t","struct timespec*"
"clock_gettime","time.h","","int","clockid_t","struct timespec*"
"clock_settime","time.h","","int","clockid_t","const struct timespec*"
"clock_systimer32","nuttx/clock.h","!defined(__HAVE_KERNEL_GLOBALS) && !defined(CONFIG_SYSTEM_TIME64)","uint32_t"
"clock_systimer64","nuttx/clock.h","!defined(__HAVE_KERNEL_GLOBALS) && defined(CONFIG_SYSTEM_TIME64)","uint64_t"
"clock_systimer","nuttx/clock.h","!defined(__HAVE_KERNEL_GLOBALS)","systime_t"
"close","unistd.h","CONFIG_NSOCKET_DESCRIPTORS > 0 || CONFIG_NFILE_DESCRIPTORS > 0","int","int"
"closedir","dirent.h","CONFIG_NFILE_DESCRIPTORS > 0","int","FAR DIR*"
"connect","sys/socket.h","CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET)","int","int","FAR const struct sockaddr*","socklen_t"

Can't render this file because it has a wrong number of fields in line 2.

View File

@ -1,7 +1,7 @@
/****************************************************************************
* syscall/syscall_clock_systimer.c
*
* Copyright (C) 2011-2012, 2014 Gregory Nutt. All rights reserved.
* Copyright (C) 2011-2012, 2014, 2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -60,7 +60,7 @@
****************************************************************************/
/****************************************************************************
* Name: syscall_clock_systimer32/64
* Name: syscall_clock_systimer
*
* Description:
* In the kernel build, proxying for clock_systimer() must be handled
@ -74,14 +74,7 @@
*
****************************************************************************/
#ifdef CONFIG_SYSTEM_TIME64
uint64_t syscall_clock_systimer64(void)
systime_t syscall_clock_systimer(void)
{
return clock_systimer64();
return clock_systime();
}
#else
uint32_t syscall_clock_systimer32(void)
{
return clock_systimer32();
}
#endif

View File

@ -99,11 +99,7 @@
* have an address that can be included in the g_funclookup[] table.
*/
#ifdef CONFIG_SYSTEM_TIME64
uint64_t syscall_clock_systimer64(void);
#else
uint32_t syscall_clock_systimer32(void);
#endif
systime_t syscall_clock_systimer(void);
/****************************************************************************
* Pre-processor Definitions

View File

@ -148,11 +148,7 @@ SYSCALL_LOOKUP(up_assert, 2, STUB_up_assert)
* NuttX configuration.
*/
#ifdef CONFIG_SYSTEM_TIME64
SYSCALL_LOOKUP(syscall_clock_systimer64, 0, STUB_clock_systimer64)
#else
SYSCALL_LOOKUP(syscall_clock_systimer32, 0, STUB_clock_systimer32)
#endif
SYSCALL_LOOKUP(syscall_clock_systimer, 0, STUB_clock_systimer)
SYSCALL_LOOKUP(clock_getres, 2, STUB_clock_getres)
SYSCALL_LOOKUP(clock_gettime, 2, STUB_clock_gettime)
SYSCALL_LOOKUP(clock_settime, 2, STUB_clock_settime)

View File

@ -150,11 +150,7 @@ uintptr_t STUB_nanosleep(int nbr, uintptr_t parm1, uintptr_t parm2);
* NuttX configuration.
*/
#ifdef CONFIG_SYSTEM_TIME64
uintptr_t STUB_clock_systimer64(int nbr);
#else
uintptr_t STUB_clock_systimer32(int nbr);
#endif
uintptr_t STUB_clock_systimer(int nbr);
uintptr_t STUB_clock_getres(int nbr, uintptr_t parm1, uintptr_t parm2);
uintptr_t STUB_clock_gettime(int nbr, uintptr_t parm1, uintptr_t parm2);
uintptr_t STUB_clock_settime(int nbr, uintptr_t parm1, uintptr_t parm2);