From 51263d87969873692b475aa8c21bfadf82e4ee78 Mon Sep 17 00:00:00 2001 From: Zbigniew Bodek Date: Wed, 28 Oct 2020 23:41:30 +0800 Subject: [PATCH] Add kernel configuration option to enable/disable HR Timer High resolution timer can now be excluded from the build. There is currently no HR Timer implementation for other platform than HiSi. Note: HR Timer will be enabled by default Signed-off-by: Zbigniew Bodek Change-Id: I5daf8e0ceec2a17025b579513e3bd74db1040916 --- bsd/compat/linuxkpi/Makefile | 4 ++++ platform/Kconfig | 7 +++++++ platform/Makefile | 5 ++++- platform/bsp.mk | 4 +++- 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/bsd/compat/linuxkpi/Makefile b/bsd/compat/linuxkpi/Makefile index 5244c469..be7ffc70 100644 --- a/bsd/compat/linuxkpi/Makefile +++ b/bsd/compat/linuxkpi/Makefile @@ -33,6 +33,10 @@ MODULE_NAME := $(notdir $(shell pwd)) LOCAL_SRCS := $(wildcard src/*.c) +ifneq ($(LOSCFG_HRTIMER_ENABLE), y) +LOCAL_SRCS := $(filter-out src/linux_hrtimer.c, $(LOCAL_SRCS)) +endif + LOCAL_INCLUDE := \ -I $(LITEOSTOPDIR)/kernel/base/include \ -I $(LITEOSTOPDIR)/bsd/compat/linuxkpi/include diff --git a/platform/Kconfig b/platform/Kconfig index 088d3a9d..db1af3f9 100644 --- a/platform/Kconfig +++ b/platform/Kconfig @@ -56,3 +56,10 @@ config PLATFORM_BSP_GIC_V3 General Interrupt Controller version 3. endchoice + +config HRTIMER_ENABLE + bool "HR TIMER enable" + default y + help + Enable High-resolution timer support + diff --git a/platform/Makefile b/platform/Makefile index eee94a0a..34ab7750 100644 --- a/platform/Makefile +++ b/platform/Makefile @@ -33,10 +33,13 @@ MODULE_NAME := bsp LOCAL_SRCS = $(wildcard $(HWI_SRC)/*.c) \ $(wildcard $(TIMER_SRC)/*.c) \ - $(wildcard $(HRTIMER_SRC)/*.c) \ $(wildcard $(UART_SRC)/*.c) \ $(wildcard ./main.c) +ifeq ($(LOSCFG_HRTIMER_ENABLE), y) +LOCAL_SRCS += $(wildcard $(HRTIMER_SRC)/*.c) +endif + LOCAL_INCLUDE += -I $(LITEOSTOPDIR)/compat/posix/src \ -I $(LITEOSTOPDIR)/bsd/dev/random diff --git a/platform/bsp.mk b/platform/bsp.mk index 0223f82d..99889951 100644 --- a/platform/bsp.mk +++ b/platform/bsp.mk @@ -64,9 +64,11 @@ else ifeq ($(LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7), y) endif +ifeq ($(LOSCFG_HRTIMER_ENABLE), y) +HRTIMER_SRC := hw/$(HRTIMER_TYPE) +endif HWI_SRC := hw/$(HWI_TYPE) TIMER_SRC := hw/$(TIMER_TYPE) -HRTIMER_SRC := hw/$(HRTIMER_TYPE) NET_SRC := net/$(NET_TYPE) UART_SRC := uart/$(UART_TYPE) USB_SRC := usb/$(USB_TYPE)