From eb02b28428c6a5438ca3d84b4ec0b6f83ce35888 Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Mon, 27 Aug 2018 07:26:22 -0600 Subject: [PATCH] drivers/audio: Move the I2S character driver to a dedicated folder. --- drivers/Kconfig | 1 + drivers/Makefile | 1 + drivers/README.txt | 3 +++ drivers/audio/Kconfig | 32 ----------------------- drivers/audio/Make.defs | 4 --- drivers/i2s/Kconfig | 35 +++++++++++++++++++++++++ drivers/i2s/Make.defs | 45 ++++++++++++++++++++++++++++++++ drivers/{audio => i2s}/i2schar.c | 2 +- 8 files changed, 86 insertions(+), 37 deletions(-) create mode 100644 drivers/i2s/Kconfig create mode 100644 drivers/i2s/Make.defs rename drivers/{audio => i2s}/i2schar.c (99%) diff --git a/drivers/Kconfig b/drivers/Kconfig index 2641064b9a..907ed4250e 100644 --- a/drivers/Kconfig +++ b/drivers/Kconfig @@ -137,6 +137,7 @@ menuconfig I2S See include/nuttx/audio/i2s.h for further I2S driver information. if I2S +source drivers/i2s/Kconfig endif # I2S source drivers/timers/Kconfig diff --git a/drivers/Makefile b/drivers/Makefile index b38157c11f..191c1a66df 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -55,6 +55,7 @@ include bch$(DELIM)Make.defs include can$(DELIM)Make.defs include crypto$(DELIM)Make.defs include i2c$(DELIM)Make.defs +include i2s$(DELIM)Make.defs include input$(DELIM)Make.defs include ioexpander$(DELIM)Make.defs include lcd$(DELIM)Make.defs diff --git a/drivers/README.txt b/drivers/README.txt index e8fc3efadc..e882afec29 100644 --- a/drivers/README.txt +++ b/drivers/README.txt @@ -75,6 +75,9 @@ eeprom/ i2c/ I2C drivers and support logic. See include/nuttx/i2c/i2c_master.h +i2s/ + I2S drivers and support logic. See include/nuttx/audio/i2s.h + input/ This directory holds implementations of human input device (HID) drivers. This includes such things as mouse, touchscreen, joystick, diff --git a/drivers/audio/Kconfig b/drivers/audio/Kconfig index d7fe03ec32..8f025cc716 100644 --- a/drivers/audio/Kconfig +++ b/drivers/audio/Kconfig @@ -3,38 +3,6 @@ # see the file kconfig-language.txt in the NuttX tools repository. # -config AUDIO_I2SCHAR - bool "I2S character driver (for testing only)" - default n - depends on I2S && AUDIO - ---help--- - This selection enables a simple character driver that supports I2S - transfers via a read() and write(). The intent of this driver is to - support I2S testing. It is not an audio driver but does conform to - some of the buffer management heuristics of an audio driver. It is - not suitable for use in any real driver application in its current - form. - -if AUDIO_I2SCHAR - -config AUDIO_I2SCHAR_RXTIMEOUT - int "RX timeout" - default 0 - ---help--- - This is a fixed timeout value that will be used for all receiver - transfers. This is in units of system clock ticks (configurable). - The special value of zero disables RX timeouts. Default: 0 - -config AUDIO_I2SCHAR_TXTIMEOUT - int "TX timeout" - default 0 - ---help--- - This is a fixed timeout value that will be used for all transmitter - transfers. This is in units of system clock ticks (configurable). - The special value of zero disables RX timeouts. Default: 0 - -endif # AUDIO_I2SCHAR - config AUDIO_TONE bool "Audio Tone Generator using PWM" default n diff --git a/drivers/audio/Make.defs b/drivers/audio/Make.defs index 5dfca4c3de..ab8d671621 100644 --- a/drivers/audio/Make.defs +++ b/drivers/audio/Make.defs @@ -73,10 +73,6 @@ ifeq ($(CONFIG_AUDIO_NULL),y) CSRCS += audio_null.c endif -ifeq ($(CONFIG_AUDIO_I2SCHAR),y) -CSRCS += i2schar.c -endif - ifeq ($(CONFIG_AUDIO_TONE),y) CSRCS += tone.c endif diff --git a/drivers/i2s/Kconfig b/drivers/i2s/Kconfig new file mode 100644 index 0000000000..dee7b2c20d --- /dev/null +++ b/drivers/i2s/Kconfig @@ -0,0 +1,35 @@ +# +# For a description of the syntax of this configuration file, +# see the file kconfig-language.txt in the NuttX tools repository. +# + +config AUDIO_I2SCHAR + bool "I2S character driver (for testing only)" + default n + ---help--- + This selection enables a simple character driver that supports I2S + transfers via a read() and write(). The intent of this driver is to + support I2S testing. It is not an audio driver but does conform to + some of the buffer management heuristics of an audio driver. It is + not suitable for use in any real driver application in its current + form. + +if AUDIO_I2SCHAR + +config AUDIO_I2SCHAR_RXTIMEOUT + int "RX timeout" + default 0 + ---help--- + This is a fixed timeout value that will be used for all receiver + transfers. This is in units of system clock ticks (configurable). + The special value of zero disables RX timeouts. Default: 0 + +config AUDIO_I2SCHAR_TXTIMEOUT + int "TX timeout" + default 0 + ---help--- + This is a fixed timeout value that will be used for all transmitter + transfers. This is in units of system clock ticks (configurable). + The special value of zero disables RX timeouts. Default: 0 + +endif # AUDIO_I2SCHAR diff --git a/drivers/i2s/Make.defs b/drivers/i2s/Make.defs new file mode 100644 index 0000000000..be55f1ae06 --- /dev/null +++ b/drivers/i2s/Make.defs @@ -0,0 +1,45 @@ +############################################################################ +# drivers/i2s/Make.defs +# +# Copyright (C) 2018 Pinecone Inc. All rights reserved. +# Author: Xiang Xiao +# +# 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. +# +############################################################################ + +ifeq ($(CONFIG_I2S),y) + +ifeq ($(CONFIG_AUDIO_I2SCHAR),y) +CSRCS += i2schar.c +endif + +DEPPATH += --dep-path i2s +VPATH += :i2s + +endif diff --git a/drivers/audio/i2schar.c b/drivers/i2s/i2schar.c similarity index 99% rename from drivers/audio/i2schar.c rename to drivers/i2s/i2schar.c index cb495446c4..d8031a215c 100644 --- a/drivers/audio/i2schar.c +++ b/drivers/i2s/i2schar.c @@ -1,5 +1,5 @@ /**************************************************************************** - * drivers/audio/i2schar.c + * drivers/i2s/i2schar.c * * This is a simple character driver for testing I2C. It is not an audio * driver but does conform to some of the buffer management heuristics of an