NOTICE: The Processors Wiki will End-of-Life on January 15, 2021. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.
DA8xx ASP Porting Guide
Introduction[edit]
The term Audio Stream Processing (ASP or also popularly known as post-processing) operates on the audio data following decoding and preceding encoding in Performance Audio Framework. The audio stream processing is implemented via a collection of individual XDAIS algorithms, each with a common, standardized interface. This document provides a guidance to the ASP developer as how custom algorithm can be integrated into PA/F. This chapter also describes common settings and recommendations for using an ASP within PA framework. Some familiarity with the XDAIS standard is assumed. Also, it's assumed that the developer has already gone through the chapter that describes the ASP interface to PA/F.
Integrating ASP into PA/F[edit]
It's assumed that the reader already have installed PA/F SDK for DA8xx device and gone through the Getting Started Guide, set-up the build environment and DA8xx EVM.
Step1: Create work area[edit]
- Unzip firmware deliverable from PA/F SDK to an empty folder preserving the path information.
- Unzip ASP Development Kit deliverable to the same folder preserving the path information, letting it overwrite existing files, if any.
- Map the folder as T: drive such that the newly created
pa
folder falls in the root of T: drive.
Step2: Generate PA/F layer using pag.exe[edit]
- Move to
aspdk
folder
- Move to
$ cd t:/pa/asp/aspdk
- Modify
example_asp.bsp
for the ASP name, vendor name and any other relevant information. - Run
pag
utility
$ ./pag.exe -g asp example_asp.bsp
This will create a folder asp
with:
- all necessary PA/F interface files
- example ASP wrapper that can be used with VC build and CCS unit testing
- Move
asp
folder to folder for your custom asp development and do file rearaangement. Below example showssur
as the custom asp name and folder.
$ mv asp ../sur $ cd ../sur $ mkdir alpha $ cp sur_a.h alpha/ $ cp main.c ../
Step3: Customize PA/F layer code[edit]
- Customize
asp_ven_ialg.c
file for any additional memory allocation/intialisation. Note that all memory allocations have to happen inasp_ven_alloc()
function throughmemTabs
. The library should not have any inside malloc/free calls. This is required to make library reentrant. - Customize
asp_ven_iasp.c
for the custom asp with calls to other functions implementing the functionality and other necessary settings of the custom algorithm.
Step4: Create and build CCSv4 project[edit]
- This can be done in CCSv4 GUI or through command line. Please see CCSv4 help for first option. Command line way to create/build project is explained here.
- Following commands creates project
sur
in directoryt:/pa/asp/sur
in CCSv4 workspacec:/workspace_asp
. When no configuration is specified; this creates Debug and Release configurations with Release configuration set to optimised options -o3 and no-Debug. Please add any additional options/include files during project creation. The scriptcreateproject.sh
in the package also includes these commands. Running this script will generate and build the CCSv4 project. In order to include any additional options please update the script.
More information on command line way to create/build project is available in Projects_-_Command_Line_Build/Create
$ cp ../aspdk/createproject.sh . $ ./createproject.sh
or
$ CCS4_DIR="C:/Program Files/Texas Instruments/ccsv4" $ C6000_CG_ROOT="C:/Program Files/Texas Instruments/ccsv4/tools/compiler/c6000" $ BIOS_CG_ROOT="C:/Program Files/Texas Instruments/bios_6_21_00_13" $ XDC_CG_ROOT="C:/Program Files/Texas Instruments/xdctools_3_16_02_32" $ XDAIS_CG_ROOT="C:/Program Files/Texas Instruments/xdais" $ PROJ_PATH="t:/pa/asp/aspdk/sur" $ PROJ_NAME=sur $ rm -rvf T:/pa/asp/aspdk/sur/{.[cps]*,Release} c:/workspace_asp/.metadata $ "${CCS4_DIR}"/eclipse/jre/bin/java -jar "${CCS4_DIR}"/eclipse/startup.jar -data c:/workspace_asp \ $ -application com.ti.ccstudio.apps.projectCreate \ $ -ccs.name "${PROJ_NAME}" \ $ -ccs.location "${PROJ_PATH}" \ $ -ccs.device com.ti.ccstudio.deviceModel.C6000.GenericC674xDevice \ $ -ccs.kind com.ti.ccstudio.managedbuild.core.ProjectKind_StaticLibrary \ $ -ccs.endianness little \ $ -ccs.artifactName "${PROJ_NAME}" \ $ -ccs.artifactExtension lib \ $ -ccs.cgtVersion 6.1.13 \ $ -ccs.setBuildOption \ $ -ccs.outputFormat coff \ $ -ccs.rts rts6740.lib \ $ -ccs.setCompilerOptions "-mv6740 --symdebug:none -o3" @configurations Release \ $ -ccs.setCompilerOptions "-mv6740 -g -o0" @configurations Debug \ $ -ccs.setCompilerOptions "-I t:/pa/f/include -I T:/pa/dec/com -I t:/pa/f/alpha -I t:/pa/f/s3 -I t:/pa/asp/com -I t:/pa/asp/std -I t:/pa/sio/acp1 -I ${PROJ_PATH} -I ${PROJ_PATH}/alpha -I ${BIOS_CG_ROOT}/packages/ti/bios/include -I ${BIOS_CG_ROOT}/packages -I ${XDC_CG_ROOT}/packages -I ${C6000_CG_ROOT}/include -I ${XDAIS_CG_ROOT}/include -I ${XDAIS_CG_ROOT}/src/api -I T:/pa/asp/fil/alg -I T:/pa/asp/fil/src" $ -ccs.overwrite keep
- Build the project using below command. This builds the library in Release configuration.
$ "${CCS4_DIR}"/eclipse/jre/bin/java -jar "${CCS4_DIR}"/eclipse/startup.jar -data c:/workspace_asp -application com.ti.ccstudio.apps.projectBuild -ccs.projects "${PROJ_NAME}" -ccs.configuration Release
Step5: Add Alpha codes[edit]
- Customize the alpha header file generated by
pag
utility (e.g:sur_a.h
) for your applcaition.
Details on alpha codes and how to write them is explained in Alpha Codes.
Step6: Adding custom ASP to the ASP chain[edit]
- Add paths to the source files for custom ASPs in the final PA project.
- Example: add
sur.lib
topa_i14_evmda830
project
- Example: add
- Include custom ASP header files (ASP.h and ASP_VEN.h) in patchs.c .
- Example: add
#include sur.h #include sur_tii.h
topa/f/s19/i14/patchs.c
- Example: add
- Add custom ASP in the PA/F ASP chain by including an appropriate PAF_ASP_LINKINIT() macro to PAF_ASP_LinkInit table in patchs.c.
- Example: add
PAF_ASP_LINKINIT (CUS, SUR, TII),
macro toaspLinkInitCusI14
table andaspLinkInitAllI14
table - Note:Location of custom ASP algorithm in the Customized Audio Stream processing chain is specified by the location of PAF_ASP_LINKINIT() macro in patchs.c.So add this line depending on the desired location of your ASP in the ASP chain. For example if location of ASPs are specified like below; then SUR ASP comes before EQU ASP in the PA/F ASP chain:
- Example: add
const PAF_ASP_LinkInit aspLinkInitCusI14[] = { PAF_ASP_LINKINIT (CUS, SUR, TII), PAF_ASP_LINKINIT (CUS, EQU, TII), PAF_ASP_LINKNONE, };
- Note that:
- All surround processing ASPs are grouped together in the ASP chain.
- Custom surround processing ASPs, such as SUR are first.
- Standard surround processing ASPs, such as PL2x, come next.
- Add an include statement for the custom alpha header file to
P:\i14_a.h
- Add apropriate alpha code inverse symbol definitions to
P:\i14_a.hdm
. This enable use of the defined alpha command directly.- Example:sur_a.h includes defintions like below:
#define readSURMode 0xf200+CUS_BETA_SUR,0x0400 #define writeSURModeDisable 0xfa00+CUS_BETA_SUR,0x0400 #define writeSURModeEnable 0xfa00+CUS_BETA_SUR,0x0401 Assuming that CUS_BETA_SUR is defined to 0x00, add below definitions to i14_a.hdm #define readSURMode 0xf200,0x0400 #define writeSURModeDisable 0xfa00,0x0400 #define writeSURModeEnable 0xfa00,0x0401
Miscellaneous Information[edit]
Communicating with other algorithms[edit]
Sometimes it may be required to communicate with other algorithms to query status or issue commands. Especially when there are more than one custom algorithms related to each other.
Following method can be used if such a communication is desired:
- Create an ACP instance.
- Required only once, before any communication is made:
#include <acp.h> #include <acp_mds.h> static ACP_Handle acp = NULL; ACP_MDS_init (); acp = ACP_create (&ACP_MDS_IACP, &ACP_PARAMS); if (!acp) return;
- To query status, send alpha code and get response.
- This example shows type-2 read:
#include <pafdec_a.h> ACP_Unit from[] = {0xc902, readDECSourceProgram}; ACP_Unit to[5]; int program = 0; if (acp->fxns->sequence (acp, from, to)) return; program = to[2] & 0xFF;
- To issue command, send alpha code
- This example shows type-2 write:
#include <pafenc_a.h> ACP_Unit from[] = {0xc902, writeENCCommandMute}; ACP_Unit to[5]; if (acp->fxns->sequence (acp, from, to)) return;