mirror of
https://github.com/zephyrproject-rtos/zephyr
synced 2025-08-10 15:05:51 +00:00
Rewritten Xtensa CCOUNT driver along the lines of all the other new drivers. The new API permits much smaller code. Notably: The Xtensa counter is a 32 bit up-counter with a comparator register. It's in some sense the archetype of this kind of timer as it's the simplest of the bunch (everything else has quirks: NRF is very slow and 24 bit, HPET has a runtime frequency detection, RISC-V is 64 bit...). I should have written this one first. Note also that this includes a blacklist of the xtensa architecture on the tests/driver/ipm test. I'm getting spurious failures there where a k_sem_take() call with a non-zero timeout is being made out of the console output code in interrupt context. This seems to have nothing to do with the timer; I suspect it's because the old timer drivers would (incorrectly!) call z_clock_announce() in non-interrupt context in some contexts (e.g. "expiring really soon"). Apparently this test (or something in the IPM or Xtensa console code) was somehow relying on that on Xtensa. But IPM is a Quark thing and there's no particular reason to run this test there. Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
256 lines
7.5 KiB
Plaintext
256 lines
7.5 KiB
Plaintext
# Kconfig - timer driver configuration options
|
|
|
|
#
|
|
# Copyright (c) 2014-2015 Wind River Systems, Inc.
|
|
# Copyright (c) 2016 Cadence Design Systems, Inc.
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
|
|
|
|
menu "Timer Drivers"
|
|
|
|
config HPET_TIMER
|
|
bool "HPET timer"
|
|
depends on X86
|
|
select IOAPIC
|
|
select LOAPIC
|
|
select TIMER_READS_ITS_FREQUENCY_AT_RUNTIME
|
|
select TICKLESS_CAPABLE
|
|
help
|
|
This option selects High Precision Event Timer (HPET) as a
|
|
system timer.
|
|
|
|
config HPET_TIMER_LEGACY_EMULATION
|
|
bool "HPET timer legacy emulation mode"
|
|
depends on HPET_TIMER
|
|
help
|
|
This option switches HPET to legacy emulation mode.
|
|
In this mode 8254 PIT is disabled, HPET timer0 is connected
|
|
to IOAPIC IRQ2, timer1 -- to IOAPIC IRQ8.
|
|
|
|
config HPET_TIMER_DEBUG
|
|
bool "Enable HPET debug output"
|
|
depends on HPET_TIMER && PRINTK
|
|
help
|
|
This option enables HPET debugging output.
|
|
|
|
config HPET_TIMER_BASE_ADDRESS
|
|
hex "HPET Base Address"
|
|
default 0xFED00000
|
|
depends on HPET_TIMER
|
|
help
|
|
This options specifies the base address of the HPET timer device.
|
|
|
|
config HPET_TIMER_IRQ
|
|
int "HPET Timer IRQ"
|
|
default 20
|
|
depends on HPET_TIMER
|
|
help
|
|
This option specifies the IRQ used by the HPET timer.
|
|
|
|
config HPET_TIMER_IRQ_PRIORITY
|
|
int "HPET Timer IRQ Priority"
|
|
default 4
|
|
depends on HPET_TIMER
|
|
help
|
|
This option specifies the IRQ priority used by the HPET timer.
|
|
|
|
choice
|
|
depends on HPET_TIMER
|
|
prompt "HPET Interrupt Trigger Condition"
|
|
default HPET_TIMER_FALLING_EDGE
|
|
|
|
config HPET_TIMER_FALLING_EDGE
|
|
bool "Falling Edge"
|
|
help
|
|
This option signifies that the HPET timer uses falling edge interrupts.
|
|
|
|
config HPET_TIMER_RISING_EDGE
|
|
bool "Rising Edge"
|
|
help
|
|
This option signifies that the HPET timer uses rising edge interrupts.
|
|
|
|
config HPET_TIMER_LEVEL_HIGH
|
|
bool "Level High"
|
|
help
|
|
This option signifies that the HPET timer uses level high interrupts.
|
|
|
|
config HPET_TIMER_LEVEL_LOW
|
|
bool "Level Low"
|
|
help
|
|
This option signifies that the HPET timer uses level low interrupts.
|
|
|
|
endchoice
|
|
|
|
config LOAPIC_TIMER
|
|
bool "LOAPIC timer"
|
|
depends on (LOAPIC || MVIC) && X86
|
|
help
|
|
This option selects LOAPIC timer as a system timer.
|
|
|
|
config LOAPIC_TIMER_IRQ
|
|
int "Local APIC Timer IRQ"
|
|
default 24
|
|
depends on LOAPIC_TIMER
|
|
help
|
|
This option specifies the IRQ used by the LOAPIC timer.
|
|
|
|
config LOAPIC_TIMER_IRQ_PRIORITY
|
|
int "Local APIC Timer IRQ Priority"
|
|
default 2
|
|
depends on LOAPIC_TIMER
|
|
help
|
|
This options specifies the IRQ priority used by the LOAPIC timer.
|
|
|
|
config TSC_CYCLES_PER_SEC
|
|
int "Frequency of x86 CPU timestamp counter"
|
|
default 0
|
|
depends on LOAPIC_TIMER
|
|
help
|
|
The x86 implementation of LOAPIC k_cycle_get_32() relies on the x86 TSC.
|
|
This runs at the CPU speed and not the bus speed. If set to 0, the
|
|
value of CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC will be used instead;
|
|
many MCUs these values are the same.
|
|
|
|
config ARCV2_TIMER
|
|
bool "ARC Timer"
|
|
default y
|
|
depends on ARC
|
|
help
|
|
This module implements a kernel device driver for the ARCv2 processor timer 0
|
|
and provides the standard "system clock driver" interfaces.
|
|
|
|
config ARCV2_TIMER_IRQ_PRIORITY
|
|
int "ARC timer interrupt priority"
|
|
default 0
|
|
depends on ARCV2_TIMER
|
|
help
|
|
This option specifies the IRQ priority used by the ARC timer. Lower
|
|
values have higher priority.
|
|
|
|
config CORTEX_M_SYSTICK
|
|
bool "Cortex-M SYSTICK timer"
|
|
default y
|
|
depends on CPU_HAS_SYSTICK
|
|
select TICKLESS_CAPABLE
|
|
help
|
|
This module implements a kernel device driver for the Cortex-M processor
|
|
SYSTICK timer and provides the standard "system clock driver" interfaces.
|
|
|
|
config ALTERA_AVALON_TIMER
|
|
bool "Altera Avalon Interval Timer"
|
|
default y
|
|
depends on NIOS2
|
|
help
|
|
This module implements a kernel device driver for the Altera Avalon
|
|
Interval Timer as described in the Embedded IP documentation, for use
|
|
with Nios II and possibly other Altera soft CPUs. It provides the
|
|
standard "system clock driver" interfaces.
|
|
|
|
config NRF_RTC_TIMER
|
|
bool "nRF Real Time Counter (NRF_RTC1) Timer"
|
|
default y
|
|
depends on CLOCK_CONTROL_NRF5
|
|
select TICKLESS_CAPABLE
|
|
help
|
|
This module implements a kernel device driver for the nRF Real Time
|
|
Counter NRF_RTC1 and provides the standard "system clock driver"
|
|
interfaces.
|
|
|
|
config PULPINO_TIMER
|
|
bool "pulpino Timer"
|
|
default y
|
|
depends on SOC_RISCV32_PULPINO
|
|
help
|
|
This module implements a kernel device driver for the pulpino processor
|
|
timer driver. It provides the standard "system clock driver" interfaces.
|
|
|
|
config RISCV_MACHINE_TIMER
|
|
bool "RISCV Machine Timer"
|
|
depends on SOC_FAMILY_RISCV_PRIVILEGE
|
|
select TICKLESS_CAPABLE
|
|
help
|
|
This module implements a kernel device driver for the generic RISCV machine
|
|
timer driver. It provides the standard "system clock driver" interfaces.
|
|
|
|
config NATIVE_POSIX_TIMER
|
|
bool "(POSIX) native_posix timer driver"
|
|
default y
|
|
depends on BOARD_NATIVE_POSIX
|
|
help
|
|
This module implements a kernel device driver for the native_posix HW timer
|
|
model
|
|
|
|
config XTENSA_TIMER
|
|
bool "Xtensa timer support"
|
|
depends on XTENSA
|
|
default y
|
|
select TICKLESS_CAPABLE
|
|
help
|
|
Enables a system timer driver for Xtensa based on the CCOUNT
|
|
and CCOMPARE special registers.
|
|
|
|
config XTENSA_TIMER_ID
|
|
int "System timer CCOMPAREn register index"
|
|
default 1
|
|
depends on XTENSA_TIMER
|
|
help
|
|
Index of the CCOMPARE register (and associated interrupt)
|
|
used for the system timer. Xtensa CPUs have hard-configured
|
|
interrupt priorities associated with each timer, and some of
|
|
them can be unmaskable (and thus not usable by OS code that
|
|
need synchronization, like the timer subsystem!). Choose
|
|
carefully. Generally you want the timer with the highest
|
|
priority maskable interrupt.
|
|
|
|
config SYSTEM_CLOCK_DISABLE
|
|
bool "API to disable system clock"
|
|
help
|
|
This option enables the sys_clock_disable() API in the kernel. It is
|
|
needed by some subsystems (which will automatically select it), but is
|
|
rarely needed by applications.
|
|
|
|
config TIMER_READS_ITS_FREQUENCY_AT_RUNTIME
|
|
bool "Timer queries its hardware to find its frequency at runtime"
|
|
help
|
|
The drivers select this option automatically when needed. Do not modify
|
|
this unless you have a very good reason for it.
|
|
|
|
config SYSTEM_CLOCK_INIT_PRIORITY
|
|
int "System clock driver initialization priority"
|
|
default 0
|
|
help
|
|
This options can be used to set a specific initialization priority
|
|
value for the system clock driver. As driver initialization might need
|
|
the clock to be running already, you should let the default value as it
|
|
is (0).
|
|
|
|
config TICKLESS_CAPABLE
|
|
bool "Timer driver supports tickless operation"
|
|
help
|
|
Timer drivers should select this flag if they are capable of
|
|
supporting tickless operation. That is, a call to
|
|
z_clock_set_timeout() with a number of ticks greater than
|
|
one should be expected not to produce a call to
|
|
z_clock_announce() (really, not to produce an interrupt at
|
|
all) until the specified expiration.
|
|
|
|
config QEMU_TICKLESS_WORKAROUND
|
|
bool "Disable tickless on qemu due to asynchrony bug"
|
|
depends on QEMU_TARGET && TICKLESS_KERNEL
|
|
help
|
|
Qemu (without -icount) has trouble keeping time when the
|
|
host process needs to timeshare. The host OS will routinely
|
|
schedule out a process at timescales equivalent to the guest
|
|
tick rate. With traditional ticks delivered regularly by
|
|
the hardware, that's mostly OK as it looks like a late
|
|
interrupt. But in tickless mode, the driver needs some CPU
|
|
in order to schedule the tick in the first place. If that
|
|
gets delayed across a tick boundary, time gets wonky. This
|
|
tunable is a hint to the driver to disable tickless
|
|
accounting on qemu. Use it only on tests that are known to
|
|
have problems.
|
|
|
|
endmenu
|