Kconfig: fix SYS_CLOCK_HW_CYCLES_PER_SEC dependencies

Fixes the SYS_CLOCK_HW_CYCLES_PER_SEC Kconfig option dependencies such that
it can be overridden by a modified platform configuration file.  This is
particularly important for the LOAPIC timer driver as
SYS_CLOCK_HW_CYCLES_PER_SEC is dependent upon the target's CPU/bus frequency.

Change-Id: I0fb49b4c540888cb1988c76e2a711a85e756f82c
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
This commit is contained in:
Peter Mitsis 2015-07-22 16:22:25 -04:00 committed by Anas Nashif
commit d2857404f5
5 changed files with 19 additions and 9 deletions

View file

@ -41,6 +41,7 @@ config PHYS_LOAD_ADDR
default 0x00100000
config SYS_CLOCK_HW_CYCLES_PER_SEC
default 150000000 if PLATFORM_ATOM_N28XX
default 1193180 if PLATFORM_PCMINUTEIA
default 150000000 if LOAPIC_TIMER
default 25000000 if HPET_TIMER
default 1193180 if PIT

View file

@ -42,7 +42,10 @@ config PHYS_LOAD_ADDR
default 0x00100000
config SYS_CLOCK_HW_CYCLES_PER_SEC
default 25000000
default 150000000 if LOAPIC_TIMER
default 25000000 if HPET_TIMER
default 1193180 if PIT
config UART_CONSOLE_INDEX
default 1

View file

@ -62,8 +62,8 @@ After reset, the timer is initialized to zero.
* LOAPIC_TIMER_IRQ
* LOAPIC_TIMER_INT_PRI
*
* A board support package's kconf file must provide the following constants:
* CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC
* NOTE: CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC must be provided by either the
* platform configuration file or the project configuration file.
*/
#include <board.h>

View file

@ -43,6 +43,11 @@ that use timer functionality.
#ifndef _ASMLANGUAGE
#include <stdint.h>
#if defined(CONFIG_SYS_CLOCK_EXISTS) && \
(CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC == 0)
#error "SYS_CLOCK_HW_CYCLES_PER_SEC must be non-zero!"
#endif
#define sys_clock_ticks_per_sec CONFIG_SYS_CLOCK_TICKS_PER_SEC
#define sys_clock_hw_cycles_per_sec CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC

View file

@ -53,11 +53,12 @@ config SYS_CLOCK_TICKS_PER_SEC
This option specifies the frequency of the system clock in Hz.
config SYS_CLOCK_HW_CYCLES_PER_SEC
int
#The value is set by each platform's Kconfig file.
int "System clock's h/w timer frequency"
default 0
help
Frequency of the hardware timer used for the system clock
(in Hz).
This option specifies the frequency of the hardware timer used for the
system clock (in Hz). It is normally set by the platform's defconfig file
and the user should generally avoid modifying it via the menu configuration.
config SYS_CLOCK_EXISTS
bool