diff options
Diffstat (limited to 'nuttx/include')
-rw-r--r-- | nuttx/include/nuttx/clock.h | 66 | ||||
-rw-r--r-- | nuttx/include/time.h | 10 |
2 files changed, 50 insertions, 26 deletions
diff --git a/nuttx/include/nuttx/clock.h b/nuttx/include/nuttx/clock.h index 4990c65b4..472ff3bfc 100644 --- a/nuttx/include/nuttx/clock.h +++ b/nuttx/include/nuttx/clock.h @@ -44,6 +44,7 @@ #include <stdint.h> #include <time.h> +#include <nuttx/compiler.h> /**************************************************************************** * Pro-processor Definitions @@ -63,6 +64,14 @@ # define __HAVE_KERNEL_GLOBALS 0 #endif +/* If CONFIG_SYSTEM_TIME64 is selected and the CPU supports long long types, + * then a 64-bit system time will be used. + */ + +#ifndef CONFIG_HAVE_LONG_LONG +# undef CONFIG_SYSTEM_TIME64 +#endif + /* Timing constants *********************************************************/ #define NSEC_PER_SEC 1000000000 @@ -126,20 +135,18 @@ */ #if __HAVE_KERNEL_GLOBALS -extern volatile uint32_t g_system_timer; -extern volatile uint32_t g_system_utc; +# ifdef CONFIG_SYSTEM_TIME64 -#if TICK_PER_SEC > 32767 -extern volatile uint32_t g_tickcount; -#elif TICK_PER_SEC > 255 -extern volatile uint16_t g_tickcount; -#else -extern volatile uint8_t g_tickcount; -#endif -#endif /* __HAVE_KERNEL_GLOBALS */ +extern volatile uint64_t g_system_timer; +#define clock_systimer() (uint32_t)(g_system_timer & 0x00000000ffffffff) +#define clock_systimer64() g_system_timer -#if !defined(CONFIG_SYSTEM_UTC) && __HAVE_KERNEL_GLOBALS +# else + +extern volatile uint32_t g_system_timer; #define clock_systimer() g_system_timer + +# endif #endif /**************************************************************************** @@ -157,10 +164,10 @@ extern "C" { * Function: clock_systimer * * Description: - * Return the current value of the system timer counter. Indirect access - * to the system timer counter is required through this function if (1) we - * are using a hardware periodic timer, OR (2) the execution environment - * does not have direct access to kernel global data + * 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 * * Parameters: * None @@ -172,8 +179,35 @@ extern "C" { * ****************************************************************************/ -#if defined(CONFIG_SYSTEM_UTC) || !__HAVE_KERNEL_GLOBALS +#if !__HAVE_KERNEL_GLOBALS +# ifdef CONFIG_SYSTEM_TIME64 +# define clock_systimer() (uint32_t)(clock_systimer64() & 0x00000000ffffffff) +# else EXTERN uint32_t clock_systimer(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 !__HAVE_KERNEL_GLOBALS && defined(CONFIG_SYSTEM_TIME64) +EXTERN uint64_t clock_systimer64(void); #endif #undef EXTERN diff --git a/nuttx/include/time.h b/nuttx/include/time.h index fae948402..7a76b7ef2 100644 --- a/nuttx/include/time.h +++ b/nuttx/include/time.h @@ -73,16 +73,6 @@ #define CLOCK_REALTIME 0 -/* Non-standard. Returns active UTC time, which is disabled during - * power down modes. Unit is 1 second. - */ - -#ifdef CONFIG_SYSTEM_UTC -# define CLOCK_ACTIVETIME 1 -#endif - -#define CLOCK_ABSTIME - /* This is a flag that may be passed to the timer_settime() function */ #define TIMER_ABSTIME 1 |