Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ export ARCH_INCDIR = \

PLATFORM_INCDIR = -I $(SRC_DIR)/platform/$(PLATFORM)/include

if BUILD_CAVS
PLATFORM_INCDIR += \
-I $(SRC_DIR)/platform/intel/include
endif

if XCC
PLATFORM_INCDIR += \
-I $(ROOT_DIR)/arch/include
Expand Down
17 changes: 11 additions & 6 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -133,16 +133,16 @@ AC_ARG_WITH([cmocka-prefix],
AS_HELP_STRING([--with-cmocka-prefix], [Path to cmocka]),
[], [with_cmocka_prefix="no"])

# in case of native build, cmocka may be installed
HAVE_CMOCKA_PKG=no
AC_CHECK_LIB(cmocka, _cmocka_run_group_tests, [HAVE_CMOCKA_PKG=yes])

if test "x$with_arch" != "xno"; then
if test "x$with_cmocka_prefix" = "xno"; then
if test "$ARCH" = "xtensa"; then
AC_MSG_WARN([Need cmocka to run unit tests. Path to cmocka not specified. Please use --with-cmocka-prefix option.])
else
# in case of native build, cmocka may be installed
PKG_CHECK_EXISTS(cmocka,
[],
[AC_MSG_WARN([Need cmocka to run unit tests. No cmocka library found. Please install cmocka or use --with-cmocka-prefix option.])]
)
elif test "x$HAVE_CMOCKA_PKG" = "xno"; then
AC_MSG_WARN([Need cmocka to run unit tests. No cmocka library found. Please install cmocka or use --with-cmocka-prefix option.])
fi
else
CMOCKA_PREFIX="$with_cmocka_prefix"
Expand Down Expand Up @@ -283,6 +283,7 @@ AM_CONDITIONAL(BUILD_BROADWELL, test "$FW_NAME" = "bdw")
AM_CONDITIONAL(BUILD_APOLLOLAKE, test "$FW_NAME" = "apl")
AM_CONDITIONAL(BUILD_CANNONLAKE, test "$FW_NAME" = "cnl")
AM_CONDITIONAL(BUILD_BOOTLOADER, test "$FW_NAME" = "apl" -o "$FW_NAME" = "cnl")
AM_CONDITIONAL(BUILD_CAVS, test "$FW_NAME" = "apl" -o "$FW_NAME" = "cnl")
AM_CONDITIONAL(BUILD_MODULE, test "$FW_NAME" = "apl" -o "$FW_NAME" = "cnl")
AM_CONDITIONAL(BUILD_APL_SSP, test "$FW_NAME" = "apl" -o "$FW_NAME" = "cnl")

Expand Down Expand Up @@ -467,6 +468,10 @@ AC_CONFIG_FILES([
src/platform/cannonlake/include/arch/xtensa/Makefile
src/platform/cannonlake/include/arch/xtensa/config/Makefile
src/platform/cannonlake/include/platform/Makefile
src/platform/intel/Makefile
src/platform/intel/include/Makefile
src/platform/intel/include/platform/Makefile
src/platform/intel/include/platform/cavs/Makefile
test/Makefile
test/cmocka/Makefile
])
Expand Down
3 changes: 2 additions & 1 deletion doc/sof_uapi.doxygen.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ GENERATE_MAN = NO
GENERATE_XML = YES

CASE_SENSE_NAMES = NO
INPUT = @top_srcdir@/src/include/uapi
INPUT = @top_srcdir@/src/include/uapi \
@top_srcdir@/src/include/sof
EXCLUDE =
RECURSIVE = YES
FILE_PATTERNS = *.c *.h
Expand Down
24 changes: 12 additions & 12 deletions src/arch/xtensa/include/arch/spinlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,29 +49,29 @@ static inline void arch_spinlock_init(spinlock_t *lock)

static inline void arch_spin_lock(spinlock_t *lock)
{
uint32_t result;
uint32_t result, current;

__asm__ __volatile__(
" movi %0, 0\n"
" wsr %0, scompare1\n"
"1: movi %0, 1\n"
" s32c1i %0, %1, 0\n"
" bnez %0, 1b\n"
: "=&a" (result)
"1: l32i %1, %2, 0\n"
" wsr %1, scompare1\n"
" movi %0, 1\n"
" s32c1i %0, %2, 0\n"
" bne %0, %1, 1b\n"
: "=&a" (result), "=&a" (current)
: "a" (&lock->lock)
: "memory");
}

static inline int arch_try_lock(spinlock_t *lock)
{
uint32_t result;
uint32_t result, current;

__asm__ __volatile__(
" movi %0, 0\n"
" wsr %0, scompare1\n"
" l32i %1, %2, 0\n"
" wsr %1, scompare1\n"
" movi %0, 1\n"
" s32c1i %0, %1, 0\n"
: "=&a" (result)
" s32c1i %0, %2, 0\n"
: "=&a" (result), "=&a" (current)
: "a" (&lock->lock)
: "memory");

Expand Down
110 changes: 101 additions & 9 deletions src/audio/volume.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@
* Tomasz Lauda <tomasz.lauda@linux.intel.com>
*/

/**
* \file audio/volume.c
* \brief Volume component implementation
* \authors Liam Girdwood <liam.r.girdwood@linux.intel.com>\n
* Keyon Jie <yang.jie@linux.intel.com>\n
* Tomasz Lauda <tomasz.lauda@linux.intel.com>
*/

#include <stddef.h>
#include <errno.h>
#include <sof/sof.h>
Expand All @@ -41,7 +49,11 @@
#include <sof/clock.h>
#include "volume.h"

/* synchronise host mmap() volume with real value */
/**
* \brief Synchronize host mmap() volume with real value.
* \param[in,out] cd Volume component private data.
* \param[in] chan Channel number.
*/
static void vol_sync_host(struct comp_data *cd, uint32_t chan)
{
if (cd->hvol == NULL)
Expand All @@ -55,13 +67,23 @@ static void vol_sync_host(struct comp_data *cd, uint32_t chan)
}
}

/**
* \brief Update volume with target value.
* \param[in,out] cd Volume component private data.
* \param[in] chan Channel number.
*/
static void vol_update(struct comp_data *cd, uint32_t chan)
{
cd->volume[chan] = cd->tvolume[chan];
vol_sync_host(cd, chan);
}

/* this ramps volume changes over time */
/**
* \brief Ramps volume changes over time.
* \param[in,out] data Volume base component device.
* \param[in] delay Update time.
* \return Time until next work.
*/
static uint64_t vol_work(void *data, uint64_t delay)
{
struct comp_dev *dev = (struct comp_dev *)data;
Expand Down Expand Up @@ -119,6 +141,12 @@ static uint64_t vol_work(void *data, uint64_t delay)
return 0;
}

/**
* \brief Creates volume component.
* \param[in,out] data Volume base component device.
* \param[in] delay Update time.
* \return Pointer to volume base component device.
*/
static struct comp_dev *volume_new(struct sof_ipc_comp *comp)
{
struct comp_dev *dev;
Expand Down Expand Up @@ -157,6 +185,10 @@ static struct comp_dev *volume_new(struct sof_ipc_comp *comp)
return dev;
}

/**
* \brief Frees volume component.
* \param[in,out] dev Volume base component device.
*/
static void volume_free(struct comp_dev *dev)
{
struct comp_data *cd = comp_get_drvdata(dev);
Expand All @@ -167,9 +199,12 @@ static void volume_free(struct comp_dev *dev)
rfree(dev);
}

/*
* Set volume component audio stream parameters - All done in prepare() since
* we need to know source and sink component params.
/**
* \brief Sets volume component audio stream parameters.
* \param[in,out] dev Volume base component device.
* \return Error code.
*
* All done in prepare() since we need to know source and sink component params.
*/
static int volume_params(struct comp_dev *dev)
{
Expand All @@ -183,6 +218,12 @@ static int volume_params(struct comp_dev *dev)
return 0;
}

/**
* \brief Sets channel target volume.
* \param[in,out] dev Volume base component device.
* \param[in] chan Channel number.
* \param[in] vol Target volume.
*/
static inline void volume_set_chan(struct comp_dev *dev, int chan, uint32_t vol)
{
struct comp_data *cd = comp_get_drvdata(dev);
Expand All @@ -202,6 +243,11 @@ static inline void volume_set_chan(struct comp_dev *dev, int chan, uint32_t vol)
cd->tvolume[chan] = v;
}

/**
* \brief Mutes channel.
* \param[in,out] dev Volume base component device.
* \param[in] chan Channel number.
*/
static inline void volume_set_chan_mute(struct comp_dev *dev, int chan)
{
struct comp_data *cd = comp_get_drvdata(dev);
Expand All @@ -212,6 +258,11 @@ static inline void volume_set_chan_mute(struct comp_dev *dev, int chan)
cd->tvolume[chan] = 0;
}

/**
* \brief Unmutes channel.
* \param[in,out] dev Volume base component device.
* \param[in] chan Channel number.
*/
static inline void volume_set_chan_unmute(struct comp_dev *dev, int chan)
{
struct comp_data *cd = comp_get_drvdata(dev);
Expand All @@ -221,6 +272,12 @@ static inline void volume_set_chan_unmute(struct comp_dev *dev, int chan)
cd->tvolume[chan] = cd->mvolume[chan];
}

/**
* \brief Sets volume control command.
* \param[in,out] dev Volume base component device.
* \param[in,out] cdata Control command data.
* \return Error code.
*/
static int volume_ctrl_set_cmd(struct comp_dev *dev,
struct sof_ipc_ctrl_data *cdata)
{
Expand Down Expand Up @@ -280,6 +337,12 @@ static int volume_ctrl_set_cmd(struct comp_dev *dev,
return 0;
}

/**
* \brief Gets volume control command.
* \param[in,out] dev Volume base component device.
* \param[in,out] cdata Control command data.
* \return Error code.
*/
static int volume_ctrl_get_cmd(struct comp_dev *dev,
struct sof_ipc_ctrl_data *cdata)
{
Expand Down Expand Up @@ -311,7 +374,13 @@ static int volume_ctrl_get_cmd(struct comp_dev *dev,
return 0;
}

/* used to pass standard and bespoke commands (with data) to component */
/**
* \brief Used to pass standard and bespoke commands (with data) to component.
* \param[in,out] dev Volume base component device.
* \param[in] cmd Command type.
* \param[in,out] data Control command data.
* \return Error code.
*/
static int volume_cmd(struct comp_dev *dev, int cmd, void *data)
{
struct sof_ipc_ctrl_data *cdata = data;
Expand All @@ -328,14 +397,24 @@ static int volume_cmd(struct comp_dev *dev, int cmd, void *data)
}
}

/**
* \brief Sets volume component state.
* \param[in,out] dev Volume base component device.
* \param[in] cmd Command type.
* \return Error code.
*/
static int volume_trigger(struct comp_dev *dev, int cmd)
{
trace_volume("trg");

return comp_set_state(dev, cmd);
}

/* copy and process stream data from source to sink buffers */
/**
* \brief Copies and processes stream data.
* \param[in,out] dev Volume base component device.
* \return Error code.
*/
static int volume_copy(struct comp_dev *dev)
{
struct comp_data *cd = comp_get_drvdata(dev);
Expand Down Expand Up @@ -375,9 +454,13 @@ static int volume_copy(struct comp_dev *dev)
return dev->frames;
}

/*
/**
* \brief Prepares volume component for processing.
* \param[in,out] dev Volume base component device.
* \return Error code.
*
* Volume component is usually first and last in pipelines so it makes sense
* to also do some type conversion too.
* to also do some type of conversion here.
*/
static int volume_prepare(struct comp_dev *dev)
{
Expand Down Expand Up @@ -489,6 +572,11 @@ static int volume_prepare(struct comp_dev *dev)
return ret;
}

/**
* \brief Resets volume component.
* \param[in,out] dev Volume base component device.
* \return Error code.
*/
static int volume_reset(struct comp_dev *dev)
{
trace_volume("res");
Expand All @@ -497,6 +585,7 @@ static int volume_reset(struct comp_dev *dev)
return 0;
}

/** \brief Volume component definition. */
struct comp_driver comp_volume = {
.type = SOF_COMP_VOLUME,
.ops = {
Expand All @@ -511,6 +600,9 @@ struct comp_driver comp_volume = {
},
};

/**
* \brief Initializes volume component.
*/
void sys_comp_volume_init(void)
{
comp_register(&comp_volume);
Expand Down
Loading