mirror of
https://github.com/apache/nuttx.git
synced 2026-08-01 20:28:58 +00:00
arch/delays: Invalid default value for BOARD_LOOPSPERMSEC
Changes the default value for CONFIG_BOARD_LOOPSPERMSEC to -1, which is invalid. All boards that forget to configure this value will encounter a static assertion at compile time, enforcing that configurations upstreamed to NuttX have calibrated values for correct delay timings. Boards which implement ALARM_ARCH or TIMER_ARCH do not rely on the busy-loop delay implementation and thus only have a run-time check to ensure proper delay-timings (in the case where delays are used before the alarm/timer driver is registered). Some boards already in the NuttX upstream do not have calibrated values, but there are no users who currently own the board to submit a calibrated value for the configurations to use. In this scenario, the value is temporarily set to 0 and a warning is displayed so that users of these boards are informed of the calibration process. Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
This commit is contained in:
parent
629a9d4ace
commit
2d768c294e
50 changed files with 225 additions and 8 deletions
|
|
@ -38,7 +38,7 @@ set(SRCS
|
|||
# don't want the weak references to conflict.
|
||||
|
||||
if(NOT CONFIG_TIMER_ARCH AND NOT CONFIG_ALARM_ARCH)
|
||||
list(APPEND SRCS delay.c)
|
||||
list(APPEND SRCS clock_delay.c)
|
||||
endif()
|
||||
|
||||
if(CONFIG_CLOCK_TIMEKEEPING)
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ CSRCS += clock_notifier.c
|
|||
|
||||
ifneq ($(CONFIG_TIMER_ARCH),y)
|
||||
ifneq ($(CONFIG_ALARM_ARCH),y)
|
||||
CSRCS += delay.c
|
||||
CSRCS += clock_delay.c
|
||||
endif
|
||||
endif
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
* sched/clock/delay.c
|
||||
* sched/clock/clock_delay.c
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
|
|
@ -56,6 +56,20 @@
|
|||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_BOARD_LOOPSPERMSEC) && CONFIG_BOARD_LOOPSPERMSEC == 0
|
||||
#warning \
|
||||
"CONFIG_BOARD_LOOPSPERMSEC is set to 0 even though this architecture does" \
|
||||
"not rely on timer or alarm drivers for correct timings. up_udelay() and " \
|
||||
"similar delay functions will not work correctly. Please determine an " \
|
||||
"appropriate value for CONFIG_BOARD_LOOPSPERMSEC using the calib_udelay " \
|
||||
"application in nuttx-apps. If this configuration is a NuttX provided " \
|
||||
"configuration, it would be appreciated if you submit a patch with the " \
|
||||
"new value to apache/nuttx."
|
||||
#endif
|
||||
|
||||
static_assert(CONFIG_BOARD_LOOPSPERMSEC != -1,
|
||||
"Configure BOARD_LOOPSPERMSEC to non-default value.");
|
||||
|
||||
#define CONFIG_BOARD_LOOPSPER100USEC ((CONFIG_BOARD_LOOPSPERMSEC+5)/10)
|
||||
#define CONFIG_BOARD_LOOPSPER10USEC ((CONFIG_BOARD_LOOPSPERMSEC+50)/100)
|
||||
#define CONFIG_BOARD_LOOPSPERUSEC ((CONFIG_BOARD_LOOPSPERMSEC+500)/1000)
|
||||
Loading…
Add table
Add a link
Reference in a new issue