diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2013-11-12 10:18:49 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2013-11-12 10:18:49 -0600 |
commit | 882abf206563fce4c24505a0c2d1c91719bbd575 (patch) | |
tree | 78ed4fb2db9c00bef883bf637ef2b8a53e14f67a /nuttx/drivers/audio | |
parent | 8855a5a6fc8285ad13e3a8ac75df665ae79a1fe1 (diff) | |
download | px4-nuttx-882abf206563fce4c24505a0c2d1c91719bbd575.tar.gz px4-nuttx-882abf206563fce4c24505a0c2d1c91719bbd575.tar.bz2 px4-nuttx-882abf206563fce4c24505a0c2d1c91719bbd575.zip |
I2S character driver now supports configurable timeouts
Diffstat (limited to 'nuttx/drivers/audio')
-rw-r--r-- | nuttx/drivers/audio/Kconfig | 20 | ||||
-rw-r--r-- | nuttx/drivers/audio/i2schar.c | 16 |
2 files changed, 34 insertions, 2 deletions
diff --git a/nuttx/drivers/audio/Kconfig b/nuttx/drivers/audio/Kconfig index a29b14e54..b94df1d3d 100644 --- a/nuttx/drivers/audio/Kconfig +++ b/nuttx/drivers/audio/Kconfig @@ -15,6 +15,26 @@ config AUDIO_I2SCHAR 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 VS1053 bool "VS1053 codec chip" default n diff --git a/nuttx/drivers/audio/i2schar.c b/nuttx/drivers/audio/i2schar.c index e3f6986b1..4b55f3799 100644 --- a/nuttx/drivers/audio/i2schar.c +++ b/nuttx/drivers/audio/i2schar.c @@ -61,7 +61,17 @@ /**************************************************************************** * Private Definitions ****************************************************************************/ +/* Configuration ************************************************************/ +#ifndef CONFIG_AUDIO_I2SCHAR_RXTIMEOUT +# define CONFIG_AUDIO_I2SCHAR_RXTIMEOUT 0 +#endif + +#ifndef CONFIG_AUDIO_I2SCHAR_TXTIMEOUT +# define CONFIG_AUDIO_I2SCHAR_TXTIMEOUT 0 +#endif + +/* Device naming ************************************************************/ #define DEVNAME_FMT "/dev/i2schar%d" #define DEVNAME_FMTLEN (12 + 3 + 1) @@ -268,7 +278,8 @@ static ssize_t i2schar_read(FAR struct file *filep, FAR char *buffer, /* Give the buffer to the I2S driver */ - ret = I2S_RECEIVE(priv->i2s, apb, i2schar_rxcallback, priv, 0); + ret = I2S_RECEIVE(priv->i2s, apb, i2schar_rxcallback, priv, + CONFIG_AUDIO_I2SCHAR_RXTIMEOUT); if (ret < 0) { i2sdbg("ERROR: I2S_RECEIVE returned: %d\n", ret); @@ -342,7 +353,8 @@ static ssize_t i2schar_write(FAR struct file *filep, FAR const char *buffer, /* Give the audio buffer to the I2S driver */ - ret = I2S_SEND(priv->i2s, apb, i2schar_txcallback, priv, 0); + ret = I2S_SEND(priv->i2s, apb, i2schar_txcallback, priv, + CONFIG_AUDIO_I2SCHAR_TXTIMEOUT); if (ret < 0) { i2sdbg("ERROR: I2S_SEND returned: %d\n", ret); |