SAMA5 SSC: Add support for loopback mode. Plus unrelated Make.defs file from the last checkin
This commit is contained in:
parent
8b73558ad7
commit
725ef58a19
@ -6025,3 +6025,6 @@
|
||||
that must be available to audio applications. If it was left in the
|
||||
audio/ directory then it would not be available to applications in the
|
||||
NuttX Kernel build (2013-11-10).
|
||||
* arch/arm/src/sama5/sam_ssc.c and Kconfig: Add configurable support
|
||||
for SSC loopback mode (2013-11-10).
|
||||
|
||||
|
@ -1528,6 +1528,17 @@ config SAMA5_SSC0_MCKDIV_SAMPLERATE
|
||||
divider to obtain that bitrate (up to 4095). If the bitrate can be realized
|
||||
by dividing down the MCK/2, a compile time error will occur.
|
||||
|
||||
config SAMA5_SSC0_LOOPBACK
|
||||
bool "Loopback mode"
|
||||
default n
|
||||
depends on SAMA5_SSC0_TX && SAMA5_SSC0_RX
|
||||
---help---
|
||||
If both the receiver and transmitter are enabled, then the SSC can
|
||||
be configured in loopback mode. This setting selects SSC loopback
|
||||
and will cause the LOOP bit to be set in the SSC_RFMR regsiter. In
|
||||
this case, RD is connected to TD, RF is connected to TF and RK is
|
||||
connected to TK.
|
||||
|
||||
endif # SAMA5_SSC0
|
||||
|
||||
if SAMA5_SSC1
|
||||
@ -1669,6 +1680,17 @@ config SAMA5_SSC1_MCKDIV_SAMPLERATE
|
||||
divider to obtain that bitrate (up to 4095). If the bitrate can be realized
|
||||
by dividing down the MCK/2, a compile time error will occur.
|
||||
|
||||
config SAMA5_SSC1_LOOPBACK
|
||||
bool "Loopback mode"
|
||||
default n
|
||||
depends on SAMA5_SSC1_TX && SAMA5_SSC1_RX
|
||||
---help---
|
||||
If both the receiver and transmitter are enabled, then the SSC can
|
||||
be configured in loopback mode. This setting selects SSC loopback
|
||||
and will cause the LOOP bit to be set in the SSC_RFMR regsiter. In
|
||||
this case, RD is connected to TD, RF is connected to TF and RK is
|
||||
connected to TK.
|
||||
|
||||
endif # SAMA5_SSC1
|
||||
|
||||
config SAMA5_SSC_DMADEBUG
|
||||
|
@ -260,6 +260,7 @@ struct sam_ssc_s
|
||||
uint16_t master:1; /* True: Master mode transfers */
|
||||
uint16_t rx:1; /* True: RX transfers supported */
|
||||
uint16_t tx:1; /* True: TX transfers supported */
|
||||
uint16_t loopback:1; /* True: Loopback mode */
|
||||
uint16_t sscno:1; /* SSC controller number (0 or 1) */
|
||||
uint16_t rxclk:2; /* Receiver clock source. See SSC_CLKSRC_* definitions */
|
||||
uint16_t txclk:2; /* Transmitter clock source. See SSC_CLKSRC_* definitions */
|
||||
@ -2132,7 +2133,7 @@ static int ssc_rx_configure(struct sam_ssc_s *priv)
|
||||
* Currently hardcoded to:
|
||||
*
|
||||
* SSC_RFMR_DATLEN(n) 'n' deterimined by configuration
|
||||
* SSC_RFMR_LOOP Loop mode not selected
|
||||
* SSC_RFMR_LOOP Determined by configuration
|
||||
* SSC_RFMR_MSBF Most significant bit first
|
||||
* SSC_RFMR_DATNB(n) Data number 'n' per frame (hard-coded)
|
||||
* SSC_RFMR_FSLEN(0) Receive frame sync length = 0
|
||||
@ -2144,6 +2145,14 @@ static int ssc_rx_configure(struct sam_ssc_s *priv)
|
||||
regval = (SSC_RFMR_DATLEN(CONFIG_SAMA5_SSC0_DATALEN - 1) | SSC_RFMR_MSBF |
|
||||
SSC_RFMR_DATNB(SSC_DATNB - 1) | SSC_RFMR_FSLEN(0) |
|
||||
SSC_RFMR_FSOS_NONE | SSC_RFMR_FSLENEXT(0));
|
||||
|
||||
/* Loopback mode? */
|
||||
|
||||
if (priv->loopback)
|
||||
{
|
||||
regval |= SSC_RFMR_LOOP;
|
||||
}
|
||||
|
||||
ssc_putreg(priv, SAM_SSC_RFMR_OFFSET, regval);
|
||||
|
||||
#else
|
||||
@ -2614,6 +2623,15 @@ static void ssc0_configure(struct sam_ssc_s *priv)
|
||||
|
||||
#endif /* CONFIG_SAMA5_SSC0_TX */
|
||||
|
||||
/* Set/clear loopback mode */
|
||||
|
||||
#if defined(CONFIG_SAMA5_SSC0_TX) && defined(CONFIG_SAMA5_SSC0_TX) && \
|
||||
defined(SAMA5_SSC0_LOOPBACK)
|
||||
priv->loopback = true;
|
||||
#else
|
||||
priv->loopback = false;
|
||||
#endif
|
||||
|
||||
/* Does the receiver or transmitter need to have the MCK divider set up? */
|
||||
|
||||
#if defined(SSC0_HAVE_MCK2)
|
||||
@ -2740,6 +2758,15 @@ static void ssc1_configure(struct sam_ssc_s *priv)
|
||||
|
||||
#endif /* CONFIG_SAMA5_SSC1_TX */
|
||||
|
||||
/* Set/clear loopback mode */
|
||||
|
||||
#if defined(CONFIG_SAMA5_SSC1_TX) && defined(CONFIG_SAMA5_SSC1_TX) && \
|
||||
defined(SAMA5_SSC1_LOOPBACK)
|
||||
priv->loopback = true;
|
||||
#else
|
||||
priv->loopback = false;
|
||||
#endif
|
||||
|
||||
/* Does the receiver or transmitter need to have the MCK divider set up? */
|
||||
|
||||
#if defined(SSC1_HAVE_MCK2)
|
||||
|
43
libc/audio/Make.defs
Normal file
43
libc/audio/Make.defs
Normal file
@ -0,0 +1,43 @@
|
||||
############################################################################
|
||||
# libc/audio/Make.defs
|
||||
#
|
||||
# Copyright (C) 2013 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# 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_AUDIO),y)
|
||||
CSRCS += lib_buffer.c
|
||||
|
||||
# Add the misc directory to the build
|
||||
|
||||
DEPPATH += --dep-path audio
|
||||
VPATH += :audio
|
||||
endif
|
Loading…
Reference in New Issue
Block a user