drivers/pwm: Move pwm.c into pwm folder

This commit is contained in:
Xiang Xiao 2018-08-27 07:17:34 -06:00 committed by Gregory Nutt
parent ff1cba6ab5
commit 0308a86435
6 changed files with 93 additions and 42 deletions

View File

@ -108,37 +108,7 @@ menuconfig PWM
See include/nuttx/drivers/pwm.h for further PWM driver information.
if PWM
config PWM_PULSECOUNT
bool "PWM Pulse Count Support"
default n
depends on ARCH_HAVE_PWM_PULSECOUNT
---help---
Some hardware will support generation of a fixed number of pulses.
This might be used, for example to support a stepper motor. If the
hardware will support a fixed pulse count, then this configuration
should be set to enable the capability.
config PWM_MULTICHAN
bool "PWM Multiple Output Channel Support"
default n
depends on ARCH_HAVE_PWM_MULTICHAN
depends on !PWM_PULSECOUNT
---help---
Enables support for multiple output channels per timer.
if PWM_MULTICHAN
config PWM_NCHANNELS
int "Number of Output Channels Per Timer"
default 1
range 1 6
---help---
Specifies the number of output channels per timer. Each timer
may support fewer output channels than this value.
endif # PWM_MULTICHAN
source drivers/pwm/Kconfig
endif # PWM
config ARCH_HAVE_I2CRESET

View File

@ -67,6 +67,7 @@ include eeprom$(DELIM)Make.defs
include net$(DELIM)Make.defs
include pipes$(DELIM)Make.defs
include power$(DELIM)Make.defs
include pwm$(DELIM)Make.defs
include sensors$(DELIM)Make.defs
include serial$(DELIM)Make.defs
include spi$(DELIM)Make.defs
@ -94,11 +95,6 @@ ifeq ($(CONFIG_DRVR_READAHEAD),y)
endif
endif
endif
ifeq ($(CONFIG_PWM),y)
CSRCS += pwm.c
endif
endif # CONFIG_NFILE_DESCRIPTORS != 0
AOBJS = $(ASRCS:.S=$(OBJEXT))

View File

@ -18,11 +18,6 @@ dev_null.c, dev_urandom, and dev_zero.c
that should be called if you want to register these devices
(devnull_register(), devurandom_register(), and devzero_register()).
pwm.c
Provides the "upper half" of a pulse width modulation (PWM) driver.
The "lower half" of the PWM driver is provided by device-specific
logic. See include/nuttx/drivers/pwm.h for usage information.
ramdisk.c
Can be used to set up a block of memory or (read-only) FLASH as
a block driver that can be mounted as a files system. See
@ -130,6 +125,11 @@ power/
and by placing drivers into reduce power usage modes when the
drivers are not active.
pwm/
Provides the "upper half" of a pulse width modulation (PWM) driver.
The "lower half" of the PWM driver is provided by device-specific
logic. See include/nuttx/drivers/pwm.h for usage information.
sensors/
Drivers for various sensors. A sensor driver differs little from
other types of drivers other than they are use to provide measuresments

38
drivers/pwm/Kconfig Normal file
View File

@ -0,0 +1,38 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#
if PWM
config PWM_PULSECOUNT
bool "PWM Pulse Count Support"
default n
depends on ARCH_HAVE_PWM_PULSECOUNT
---help---
Some hardware will support generation of a fixed number of pulses.
This might be used, for example to support a stepper motor. If the
hardware will support a fixed pulse count, then this configuration
should be set to enable the capability.
config PWM_MULTICHAN
bool "PWM Multiple Output Channel Support"
default n
depends on ARCH_HAVE_PWM_MULTICHAN
depends on !PWM_PULSECOUNT
---help---
Enables support for multiple output channels per timer.
if PWM_MULTICHAN
config PWM_NCHANNELS
int "Number of Output Channels Per Timer"
default 1
range 1 6
---help---
Specifies the number of output channels per timer. Each timer
may support fewer output channels than this value.
endif # PWM_MULTICHAN
endif # PWM

47
drivers/pwm/Make.defs Normal file
View File

@ -0,0 +1,47 @@
############################################################################
# drivers/pwm/Make.defs
#
# Copyright (C) 2017 Pinecone Inc. All rights reserved.
# Author: Xiang Xiao <xiaoxiang@pinecone.net>
#
# 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.
#
############################################################################
# Don't build anything if there is no PWM support
ifeq ($(CONFIG_PWM),y)
CSRCS += pwm.c
# Include PWM device driver build support
DEPPATH += --dep-path pwm
VPATH += :pwm
CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)$(DELIM)drivers$(DELIM)pwm}
endif

View File

@ -1,5 +1,5 @@
/****************************************************************************
* drivers/pwm.c
* drivers/pwm/pwm.c
*
* Copyright (C) 2011-2013, 2016-2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>