Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linux host + xaf release Version 1.0: #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
64 changes: 28 additions & 36 deletions README
Original file line number Diff line number Diff line change
@@ -1,47 +1,39 @@
[sw version 0.1] Host (Linux) + HiFix with XAF using XTSC
============================================================
prerequisite:
======================================================================
Xtensa Audio Framework (XAF) - Host (Linux) + HiFi with Hostless XAF
======================================================================

1. Check /usr/bin/gcc version and if it is greater than ~/XtensaTools/Tools/bin/gcc, use /usr/bin/gcc by seting the path like below.
======================================================================
Revision History
======================================================================

$ set path = ( /usr/bin $path )
Version 1.0 : Feb 23, 2023

2. Install libfdt-dev on your local machine only if /usr/bin/gcc is used.
+ Built and tested with RI.6 tools

$ sudo apt-get install libfdt-dev
NOTES:
1. The RTOS supported and tested is XOS
2. Support for 1 input and 1 output stream for a generic pipe

======================================================================
Version 0.2 : June 21, 2022

+ Built and tested with RI.6 tools

Build Steps below :
+ xaf-hostless version is upgraded to v2.10

1. Set up environment variables for Xtensa Tools:

E.g below :
$ set path = ($path ~/xtensa/XtDevTools/install/tools/RI-2019.2-linux/XtensaTools/bin )
$ set path = ( ~/xtensa/XtDevTools/install/tools/RI-2019.2-linux/XtensaTools/bin $path )
$ setenv XTENSA_SYSTEM ~/xtensa/XtDevTools/install/tools/RI-2019.2-linux/XtensaTools/config
$ setenv XTENSA_CORE AE_HiFi4_LE5
$ set path = ( ~/xtensa/XtDevTools/install/tools/RI-2019.2-linux/XtensaTools/Tools/bin $path )
$ set path = ( /usr/bin $path ) ( only set this, if /usr/bin/gcc version is gretaer than ~/XtensaTools/Tools/bin/gcc )
+ Added generic command support to create, connect and execute a
data-pipe with 1 input and 1 output stream

2. $ cd build
$ make clean

3. $ make xrp_setup
This copies over the XRP host source files from XtensaTools

4. $ make build
This generates the XTSC model and the MP LSPs

5. $ make stmp-xrp
This generates the XRP libraries for the host

6. $ cd ../dsp/xaf/build/
$ make clean all
Build XAF library with pcm gain component.
$ cd ../../../build/

7. $ make run
Builds the binaries for the host and the single core DSP and runs them.
NOTES:
1. The RTOS supported and tested is XOS
2. Support for 1 input and 1 output stream for a generic pipe

======================================================================

Version 0.1: February, 2021

+ Built and tested with RI.2 tools

+ Initial revision

+ xaf-hostless version used is v2.3
22 changes: 18 additions & 4 deletions build/Makefile
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ endif

DSP_DIR = ../dsp
HOST_DIR = ../host/src
XA_FRMWK_HW_REL_DIR = ../dsp/xaf/build
XA_FRMWK_HW_REL_DIR = ../dsp/xaf-hostless/build
SYSBUILD_DIR = sysbuild_dir
SUBSYS_YML = subsys.yml
SUBSYS_XLD = subsys.xld
CMAKE=cmake

LSP0=${SYSBUILD_DIR}/sys-x86_64-linux/subsys.xld/package/cores/DSP0/xtensa-elf/lib/sim

Expand Down Expand Up @@ -56,7 +57,17 @@ DSP0_LDFLAGS = -lxrp-dsp -lxrp-dsp-hw-simple-xos -lxrp-common \

DSP_CFLAGS = -I $(INCLUDE) -O2 -Wall -Werror

all: stmp-xrp $(HOST_BIN) $(DSP0_BIN)
clean_host:
rm -rf $(HOST_BIN)

clean_dsp:
rm -rf $(DSP0_BIN)
make -f makefile_test_dsp clean

all: clean_host clean_dsp stmp-xrp $(HOST_BIN) $(DSP0_BIN)

test_dsp:
make -f makefile_test_dsp all

# Copy over the XRP host sources
xrp_setup:
Expand All @@ -71,7 +82,7 @@ stmp-xrp:
mkdir -p build install
cd build && \
CC=gcc CXX=g++ \
cmake .. \
$(CMAKE) .. \
-DCMAKE_INSTALL_PREFIX=../install && \
make VERBOSE=1 install && \
cd ..
Expand All @@ -89,10 +100,13 @@ $(HOST_BIN): $(HOST_DIR)/host_main.c

LIBS := -Wl,--start-group \
$(XA_FRMWK_HW_REL_DIR)/xa_af_hostless.a \
$(XA_FRMWK_HW_REL_DIR)/../test/plugins/cadence/mp3_dec/lib/xa_mp3_dec.a \
$(XA_FRMWK_HW_REL_DIR)/../test/plugins/cadence/vorbis_dec/lib/xa_vorbis_dec.a \
$(XA_FRMWK_HW_REL_DIR)/../test/plugins/cadence/opus_enc/lib/xa_opus_codec.a \
xa_test_dsp.a \
-Wl,--end-group

$(DSP0_BIN): $(DSP_DIR)/dsp_main.c
$(DSP0_BIN): $(DSP_DIR)/src/dsp_main.c test_dsp
$(DSP_CC) --xtensa-core=${XTENSA_CORE} $(DSP_CFLAGS) $< $(DSP0_LDFLAGS) $(LIBS) -lxos -o $@

define run_pre
Expand Down
File renamed without changes.
116 changes: 116 additions & 0 deletions build/makefile_test_dsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
#
# Copyright (c) 2015-2022 Cadence Design Systems, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#


.PHONY: all clean

ROOTDIR = ../dsp
CODEC_NAME = test_dsp
NOSTRIP=1

XA_RTOS ?= xos
XF_TRACE ?= 0

ifneq (,$(findstring RF-2015.2, $(XTENSA_SYSTEM)))
# RF.2 toolchain
CFLAGS += -D__TOOLS_RF2__
endif

ifneq ($(XF_TRACE), 0)
CFLAGS += -DXF_TRACE=$(XF_TRACE)
endif

ifeq ($(XA_RTOS),xos)
INCLUDES += -I$(ROOTDIR)/xaf-hostless/include/sysdeps/xos/include
CFLAGS += -DHAVE_XOS
endif

#common test helpres source path
vpath %.c $(ROOTDIR)/xaf-hostless/test/src

#plugin source path
vpath %.c $(ROOTDIR)/xaf-hostless/test/plugins
vpath %.c $(ROOTDIR)/xaf-hostless/test/plugins/cadence/pcm_gain
vpath %.c $(ROOTDIR)/xaf-hostless/test/plugins/cadence/mp3_dec
vpath %.c $(ROOTDIR)/xaf-hostless/test/plugins/cadence/vorbis_dec
vpath %.c $(ROOTDIR)/xaf-hostless/test/plugins/cadence/renderer
vpath %.c $(ROOTDIR)/xaf-hostless/test/plugins/cadence/opus_enc
vpath %.c $(ROOTDIR)/xaf-hostless/test/plugins/cadence/opus_dec

#hosted source path
vpath %.c $(ROOTDIR)/src

#hosted includes
INCLUDES += -I$(ROOTDIR)/include

#xrp include
INCLUDES += -I$(ROOTDIR)/../common/include

#API includes
INCLUDES += -I$(ROOTDIR)/xaf-hostless/include \
-I$(ROOTDIR)/xaf-hostless/include/audio

#plugin includes
INCLUDES += -I$(ROOTDIR)/xaf-hostless/test/include \
-I$(ROOTDIR)/xaf-hostless/test/include/audio \
-I$(ROOTDIR)/xaf-hostless/test/plugins

CFLAGS += -DHAVE_XOS=1
CFLAGS += -DXA_PCM_GAIN=1
CFLAGS += -DXA_MP3_DECODER=1
CFLAGS += -DXA_VORBIS_DECODER=1
CFLAGS += -DXA_OPUS_ENCODER=1
CFLAGS += -DXA_OPUS_DECODER=1
CFLAGS += -DXA_RENDERER=1
CFLAGS += -DFIO_LOCAL_FS
CFLAGS += -DXAF_PROFILE
CFLAGS += -DXRP_CODE_INTG_CHG

#common test objects
TESTOBJS += \
xa-factory.o \
xaf-fio-test.o \
xaf-clk-test.o \
xaf-mem-test.o

#plugin objects
TESTOBJS += \
xa-pcm-gain.o \
xa-mp3-decoder.o \
xa-vorbis-decoder.o \
xa-renderer.o \
xa-opus-encoder.o \
xa-opus-decoder.o \
opus_header.o

#hosted test objects
TESTOBJS += \
xaf-hosted-main-dsp.o \
xaf-hosted-utils.o \
xaf-hosted-pcm-gain.o \
circularbuffer.o \
xaf-hosted-file-dec.o

LIBOSOBJS = $(TESTOBJS)

include $(ROOTDIR)/xaf-hostless/build/common.mk
Empty file modified build/xrp_host/CMakeLists.txt
100644 → 100755
Empty file.
Empty file modified build/xrp_host/lib/xrp_sim/CMakeLists.txt
100644 → 100755
Empty file.
Empty file modified build/xrp_host/xrp.dtb.s
100644 → 100755
Empty file.
64 changes: 39 additions & 25 deletions common/include/xrpm_msg.h
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,25 +1,3 @@
/*
* Copyright (c) 2015-2020 Cadence Design Systems Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

#ifndef _XRPM_MSG_H
#define _XRPM_MSG_H
Expand Down Expand Up @@ -84,6 +62,7 @@ typedef struct _xrpm_packet_head
char command;
char priority;
char reserved[4U];
int cid;
} xrpm_packet_head_t;

#define AUDIO_MAX_INPUT_BUFFER (113 * 1024)
Expand Down Expand Up @@ -117,7 +96,9 @@ typedef enum _xrpm_audio_component
DSP_COMPONENT_MP3,
DSP_COMPONENT_AAC,
DSP_COMPONENT_VORBIS,
DSP_COMPONENT_OPUS
DSP_COMPONENT_PCM_GAIN,
DSP_COMPONENT_OPUS_ENC,
DSP_COMPONENT_OPUS_DEC,
} xrpm_audio_component_t;

/**
Expand All @@ -128,13 +109,46 @@ typedef enum _xrpm_dsp_audio_command
XRPM_Command_ECHO, /* Fetch XAF version */
XRPM_Command_GAIN, /* PCM Gain control */
XRPM_Command_FileStart, /* File playback start */
XRPM_Command_FileData, /* Data frame from remote file playback */
XRPM_Command_FileDataIn, /* Data frame from remote file playback */
XRPM_Command_FileStop,
XRPM_Command_FileEnd,
XRPM_Command_FileEndOut,
XRPM_Command_EXIT,
XRPM_Command_STOP
XRPM_Command_STOP,
XRPM_Command_FileDataOut, /* Data frame from remote playback DSP output */
XRPM_Command_CompCreate,
XRPM_Command_CompConnect,
} xrpm_audio_command_t;

enum _param_index {
PARAM_INDEX_IN_BUF_OFFSET =0,
PARAM_INDEX_IN_BUF_SIZE =1,
PARAM_INDEX_IN_EOF =2, /* intentional repeat enum */
PARAM_INDEX_OUT_BUF_OFFSET =3,
PARAM_INDEX_OUT_BUF_SIZE =4,
PARAM_INDEX_COMP_SAMPLE_RATE =5,
PARAM_INDEX_COMP_CHANNELS =6,
PARAM_INDEX_COMP_PCM_WIDTH =7,
PARAM_INDEX_COMP_PCM_GAIN_INDEX =8,
PARAM_INDEX_COMP_ID =9,
PARAM_INDEX_IN_BYTES_CONSUMED =10,
PARAM_INDEX_OUT_BYTES_PRODUCED =11,
PARAM_INDEX_COMP_NAME =12,
PARAM_INDEX_COMP_NUM_INBUF =13,
PARAM_INDEX_COMP_NUM_OUTBUF =14,
PARAM_INDEX_COMP_IN_FILE_ID =15,
PARAM_INDEX_COMP_OUT_FILE_ID =16,
PARAM_INDEX_MAX,
};

enum _param_connect_index {
PARAM_INDEX_CONNECT_NCONNECTS =12,
PARAM_INDEX_CONNECT_COMP_ID_SRC =13,
PARAM_INDEX_CONNECT_PORT_ID_SRC =14,
PARAM_INDEX_CONNECT_COMP_ID_DST =15,
PARAM_INDEX_CONNECT_PORT_ID_DST =16,
};

#endif


Expand Down
Binary file modified doc/Linux_XTSC_HiFix_With_XAF_UG.pdf
Binary file not shown.
Loading