mirror of
https://github.com/apache/nuttx.git
synced 2026-06-03 22:20:31 +08:00
Move timer-related drivers from drivers/ to drivers/timers.
This commit is contained in:
+1
-82
@@ -220,88 +220,7 @@ menuconfig I2S
|
|||||||
if I2S
|
if I2S
|
||||||
endif # I2S
|
endif # I2S
|
||||||
|
|
||||||
menuconfig RTC
|
source drivers/timers/Kconfig
|
||||||
bool "RTC Driver Support"
|
|
||||||
default n
|
|
||||||
---help---
|
|
||||||
This selection enables configuration of a real time clock (RTCdriver.
|
|
||||||
See include/nuttx/rtc.h for further RTC driver information.
|
|
||||||
Most RTC drivers are MCU specific and may require other specific
|
|
||||||
settings.
|
|
||||||
|
|
||||||
if RTC
|
|
||||||
|
|
||||||
config RTC_DATETIME
|
|
||||||
bool "Date/Time RTC Support"
|
|
||||||
default n
|
|
||||||
---help---
|
|
||||||
There are two general types of RTC: (1) A simple battery backed
|
|
||||||
counter that keeps the time when power is down, and (2) a full
|
|
||||||
date / time RTC the provides the date and time information, often in
|
|
||||||
BCD format. If RTC_DATETIME is selected, it specifies this second kind
|
|
||||||
of RTC. In this case, the RTC is used to "seed" the normal NuttX timer
|
|
||||||
and the NuttX system timer provides for higher resolution time.
|
|
||||||
|
|
||||||
if !RTC_DATETIME
|
|
||||||
|
|
||||||
config RTC_HIRES
|
|
||||||
bool "Hi-Res RTC Support"
|
|
||||||
default n
|
|
||||||
---help---
|
|
||||||
If RTC_DATETIME not selected, then the simple, battery backed counter
|
|
||||||
is used. There are two different implementations of such simple
|
|
||||||
counters based on the time resolution of the counter: The typical RTC
|
|
||||||
keeps time to resolution of 1 second, usually supporting a 32-bit
|
|
||||||
time_t value. In this case, the RTC is used to "seed" the normal NuttX
|
|
||||||
timer and the NuttX timer provides for higherresoution time.
|
|
||||||
|
|
||||||
If RTC_HIRES is enabled in the NuttX configuration, then the RTC
|
|
||||||
provides higher resolution time and completely replaces the system
|
|
||||||
timer for purpose of date and time.
|
|
||||||
|
|
||||||
config RTC_FREQUENCY
|
|
||||||
int "Hi-Res RTC frequency"
|
|
||||||
default 1
|
|
||||||
depends on RTC_HIRES
|
|
||||||
---help---
|
|
||||||
If RTC_HIRES is defined, then the frequency of the high resolution RTC
|
|
||||||
must be provided. If RTC_HIRES is not defined, RTC_FREQUENCY is
|
|
||||||
assumed to be one Hz.
|
|
||||||
|
|
||||||
endif # !RTC_DATETIME
|
|
||||||
|
|
||||||
config RTC_ALARM
|
|
||||||
bool "RTC Alarm Support"
|
|
||||||
default n
|
|
||||||
---help---
|
|
||||||
Enable if the RTC hardware supports setting of an alarm. A callback
|
|
||||||
function will be executed when the alarm goes off.
|
|
||||||
|
|
||||||
endif # RTC
|
|
||||||
|
|
||||||
menuconfig WATCHDOG
|
|
||||||
bool "Watchdog Timer Support"
|
|
||||||
default n
|
|
||||||
---help---
|
|
||||||
This selection enables building of the "upper-half" watchdog timer
|
|
||||||
driver. See include/nuttx/watchdog.h for further watchdog timer driver
|
|
||||||
information.
|
|
||||||
|
|
||||||
if WATCHDOG
|
|
||||||
|
|
||||||
config WATCHDOG_DEVPATH
|
|
||||||
string "Watchdog Device Path"
|
|
||||||
default "/dev/watchdog0"
|
|
||||||
|
|
||||||
endif # WATCHDOG
|
|
||||||
|
|
||||||
menuconfig TIMER
|
|
||||||
bool "Timer Support"
|
|
||||||
default n
|
|
||||||
---help---
|
|
||||||
This selection enables building of the "upper-half" timer
|
|
||||||
driver. See include/nuttx/timer.h for further timer driver
|
|
||||||
information.
|
|
||||||
|
|
||||||
menuconfig ANALOG
|
menuconfig ANALOG
|
||||||
bool "Analog Device(ADC/DAC) Support"
|
bool "Analog Device(ADC/DAC) Support"
|
||||||
|
|||||||
+1
-8
@@ -65,6 +65,7 @@ include sercomm$(DELIM)Make.defs
|
|||||||
include serial$(DELIM)Make.defs
|
include serial$(DELIM)Make.defs
|
||||||
include spi$(DELIM)Make.defs
|
include spi$(DELIM)Make.defs
|
||||||
include syslog$(DELIM)Make.defs
|
include syslog$(DELIM)Make.defs
|
||||||
|
include timers$(DELIM)Make.defs
|
||||||
include usbdev$(DELIM)Make.defs
|
include usbdev$(DELIM)Make.defs
|
||||||
include usbhost$(DELIM)Make.defs
|
include usbhost$(DELIM)Make.defs
|
||||||
include video$(DELIM)Make.defs
|
include video$(DELIM)Make.defs
|
||||||
@@ -91,14 +92,6 @@ endif
|
|||||||
ifeq ($(CONFIG_PWM),y)
|
ifeq ($(CONFIG_PWM),y)
|
||||||
CSRCS += pwm.c
|
CSRCS += pwm.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_WATCHDOG),y)
|
|
||||||
CSRCS += watchdog.c
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(CONFIG_TIMER),y)
|
|
||||||
CSRCS += timer.c
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
AOBJS = $(ASRCS:.S=$(OBJEXT))
|
AOBJS = $(ASRCS:.S=$(OBJEXT))
|
||||||
|
|||||||
@@ -0,0 +1,95 @@
|
|||||||
|
#
|
||||||
|
# For a description of the syntax of this configuration file,
|
||||||
|
# see misc/tools/kconfig-language.txt.
|
||||||
|
#
|
||||||
|
|
||||||
|
menuconfig TIMER
|
||||||
|
bool "Timer Support"
|
||||||
|
default n
|
||||||
|
---help---
|
||||||
|
This selection enables building of the "upper-half" timer
|
||||||
|
driver. See include/nuttx/timer.h for further timer driver
|
||||||
|
information.
|
||||||
|
|
||||||
|
menuconfig RTC
|
||||||
|
bool "RTC Driver Support"
|
||||||
|
default n
|
||||||
|
---help---
|
||||||
|
This selection enables configuration of a real time clock (RTCdriver.
|
||||||
|
See include/nuttx/rtc.h for further RTC driver information.
|
||||||
|
Most RTC drivers are MCU specific and may require other specific
|
||||||
|
settings.
|
||||||
|
|
||||||
|
if RTC
|
||||||
|
|
||||||
|
config RTC_DATETIME
|
||||||
|
bool "Date/Time RTC Support"
|
||||||
|
default n
|
||||||
|
---help---
|
||||||
|
There are two general types of RTC: (1) A simple battery backed
|
||||||
|
counter that keeps the time when power is down, and (2) a full
|
||||||
|
date / time RTC the provides the date and time information, often in
|
||||||
|
BCD format. If RTC_DATETIME is selected, it specifies this second kind
|
||||||
|
of RTC. In this case, the RTC is used to "seed" the normal NuttX timer
|
||||||
|
and the NuttX system timer provides for higher resolution time.
|
||||||
|
|
||||||
|
if !RTC_DATETIME
|
||||||
|
|
||||||
|
config RTC_HIRES
|
||||||
|
bool "Hi-Res RTC Support"
|
||||||
|
default n
|
||||||
|
---help---
|
||||||
|
If RTC_DATETIME not selected, then the simple, battery backed counter
|
||||||
|
is used. There are two different implementations of such simple
|
||||||
|
counters based on the time resolution of the counter: The typical RTC
|
||||||
|
keeps time to resolution of 1 second, usually supporting a 32-bit
|
||||||
|
time_t value. In this case, the RTC is used to "seed" the normal NuttX
|
||||||
|
timer and the NuttX timer provides for higherresoution time.
|
||||||
|
|
||||||
|
If RTC_HIRES is enabled in the NuttX configuration, then the RTC
|
||||||
|
provides higher resolution time and completely replaces the system
|
||||||
|
timer for purpose of date and time.
|
||||||
|
|
||||||
|
config RTC_FREQUENCY
|
||||||
|
int "Hi-Res RTC frequency"
|
||||||
|
default 1
|
||||||
|
depends on RTC_HIRES
|
||||||
|
---help---
|
||||||
|
If RTC_HIRES is defined, then the frequency of the high resolution RTC
|
||||||
|
must be provided. If RTC_HIRES is not defined, RTC_FREQUENCY is
|
||||||
|
assumed to be one Hz.
|
||||||
|
|
||||||
|
endif # !RTC_DATETIME
|
||||||
|
|
||||||
|
config RTC_ALARM
|
||||||
|
bool "RTC Alarm Support"
|
||||||
|
default n
|
||||||
|
---help---
|
||||||
|
Enable if the RTC hardware supports setting of an alarm. A callback
|
||||||
|
function will be executed when the alarm goes off.
|
||||||
|
|
||||||
|
config RTC_DRIVER
|
||||||
|
bool "RTC Driver Support"
|
||||||
|
default n
|
||||||
|
---help---
|
||||||
|
This selection enables building of the "upper-half" RTC
|
||||||
|
driver. See include/nuttx/rtc.h for further RTC driver
|
||||||
|
information.
|
||||||
|
|
||||||
|
endif # RTC
|
||||||
|
|
||||||
|
menuconfig WATCHDOG
|
||||||
|
bool "Watchdog Timer Support"
|
||||||
|
default n
|
||||||
|
---help---
|
||||||
|
This selection enables building of the "upper-half" watchdog timer
|
||||||
|
driver. See include/nuttx/watchdog.h for further watchdog timer driver
|
||||||
|
information.
|
||||||
|
|
||||||
|
if WATCHDOG
|
||||||
|
|
||||||
|
config WATCHDOG_DEVPATH
|
||||||
|
string "Watchdog Device Path"
|
||||||
|
default "/dev/watchdog0"
|
||||||
|
|
||||||
|
endif # WATCHDOG
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
############################################################################
|
||||||
|
# drivers/timers/Make.defs
|
||||||
|
# These drivers support various timer devices
|
||||||
|
#
|
||||||
|
# Copyright (C) 20125Gregory Nutt. All rights reserved.
|
||||||
|
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions
|
||||||
|
# are met:
|
||||||
|
#
|
||||||
|
# 1. Redistributions of source code must retain the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer.
|
||||||
|
# 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer in
|
||||||
|
# the documentation and/or other materials provided with the
|
||||||
|
# distribution.
|
||||||
|
# 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
|
# used to endorse or promote products derived from this software
|
||||||
|
# without specific prior written permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||||
|
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||||
|
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||||
|
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||||
|
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||||
|
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||||
|
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
# POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
#
|
||||||
|
############################################################################
|
||||||
|
|
||||||
|
# Include timer drivers
|
||||||
|
|
||||||
|
TMRDEPPATH =
|
||||||
|
TMRVPATH =
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_WATCHDOG),y)
|
||||||
|
CSRCS += watchdog.c
|
||||||
|
TMRDEPPATH = --dep-path timers
|
||||||
|
TMRVPATH = :timers
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_TIMER),y)
|
||||||
|
CSRCS += timer.c
|
||||||
|
TMRDEPPATH = --dep-path timers
|
||||||
|
TMRVPATH = :timers
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_RTC_DRIVER),y)
|
||||||
|
CSRCS += rtc.c
|
||||||
|
TMRDEPPATH = --dep-path timers
|
||||||
|
TMRVPATH = :timers
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Include timer build support (if any were selected)
|
||||||
|
|
||||||
|
DEPPATH += $(TMRDEPPATH)
|
||||||
|
VPATH += $(TMRVPATH)
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* drivers/timer.c
|
* drivers/timers/timer.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
|
||||||
* Authors: Gregory Nutt <gnutt@nuttx.org>
|
* Authors: Gregory Nutt <gnutt@nuttx.org>
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* drivers/watchdog.c
|
* drivers/timers/watchdog.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
Reference in New Issue
Block a user