Skip to content
Snippets Groups Projects
Commit c33fe29c authored by Gregory Nutt's avatar Gregory Nutt
Browse files

I2S character driver now supports configurable timeouts

parent a29e6f93
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment