This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 1b66f07ff542fc4d7d8edcd9b79a7aa8ed5d6663 Author: Marco Casaroli <[email protected]> AuthorDate: Tue Oct 20 20:53:02 2026 +0200 arch, drivers, fs, libc, sched: Use CLK_TCK for the system tick rate. These files used CLOCKS_PER_SEC as the number of system clock ticks per second: timer setups, driver timeouts, the PM activity governor, procfs uptime, CPU load, the critical section monitor and sysconf(_SC_CLK_TCK). CLOCKS_PER_SEC is the unit of clock(). CLK_TCK in <time.h> is the tick rate, and it has the same value as CLOCKS_PER_SEC today. Use CLK_TCK. The generated code does not change. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Marco Casaroli <[email protected]> --- arch/arm/src/kinetis/kinetis_usbdev.c | 2 +- arch/arm/src/rm57/rm57_ethernet.c | 2 +- arch/arm/src/rtl8720c/amebaz_driver.c | 4 ++-- arch/avr/src/at90usb/at90usb_timerisr.c | 16 ++++++++-------- arch/avr/src/atmega/atmega_timerisr.c | 16 ++++++++-------- arch/mips/src/pic32mx/pic32mx_timerisr.c | 12 ++++++------ arch/mips/src/pic32mx/pic32mx_usbdev.c | 2 +- arch/mips/src/pic32mz/pic32mz_timerisr.c | 12 ++++++------ arch/misoc/src/common/misoc_timerisr.c | 8 ++++---- arch/risc-v/src/esp32c3-legacy/esp32c3_timerisr.c | 2 +- arch/sparc/src/bm3803/bm3803-timerisr.c | 6 +++--- arch/sparc/src/bm3823/bm3823-timerisr.c | 6 +++--- arch/sparc/src/s698pm/s698pm-timerisr.c | 6 +++--- arch/xtensa/src/esp32/esp32_timerisr.c | 2 +- arch/xtensa/src/esp32s2/esp32s2_timerisr.c | 2 +- arch/xtensa/src/esp32s3/esp32s3_timerisr.c | 2 +- arch/z16/src/z16f/z16f_timerisr.c | 6 +++--- drivers/power/pm/activity_governor.c | 6 +++--- drivers/wireless/ieee80211/bcm43xxx/bcmf_driver.c | 2 +- fs/procfs/fs_procfsuptime.c | 8 ++++---- libs/libc/unistd/lib_sysconf.c | 2 +- sched/sched/sched_cpuload.c | 2 +- sched/sched/sched_critmonitor.c | 4 ++-- 23 files changed, 65 insertions(+), 65 deletions(-) diff --git a/arch/arm/src/kinetis/kinetis_usbdev.c b/arch/arm/src/kinetis/kinetis_usbdev.c index f42fb205ee4..266cb36204e 100644 --- a/arch/arm/src/kinetis/kinetis_usbdev.c +++ b/arch/arm/src/kinetis/kinetis_usbdev.c @@ -187,7 +187,7 @@ #define khci_rqhead(q) ((q)->head) #define khci_rqtail(q) ((q)->tail) -#define RESTART_DELAY (150 * CLOCKS_PER_SEC / 1000) +#define RESTART_DELAY (150 * CLK_TCK / 1000) #define USB0_USBTRC0_BIT6 0x40 /* Undocumented bit that is set in the * Kinetis lib diff --git a/arch/arm/src/rm57/rm57_ethernet.c b/arch/arm/src/rm57/rm57_ethernet.c index 05689a1973e..ad11d1e8e33 100644 --- a/arch/arm/src/rm57/rm57_ethernet.c +++ b/arch/arm/src/rm57/rm57_ethernet.c @@ -140,7 +140,7 @@ * only the last-resort backstop. */ -#define RM57_EMAC_TXTIMEOUT (60 * CLOCKS_PER_SEC) +#define RM57_EMAC_TXTIMEOUT (60 * CLK_TCK) /* Bounded loops guard against a wedged descriptor chain hanging a * worker forever, matching the RM57_DCAN_ISR_BOUND idiom in diff --git a/arch/arm/src/rtl8720c/amebaz_driver.c b/arch/arm/src/rtl8720c/amebaz_driver.c index da6772c7887..bbb7f68f552 100644 --- a/arch/arm/src/rtl8720c/amebaz_driver.c +++ b/arch/arm/src/rtl8720c/amebaz_driver.c @@ -36,8 +36,8 @@ * Pre-processor Definitions ****************************************************************************/ -#define AMEBAZ_SCAN_TIMEOUT_TICK (10 * CLOCKS_PER_SEC) -#define AMEBAZ_CONNECT_TIMEOUT_TICK (10 * CLOCKS_PER_SEC) +#define AMEBAZ_SCAN_TIMEOUT_TICK (10 * CLK_TCK) +#define AMEBAZ_CONNECT_TIMEOUT_TICK (10 * CLK_TCK) #define AMEBAZ_DEVICE_COUNT (2) #define AMEBAZ_SCAN_ENTRY_COUNT (5) #define AMEBAZ_DEFAULT_COUNTRY "CN" diff --git a/arch/avr/src/at90usb/at90usb_timerisr.c b/arch/avr/src/at90usb/at90usb_timerisr.c index 6fba62d9cd9..e61e5da0aa7 100644 --- a/arch/avr/src/at90usb/at90usb_timerisr.c +++ b/arch/avr/src/at90usb/at90usb_timerisr.c @@ -46,18 +46,18 @@ * ideal match is given by: * * CLOCK = CPU_CLOCK / DIVISOR # CPU clocks/sec - * MATCH = CLOCK / CLOCKS_PER_SEC # CPU clocks/timer tick - * MATCH = CPU_CLOCK / DIVISOR / CLOCKS_PER_SEC # CPU clocks/timer tick + * MATCH = CLOCK / CLK_TCK # CPU clocks/timer tick + * MATCH = CPU_CLOCK / DIVISOR / CLK_TCK # CPU clocks/timer tick * * But we only have 16-bits of accuracy so we need to pick the smallest * divisor using the following brute force calculation: */ -#define MATCH1 (( BOARD_CPU_CLOCK + CLOCKS_PER_SEC/2) / CLOCKS_PER_SEC) -#define MATCH8 ((((BOARD_CPU_CLOCK + 4) / 8) + CLOCKS_PER_SEC/2) / CLOCKS_PER_SEC) -#define MATCH64 ((((BOARD_CPU_CLOCK + 8) / 64) + CLOCKS_PER_SEC/2) / CLOCKS_PER_SEC) -#define MATCH256 ((((BOARD_CPU_CLOCK + 128) / 256) + CLOCKS_PER_SEC/2) / CLOCKS_PER_SEC) -#define MATCH1024 ((((BOARD_CPU_CLOCK + 512) / 1024) + CLOCKS_PER_SEC/2) / CLOCKS_PER_SEC) +#define MATCH1 (( BOARD_CPU_CLOCK + CLK_TCK/2) / CLK_TCK) +#define MATCH8 ((((BOARD_CPU_CLOCK + 4) / 8) + CLK_TCK/2) / CLK_TCK) +#define MATCH64 ((((BOARD_CPU_CLOCK + 8) / 64) + CLK_TCK/2) / CLK_TCK) +#define MATCH256 ((((BOARD_CPU_CLOCK + 128) / 256) + CLK_TCK/2) / CLK_TCK) +#define MATCH1024 ((((BOARD_CPU_CLOCK + 512) / 1024) + CLK_TCK/2) / CLK_TCK) #if MATCH1 <= 65536 # define MATCH (MATCH1-1) @@ -78,7 +78,7 @@ # error "Cannot represent this timer frequency" #endif -/* Eg. CPU_CLOCK = 8MHz, CLOCKS_PER_SEC = 100 +/* Eg. CPU_CLOCK = 8MHz, CLK_TCK = 100 * * MATCH1 ((8000000 + 50) / 100) = 80,000 FREQ=100.0Hz * MATCH8 ((1000000 + 50) / 100) = 10,000 FREQ=100.0Hz <-- this one diff --git a/arch/avr/src/atmega/atmega_timerisr.c b/arch/avr/src/atmega/atmega_timerisr.c index ab457508606..83891e2f465 100644 --- a/arch/avr/src/atmega/atmega_timerisr.c +++ b/arch/avr/src/atmega/atmega_timerisr.c @@ -46,18 +46,18 @@ * ideal match is given by: * * CLOCK = CPU_CLOCK / DIVISOR # CPU clocks/sec - * MATCH = CLOCK / CLOCKS_PER_SEC # CPU clocks/timer tick - * MATCH = CPU_CLOCK / DIVISOR / CLOCKS_PER_SEC # CPU clocks/timer tick + * MATCH = CLOCK / CLK_TCK # CPU clocks/timer tick + * MATCH = CPU_CLOCK / DIVISOR / CLK_TCK # CPU clocks/timer tick * * But we only have 16-bits of accuracy so we need to pick the smallest * divisor using the following brute force calculation: */ -#define MATCH1 (( BOARD_CPU_CLOCK + CLOCKS_PER_SEC/2) / CLOCKS_PER_SEC) -#define MATCH8 ((((BOARD_CPU_CLOCK + 4) / 8) + CLOCKS_PER_SEC/2) / CLOCKS_PER_SEC) -#define MATCH64 ((((BOARD_CPU_CLOCK + 8) / 64) + CLOCKS_PER_SEC/2) / CLOCKS_PER_SEC) -#define MATCH256 ((((BOARD_CPU_CLOCK + 128) / 256) + CLOCKS_PER_SEC/2) / CLOCKS_PER_SEC) -#define MATCH1024 ((((BOARD_CPU_CLOCK + 512) / 1024) + CLOCKS_PER_SEC/2) / CLOCKS_PER_SEC) +#define MATCH1 (( BOARD_CPU_CLOCK + CLK_TCK/2) / CLK_TCK) +#define MATCH8 ((((BOARD_CPU_CLOCK + 4) / 8) + CLK_TCK/2) / CLK_TCK) +#define MATCH64 ((((BOARD_CPU_CLOCK + 8) / 64) + CLK_TCK/2) / CLK_TCK) +#define MATCH256 ((((BOARD_CPU_CLOCK + 128) / 256) + CLK_TCK/2) / CLK_TCK) +#define MATCH1024 ((((BOARD_CPU_CLOCK + 512) / 1024) + CLK_TCK/2) / CLK_TCK) #if MATCH1 <= 65536 # define MATCH (MATCH1-1) @@ -78,7 +78,7 @@ # error "Cannot represent this timer frequency" #endif -/* Eg. CPU_CLOCK = 8MHz, CLOCKS_PER_SEC = 100 +/* Eg. CPU_CLOCK = 8MHz, CLK_TCK = 100 * * MATCH1 ((8000000 + 50) / 100) = 80,000 FREQ=100.0Hz * MATCH8 ((1000000 + 50) / 100) = 10,000 FREQ=100.0Hz <-- this one diff --git a/arch/mips/src/pic32mx/pic32mx_timerisr.c b/arch/mips/src/pic32mx/pic32mx_timerisr.c index a24f644f3db..fdc34acae07 100644 --- a/arch/mips/src/pic32mx/pic32mx_timerisr.c +++ b/arch/mips/src/pic32mx/pic32mx_timerisr.c @@ -63,12 +63,12 @@ * register value given the timer 1 input clock frequency and the desired * system timer frequency: * - * TIMER1_MATCH = TIMER1_SRC_FREQ / TIMER1_PRESCALE / CLOCKS_PER_SEC + * TIMER1_MATCH = TIMER1_SRC_FREQ / TIMER1_PRESCALE / CLK_TCK * * We want the largest possible value for MATCH that is less than 65,535, the * maximum value for the 16-bit timer register: * - * TIMER1_PRESCALE >= TIMER1_SRC_FREQ / CLOCKS_PER_SEC / 65535 + * TIMER1_PRESCALE >= TIMER1_SRC_FREQ / CLK_TCK / 65535 * * Timer 1 does not have very many options for the prescaler value. So we * can pick the best by brute force. Example: @@ -76,7 +76,7 @@ * Example 1. Given: * BOARD_TIMER1_SOSC = Defined * BOARD_SOSC_FREQ = 32768 - * CLOCKS_PER_SEC = 100 + * CLK_TCK = 100 * Then: * OPTIMAL_PRESCALE = 1 * TIMER1_PRESCALE = 1 @@ -85,14 +85,14 @@ * Example 2. Given: * BOARD_TIMER1_SOSC = Not defined * BOARD_PBCLOCK = 60000000 - * CLOCKS_PER_SEC = 100 + * CLK_TCK = 100 * Then: * OPTIMAL_PRESCALE = 9.2 * TIMER1_PRESCALE = 64 * TIMER1_MATCH = 9375 -> 100.0 ticks/sec */ -#define OPTIMAL_PRESCALE (TIMER1_SRC_FREQ / CLOCKS_PER_SEC / 65535) +#define OPTIMAL_PRESCALE (TIMER1_SRC_FREQ / CLK_TCK / 65535) #if OPTIMAL_PRESCALE <= 1 # define TIMER1_CON_TCKPS TIMER1_CON_TCKPS_1 # define TIMER1_PRESCALE 1 @@ -109,7 +109,7 @@ # error "This timer frequency cannot be represented" #endif -#define TIMER1_MATCH (TIMER1_SRC_FREQ / TIMER1_PRESCALE / CLOCKS_PER_SEC) +#define TIMER1_MATCH (TIMER1_SRC_FREQ / TIMER1_PRESCALE / CLK_TCK) /**************************************************************************** * Private Functions diff --git a/arch/mips/src/pic32mx/pic32mx_usbdev.c b/arch/mips/src/pic32mx/pic32mx_usbdev.c index 2664d460892..00a91c0a514 100644 --- a/arch/mips/src/pic32mx/pic32mx_usbdev.c +++ b/arch/mips/src/pic32mx/pic32mx_usbdev.c @@ -166,7 +166,7 @@ #define pic32mx_rqhead(q) ((q)->head) #define pic32mx_rqtail(q) ((q)->tail) -#define RESTART_DELAY (150 * CLOCKS_PER_SEC / 1000) +#define RESTART_DELAY (150 * CLK_TCK / 1000) /* USB trace ****************************************************************/ diff --git a/arch/mips/src/pic32mz/pic32mz_timerisr.c b/arch/mips/src/pic32mz/pic32mz_timerisr.c index 9441e048438..54cd427ec7d 100644 --- a/arch/mips/src/pic32mz/pic32mz_timerisr.c +++ b/arch/mips/src/pic32mz/pic32mz_timerisr.c @@ -66,12 +66,12 @@ * register value given the timer 1 input clock frequency and the desired * system timer frequency: * - * TIMER1_MATCH = TIMER1_SRC_FREQ / TIMER1_PRESCALE / CLOCKS_PER_SEC + * TIMER1_MATCH = TIMER1_SRC_FREQ / TIMER1_PRESCALE / CLK_TCK * * We want the largest possible value for MATCH that is less than 65,535, the * maximum value for the 16-bit timer register: * - * TIMER1_PRESCALE >= TIMER1_SRC_FREQ / CLOCKS_PER_SEC / 65535 + * TIMER1_PRESCALE >= TIMER1_SRC_FREQ / CLK_TCK / 65535 * * Timer 1 does not have very many options for the prescaler value. So we * can pick the best by brute force. Example: @@ -79,7 +79,7 @@ * Example 1. Given: * BOARD_TIMER1_SOSC = Defined * BOARD_SOSC_FREQ = 32768 - * CLOCKS_PER_SEC = 100 + * CLK_TCK = 100 * Then: * OPTIMAL_PRESCALE = 1 * TIMER1_PRESCALE = 1 @@ -88,14 +88,14 @@ * Example 2. Given: * BOARD_TIMER1_SOSC = Not defined * BOARD_PBCLK3 = 60000000 - * CLOCKS_PER_SEC = 100 + * CLK_TCK = 100 * Then: * OPTIMAL_PRESCALE = 9.2 * TIMER1_PRESCALE = 64 * TIMER1_MATCH = 9375 -> 100.0 ticks/sec */ -#define OPTIMAL_PRESCALE (TIMER1_SRC_FREQ / CLOCKS_PER_SEC / 65535) +#define OPTIMAL_PRESCALE (TIMER1_SRC_FREQ / CLK_TCK / 65535) #if OPTIMAL_PRESCALE <= 1 # define TIMER1_CON_TCKPS TIMER1_CON_TCKPS_1 # define TIMER1_PRESCALE 1 @@ -112,7 +112,7 @@ # error "This timer frequency cannot be represented" #endif -#define TIMER1_MATCH (TIMER1_SRC_FREQ / TIMER1_PRESCALE / CLOCKS_PER_SEC) +#define TIMER1_MATCH (TIMER1_SRC_FREQ / TIMER1_PRESCALE / CLK_TCK) /**************************************************************************** * Private Functions diff --git a/arch/misoc/src/common/misoc_timerisr.c b/arch/misoc/src/common/misoc_timerisr.c index 74e82752b3e..e51bc073bdb 100644 --- a/arch/misoc/src/common/misoc_timerisr.c +++ b/arch/misoc/src/common/misoc_timerisr.c @@ -43,7 +43,7 @@ ****************************************************************************/ /* The desired timer interrupt frequency is provided by the definition - * CLOCKS_PER_SEC (see include/time.h). CLOCKS_PER_SEC defines the desired + * CLK_TCK (see include/time.h). CLK_TCK defines the desired * number of system clock ticks per second. That value is a user * configurable setting based on CONFIG_USEC_PER_TICK. It defaults to 100 * (100 ticks per second = 10 MS interval). @@ -51,10 +51,10 @@ * Given the timer input frequency (Finput). The timer correct reload * value is: * - * reload = Finput / CLOCKS_PER_SEC + * reload = Finput / CLK_TCK */ -#define SYSTICK_RELOAD ((SYSTEM_CLOCK_FREQUENCY / CLOCKS_PER_SEC) - 1) +#define SYSTICK_RELOAD ((SYSTEM_CLOCK_FREQUENCY / CLK_TCK) - 1) /* The size of the reload field is 30 bits. Verify that the reload value * will fit in the reload register. @@ -109,7 +109,7 @@ void up_timer_initialize(void) timer0_en_write(0); /* Setup the timer reload register to generate interrupts at the rate of - * CLOCKS_PER_SEC. + * CLK_TCK. */ timer0_reload_write(SYSTICK_RELOAD * 20); diff --git a/arch/risc-v/src/esp32c3-legacy/esp32c3_timerisr.c b/arch/risc-v/src/esp32c3-legacy/esp32c3_timerisr.c index 77ec74202f4..da9a7fa2cde 100644 --- a/arch/risc-v/src/esp32c3-legacy/esp32c3_timerisr.c +++ b/arch/risc-v/src/esp32c3-legacy/esp32c3_timerisr.c @@ -91,7 +91,7 @@ void up_timer_initialize(void) /* Configure alarm0 (Comparator 0) */ regval = SYS_TIMER_TARGET0_PERIOD_MODE | - ((ESP32C3_SYSTIMER_TICKS_PER_SEC / CLOCKS_PER_SEC) << + ((ESP32C3_SYSTIMER_TICKS_PER_SEC / CLK_TCK) << SYS_TIMER_TARGET0_PERIOD_S); putreg32(regval, SYS_TIMER_SYSTIMER_TARGET0_CONF_REG); diff --git a/arch/sparc/src/bm3803/bm3803-timerisr.c b/arch/sparc/src/bm3803/bm3803-timerisr.c index 782d1f36471..a62d523e656 100644 --- a/arch/sparc/src/bm3803/bm3803-timerisr.c +++ b/arch/sparc/src/bm3803/bm3803-timerisr.c @@ -45,14 +45,14 @@ * ideal match is given by: * * CLOCK = CPU_CLOCK / DIVISOR # CPU clocks/sec - * MATCH = CLOCK / CLOCKS_PER_SEC # CPU clocks/timer tick - * MATCH = CPU_CLOCK / DIVISOR / CLOCKS_PER_SEC # CPU clocks/timer tick + * MATCH = CLOCK / CLK_TCK # CPU clocks/timer tick + * MATCH = CPU_CLOCK / DIVISOR / CLK_TCK # CPU clocks/timer tick * * But we only have 16-bits of accuracy so we need to pick the smallest * divisor using the following brute force calculation: */ #define BM3803_TIMER_CLOCK 1000000 -#define MATCH1 (( 1000000 / CLOCKS_PER_SEC) - 1) +#define MATCH1 (( 1000000 / CLK_TCK) - 1) /* Bit 0: enables the timer when set */ #define TIMCTR_ENABLE_COUNTER (1 << 0) diff --git a/arch/sparc/src/bm3823/bm3823-timerisr.c b/arch/sparc/src/bm3823/bm3823-timerisr.c index 6bdceff6288..638b4ed3fb2 100644 --- a/arch/sparc/src/bm3823/bm3823-timerisr.c +++ b/arch/sparc/src/bm3823/bm3823-timerisr.c @@ -45,14 +45,14 @@ * ideal match is given by: * * CLOCK = CPU_CLOCK / DIVISOR # CPU clocks/sec - * MATCH = CLOCK / CLOCKS_PER_SEC # CPU clocks/timer tick - * MATCH = CPU_CLOCK / DIVISOR / CLOCKS_PER_SEC # CPU clocks/timer tick + * MATCH = CLOCK / CLK_TCK # CPU clocks/timer tick + * MATCH = CPU_CLOCK / DIVISOR / CLK_TCK # CPU clocks/timer tick * * But we only have 16-bits of accuracy so we need to pick the smallest * divisor using the following brute force calculation: */ #define BM3823_TIMER_CLOCK 1000000 -#define MATCH1 (( 1000000 / CLOCKS_PER_SEC) - 1) +#define MATCH1 (( 1000000 / CLK_TCK) - 1) #define TIMCTR_ENABLE_COUNTER (1 << 0) /* Bit 0: enables the * timer when set diff --git a/arch/sparc/src/s698pm/s698pm-timerisr.c b/arch/sparc/src/s698pm/s698pm-timerisr.c index 923ce4d3f7f..83e51b1c1bc 100644 --- a/arch/sparc/src/s698pm/s698pm-timerisr.c +++ b/arch/sparc/src/s698pm/s698pm-timerisr.c @@ -47,15 +47,15 @@ * ideal match is given by: * * CLOCK = CPU_CLOCK / DIVISOR # CPU clocks/sec - * MATCH = CLOCK / CLOCKS_PER_SEC # CPU clocks/timer tick - * MATCH = CPU_CLOCK / DIVISOR / CLOCKS_PER_SEC # CPU clocks/timer tick + * MATCH = CLOCK / CLK_TCK # CPU clocks/timer tick + * MATCH = CPU_CLOCK / DIVISOR / CLK_TCK # CPU clocks/timer tick * * But we only have 16-bits of accuracy so we need to pick the smallest * divisor using the following brute force calculation: */ #define S698PM_TIMER_CLOCK 1000000 -#define MATCH1 (( 1000000 / CLOCKS_PER_SEC) - 1) +#define MATCH1 (( 1000000 / CLK_TCK) - 1) /* Bit 0: enables the timer when set */ diff --git a/arch/xtensa/src/esp32/esp32_timerisr.c b/arch/xtensa/src/esp32/esp32_timerisr.c index 830c9343329..339b62f88e3 100644 --- a/arch/xtensa/src/esp32/esp32_timerisr.c +++ b/arch/xtensa/src/esp32/esp32_timerisr.c @@ -118,7 +118,7 @@ void up_timer_initialize(void) * divisor = BOARD_CLOCK_FREQUENCY / ticks_per_sec */ - divisor = BOARD_CLOCK_FREQUENCY / CLOCKS_PER_SEC; + divisor = BOARD_CLOCK_FREQUENCY / CLK_TCK; g_tick_divisor = divisor; /* Set up periodic timer */ diff --git a/arch/xtensa/src/esp32s2/esp32s2_timerisr.c b/arch/xtensa/src/esp32s2/esp32s2_timerisr.c index 1c72263a23b..60183e2f5fd 100644 --- a/arch/xtensa/src/esp32s2/esp32s2_timerisr.c +++ b/arch/xtensa/src/esp32s2/esp32s2_timerisr.c @@ -118,7 +118,7 @@ void up_timer_initialize(void) * divisor = BOARD_CLOCK_FREQUENCY / ticks_per_sec */ - divisor = BOARD_CLOCK_FREQUENCY / CLOCKS_PER_SEC; + divisor = BOARD_CLOCK_FREQUENCY / CLK_TCK; g_tick_divisor = divisor; /* Set up periodic timer */ diff --git a/arch/xtensa/src/esp32s3/esp32s3_timerisr.c b/arch/xtensa/src/esp32s3/esp32s3_timerisr.c index e478fe12886..a4616942aba 100644 --- a/arch/xtensa/src/esp32s3/esp32s3_timerisr.c +++ b/arch/xtensa/src/esp32s3/esp32s3_timerisr.c @@ -129,7 +129,7 @@ void up_timer_initialize(void) /* Configure alarm 0 (Comparator 0) */ regval = SYSTIMER_TARGET0_PERIOD_MODE | - ((ESP32S3_SYSTIMER_TICKS_PER_SEC / CLOCKS_PER_SEC) << + ((ESP32S3_SYSTIMER_TICKS_PER_SEC / CLK_TCK) << SYSTIMER_TARGET0_PERIOD_S); putreg32(regval, SYSTIMER_TARGET0_CONF_REG); putreg32(SYSTIMER_TIMER_COMP0_LOAD, SYSTIMER_COMP0_LOAD_REG); diff --git a/arch/z16/src/z16f/z16f_timerisr.c b/arch/z16/src/z16f/z16f_timerisr.c index 25a8ca0196b..22a399a1256 100644 --- a/arch/z16/src/z16f/z16f_timerisr.c +++ b/arch/z16/src/z16f/z16f_timerisr.c @@ -42,7 +42,7 @@ ****************************************************************************/ /* The desired timer interrupt frequency is provided by the definition - * CLOCKS_PER_SEC (see include/time.h). CLOCKS_PER_SEC defines the desired + * CLK_TCK (see include/time.h). CLK_TCK defines the desired * number of system clock ticks per second. That value is a user * configurable setting that defaults to 100 (100 ticks per second = 10 MS * interval). @@ -143,9 +143,9 @@ void up_timer_initialize(void) */ #if 0 /* Does not work ??? */ - scaledfreq = _DEFCLK / CLOCKS_PER_SEC; + scaledfreq = _DEFCLK / CLK_TCK; #else - scaledfreq = (BOARD_SYSTEM_FREQUENCY / CLOCKS_PER_SEC); + scaledfreq = (BOARD_SYSTEM_FREQUENCY / CLK_TCK); #endif rawdiv = (scaledfreq >> 16) + 1; diff --git a/drivers/power/pm/activity_governor.c b/drivers/power/pm/activity_governor.c index c9060c65c00..d1ed753772d 100644 --- a/drivers/power/pm/activity_governor.c +++ b/drivers/power/pm/activity_governor.c @@ -47,13 +47,13 @@ /* Convert the time slice interval into system clock ticks. * * CONFIG_PM_SLICEMS provides the duration of one time slice in milliseconds. - * CLOCKS_PER_SEC provides the number of timer ticks in one second. + * CLK_TCK provides the number of timer ticks in one second. * * slice ticks = (CONFIG_PM_SLICEMS msec / 1000 msec/sec) / - * (CLOCKS_PER_SEC ticks/sec) + * (CLK_TCK ticks/sec) */ -#define TIME_SLICE_TICKS ((CONFIG_PM_GOVERNOR_SLICEMS * CLOCKS_PER_SEC) / 1000) +#define TIME_SLICE_TICKS ((CONFIG_PM_GOVERNOR_SLICEMS * CLK_TCK) / 1000) /**************************************************************************** * Private Types diff --git a/drivers/wireless/ieee80211/bcm43xxx/bcmf_driver.c b/drivers/wireless/ieee80211/bcm43xxx/bcmf_driver.c index 32819509e87..eaf308084f0 100644 --- a/drivers/wireless/ieee80211/bcm43xxx/bcmf_driver.c +++ b/drivers/wireless/ieee80211/bcm43xxx/bcmf_driver.c @@ -56,7 +56,7 @@ ****************************************************************************/ #define DOT11_BSSTYPE_ANY 2 -#define BCMF_SCAN_TIMEOUT_TICK (5*CLOCKS_PER_SEC) +#define BCMF_SCAN_TIMEOUT_TICK (5*CLK_TCK) #define BCMF_AUTH_TIMEOUT_MS 15000 /* was 10000 */ #define BCMF_SCAN_RESULT_ENTRIES CONFIG_IEEE80211_BROADCOM_SCAN_RESULT_ENTRIES diff --git a/fs/procfs/fs_procfsuptime.c b/fs/procfs/fs_procfsuptime.c index 2237fa2b819..4188a1941fd 100644 --- a/fs/procfs/fs_procfsuptime.c +++ b/fs/procfs/fs_procfsuptime.c @@ -223,16 +223,16 @@ static ssize_t uptime_read(FAR struct file *filep, FAR char *buffer, #if defined(CONFIG_HAVE_DOUBLE) && defined(CONFIG_LIBC_FLOATINGPOINT) /* Convert the up time to a seconds + hundredths of seconds string */ - now = (double)ticktime / (double)CLOCKS_PER_SEC; + now = (double)ticktime / (double)CLK_TCK; linesize = procfs_snprintf(attr->line, UPTIME_LINELEN, "%10.2f\n", now); #else /* Convert the system up time to seconds + hundredths of seconds */ - sec = ticktime / CLOCKS_PER_SEC; - remainder = (unsigned int)(ticktime % CLOCKS_PER_SEC); - csec = (100 * remainder + (CLOCKS_PER_SEC / 2)) / CLOCKS_PER_SEC; + sec = ticktime / CLK_TCK; + remainder = (unsigned int)(ticktime % CLK_TCK); + csec = (100 * remainder + (CLK_TCK / 2)) / CLK_TCK; /* Make sure that rounding did not force the hundredths of * a second above 99 diff --git a/libs/libc/unistd/lib_sysconf.c b/libs/libc/unistd/lib_sysconf.c index 88d9faeb00a..1e3460b1bae 100644 --- a/libs/libc/unistd/lib_sysconf.c +++ b/libs/libc/unistd/lib_sysconf.c @@ -240,7 +240,7 @@ long sysconf(int name) case _SC_REALTIME_SIGNALS: return _POSIX_REALTIME_SIGNALS; case _SC_CLK_TCK: - return CLOCKS_PER_SEC; + return CLK_TCK; case _SC_ARG_MAX: return ARG_MAX; diff --git a/sched/sched/sched_cpuload.c b/sched/sched/sched_cpuload.c index 3eb62043f23..41d0664b34f 100644 --- a/sched/sched/sched_cpuload.c +++ b/sched/sched/sched_cpuload.c @@ -49,7 +49,7 @@ # endif # define CPULOAD_TICKSPERSEC CONFIG_SCHED_CPULOAD_TICKSPERSEC #else -# define CPULOAD_TICKSPERSEC CLOCKS_PER_SEC +# define CPULOAD_TICKSPERSEC CLK_TCK #endif /* When g_cpuload_total exceeds the following time constant, the load and diff --git a/sched/sched/sched_critmonitor.c b/sched/sched/sched_critmonitor.c index 7e12f367a29..7f658e2f668 100644 --- a/sched/sched/sched_critmonitor.c +++ b/sched/sched/sched_critmonitor.c @@ -374,7 +374,7 @@ void nxsched_switch_critmon(FAR struct tcb_s *from, FAR struct tcb_s *to) clock_t elapsed = current - from->run_start; #ifdef CONFIG_SCHED_CPULOAD_CRITMONITOR - clock_t tick = elapsed * CLOCKS_PER_SEC / perf_getfreq(); + clock_t tick = elapsed * CLK_TCK / perf_getfreq(); nxsched_critmon_cpuload(from, current, tick); #endif @@ -465,7 +465,7 @@ void nxsched_update_critmon(FAR struct tcb_s *tcb) if (tcb->task_state == TSTATE_TASK_RUNNING) { #ifdef CONFIG_SCHED_CPULOAD_CRITMONITOR - clock_t tick = elapsed * CLOCKS_PER_SEC / perf_getfreq(); + clock_t tick = elapsed * CLK_TCK / perf_getfreq(); nxsched_process_taskload_ticks(tcb, tick); #endif
