drivers: i2s_sam_ssc: fix syntax using uncrustify
After changing the logger, run uncrustify to update syntax. Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
parent
a5ae1af615
commit
0a04a134a8
1 changed files with 47 additions and 47 deletions
|
@ -38,12 +38,12 @@ LOG_MODULE_REGISTER(LOG_DOMAIN);
|
||||||
*/
|
*/
|
||||||
#if 0
|
#if 0
|
||||||
#define DCACHE_INVALIDATE(addr, size) \
|
#define DCACHE_INVALIDATE(addr, size) \
|
||||||
SCB_InvalidateDCache_by_Addr((u32_t *)addr, size)
|
SCB_InvalidateDCache_by_Addr((u32_t *)addr, size)
|
||||||
#define DCACHE_CLEAN(addr, size) \
|
#define DCACHE_CLEAN(addr, size) \
|
||||||
SCB_CleanDCache_by_Addr((u32_t *)addr, size)
|
SCB_CleanDCache_by_Addr((u32_t *)addr, size)
|
||||||
#else
|
#else
|
||||||
#define DCACHE_INVALIDATE(addr, size) { ; }
|
#define DCACHE_INVALIDATE(addr, size) {; }
|
||||||
#define DCACHE_CLEAN(addr, size) { ; }
|
#define DCACHE_CLEAN(addr, size) {; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define SAM_SSC_WORD_SIZE_BITS_MIN 2
|
#define SAM_SSC_WORD_SIZE_BITS_MIN 2
|
||||||
|
@ -103,7 +103,7 @@ struct i2s_sam_dev_data {
|
||||||
#define DEV_DATA(dev) \
|
#define DEV_DATA(dev) \
|
||||||
((struct i2s_sam_dev_data *const)(dev)->driver_data)
|
((struct i2s_sam_dev_data *const)(dev)->driver_data)
|
||||||
|
|
||||||
#define MODULO_INC(val, max) {val = (++val < max) ? val : 0; }
|
#define MODULO_INC(val, max) { val = (++val < max) ? val : 0; }
|
||||||
|
|
||||||
static struct device *get_dev_from_dma_channel(u32_t dma_channel);
|
static struct device *get_dev_from_dma_channel(u32_t dma_channel);
|
||||||
static void dma_rx_callback(struct device *, u32_t, int);
|
static void dma_rx_callback(struct device *, u32_t, int);
|
||||||
|
@ -324,8 +324,8 @@ static int set_rx_data_format(const struct i2s_sam_dev_cfg *const dev_cfg,
|
||||||
fslen = word_size_bits - 1;
|
fslen = word_size_bits - 1;
|
||||||
|
|
||||||
ssc_rcmr = SSC_RCMR_CKI
|
ssc_rcmr = SSC_RCMR_CKI
|
||||||
| (pin_rf_en ? SSC_RCMR_START_RF_FALLING : 0)
|
| (pin_rf_en ? SSC_RCMR_START_RF_FALLING : 0)
|
||||||
| SSC_RCMR_STTDLY(1);
|
| SSC_RCMR_STTDLY(1);
|
||||||
|
|
||||||
ssc_rfmr = (pin_rf_en && frame_clk_master
|
ssc_rfmr = (pin_rf_en && frame_clk_master
|
||||||
? SSC_RFMR_FSOS_NEGATIVE : SSC_RFMR_FSOS_NONE);
|
? SSC_RFMR_FSOS_NEGATIVE : SSC_RFMR_FSOS_NONE);
|
||||||
|
@ -333,7 +333,7 @@ static int set_rx_data_format(const struct i2s_sam_dev_cfg *const dev_cfg,
|
||||||
|
|
||||||
case I2S_FMT_DATA_FORMAT_PCM_SHORT:
|
case I2S_FMT_DATA_FORMAT_PCM_SHORT:
|
||||||
ssc_rcmr = (pin_rf_en ? SSC_RCMR_START_RF_FALLING : 0)
|
ssc_rcmr = (pin_rf_en ? SSC_RCMR_START_RF_FALLING : 0)
|
||||||
| SSC_RCMR_STTDLY(0);
|
| SSC_RCMR_STTDLY(0);
|
||||||
|
|
||||||
ssc_rfmr = (pin_rf_en && frame_clk_master
|
ssc_rfmr = (pin_rf_en && frame_clk_master
|
||||||
? SSC_RFMR_FSOS_POSITIVE : SSC_RFMR_FSOS_NONE);
|
? SSC_RFMR_FSOS_POSITIVE : SSC_RFMR_FSOS_NONE);
|
||||||
|
@ -343,7 +343,7 @@ static int set_rx_data_format(const struct i2s_sam_dev_cfg *const dev_cfg,
|
||||||
fslen = num_words * word_size_bits / 2 - 1;
|
fslen = num_words * word_size_bits / 2 - 1;
|
||||||
|
|
||||||
ssc_rcmr = (pin_rf_en ? SSC_RCMR_START_RF_RISING : 0)
|
ssc_rcmr = (pin_rf_en ? SSC_RCMR_START_RF_RISING : 0)
|
||||||
| SSC_RCMR_STTDLY(0);
|
| SSC_RCMR_STTDLY(0);
|
||||||
|
|
||||||
ssc_rfmr = (pin_rf_en && frame_clk_master
|
ssc_rfmr = (pin_rf_en && frame_clk_master
|
||||||
? SSC_RFMR_FSOS_POSITIVE : SSC_RFMR_FSOS_NONE);
|
? SSC_RFMR_FSOS_POSITIVE : SSC_RFMR_FSOS_NONE);
|
||||||
|
@ -353,8 +353,8 @@ static int set_rx_data_format(const struct i2s_sam_dev_cfg *const dev_cfg,
|
||||||
fslen = num_words * word_size_bits / 2 - 1;
|
fslen = num_words * word_size_bits / 2 - 1;
|
||||||
|
|
||||||
ssc_rcmr = SSC_RCMR_CKI
|
ssc_rcmr = SSC_RCMR_CKI
|
||||||
| (pin_rf_en ? SSC_RCMR_START_RF_RISING : 0)
|
| (pin_rf_en ? SSC_RCMR_START_RF_RISING : 0)
|
||||||
| SSC_RCMR_STTDLY(0);
|
| SSC_RCMR_STTDLY(0);
|
||||||
|
|
||||||
ssc_rfmr = (pin_rf_en && frame_clk_master
|
ssc_rfmr = (pin_rf_en && frame_clk_master
|
||||||
? SSC_RFMR_FSOS_POSITIVE : SSC_RFMR_FSOS_NONE);
|
? SSC_RFMR_FSOS_POSITIVE : SSC_RFMR_FSOS_NONE);
|
||||||
|
@ -368,28 +368,28 @@ static int set_rx_data_format(const struct i2s_sam_dev_cfg *const dev_cfg,
|
||||||
if (pin_rk_en) {
|
if (pin_rk_en) {
|
||||||
ssc_rcmr |= ((i2s_cfg->options & I2S_OPT_BIT_CLK_SLAVE)
|
ssc_rcmr |= ((i2s_cfg->options & I2S_OPT_BIT_CLK_SLAVE)
|
||||||
? SSC_RCMR_CKS_RK : SSC_RCMR_CKS_MCK)
|
? SSC_RCMR_CKS_RK : SSC_RCMR_CKS_MCK)
|
||||||
| ((i2s_cfg->options & I2S_OPT_BIT_CLK_GATED)
|
| ((i2s_cfg->options & I2S_OPT_BIT_CLK_GATED)
|
||||||
? SSC_RCMR_CKO_TRANSFER : SSC_RCMR_CKO_CONTINUOUS);
|
? SSC_RCMR_CKO_TRANSFER : SSC_RCMR_CKO_CONTINUOUS);
|
||||||
} else {
|
} else {
|
||||||
ssc_rcmr |= SSC_RCMR_CKS_TK
|
ssc_rcmr |= SSC_RCMR_CKS_TK
|
||||||
| SSC_RCMR_CKO_NONE;
|
| SSC_RCMR_CKO_NONE;
|
||||||
}
|
}
|
||||||
|
/* SSC_RCMR.PERIOD bit filed does not support setting the
|
||||||
|
* frame period with one bit resolution. In case the required
|
||||||
|
* frame period is an odd number set it to be one bit longer.
|
||||||
|
*/
|
||||||
ssc_rcmr |= (pin_rf_en ? 0 : SSC_RCMR_START_TRANSMIT)
|
ssc_rcmr |= (pin_rf_en ? 0 : SSC_RCMR_START_TRANSMIT)
|
||||||
/* SSC_RCMR.PERIOD bit filed does not support setting the
|
| SSC_RCMR_PERIOD((num_words * word_size_bits + 1) / 2 - 1);
|
||||||
* frame period with one bit resolution. In case the required
|
|
||||||
* frame period is an odd number set it to be one bit longer.
|
|
||||||
*/
|
|
||||||
| SSC_RCMR_PERIOD((num_words * word_size_bits + 1) / 2 - 1);
|
|
||||||
|
|
||||||
/* Receive Clock Mode Register */
|
/* Receive Clock Mode Register */
|
||||||
ssc->SSC_RCMR = ssc_rcmr;
|
ssc->SSC_RCMR = ssc_rcmr;
|
||||||
|
|
||||||
ssc_rfmr |= SSC_RFMR_DATLEN(word_size_bits - 1)
|
ssc_rfmr |= SSC_RFMR_DATLEN(word_size_bits - 1)
|
||||||
| ((i2s_cfg->format & I2S_FMT_DATA_ORDER_LSB)
|
| ((i2s_cfg->format & I2S_FMT_DATA_ORDER_LSB)
|
||||||
? 0 : SSC_RFMR_MSBF)
|
? 0 : SSC_RFMR_MSBF)
|
||||||
| SSC_RFMR_DATNB(num_words - 1)
|
| SSC_RFMR_DATNB(num_words - 1)
|
||||||
| SSC_RFMR_FSLEN(fslen)
|
| SSC_RFMR_FSLEN(fslen)
|
||||||
| SSC_RFMR_FSLEN_EXT(fslen >> 4);
|
| SSC_RFMR_FSLEN_EXT(fslen >> 4);
|
||||||
|
|
||||||
/* Receive Frame Mode Register */
|
/* Receive Frame Mode Register */
|
||||||
ssc->SSC_RFMR = ssc_rfmr;
|
ssc->SSC_RFMR = ssc_rfmr;
|
||||||
|
@ -414,15 +414,15 @@ static int set_tx_data_format(const struct i2s_sam_dev_cfg *const dev_cfg,
|
||||||
fslen = word_size_bits - 1;
|
fslen = word_size_bits - 1;
|
||||||
|
|
||||||
ssc_tcmr = SSC_TCMR_START_TF_FALLING
|
ssc_tcmr = SSC_TCMR_START_TF_FALLING
|
||||||
| SSC_TCMR_STTDLY(1);
|
| SSC_TCMR_STTDLY(1);
|
||||||
|
|
||||||
ssc_tfmr = SSC_TFMR_FSOS_NEGATIVE;
|
ssc_tfmr = SSC_TFMR_FSOS_NEGATIVE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case I2S_FMT_DATA_FORMAT_PCM_SHORT:
|
case I2S_FMT_DATA_FORMAT_PCM_SHORT:
|
||||||
ssc_tcmr = SSC_TCMR_CKI
|
ssc_tcmr = SSC_TCMR_CKI
|
||||||
| SSC_TCMR_START_TF_FALLING
|
| SSC_TCMR_START_TF_FALLING
|
||||||
| SSC_TCMR_STTDLY(0);
|
| SSC_TCMR_STTDLY(0);
|
||||||
|
|
||||||
ssc_tfmr = SSC_TFMR_FSOS_POSITIVE;
|
ssc_tfmr = SSC_TFMR_FSOS_POSITIVE;
|
||||||
break;
|
break;
|
||||||
|
@ -431,8 +431,8 @@ static int set_tx_data_format(const struct i2s_sam_dev_cfg *const dev_cfg,
|
||||||
fslen = num_words * word_size_bits / 2 - 1;
|
fslen = num_words * word_size_bits / 2 - 1;
|
||||||
|
|
||||||
ssc_tcmr = SSC_TCMR_CKI
|
ssc_tcmr = SSC_TCMR_CKI
|
||||||
| SSC_TCMR_START_TF_RISING
|
| SSC_TCMR_START_TF_RISING
|
||||||
| SSC_TCMR_STTDLY(0);
|
| SSC_TCMR_STTDLY(0);
|
||||||
|
|
||||||
ssc_tfmr = SSC_TFMR_FSOS_POSITIVE;
|
ssc_tfmr = SSC_TFMR_FSOS_POSITIVE;
|
||||||
break;
|
break;
|
||||||
|
@ -441,7 +441,7 @@ static int set_tx_data_format(const struct i2s_sam_dev_cfg *const dev_cfg,
|
||||||
fslen = num_words * word_size_bits / 2 - 1;
|
fslen = num_words * word_size_bits / 2 - 1;
|
||||||
|
|
||||||
ssc_tcmr = SSC_TCMR_START_TF_RISING
|
ssc_tcmr = SSC_TCMR_START_TF_RISING
|
||||||
| SSC_TCMR_STTDLY(0);
|
| SSC_TCMR_STTDLY(0);
|
||||||
|
|
||||||
ssc_tfmr = SSC_TFMR_FSOS_POSITIVE;
|
ssc_tfmr = SSC_TFMR_FSOS_POSITIVE;
|
||||||
break;
|
break;
|
||||||
|
@ -451,15 +451,15 @@ static int set_tx_data_format(const struct i2s_sam_dev_cfg *const dev_cfg,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* SSC_TCMR.PERIOD bit filed does not support setting the
|
||||||
|
* frame period with one bit resolution. In case the required
|
||||||
|
* frame period is an odd number set it to be one bit longer.
|
||||||
|
*/
|
||||||
ssc_tcmr |= ((i2s_cfg->options & I2S_OPT_BIT_CLK_SLAVE)
|
ssc_tcmr |= ((i2s_cfg->options & I2S_OPT_BIT_CLK_SLAVE)
|
||||||
? SSC_TCMR_CKS_TK : SSC_TCMR_CKS_MCK)
|
? SSC_TCMR_CKS_TK : SSC_TCMR_CKS_MCK)
|
||||||
| ((i2s_cfg->options & I2S_OPT_BIT_CLK_GATED)
|
| ((i2s_cfg->options & I2S_OPT_BIT_CLK_GATED)
|
||||||
? SSC_TCMR_CKO_TRANSFER : SSC_TCMR_CKO_CONTINUOUS)
|
? SSC_TCMR_CKO_TRANSFER : SSC_TCMR_CKO_CONTINUOUS)
|
||||||
/* SSC_TCMR.PERIOD bit filed does not support setting the
|
| SSC_TCMR_PERIOD((num_words * word_size_bits + 1) / 2 - 1);
|
||||||
* frame period with one bit resolution. In case the required
|
|
||||||
* frame period is an odd number set it to be one bit longer.
|
|
||||||
*/
|
|
||||||
| SSC_TCMR_PERIOD((num_words * word_size_bits + 1) / 2 - 1);
|
|
||||||
|
|
||||||
/* Transmit Clock Mode Register */
|
/* Transmit Clock Mode Register */
|
||||||
ssc->SSC_TCMR = ssc_tcmr;
|
ssc->SSC_TCMR = ssc_tcmr;
|
||||||
|
@ -470,11 +470,11 @@ static int set_tx_data_format(const struct i2s_sam_dev_cfg *const dev_cfg,
|
||||||
}
|
}
|
||||||
|
|
||||||
ssc_tfmr |= SSC_TFMR_DATLEN(word_size_bits - 1)
|
ssc_tfmr |= SSC_TFMR_DATLEN(word_size_bits - 1)
|
||||||
| ((i2s_cfg->format & I2S_FMT_DATA_ORDER_LSB)
|
| ((i2s_cfg->format & I2S_FMT_DATA_ORDER_LSB)
|
||||||
? 0 : SSC_TFMR_MSBF)
|
? 0 : SSC_TFMR_MSBF)
|
||||||
| SSC_TFMR_DATNB(num_words - 1)
|
| SSC_TFMR_DATNB(num_words - 1)
|
||||||
| SSC_TFMR_FSLEN(fslen)
|
| SSC_TFMR_FSLEN(fslen)
|
||||||
| SSC_TFMR_FSLEN_EXT(fslen >> 4);
|
| SSC_TFMR_FSLEN_EXT(fslen >> 4);
|
||||||
|
|
||||||
/* Transmit Frame Mode Register */
|
/* Transmit Frame Mode Register */
|
||||||
ssc->SSC_TFMR = ssc_tfmr;
|
ssc->SSC_TFMR = ssc_tfmr;
|
||||||
|
@ -616,7 +616,7 @@ static int i2s_sam_configure(struct device *dev, enum i2s_dir dir,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rx_stream_start(struct stream *stream, Ssc *const ssc,
|
static int rx_stream_start(struct stream *stream, Ssc *const ssc,
|
||||||
struct device *dev_dma)
|
struct device *dev_dma)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -651,7 +651,7 @@ static int rx_stream_start(struct stream *stream, Ssc *const ssc,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tx_stream_start(struct stream *stream, Ssc *const ssc,
|
static int tx_stream_start(struct stream *stream, Ssc *const ssc,
|
||||||
struct device *dev_dma)
|
struct device *dev_dma)
|
||||||
{
|
{
|
||||||
size_t mem_block_size;
|
size_t mem_block_size;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -692,7 +692,7 @@ static int tx_stream_start(struct stream *stream, Ssc *const ssc,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rx_stream_disable(struct stream *stream, Ssc *const ssc,
|
static void rx_stream_disable(struct stream *stream, Ssc *const ssc,
|
||||||
struct device *dev_dma)
|
struct device *dev_dma)
|
||||||
{
|
{
|
||||||
ssc->SSC_CR = SSC_CR_RXDIS;
|
ssc->SSC_CR = SSC_CR_RXDIS;
|
||||||
ssc->SSC_IDR = SSC_IDR_OVRUN;
|
ssc->SSC_IDR = SSC_IDR_OVRUN;
|
||||||
|
@ -704,7 +704,7 @@ static void rx_stream_disable(struct stream *stream, Ssc *const ssc,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tx_stream_disable(struct stream *stream, Ssc *const ssc,
|
static void tx_stream_disable(struct stream *stream, Ssc *const ssc,
|
||||||
struct device *dev_dma)
|
struct device *dev_dma)
|
||||||
{
|
{
|
||||||
ssc->SSC_CR = SSC_CR_TXDIS;
|
ssc->SSC_CR = SSC_CR_TXDIS;
|
||||||
ssc->SSC_IDR = SSC_IDR_TXEMPTY;
|
ssc->SSC_IDR = SSC_IDR_TXEMPTY;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue