audio: fix to use i2s character device
authorBongryul Lee <bongryul.lee@samsung.com>
Wed, 16 Aug 2017 06:09:11 +0000 (15:09 +0900)
committerIvan Galkin <ivan.galkin@samsung.com>
Sun, 27 Aug 2017 06:30:54 +0000 (15:30 +0900)
Change-Id: Ie7d5c45aba10e8831506eb6d0c32b58f431fbd92
Signed-off-by: Bongryul Lee <bongryul.lee@samsung.com>
os/drivers/audio/Kconfig
os/drivers/audio/Make.defs
os/drivers/audio/i2schar.c

index 6865b26..69a0055 100755 (executable)
@@ -1,38 +1,46 @@
 #
 # For a description of the syntax of this configuration file,
 # see kconfig-language at https://www.kernel.org/doc/Documentation/kbuild/kconfig-language.txt
-#
 
-config AUDIO_NULL
-       bool "NULL audio device"
+config AUDIO_I2SCHAR
+       bool "I2S character driver (for testing only)"
        default n
-       depends on AUDIO
+       depends on I2S && AUDIO
        ---help---
-               A do-nothinig audio device driver to simplify testing of audio
-               decoders.
-
-if AUDIO_NULL
-
-config AUDIO_NULL_MSG_PRIO
-       int "Null audio device message priority"
-       default 1
+               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.
 
-config AUDIO_NULL_BUFFER_SIZE
-       int "Null audio device preferred buffer size"
-       default 8192
+if AUDIO_I2SCHAR
 
-config AUDIO_NULL_NUM_BUFFERS
-       int "Null audio device preferred number of buffers"
-       default 4
+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_NULL_WORKER_STACKSIZE
-       int "Null audio device worker thread stack size"
-       default 768
+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_NULL
+endif # AUDIO_I2SCHAR
 
-choice
-       prompt "Select how to use the alc5658"
+config AUDIO_NULL
+       bool "NULL audio device"
+       default n
+       depends on AUDIO
+       ---help---
+               A do-nothinig audio device driver to simplify testing of audio
+               decoders.
 
 config AUDIO_ALC5658
        bool "ALC5658 audio chip"
@@ -84,7 +92,7 @@ endif # AUDIO_ALC5658
 
 config AUDIO_ALC5658CHAR
        bool "ALC5658 Character Driver (for testing and demo only)"
-       depends on I2S && AUDIO && I2C
+       depends on I2S && AUDIO && I2C && !AUDIO_ALC5658 && EXAMPLES_SENSORBOARD
        ---help---
                This selection enables a simple character driver that supports ALC codec
                transfers via a read() and write() ioctl.  The intent of this driver is to
@@ -113,4 +121,22 @@ config AUDIO_ALC5658CHAR_TXTIMEOUT
 
 endif # AUDIO_ALC5658CHAR
 
-endchoice
+if AUDIO_NULL
+
+config AUDIO_NULL_MSG_PRIO
+       int "Null audio device message priority"
+       default 1
+
+config AUDIO_NULL_BUFFER_SIZE
+       int "Null audio device preferred buffer size"
+       default 8192
+
+config AUDIO_NULL_NUM_BUFFERS
+       int "Null audio device preferred number of buffers"
+       default 4
+
+config AUDIO_NULL_WORKER_STACKSIZE
+       int "Null audio device worker thread stack size"
+       default 768
+
+endif # AUDIO_NULL
index f35351a..81cbc5a 100644 (file)
@@ -60,6 +60,10 @@ ifeq ($(CONFIG_AUDIO_NULL),y)
 CSRCS += audio_null.c
 endif
 
+ifeq ($(CONFIG_AUDIO_I2SCHAR),y)
+CSRCS += i2schar.c
+endif
+
 ifeq ($(CONFIG_AUDIO_ALC5658),y)
 CSRCS += alc5658.c
 endif
index cbc75de..f3edc6f 100644 (file)
@@ -250,7 +250,7 @@ static ssize_t i2schar_read(FAR struct file *filep, FAR char *buffer, size_t buf
        if (ret < 0) {
                ret = -errno;
                DEBUGASSERT(ret < 0);
-               i2serr("ERROR: sem_wait returned: %d\n", ret);
+               lldbg("ERROR: sem_wait returned: %d\n", ret);
                goto errout_with_reference;
        }
 
@@ -258,7 +258,7 @@ static ssize_t i2schar_read(FAR struct file *filep, FAR char *buffer, size_t buf
 
        ret = I2S_RECEIVE(priv->i2s, apb, i2schar_rxcallback, priv, CONFIG_AUDIO_I2SCHAR_RXTIMEOUT);
        if (ret < 0) {
-               i2serr("ERROR: I2S_RECEIVE returned: %d\n", ret);
+               lldbg("ERROR: I2S_RECEIVE returned: %d\n", ret);
                goto errout_with_reference;
        }
 
@@ -321,7 +321,7 @@ static ssize_t i2schar_write(FAR struct file *filep, FAR const char *buffer, siz
        if (ret < 0) {
                ret = -errno;
                DEBUGASSERT(ret < 0);
-               i2serr("ERROR: sem_wait returned: %d\n", ret);
+               lldbg("ERROR: sem_wait returned: %d\n", ret);
                goto errout_with_reference;
        }
 
@@ -329,7 +329,7 @@ static ssize_t i2schar_write(FAR struct file *filep, FAR const char *buffer, siz
 
        ret = I2S_SEND(priv->i2s, apb, i2schar_txcallback, priv, CONFIG_AUDIO_I2SCHAR_TXTIMEOUT);
        if (ret < 0) {
-               i2serr("ERROR: I2S_SEND returned: %d\n", ret);
+               lldbg("ERROR: I2S_SEND returned: %d\n", ret);
                goto errout_with_reference;
        }