2016-08-07 22:32:11 +08:00
|
|
|
/****************************************************************************
|
2014-08-09 04:43:02 +08:00
|
|
|
* sched/clock/clock.h
|
2007-02-18 07:21:28 +08:00
|
|
|
*
|
2021-02-08 23:33:58 +08:00
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
|
|
* this work for additional information regarding copyright ownership. The
|
|
|
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
|
|
* "License"); you may not use this file except in compliance with the
|
|
|
|
* License. You may obtain a copy of the License at
|
2007-02-18 07:21:28 +08:00
|
|
|
*
|
2021-02-08 23:33:58 +08:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2007-02-18 07:21:28 +08:00
|
|
|
*
|
2021-02-08 23:33:58 +08:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
* License for the specific language governing permissions and limitations
|
|
|
|
* under the License.
|
2007-02-18 07:21:28 +08:00
|
|
|
*
|
2016-08-07 22:32:11 +08:00
|
|
|
****************************************************************************/
|
2007-02-18 07:21:28 +08:00
|
|
|
|
2014-08-09 04:43:02 +08:00
|
|
|
#ifndef __SCHED_CLOCK_CLOCK_H
|
|
|
|
#define __SCHED_CLOCK_CLOCK_H
|
2007-02-18 07:21:28 +08:00
|
|
|
|
2016-08-07 22:32:11 +08:00
|
|
|
/****************************************************************************
|
2007-02-18 07:21:28 +08:00
|
|
|
* Included Files
|
2016-08-07 22:32:11 +08:00
|
|
|
****************************************************************************/
|
2007-02-18 07:21:28 +08:00
|
|
|
|
2007-06-09 23:49:44 +08:00
|
|
|
#include <nuttx/config.h>
|
2009-12-15 03:30:18 +08:00
|
|
|
|
|
|
|
#include <stdint.h>
|
2011-10-02 22:16:30 +08:00
|
|
|
|
2007-09-09 19:58:50 +08:00
|
|
|
#include <nuttx/clock.h>
|
2007-02-18 07:21:28 +08:00
|
|
|
#include <nuttx/compiler.h>
|
|
|
|
|
2016-08-07 22:32:11 +08:00
|
|
|
/****************************************************************************
|
2011-10-02 22:16:30 +08:00
|
|
|
* Pre-processor Definitions
|
2016-08-07 22:32:11 +08:00
|
|
|
****************************************************************************/
|
2021-02-09 01:46:31 +08:00
|
|
|
|
2011-10-02 22:16:30 +08:00
|
|
|
/* Configuration ************************************************************/
|
2021-02-09 01:46:31 +08:00
|
|
|
|
2011-10-02 22:16:30 +08:00
|
|
|
/* 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
|
2007-02-18 07:21:28 +08:00
|
|
|
|
2016-08-07 22:32:11 +08:00
|
|
|
/****************************************************************************
|
2007-02-18 07:21:28 +08:00
|
|
|
* Public Type Definitions
|
2016-08-07 22:32:11 +08:00
|
|
|
****************************************************************************/
|
2007-02-18 07:21:28 +08:00
|
|
|
|
2016-08-07 22:32:11 +08:00
|
|
|
/****************************************************************************
|
2015-10-03 06:30:35 +08:00
|
|
|
* Public Data
|
2016-08-07 22:32:11 +08:00
|
|
|
****************************************************************************/
|
2014-10-04 00:20:46 +08:00
|
|
|
|
2014-08-31 04:44:48 +08:00
|
|
|
#if !defined(CONFIG_SCHED_TICKLESS) && !defined(__HAVE_KERNEL_GLOBALS)
|
2014-08-29 07:00:03 +08:00
|
|
|
/* The system clock exists (CONFIG_SCHED_TICKLESS), but it not prototyped
|
|
|
|
* globally in include/nuttx/clock.h.
|
|
|
|
*/
|
|
|
|
|
2022-09-27 12:03:48 +08:00
|
|
|
extern volatile clock_t g_system_ticks;
|
2014-08-29 07:00:03 +08:00
|
|
|
#endif
|
2007-02-18 07:21:28 +08:00
|
|
|
|
2016-07-11 20:54:02 +08:00
|
|
|
#ifndef CONFIG_CLOCK_TIMEKEEPING
|
2022-09-27 12:03:48 +08:00
|
|
|
extern struct timespec g_basetime;
|
2016-07-11 06:14:25 +08:00
|
|
|
#endif
|
2007-02-18 07:21:28 +08:00
|
|
|
|
2016-08-07 22:32:11 +08:00
|
|
|
/****************************************************************************
|
2007-02-18 07:21:28 +08:00
|
|
|
* Public Function Prototypes
|
2016-08-07 22:32:11 +08:00
|
|
|
****************************************************************************/
|
2007-02-18 07:21:28 +08:00
|
|
|
|
2018-11-12 21:00:41 +08:00
|
|
|
int clock_basetime(FAR struct timespec *tp);
|
|
|
|
|
2022-08-16 12:20:39 +08:00
|
|
|
void clock_initialize(void);
|
2014-08-07 08:29:05 +08:00
|
|
|
#ifndef CONFIG_SCHED_TICKLESS
|
2022-08-16 12:20:39 +08:00
|
|
|
void clock_timer(void);
|
|
|
|
#else
|
|
|
|
# define clock_timer()
|
2014-08-07 08:29:05 +08:00
|
|
|
#endif
|
2007-02-18 07:21:28 +08:00
|
|
|
|
2015-07-27 05:03:47 +08:00
|
|
|
int clock_abstime2ticks(clockid_t clockid,
|
|
|
|
FAR const struct timespec *abstime,
|
2018-06-17 02:16:13 +08:00
|
|
|
FAR sclock_t *ticks);
|
2007-02-18 07:21:28 +08:00
|
|
|
|
2023-09-06 22:52:59 +08:00
|
|
|
/****************************************************************************
|
|
|
|
* perf_init
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
void perf_init(void);
|
|
|
|
|
2014-08-09 04:43:02 +08:00
|
|
|
#endif /* __SCHED_CLOCK_CLOCK_H */
|