summaryrefslogtreecommitdiff
path: root/hifi/xaf/host-apf/include
diff options
context:
space:
mode:
Diffstat (limited to 'hifi/xaf/host-apf/include')
-rw-r--r--hifi/xaf/host-apf/include/audio/xa-audio-decoder-api.h46
-rw-r--r--hifi/xaf/host-apf/include/audio/xa-mixer-api.h154
-rw-r--r--hifi/xaf/host-apf/include/audio/xa-pcm-api.h138
-rw-r--r--hifi/xaf/host-apf/include/audio/xa_apicmd_standards.h107
-rw-r--r--hifi/xaf/host-apf/include/audio/xa_error_standards.h79
-rw-r--r--hifi/xaf/host-apf/include/audio/xa_memory_standards.h104
-rw-r--r--hifi/xaf/host-apf/include/audio/xa_type_def.h98
-rw-r--r--hifi/xaf/host-apf/include/audio/xa_vorbis_dec_api.h121
-rw-r--r--hifi/xaf/host-apf/include/os/android/xf-osal.h215
-rw-r--r--hifi/xaf/host-apf/include/os/xos/xf-osal.h206
-rw-r--r--hifi/xaf/host-apf/include/sys/fio/xf-config.h36
-rw-r--r--hifi/xaf/host-apf/include/sys/fio/xf-hal.h34
-rw-r--r--hifi/xaf/host-apf/include/sys/fio/xf-ipc.h127
-rw-r--r--hifi/xaf/host-apf/include/sys/fio/xf-runtime.h35
-rw-r--r--hifi/xaf/host-apf/include/sys/fio/xf-types.h88
-rw-r--r--hifi/xaf/host-apf/include/xaf-api.h139
-rw-r--r--hifi/xaf/host-apf/include/xaf-structs.h82
-rw-r--r--hifi/xaf/host-apf/include/xf-debug.h194
-rw-r--r--hifi/xaf/host-apf/include/xf-opcode.h297
-rw-r--r--hifi/xaf/host-apf/include/xf-proto.h82
-rw-r--r--hifi/xaf/host-apf/include/xf-proxy.h297
-rw-r--r--hifi/xaf/host-apf/include/xf.h53
22 files changed, 2732 insertions, 0 deletions
diff --git a/hifi/xaf/host-apf/include/audio/xa-audio-decoder-api.h b/hifi/xaf/host-apf/include/audio/xa-audio-decoder-api.h
new file mode 100644
index 00000000..f82544c8
--- /dev/null
+++ b/hifi/xaf/host-apf/include/audio/xa-audio-decoder-api.h
@@ -0,0 +1,46 @@
+/*******************************************************************************
+* Copyright (C) 2018 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 use this Software with Cadence processor cores only and
+* not with any other processors and platforms, 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 __XA_ADEC_API_H__
+#define __XA_ADEC_API_H__
+
+/* ...generic audio-decoder configuration parameters */
+enum xa_config_param_codec {
+ XA_CODEC_CONFIG_PARAM_CHANNELS = 0x10000 + 0,
+ XA_CODEC_CONFIG_PARAM_SAMPLE_RATE = 0x10000 + 1,
+ XA_CODEC_CONFIG_PARAM_PCM_WIDTH = 0x10000 + 2,
+ XA_CODEC_CONFIG_PARAM_PRODUCED = 0x10000 + 3
+};
+
+/* ...ports indices */
+enum xa_codec_ports {
+ XA_CODEC_INPUT_PORT = 0,
+ XA_CODEC_OUTPUT_PORT = 1
+};
+
+/* ...non-fatal execution errors */
+enum
+{
+ XA_CODEC_EXEC_NO_DATA = XA_ERROR_CODE(xa_severity_nonfatal, xa_class_execute, XA_CODEC_GENERIC, 0)
+};
+
+#endif
diff --git a/hifi/xaf/host-apf/include/audio/xa-mixer-api.h b/hifi/xaf/host-apf/include/audio/xa-mixer-api.h
new file mode 100644
index 00000000..c9695b40
--- /dev/null
+++ b/hifi/xaf/host-apf/include/audio/xa-mixer-api.h
@@ -0,0 +1,154 @@
+/*******************************************************************************
+* Copyright (C) 2018 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 use this Software with Cadence processor cores only and
+* not with any other processors and platforms, 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 __XA_MIXER_API_H__
+#define __XA_MIXER_API_H__
+
+/*******************************************************************************
+ * Includes
+ ******************************************************************************/
+
+/* ...generic commands */
+#include "xa_apicmd_standards.h"
+
+/* ...generic error codes */
+#include "xa_error_standards.h"
+
+/* ...common types */
+#include "xa_type_def.h"
+
+/*******************************************************************************
+ * Constants definitions
+ ******************************************************************************/
+
+/* ...mixer-specific configuration parameters */
+enum xa_config_param_mixer {
+ XA_MIXER_CONFIG_PARAM_INPUT_TRACKS = 0,
+ XA_MIXER_CONFIG_PARAM_PCM_WIDTH = 1,
+ XA_MIXER_CONFIG_PARAM_CHANNELS = 2,
+ XA_MIXER_CONFIG_PARAM_SAMPLE_RATE = 4,
+ XA_MIXER_CONFIG_PARAM_FRAME_SIZE = 5,
+ XA_MIXER_CONFIG_PARAM_BUFFER_SIZE = 6,
+ XA_MIXER_CONFIG_PARAM_VOLUME = 7,
+ XA_MIXER_CONFIG_PARAM_NUM = 8
+};
+
+/* ...component identifier (informative) */
+#define XA_CODEC_MIXER 1
+
+/* ...global limitation - maximal mixer track number */
+#define XA_MIXER_MAX_TRACK_NUMBER 4
+
+/* ...volume representation */
+#define __XA_MIXER_VOLUME(v) \
+ ({ u32 __v = (u32)((v) * (1 << 12)); (__v > 0xFFFF ? __v = 0xFFFF : 0); (u16)__v; })
+
+/* ...mixer volume setting command encoding */
+#define XA_MIXER_VOLUME(track, channel, volume) \
+ (__XA_MIXER_VOLUME(volume) | ((track) << 16) | ((channel) << 20))
+
+/*******************************************************************************
+ * Class 0: API Errors
+ ******************************************************************************/
+
+#define XA_MIXER_API_NONFATAL(e) \
+ XA_ERROR_CODE(xa_severity_nonfatal, xa_class_api, XA_CODEC_MIXER, (e))
+
+#define XA_MIXER_API_FATAL(e) \
+ XA_ERROR_CODE(xa_severity_fatal, xa_class_api, XA_CODEC_MIXER, (e))
+
+enum xa_error_nonfatal_api_mixer {
+ XA_MIXER_API_NONFATAL_MAX = XA_MIXER_API_NONFATAL(0)
+};
+
+enum xa_error_fatal_api_mixer {
+ XA_MIXER_API_FATAL_MAX = XA_MIXER_API_FATAL(0)
+};
+
+/*******************************************************************************
+ * Class 1: Configuration Errors
+ ******************************************************************************/
+
+#define XA_MIXER_CONFIG_NONFATAL(e) \
+ XA_ERROR_CODE(xa_severity_nonfatal, xa_class_config, XA_CODEC_MIXER, (e))
+
+#define XA_MIXER_CONFIG_FATAL(e) \
+ XA_ERROR_CODE(xa_severity_fatal, xa_class_config, XA_CODEC_MIXER, (e))
+
+enum xa_error_nonfatal_config_mixer {
+ XA_MIXER_CONFIG_NONFATAL_RANGE = XA_MIXER_CONFIG_NONFATAL(0),
+ XA_MIXER_CONFIG_NONFATAL_STATE = XA_MIXER_CONFIG_NONFATAL(1),
+ XA_MIXER_CONFIG_NONFATAL_MAX = XA_MIXER_CONFIG_NONFATAL(2)
+};
+
+enum xa_error_fatal_config_mixer {
+ XA_MIXER_CONFIG_FATAL_RANGE = XA_MIXER_CONFIG_FATAL(0),
+ XA_MIXER_CONFIG_FATAL_TRACK_STATE = XA_MIXER_CONFIG_FATAL(0 + XA_MIXER_CONFIG_NONFATAL_MAX),
+ XA_MIXER_CONFIG_FATAL_MAX = XA_MIXER_CONFIG_FATAL(1)
+};
+
+/*******************************************************************************
+ * Class 2: Execution Class Errors
+ ******************************************************************************/
+
+#define XA_MIXER_EXEC_NONFATAL(e) \
+ XA_ERROR_CODE(xa_severity_nonfatal, xa_class_execute, XA_CODEC_MIXER, (e))
+
+#define XA_MIXER_EXEC_FATAL(e) \
+ XA_ERROR_CODE(xa_severity_fatal, xa_class_execute, XA_CODEC_MIXER, (e))
+
+enum xa_error_nonfatal_execute_mixer {
+ XA_MIXER_EXEC_NONFATAL_STATE = XA_MIXER_EXEC_NONFATAL(0),
+ XA_MIXER_EXEC_NONFATAL_NO_DATA = XA_MIXER_EXEC_NONFATAL(1),
+ XA_MIXER_EXEC_NONFATAL_INPUT = XA_MIXER_EXEC_NONFATAL(2),
+ XA_MIXER_EXEC_NONFATAL_OUTPUT = XA_MIXER_EXEC_NONFATAL(3),
+ XA_MIXER_EXEC_NONFATAL_MAX = XA_MIXER_EXEC_NONFATAL(4)
+};
+
+enum xa_error_fatal_execute_mixer {
+ XA_MIXER_EXEC_FATAL_STATE = XA_MIXER_EXEC_FATAL(0),
+ XA_MIXER_EXEC_FATAL_INPUT = XA_MIXER_EXEC_FATAL(1),
+ XA_MIXER_EXEC_FATAL_OUTPUT = XA_MIXER_EXEC_FATAL(2),
+ XA_MIXER_EXEC_FATAL_MAX = XA_MIXER_EXEC_FATAL(3)
+};
+
+/*******************************************************************************
+ * API function definition (tbd)
+ ******************************************************************************/
+
+#if defined(USE_DLL) && defined(_WIN32)
+#define DLL_SHARED __declspec(dllimport)
+#elif defined (_WINDLL)
+#define DLL_SHARED __declspec(dllexport)
+#else
+#define DLL_SHARED
+#endif
+
+#if defined(__cplusplus)
+extern "C" {
+#endif /* __cplusplus */
+DLL_SHARED xa_codec_func_t xa_mixer;
+#if defined(__cplusplus)
+}
+#endif /* __cplusplus */
+
+#endif /* __XA_MIXER_API_H__ */
diff --git a/hifi/xaf/host-apf/include/audio/xa-pcm-api.h b/hifi/xaf/host-apf/include/audio/xa-pcm-api.h
new file mode 100644
index 00000000..94fb1362
--- /dev/null
+++ b/hifi/xaf/host-apf/include/audio/xa-pcm-api.h
@@ -0,0 +1,138 @@
+/*******************************************************************************
+* Copyright (C) 2018 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 use this Software with Cadence processor cores only and
+* not with any other processors and platforms, 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 __XA_PCM_API_H__
+#define __XA_PCM_API_H__
+
+/*******************************************************************************
+ * Includes
+ ******************************************************************************/
+
+#include "xa_type_def.h"
+#include "xa_error_standards.h"
+#include "xa_apicmd_standards.h"
+#include "xa_memory_standards.h"
+
+/*******************************************************************************
+ * Constants definitions
+ ******************************************************************************/
+
+/* ...codec-specific configuration parameters */
+enum xa_config_param_pcm {
+ XA_PCM_CONFIG_PARAM_SAMPLE_RATE = 0,
+ XA_PCM_CONFIG_PARAM_IN_PCM_WIDTH = 1,
+ XA_PCM_CONFIG_PARAM_IN_CHANNELS = 2,
+ XA_PCM_CONFIG_PARAM_OUT_PCM_WIDTH = 3,
+ XA_PCM_CONFIG_PARAM_OUT_CHANNELS = 4,
+ XA_PCM_CONFIG_PARAM_CHANROUTING = 5,
+ XA_PCM_CONFIG_PARAM_NUM = 6,
+};
+
+/* ...component identifier (informative) */
+#define XA_CODEC_PCM 16
+
+/*******************************************************************************
+ * Class 0: API Errors
+ ******************************************************************************/
+
+#define XA_PCM_API_NONFATAL(e) \
+ XA_ERROR_CODE(xa_severity_nonfatal, xa_class_api, XA_CODEC_PCM, (e))
+
+#define XA_PCM_API_FATAL(e) \
+ XA_ERROR_CODE(xa_severity_fatal, xa_class_api, XA_CODEC_PCM, (e))
+
+enum xa_error_nonfatal_api_pcm {
+ XA_PCM_API_NONFATAL_MAX = XA_PCM_API_NONFATAL(0)
+};
+
+enum xa_error_fatal_api_pcm {
+ XA_PCM_API_FATAL_MAX = XA_PCM_API_FATAL(0)
+};
+
+/*******************************************************************************
+ * Class 1: Configuration Errors
+ ******************************************************************************/
+
+#define XA_PCM_CONFIG_NONFATAL(e) \
+ XA_ERROR_CODE(xa_severity_nonfatal, xa_class_config, XA_CODEC_PCM, (e))
+
+#define XA_PCM_CONFIG_FATAL(e) \
+ XA_ERROR_CODE(xa_severity_fatal, xa_class_config, XA_CODEC_PCM, (e))
+
+enum xa_error_nonfatal_config_pcm {
+ XA_PCM_CONFIG_NONFATAL_RANGE = XA_PCM_CONFIG_NONFATAL(0),
+ XA_PCM_CONFIG_NONFATAL_STATE = XA_PCM_CONFIG_NONFATAL(1),
+ XA_PCM_CONFIG_NONFATAL_MAX = XA_PCM_CONFIG_NONFATAL(2)
+};
+
+enum xa_error_fatal_config_pcm {
+ XA_PCM_CONFIG_FATAL_RANGE = XA_PCM_CONFIG_FATAL(0),
+ XA_PCM_CONFIG_FATAL_MAX = XA_PCM_CONFIG_FATAL(1)
+};
+
+/*******************************************************************************
+ * Class 2: Execution Class Errors
+ ******************************************************************************/
+
+#define XA_PCM_EXEC_NONFATAL(e) \
+ XA_ERROR_CODE(xa_severity_nonfatal, xa_class_execute, XA_CODEC_PCM, (e))
+
+#define XA_PCM_EXEC_FATAL(e) \
+ XA_ERROR_CODE(xa_severity_fatal, xa_class_execute, XA_CODEC_PCM, (e))
+
+enum xa_error_nonfatal_execute_pcm {
+ XA_PCM_EXEC_NONFATAL_STATE = XA_PCM_EXEC_NONFATAL(0),
+ XA_PCM_EXEC_NONFATAL_NO_DATA = XA_PCM_EXEC_NONFATAL(1),
+ XA_PCM_EXEC_NONFATAL_INPUT = XA_PCM_EXEC_NONFATAL(2),
+ XA_PCM_EXEC_NONFATAL_OUTPUT = XA_PCM_EXEC_NONFATAL(3),
+ XA_PCM_EXEC_NONFATAL_MAX = XA_PCM_EXEC_NONFATAL(4)
+};
+
+enum xa_error_fatal_execute_pcm {
+ XA_PCM_EXEC_FATAL_STATE = XA_PCM_EXEC_FATAL(0),
+ XA_PCM_EXEC_FATAL_INPUT = XA_PCM_EXEC_FATAL(1),
+ XA_PCM_EXEC_FATAL_OUTPUT = XA_PCM_EXEC_FATAL(2),
+ XA_PCM_EXEC_FATAL_MAX = XA_PCM_EXEC_FATAL(3)
+};
+
+/*******************************************************************************
+ * API function definition
+ ******************************************************************************/
+
+#if defined(USE_DLL) && defined(_WIN32)
+#define DLL_SHARED __declspec(dllimport)
+#elif defined (_WINDLL)
+#define DLL_SHARED __declspec(dllexport)
+#else
+#define DLL_SHARED
+#endif
+
+#if defined(__cplusplus)
+extern "C" {
+#endif /* __cplusplus */
+DLL_SHARED xa_codec_func_t xa_pcm_codec;
+#if defined(__cplusplus)
+}
+#endif /* __cplusplus */
+
+#endif /* __XA_PCM_API_H__ */
+
diff --git a/hifi/xaf/host-apf/include/audio/xa_apicmd_standards.h b/hifi/xaf/host-apf/include/audio/xa_apicmd_standards.h
new file mode 100644
index 00000000..eb1b78e1
--- /dev/null
+++ b/hifi/xaf/host-apf/include/audio/xa_apicmd_standards.h
@@ -0,0 +1,107 @@
+/*******************************************************************************
+* Copyright (C) 2018 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 use this Software with Cadence processor cores only and
+* not with any other processors and platforms, 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.
+
+******************************************************************************/
+/*******************************************************************************
+*
+* NOTE, ANY CHANGES TO THIS FILE MAY AFFECT UNDERLYING AUDIO / SPEECH CODEC
+* LIBRARY COMPONENT FROM CADENCE DESIGN SYSTEMS, INC.
+*
+******************************************************************************/
+
+
+#ifndef __XA_API_CMD_STANDARDS_H__
+#define __XA_API_CMD_STANDARDS_H__
+
+/*****************************************************************************/
+/* Standard API commands */
+/*****************************************************************************/
+
+enum xa_api_cmd_generic {
+ XA_API_CMD_GET_LIB_ID_STRINGS = 0x0001,
+
+ XA_API_CMD_GET_API_SIZE = 0x0002,
+ XA_API_CMD_INIT = 0x0003,
+
+ XA_API_CMD_SET_CONFIG_PARAM = 0x0004,
+ XA_API_CMD_GET_CONFIG_PARAM = 0x0005,
+
+ XA_API_CMD_GET_MEMTABS_SIZE = 0x0006,
+ XA_API_CMD_SET_MEMTABS_PTR = 0x0007,
+ XA_API_CMD_GET_N_MEMTABS = 0x0008,
+
+ XA_API_CMD_EXECUTE = 0x0009,
+
+ XA_API_CMD_PUT_INPUT_QUERY = 0x000A,
+ XA_API_CMD_GET_CURIDX_INPUT_BUF = 0x000B,
+ XA_API_CMD_SET_INPUT_BYTES = 0x000C,
+ XA_API_CMD_GET_OUTPUT_BYTES = 0x000D,
+ XA_API_CMD_INPUT_OVER = 0x000E,
+
+ XA_API_CMD_GET_MEM_INFO_SIZE = 0x0010,
+ XA_API_CMD_GET_MEM_INFO_ALIGNMENT = 0x0011,
+ XA_API_CMD_GET_MEM_INFO_TYPE = 0x0012,
+ XA_API_CMD_GET_MEM_INFO_PLACEMENT = 0x0013,
+ XA_API_CMD_GET_MEM_INFO_PRIORITY = 0x0014,
+ XA_API_CMD_SET_MEM_PTR = 0x0015,
+ XA_API_CMD_SET_MEM_INFO_SIZE = 0x0016,
+ XA_API_CMD_SET_MEM_PLACEMENT = 0x0017,
+
+ XA_API_CMD_GET_N_TABLES = 0x0018,
+ XA_API_CMD_GET_TABLE_INFO_SIZE = 0x0019,
+ XA_API_CMD_GET_TABLE_INFO_ALIGNMENT = 0x001A,
+ XA_API_CMD_GET_TABLE_INFO_PRIORITY = 0x001B,
+ XA_API_CMD_SET_TABLE_PTR = 0x001C,
+ XA_API_CMD_GET_TABLE_PTR = 0x001D
+};
+
+/*****************************************************************************/
+/* Standard API command indices */
+/*****************************************************************************/
+
+enum xa_cmd_type_generic {
+ /* XA_API_CMD_GET_LIB_ID_STRINGS indices */
+ XA_CMD_TYPE_LIB_NAME = 0x0100,
+ XA_CMD_TYPE_LIB_VERSION = 0x0200,
+ XA_CMD_TYPE_API_VERSION = 0x0300,
+
+ /* XA_API_CMD_INIT indices */
+ XA_CMD_TYPE_INIT_API_PRE_CONFIG_PARAMS = 0x0100,
+ XA_CMD_TYPE_INIT_API_POST_CONFIG_PARAMS = 0x0200,
+ XA_CMD_TYPE_INIT_PROCESS = 0x0300,
+ XA_CMD_TYPE_INIT_DONE_QUERY = 0x0400,
+
+ /* XA_API_CMD_EXECUTE indices */
+ XA_CMD_TYPE_DO_EXECUTE = 0x0100,
+ XA_CMD_TYPE_DONE_QUERY = 0x0200,
+ XA_CMD_TYPE_DO_RUNTIME_INIT = 0x0300
+};
+
+
+/*****************************************************************************/
+/* Standard API configuration parameters */
+/*****************************************************************************/
+
+enum xa_config_param_generic {
+ XA_CONFIG_PARAM_CUR_INPUT_STREAM_POS = 0x0100,
+ XA_CONFIG_PARAM_GEN_INPUT_STREAM_POS = 0x0200,
+};
+
+#endif /* __XA_API_CMD_STANDARDS_H__ */
diff --git a/hifi/xaf/host-apf/include/audio/xa_error_standards.h b/hifi/xaf/host-apf/include/audio/xa_error_standards.h
new file mode 100644
index 00000000..1b67b52f
--- /dev/null
+++ b/hifi/xaf/host-apf/include/audio/xa_error_standards.h
@@ -0,0 +1,79 @@
+/*******************************************************************************
+* Copyright (C) 2018 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 use this Software with Cadence processor cores only and
+* not with any other processors and platforms, 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.
+
+******************************************************************************/
+/*******************************************************************************
+*
+* NOTE, ANY CHANGES TO THIS FILE MAY AFFECT UNDERLYING AUDIO / SPEECH CODEC
+* LIBRARY COMPONENT FROM CADENCE DESIGN SYSTEMS, INC.
+*
+******************************************************************************/
+
+
+#ifndef __XA_ERROR_STANDARDS_H__
+#define __XA_ERROR_STANDARDS_H__
+
+/*****************************************************************************/
+/* File includes */
+/* xa_type_def.h */
+/*****************************************************************************/
+
+/*****************************************************************************/
+/* Constant hash defines */
+/*****************************************************************************/
+#define XA_NO_ERROR 0
+#define XA_FATAL_ERROR 0x80000000
+
+enum xa_error_severity {
+ xa_severity_nonfatal = 0,
+ xa_severity_fatal = 0xffffffff
+};
+
+enum xa_error_class {
+ xa_class_api = 0,
+ xa_class_config = 1,
+ xa_class_execute = 2,
+ xa_class_proxy = 3
+};
+
+#define XA_CODEC_GENERIC 0
+
+#define XA_ERROR_CODE(severity, class, codec, index) ((severity << 15) | (class << 11) | (codec << 6) | index)
+#define XA_ERROR_SEVERITY(code) (((code) & XA_FATAL_ERROR) != 0)
+#define XA_ERROR_CLASS(code) (((code) >> 11) & 0x0f)
+#define XA_ERROR_CODEC(code) (((code) >> 6) & 0x1f)
+#define XA_ERROR_SUBCODE(code) (((code) >> 0) & 0x3f)
+
+/* Our convention is that only api-class errors can be generic ones. */
+
+/*****************************************************************************/
+/* Class 0: API Errors */
+/*****************************************************************************/
+/* Non Fatal Errors */
+/* (none) */
+/* Fatal Errors */
+enum xa_error_fatal_api_generic {
+ XA_API_FATAL_MEM_ALLOC = XA_ERROR_CODE(xa_severity_fatal, xa_class_api, XA_CODEC_GENERIC, 0),
+ XA_API_FATAL_MEM_ALIGN = XA_ERROR_CODE(xa_severity_fatal, xa_class_api, XA_CODEC_GENERIC, 1),
+ XA_API_FATAL_INVALID_CMD = XA_ERROR_CODE(xa_severity_fatal, xa_class_api, XA_CODEC_GENERIC, 2),
+ XA_API_FATAL_INVALID_CMD_TYPE = XA_ERROR_CODE(xa_severity_fatal, xa_class_api, XA_CODEC_GENERIC, 3)
+};
+
+#endif /* __XA_ERROR_STANDARDS_H__ */
diff --git a/hifi/xaf/host-apf/include/audio/xa_memory_standards.h b/hifi/xaf/host-apf/include/audio/xa_memory_standards.h
new file mode 100644
index 00000000..27ec455f
--- /dev/null
+++ b/hifi/xaf/host-apf/include/audio/xa_memory_standards.h
@@ -0,0 +1,104 @@
+/*******************************************************************************
+* Copyright (C) 2018 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 use this Software with Cadence processor cores only and
+* not with any other processors and platforms, 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.
+
+******************************************************************************/
+/*******************************************************************************
+*
+* NOTE, ANY CHANGES TO THIS FILE MAY AFFECT UNDERLYING AUDIO / SPEECH CODEC
+* LIBRARY COMPONENT FROM CADENCE DESIGN SYSTEMS, INC.
+*
+******************************************************************************/
+
+
+#ifndef __XA_MEMORY_STANDARDS_H__
+#define __XA_MEMORY_STANDARDS_H__
+
+/*****************************************************************************/
+/* Constant hash defines */
+/*****************************************************************************/
+/* when you don't need alignment, pass this to memory library */
+#define XA_MEM_NO_ALIGN 0x01
+
+/* standard memory types */
+/* to be used inter frames */
+#define XA_MEMTYPE_PERSIST 0x00
+/* read write, to be used intra frames */
+#define XA_MEMTYPE_SCRATCH 0x01
+/* read only memory, intra frame */
+#define XA_MEMTYPE_INPUT 0x02
+/* read-write memory, for usable output, intra frame */
+#define XA_MEMTYPE_OUTPUT 0x03
+/* readonly memory, inter frame */
+#define XA_MEMTYPE_TABLE 0x04
+/* input buffer before mem tabs allocation */
+#define XA_MEMTYPE_PRE_FRAME_INPUT 0x05
+/* input buffer before mem tabs allocation */
+#define XA_MEMTYPE_PRE_FRAME_SCRATCH 0x06
+/* for local variables */
+#define XA_MEMTYPE_AUTO_VAR 0x80
+
+/* standard memory priorities */
+#define XA_MEMPRIORITY_ANYWHERE 0x00
+#define XA_MEMPRIORITY_LOWEST 0x01
+#define XA_MEMPRIORITY_LOW 0x02
+#define XA_MEMPRIORITY_NORM 0x03
+#define XA_MEMPRIORITY_ABOVE_NORM 0x04
+#define XA_MEMPRIORITY_HIGH 0x05
+#define XA_MEMPRIORITY_HIGHER 0x06
+#define XA_MEMPRIORITY_CRITICAL 0x07
+
+/* standard memory placements */
+/* placement is defined by 64 bits */
+
+#define XA_MEMPLACE_FAST_RAM_0 0x000001
+#define XA_MEMPLACE_FAST_RAM_1 0x000002
+#define XA_MEMPLACE_FAST_RAM_2 0x000004
+#define XA_MEMPLACE_FAST_RAM_3 0x000008
+#define XA_MEMPLACE_FAST_RAM_4 0x000010
+#define XA_MEMPLACE_FAST_RAM_5 0x000020
+#define XA_MEMPLACE_FAST_RAM_6 0x000040
+#define XA_MEMPLACE_FAST_RAM_7 0x000080
+
+#define XA_MEMPLACE_INT_RAM_0 0x000100
+#define XA_MEMPLACE_INT_RAM_1 0x000200
+#define XA_MEMPLACE_INT_RAM_2 0x000400
+#define XA_MEMPLACE_INT_RAM_3 0x000800
+#define XA_MEMPLACE_INT_RAM_4 0x001000
+#define XA_MEMPLACE_INT_RAM_5 0x002000
+#define XA_MEMPLACE_INT_RAM_6 0x004000
+#define XA_MEMPLACE_INT_RAM_7 0x008000
+
+#define XA_MEMPLACE_EXT_RAM_0 0x010000
+#define XA_MEMPLACE_EXT_RAM_1 0x020000
+#define XA_MEMPLACE_EXT_RAM_2 0x040000
+#define XA_MEMPLACE_EXT_RAM_3 0x080000
+#define XA_MEMPLACE_EXT_RAM_4 0x100000
+#define XA_MEMPLACE_EXT_RAM_5 0x200000
+#define XA_MEMPLACE_EXT_RAM_6 0x400000
+#define XA_MEMPLACE_EXT_RAM_7 0x800000
+
+#define XA_MEMPLACE_DONTCARE_H 0xFFFFFFFF
+#define XA_MEMPLACE_DONTCARE_L 0xFFFFFFFF
+
+/* the simple common PC RAM */
+#define XA_PC_RAM_H 0x00000000
+#define XA_PC_RAM_L XA_MEMPLACE_EXT_RAM_0
+
+#endif /* __XA_MEMORY_STANDARDS_H__ */
diff --git a/hifi/xaf/host-apf/include/audio/xa_type_def.h b/hifi/xaf/host-apf/include/audio/xa_type_def.h
new file mode 100644
index 00000000..e83cdd34
--- /dev/null
+++ b/hifi/xaf/host-apf/include/audio/xa_type_def.h
@@ -0,0 +1,98 @@
+/*******************************************************************************
+* Copyright (C) 2018 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 use this Software with Cadence processor cores only and
+* not with any other processors and platforms, 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.
+
+******************************************************************************/
+/*******************************************************************************
+*
+* NOTE, ANY CHANGES TO THIS FILE MAY AFFECT UNDERLYING AUDIO / SPEECH CODEC
+* LIBRARY COMPONENT FROM CADENCE DESIGN SYSTEMS, INC.
+*
+******************************************************************************/
+
+
+#ifndef __XA_TYPE_DEF_H__
+#define __XA_TYPE_DEF_H__
+
+/****************************************************************************/
+/* types type define prefix examples bytes */
+/************************ *********** ****** **************** ***** */
+typedef signed char WORD8 ;/* b WORD8 b_name 1 */
+typedef signed char * pWORD8 ;/* pb pWORD8 pb_nmae 1 */
+typedef unsigned char UWORD8 ;/* ub UWORD8 ub_count 1 */
+typedef unsigned char * pUWORD8 ;/* pub pUWORD8 pub_count 1 */
+
+typedef signed short WORD16 ;/* s WORD16 s_count 2 */
+typedef signed short * pWORD16 ;/* ps pWORD16 ps_count 2 */
+typedef unsigned short UWORD16 ;/* us UWORD16 us_count 2 */
+typedef unsigned short * pUWORD16;/* pus pUWORD16 pus_count 2 */
+
+typedef signed int WORD24 ;/* k WORD24 k_count 3 */
+typedef signed int * pWORD24 ;/* pk pWORD24 pk_count 3 */
+typedef unsigned int UWORD24 ;/* uk UWORD24 uk_count 3 */
+typedef unsigned int * pUWORD24;/* puk pUWORD24 puk_count 3 */
+
+typedef signed int WORD32 ;/* i WORD32 i_count 4 */
+typedef signed int * pWORD32 ;/* pi pWORD32 pi_count 4 */
+typedef unsigned int UWORD32 ;/* ui UWORD32 ui_count 4 */
+typedef unsigned int * pUWORD32;/* pui pUWORD32 pui_count 4 */
+
+typedef signed long long WORD40 ;/* m WORD40 m_count 5 */
+typedef signed long long * pWORD40 ;/* pm pWORD40 pm_count 5 */
+typedef unsigned long long UWORD40 ;/* um UWORD40 um_count 5 */
+typedef unsigned long long * pUWORD40;/* pum pUWORD40 pum_count 5 */
+
+typedef signed long long WORD64 ;/* h WORD64 h_count 8 */
+typedef signed long long * pWORD64 ;/* ph pWORD64 ph_count 8 */
+typedef unsigned long long UWORD64 ;/* uh UWORD64 uh_count 8 */
+typedef unsigned long long * pUWORD64;/* puh pUWORD64 puh_count 8 */
+
+typedef float FLOAT32 ;/* f FLOAT32 f_count 4 */
+typedef float * pFLOAT32;/* pf pFLOAT32 pf_count 4 */
+typedef double FLOAT64 ;/* d UFLOAT64 d_count 8 */
+typedef double * pFlOAT64;/* pd pFLOAT64 pd_count 8 */
+
+typedef void VOID ;/* v VOID v_flag 4 */
+typedef void * pVOID ;/* pv pVOID pv_flag 4 */
+
+/* variable size types: platform optimized implementation */
+//typedef signed int BOOL ;/* bool BOOL bool_true */
+//typedef unsigned int UBOOL ;/* ubool BOOL ubool_true */
+typedef signed int FLAG ;/* flag FLAG flag_false */
+typedef unsigned int UFLAG ;/* uflag FLAG uflag_false */
+typedef signed int LOOPIDX ;/* lp LOOPIDX lp_index */
+typedef unsigned int ULOOPIDX;/* ulp SLOOPIDX ulp_index */
+typedef signed int WORD ;/* lp LOOPIDX lp_index */
+typedef unsigned int UWORD ;/* ulp SLOOPIDX ulp_index */
+
+typedef LOOPIDX LOOPINDEX; /* lp LOOPIDX lp_index */
+typedef ULOOPIDX ULOOPINDEX;/* ulp SLOOPIDX ulp_index */
+
+#define PLATFORM_INLINE __inline
+
+typedef struct xa_codec_opaque { WORD32 _; } *xa_codec_handle_t;
+
+typedef int XA_ERRORCODE;
+
+typedef XA_ERRORCODE xa_codec_func_t(xa_codec_handle_t p_xa_module_obj,
+ WORD32 i_cmd,
+ WORD32 i_idx,
+ pVOID pv_value);
+
+#endif /* __XA_TYPE_DEF_H__ */
diff --git a/hifi/xaf/host-apf/include/audio/xa_vorbis_dec_api.h b/hifi/xaf/host-apf/include/audio/xa_vorbis_dec_api.h
new file mode 100644
index 00000000..f99660f8
--- /dev/null
+++ b/hifi/xaf/host-apf/include/audio/xa_vorbis_dec_api.h
@@ -0,0 +1,121 @@
+/*******************************************************************************
+* Copyright (C) 2018 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 use this Software with Cadence processor cores only and
+* not with any other processors and platforms, 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.
+
+******************************************************************************/
+/*******************************************************************************
+*
+* NOTE, ANY CHANGES TO THIS FILE MAY AFFECT UNDERLYING AUDIO / SPEECH CODEC
+* LIBRARY COMPONENT FROM CADENCE DESIGN SYSTEMS, INC.
+*
+******************************************************************************/
+
+
+
+#ifndef __XA_VORBIS_DEC_API_H__
+#define __XA_VORBIS_DEC_API_H__
+
+#include <xa_memory_standards.h>
+
+/* vorbis_dec-specific configuration parameters */
+enum xa_config_param_vorbis_dec
+{
+ XA_VORBISDEC_CONFIG_PARAM_SAMP_FREQ = 0,
+ XA_VORBISDEC_CONFIG_PARAM_NUM_CHANNELS = 1,
+ XA_VORBISDEC_CONFIG_PARAM_PCM_WDSZ = 2,
+ XA_VORBISDEC_CONFIG_PARAM_COMMENT_MEM_PTR = 3,
+ XA_VORBISDEC_CONFIG_PARAM_COMMENT_MEM_SIZE = 4,
+ XA_VORBISDEC_CONFIG_PARAM_GET_CUR_BITRATE = 5,
+ XA_VORBISDEC_CONFIG_PARAM_RAW_VORBIS_FILE_MODE = 6,
+ XA_VORBISDEC_CONFIG_PARAM_RAW_VORBIS_LAST_PKT_GRANULE_POS = 7,
+ XA_VORBISDEC_CONFIG_PARAM_OGG_MAX_PAGE_SIZE = 8,
+ XA_VORBISDEC_CONFIG_PARAM_RUNTIME_MEM = 9
+};
+
+/* commands */
+#include <xa_apicmd_standards.h>
+
+/* vorbis_dec-specific command types */
+/* (none) */
+
+/* error codes */
+#include <xa_error_standards.h>
+#define XA_CODEC_VORBIS_DEC 7
+
+/* vorbis_dec-specific error codes */
+
+/*****************************************************************************/
+/* Class 1: Configuration Errors */
+/*****************************************************************************/
+/* Nonfatal Errors */
+enum xa_error_nonfatal_config_vorbis_dec
+{
+ XA_VORBISDEC_CONFIG_NONFATAL_GROUPED_STREAM = XA_ERROR_CODE(xa_severity_nonfatal, xa_class_config, XA_CODEC_VORBIS_DEC, 0),
+ XA_VORBISDEC_CONFIG_NONFATAL_BAD_PARAM = XA_ERROR_CODE(xa_severity_nonfatal, xa_class_config, XA_CODEC_VORBIS_DEC, 1)
+};
+
+/* Fatal Errors */
+enum xa_error_fatal_config_vorbis_dec
+{
+ XA_VORBISDEC_CONFIG_FATAL_BADHDR = XA_ERROR_CODE(xa_severity_fatal, xa_class_config, XA_CODEC_VORBIS_DEC, 0),
+ XA_VORBISDEC_CONFIG_FATAL_NOTVORBIS = XA_ERROR_CODE(xa_severity_fatal, xa_class_config, XA_CODEC_VORBIS_DEC, 1),
+ XA_VORBISDEC_CONFIG_FATAL_BADINFO = XA_ERROR_CODE(xa_severity_fatal, xa_class_config, XA_CODEC_VORBIS_DEC, 2),
+ XA_VORBISDEC_CONFIG_FATAL_BADVERSION = XA_ERROR_CODE(xa_severity_fatal, xa_class_config, XA_CODEC_VORBIS_DEC, 3),
+ XA_VORBISDEC_CONFIG_FATAL_BADBOOKS = XA_ERROR_CODE(xa_severity_fatal, xa_class_config, XA_CODEC_VORBIS_DEC, 4),
+ XA_VORBISDEC_CONFIG_FATAL_CODEBOOK_DECODE = XA_ERROR_CODE(xa_severity_fatal, xa_class_config, XA_CODEC_VORBIS_DEC, 5),
+ XA_VORBISDEC_CONFIG_FATAL_INVALID_PARAM = XA_ERROR_CODE(xa_severity_fatal, xa_class_config, XA_CODEC_VORBIS_DEC, 6)
+};
+
+/*****************************************************************************/
+/* Class 2: Execution Errors */
+/*****************************************************************************/
+/* Nonfatal Errors */
+enum xa_error_nonfatal_execute_vorbis_dec
+{
+ XA_VORBISDEC_EXECUTE_NONFATAL_OV_HOLE = XA_ERROR_CODE(xa_severity_nonfatal, xa_class_execute, XA_CODEC_VORBIS_DEC, 0),
+ XA_VORBISDEC_EXECUTE_NONFATAL_OV_NOTAUDIO = XA_ERROR_CODE(xa_severity_nonfatal, xa_class_execute, XA_CODEC_VORBIS_DEC, 1),
+ XA_VORBISDEC_EXECUTE_NONFATAL_OV_BADPACKET = XA_ERROR_CODE(xa_severity_nonfatal, xa_class_execute, XA_CODEC_VORBIS_DEC, 2),
+ XA_VORBISDEC_EXECUTE_NONFATAL_OV_RUNTIME_DECODE_FLUSH_IN_PROGRESS = XA_ERROR_CODE(xa_severity_nonfatal, xa_class_execute, XA_CODEC_VORBIS_DEC, 3),
+ XA_VORBISDEC_EXECUTE_NONFATAL_OV_INVALID_STRM_POS = XA_ERROR_CODE(xa_severity_nonfatal, xa_class_execute, XA_CODEC_VORBIS_DEC, 4),
+ XA_VORBISDEC_EXECUTE_NONFATAL_OV_INSUFFICIENT_DATA = XA_ERROR_CODE(xa_severity_nonfatal, xa_class_execute, XA_CODEC_VORBIS_DEC, 5),
+ XA_VORBISDEC_EXECUTE_NONFATAL_OV_UNEXPECTED_IDENT_PKT_RECEIVED = XA_ERROR_CODE(xa_severity_nonfatal, xa_class_execute, XA_CODEC_VORBIS_DEC, 6),
+ XA_VORBISDEC_EXECUTE_NONFATAL_OV_UNEXPECTED_HEADER_PKT_RECEIVED = XA_ERROR_CODE(xa_severity_nonfatal, xa_class_execute, XA_CODEC_VORBIS_DEC, 7)
+};
+/* Fatal Errors */
+enum xa_error_fatal_execute_vorbis_dec
+{
+ XA_VORBISDEC_EXECUTE_FATAL_PERSIST_ALLOC = XA_ERROR_CODE(xa_severity_fatal, xa_class_execute, XA_CODEC_VORBIS_DEC, 0),
+ XA_VORBISDEC_EXECUTE_FATAL_SCRATCH_ALLOC = XA_ERROR_CODE(xa_severity_fatal, xa_class_execute, XA_CODEC_VORBIS_DEC, 1),
+ XA_VORBISDEC_EXECUTE_FATAL_CORRUPT_STREAM = XA_ERROR_CODE(xa_severity_fatal, xa_class_execute, XA_CODEC_VORBIS_DEC, 2),
+ XA_VORBISDEC_EXECUTE_FATAL_INSUFFICIENT_INP_BUF_SIZE = XA_ERROR_CODE(xa_severity_fatal, xa_class_execute, XA_CODEC_VORBIS_DEC, 3)
+};
+
+#include "xa_type_def.h"
+
+#ifdef __cplusplus
+ extern "C" {
+#endif /* __cplusplus */
+
+ xa_codec_func_t xa_vorbis_dec;
+
+#ifdef __cplusplus
+ }
+#endif /* __cplusplus */
+
+#endif /* __XA_VORBIS_DEC_API_H__ */
diff --git a/hifi/xaf/host-apf/include/os/android/xf-osal.h b/hifi/xaf/host-apf/include/os/android/xf-osal.h
new file mode 100644
index 00000000..7d2f5a95
--- /dev/null
+++ b/hifi/xaf/host-apf/include/os/android/xf-osal.h
@@ -0,0 +1,215 @@
+/*******************************************************************************
+* Copyright (C) 2018 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 use this Software with Cadence processor cores only and
+* not with any other processors and platforms, 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 __XF_H
+#error "xf-osal.h mustn't be included directly"
+#endif
+
+/*******************************************************************************
+ * Includes
+ ******************************************************************************/
+
+#include <pthread.h>
+#include <fcntl.h>
+#include <limits.h>
+#include <sys/mman.h>
+#include <sys/ioctl.h>
+#include <sys/time.h>
+#include <cutils/log.h>
+
+/*******************************************************************************
+ * Tracing primitive
+ ******************************************************************************/
+
+#define __xf_puts(str) \
+ ALOG(LOG_INFO, "PROXY", "%s", (str))
+
+/*******************************************************************************
+ * Lock operation
+ ******************************************************************************/
+
+/* ...lock definition */
+typedef pthread_mutex_t xf_lock_t;
+
+/* ...lock initialization */
+static inline void __xf_lock_init(xf_lock_t *lock)
+{
+ pthread_mutex_init(lock, NULL);
+}
+
+/* ...lock acquisition */
+static inline void __xf_lock(xf_lock_t *lock)
+{
+ pthread_mutex_lock(lock);
+}
+
+/* ...lock release */
+static inline void __xf_unlock(xf_lock_t *lock)
+{
+ pthread_mutex_unlock(lock);
+}
+
+/*******************************************************************************
+ * Waiting object
+ ******************************************************************************/
+
+/* ...waiting object handle */
+typedef struct __xf_wait
+{
+ /* ...conditional variable */
+ pthread_cond_t wait;
+
+ /* ...waiting mutex */
+ pthread_mutex_t mutex;
+
+} xf_wait_t;
+
+/* ...initialize waiting object */
+static inline void __xf_wait_init(xf_wait_t *w)
+{
+ pthread_cond_init(&w->wait, NULL);
+ pthread_mutex_init(&w->mutex, NULL);
+}
+
+/* ...prepare to waiting */
+static inline void __xf_wait_prepare(xf_wait_t *w)
+{
+ pthread_mutex_lock(&w->mutex);
+}
+
+#define __xf_wait_prepare(w) \
+({ \
+ TRACE(1, _x("prepare-wait")); \
+ (__xf_wait_prepare)(w); \
+})
+
+/* ...wait until event is signalled */
+static inline int __xf_wait(xf_wait_t *w, u32 timeout)
+{
+ struct timespec ts;
+ struct timeval tv;
+ int r;
+
+ /* ...wait with or without timeout (communication mutex is taken) */
+ if (!timeout)
+ {
+ r = -pthread_cond_wait(&w->wait, &w->mutex);
+ }
+ else
+ {
+ /* ...get current time */
+ gettimeofday(&tv, NULL);
+
+ /* ...set absolute timeout */
+ ts.tv_sec = tv.tv_sec + timeout / 1000;
+ ts.tv_nsec = tv.tv_usec * 1000 + (timeout % 1000) * 1000000;
+ (ts.tv_nsec >= 1000000000 ? ts.tv_sec++, ts.tv_nsec -= 1000000000 : 0);
+
+ /* ...wait conditionally with absolute timeout*/
+ r = -pthread_cond_timedwait(&w->wait, &w->mutex, &ts);
+ }
+
+ /* ...leave with communication mutex taken */
+ return r;
+}
+
+#define __xf_wait(w, timeout) \
+({ \
+ int __r; \
+ TRACE(1, _x("wait")); \
+ __r = (__xf_wait)(w, timeout); \
+ TRACE(1, _x("resume")); \
+ __r; \
+})
+
+/* ...wake up waiting handle */
+static inline void __xf_wakeup(xf_wait_t *w)
+{
+ /* ...take communication mutex before signaling */
+ pthread_mutex_lock(&w->mutex);
+
+ /* ...signalling will resume waiting thread */
+ pthread_cond_signal(&w->wait);
+
+ /* ...assure that waiting task will not resume until we say this - is that really needed? - tbd */
+ pthread_mutex_unlock(&w->mutex);
+}
+
+#define __xf_wakeup(w) \
+({ \
+ TRACE(1, _x("wakeup")); \
+ (__xf_wakeup)(w); \
+})
+
+/* ...complete waiting operation */
+static inline void __xf_wait_complete(xf_wait_t *w)
+{
+ pthread_mutex_unlock(&w->mutex);
+}
+
+#define __xf_wait_complete(w) \
+({ \
+ TRACE(1, _x("wait-complete")); \
+ (__xf_wait_complete)(w); \
+})
+
+/*******************************************************************************
+ * Thread support
+ ******************************************************************************/
+
+/* ...thread handle definition */
+typedef pthread_t xf_thread_t;
+
+/* ...thread creation */
+static inline int __xf_thread_create(xf_thread_t *thread, void * (*f)(void *), void *arg)
+{
+ pthread_attr_t attr;
+ int r;
+
+ /* ...initialize thread attributes - joinable with minimal stack */
+ pthread_attr_init(&attr);
+ pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
+ pthread_attr_setstacksize(&attr, PTHREAD_STACK_MIN);
+
+ /* ...create proxy asynchronous thread managing SHMEM */
+ r = -pthread_create(thread, &attr, f, arg);
+
+ /* ...destroy thread attributes */
+ pthread_attr_destroy(&attr);
+
+ return r;
+}
+
+/* ...terminate thread operation */
+static inline int __xf_thread_destroy(xf_thread_t *thread)
+{
+ void *r;
+
+ /* ...tell the thread to terminate */
+ pthread_kill(*thread,SIGUSR1);
+
+ /* ...wait until thread terminates */
+ pthread_join(*thread, &r);
+
+ /* ...return final status */
+ return (int)(intptr_t)r;
+}
diff --git a/hifi/xaf/host-apf/include/os/xos/xf-osal.h b/hifi/xaf/host-apf/include/os/xos/xf-osal.h
new file mode 100644
index 00000000..c3468000
--- /dev/null
+++ b/hifi/xaf/host-apf/include/os/xos/xf-osal.h
@@ -0,0 +1,206 @@
+/*******************************************************************************
+* Copyright (C) 2018 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 use this Software with Cadence processor cores only and
+* not with any other processors and platforms, 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 __XF_H
+#error "xf-osal.h mustn't be included directly"
+#endif
+
+/*******************************************************************************
+ * Includes
+ ******************************************************************************/
+#include "xos.h"
+
+/*******************************************************************************
+ * Tracing primitive
+ ******************************************************************************/
+
+#define __xf_puts(str) \
+ puts((str))
+
+/*******************************************************************************
+ * Lock operation
+ ******************************************************************************/
+
+/* ...lock definition */
+typedef XosMutex xf_lock_t;
+
+/* ...lock initialization */
+static inline void __xf_lock_init(xf_lock_t *lock)
+{
+ xos_mutex_create(lock, XOS_MUTEX_WAIT_PRIORITY, 0);
+}
+
+/* ...lock acquisition */
+static inline void __xf_lock(xf_lock_t *lock)
+{
+ xos_mutex_lock(lock);
+}
+
+/* ...lock release */
+static inline void __xf_unlock(xf_lock_t *lock)
+{
+ xos_mutex_unlock(lock);
+}
+
+/*******************************************************************************
+ * Waiting object
+ ******************************************************************************/
+
+#if 0
+/* ...waiting object handle */
+typedef struct __xf_wait
+{
+ /* ...conditional variable */
+ pthread_cond_t wait;
+
+ /* ...waiting mutex */
+ pthread_mutex_t mutex;
+
+} xf_wait_t;
+
+/* ...initialize waiting object */
+static inline void __xf_wait_init(xf_wait_t *w)
+{
+ pthread_cond_init(&w->wait, NULL);
+ pthread_mutex_init(&w->mutex, NULL);
+}
+
+/* ...prepare to waiting */
+static inline void __xf_wait_prepare(xf_wait_t *w)
+{
+ pthread_mutex_lock(&w->mutex);
+}
+
+#define __xf_wait_prepare(w) \
+({ \
+ TRACE(1, _x("prepare-wait")); \
+ (__xf_wait_prepare)(w); \
+})
+
+/* ...wait until event is signalled */
+static inline int __xf_wait(xf_wait_t *w, u32 timeout)
+{
+ struct timespec ts;
+ struct timeval tv;
+ int r;
+
+ /* ...wait with or without timeout (communication mutex is taken) */
+ if (!timeout)
+ {
+ r = -pthread_cond_wait(&w->wait, &w->mutex);
+ }
+ else
+ {
+ /* ...get current time */
+ gettimeofday(&tv, NULL);
+
+ /* ...set absolute timeout */
+ ts.tv_sec = tv.tv_sec + timeout / 1000;
+ ts.tv_nsec = tv.tv_usec * 1000 + (timeout % 1000) * 1000000;
+ (ts.tv_nsec >= 1000000000 ? ts.tv_sec++, ts.tv_nsec -= 1000000000 : 0);
+
+ /* ...wait conditionally with absolute timeout*/
+ r = -pthread_cond_timedwait(&w->wait, &w->mutex, &ts);
+ }
+
+ /* ...leave with communication mutex taken */
+ return r;
+}
+
+#define __xf_wait(w, timeout) \
+({ \
+ int __r; \
+ TRACE(1, _x("wait")); \
+ __r = (__xf_wait)(w, timeout); \
+ TRACE(1, _x("resume")); \
+ __r; \
+})
+
+/* ...wake up waiting handle */
+static inline void __xf_wakeup(xf_wait_t *w)
+{
+ /* ...take communication mutex before signaling */
+ pthread_mutex_lock(&w->mutex);
+
+ /* ...signalling will resume waiting thread */
+ pthread_cond_signal(&w->wait);
+
+ /* ...assure that waiting task will not resume until we say this - is that really needed? - tbd */
+ pthread_mutex_unlock(&w->mutex);
+}
+
+#define __xf_wakeup(w) \
+({ \
+ TRACE(1, _x("wakeup")); \
+ (__xf_wakeup)(w); \
+})
+
+/* ...complete waiting operation */
+static inline void __xf_wait_complete(xf_wait_t *w)
+{
+ pthread_mutex_unlock(&w->mutex);
+}
+
+#define __xf_wait_complete(w) \
+({ \
+ TRACE(1, _x("wait-complete")); \
+ (__xf_wait_complete)(w); \
+})
+#endif
+
+/*******************************************************************************
+ * Thread support
+ ******************************************************************************/
+
+/* ...thread handle definition */
+typedef XosThread xf_thread_t;
+typedef XosThreadFunc xf_entry_t;
+
+/* ...thread creation */
+static inline int __xf_thread_create(xf_thread_t *thread, xf_entry_t *f,
+ void *arg, const char *name, void * stack,
+ unsigned int stack_size, int priority)
+{
+ int r;
+
+ /* ...create proxy asynchronous thread managing SHMEM */
+ r = xos_thread_create(thread, 0, f, arg, name, stack, stack_size, priority, 0, 0);
+
+ return r;
+}
+
+/* ...terminate thread operation */
+static inline int __xf_thread_destroy(xf_thread_t *thread)
+{
+ int r;
+
+ /* ...wait until thread terminates */
+ /* v-tbd - avoid infinite wait for join */
+ //xos_thread_join(thread, &r);
+
+ /* ...delete thread, free up TCB, stack */
+ r = xos_thread_delete(thread);
+
+ /* ...return final status */
+ return r;
+}
+
diff --git a/hifi/xaf/host-apf/include/sys/fio/xf-config.h b/hifi/xaf/host-apf/include/sys/fio/xf-config.h
new file mode 100644
index 00000000..2e1d4c61
--- /dev/null
+++ b/hifi/xaf/host-apf/include/sys/fio/xf-config.h
@@ -0,0 +1,36 @@
+/*******************************************************************************
+* Copyright (C) 2018 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 use this Software with Cadence processor cores only and
+* not with any other processors and platforms, 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.
+
+******************************************************************************/
+
+/* ...number of DSP cores */
+#define XF_CFG_CORES_NUM 4
+
+/* ...maximal number of clients supported by proxy */
+#define XF_CFG_PROXY_MAX_CLIENTS 256
+
+/* ...size of the shared memory pool (in bytes) */
+#define XF_CFG_REMOTE_IPC_POOL_SIZE (256 << 10)
+
+/* ...size of the component(DSP) local memory pool (in bytes) */
+#define XF_CFG_LOCAL_POOL_SIZE (1024<< 10)
+
+/* ...alignment for shared buffers */
+#define XF_PROXY_ALIGNMENT 64
diff --git a/hifi/xaf/host-apf/include/sys/fio/xf-hal.h b/hifi/xaf/host-apf/include/sys/fio/xf-hal.h
new file mode 100644
index 00000000..15a82b03
--- /dev/null
+++ b/hifi/xaf/host-apf/include/sys/fio/xf-hal.h
@@ -0,0 +1,34 @@
+/*******************************************************************************
+* Copyright (C) 2018 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 use this Software with Cadence processor cores only and
+* not with any other processors and platforms, 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 __XF_H
+#error "xf-hal.h mustn't be included directly"
+#endif
+
+/*******************************************************************************
+ * Includes
+ ******************************************************************************/
+
+/* ...primitive types */
+#include "xf-types.h"
+
+/* ...anything else? - tbd */
diff --git a/hifi/xaf/host-apf/include/sys/fio/xf-ipc.h b/hifi/xaf/host-apf/include/sys/fio/xf-ipc.h
new file mode 100644
index 00000000..2ee859a8
--- /dev/null
+++ b/hifi/xaf/host-apf/include/sys/fio/xf-ipc.h
@@ -0,0 +1,127 @@
+/*******************************************************************************
+* Copyright (C) 2018 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 use this Software with Cadence processor cores only and
+* not with any other processors and platforms, 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 __XF_H
+#error "xf-ipc.h mustn't be included directly"
+#endif
+
+/*******************************************************************************
+ * Types definitions
+ ******************************************************************************/
+
+/* ...proxy IPC data */
+typedef struct xf_proxy_ipc_data
+{
+ /* ...shared memory buffer pointer */
+ void *shmem;
+
+ /* ...file descriptor */
+ int fd;
+
+ /* ...pipe for asynchronous response delivery */
+ int pipe[2];
+
+} xf_proxy_ipc_data_t;
+
+/*******************************************************************************
+ * Helpers for asynchronous response delivery
+ ******************************************************************************/
+
+#define xf_proxy_ipc_response_put(ipc, msg) \
+ (write((ipc)->pipe[1], (msg), sizeof(*(msg))) == sizeof(*(msg)) ? 0 : -errno)
+
+#define xf_proxy_ipc_response_get(ipc, msg) \
+ (read((ipc)->pipe[0], (msg), sizeof(*(msg))) == sizeof(*(msg)) ? 0 : -errno)
+
+/*******************************************************************************
+ * Shared memory translation
+ ******************************************************************************/
+
+/* ...translate proxy shared address into local virtual address */
+static inline void * xf_ipc_a2b(xf_proxy_ipc_data_t *ipc, u32 address)
+{
+ if (address < XF_CFG_REMOTE_IPC_POOL_SIZE)
+ return (unsigned char *) ipc->shmem + address;
+ else if (address == XF_PROXY_NULL)
+ return NULL;
+ else
+ return (void *) -1;
+}
+
+/* ...translate local virtual address into shared proxy address */
+static inline u32 xf_ipc_b2a(xf_proxy_ipc_data_t *ipc, void *b)
+{
+ u32 a;
+
+ if (b == NULL)
+ return XF_PROXY_NULL;
+ if ((a = (u32)((u8 *)b - (u8 *)ipc->shmem)) < XF_CFG_REMOTE_IPC_POOL_SIZE)
+ return a;
+ else
+ return XF_PROXY_BADADDR;
+}
+
+/*******************************************************************************
+ * Component inter-process communication
+ ******************************************************************************/
+
+typedef struct xf_ipc_data
+{
+ /* ...asynchronous response delivery pipe */
+ int pipe[2];
+
+} xf_ipc_data_t;
+
+/*******************************************************************************
+ * Helpers for asynchronous response delivery
+ ******************************************************************************/
+
+#define xf_ipc_response_put(ipc, msg) \
+ (write((ipc)->pipe[1], (msg), sizeof(*(msg))) == sizeof(*(msg)) ? 0 : -errno)
+
+#define xf_ipc_response_get(ipc, msg) \
+ (read((ipc)->pipe[0], (msg), sizeof(*(msg))) == sizeof(*(msg)) ? 0 : -errno)
+
+#define xf_ipc_data_init(ipc) \
+ (pipe((ipc)->pipe) == 0 ? 0 : -errno)
+
+#define xf_ipc_data_destroy(ipc) \
+ (close((ipc)->pipe[0]), close((ipc)->pipe[1]))
+
+/*******************************************************************************
+* API functions
+ ******************************************************************************/
+
+/* ...send asynchronous command */
+extern int xf_ipc_send(xf_proxy_ipc_data_t *ipc, xf_proxy_msg_t *msg, void *b);
+
+/* ...wait for response from remote proxy */
+extern int xf_ipc_wait(xf_proxy_ipc_data_t *ipc, u32 timeout);
+
+/* ...receive response from IPC layer */
+extern int xf_ipc_recv(xf_proxy_ipc_data_t *ipc, xf_proxy_msg_t *msg, void **b);
+
+/* ...open proxy interface on proper DSP partition */
+extern int xf_ipc_open(xf_proxy_ipc_data_t *proxy, u32 core, void *p_shmem);
+
+/* ...close proxy handle */
+extern void xf_ipc_close(xf_proxy_ipc_data_t *proxy, u32 core);
diff --git a/hifi/xaf/host-apf/include/sys/fio/xf-runtime.h b/hifi/xaf/host-apf/include/sys/fio/xf-runtime.h
new file mode 100644
index 00000000..9cad95f4
--- /dev/null
+++ b/hifi/xaf/host-apf/include/sys/fio/xf-runtime.h
@@ -0,0 +1,35 @@
+/*******************************************************************************
+* Copyright (C) 2018 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 use this Software with Cadence processor cores only and
+* not with any other processors and platforms, 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 __XF_H
+#error "xf-runtime.h mustn't be included directly"
+#endif
+
+/*******************************************************************************
+ * Includes
+ ******************************************************************************/
+
+/* ...platform HAL layer */
+#include "xf-hal.h"
+
+/* ...OS abstraction layer */
+#include "xf-osal.h"
diff --git a/hifi/xaf/host-apf/include/sys/fio/xf-types.h b/hifi/xaf/host-apf/include/sys/fio/xf-types.h
new file mode 100644
index 00000000..a610c8e1
--- /dev/null
+++ b/hifi/xaf/host-apf/include/sys/fio/xf-types.h
@@ -0,0 +1,88 @@
+/*******************************************************************************
+* Copyright (C) 2018 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 use this Software with Cadence processor cores only and
+* not with any other processors and platforms, 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 __XF_H
+#error "xf-types.h mustn't be included directly"
+#endif
+
+/*******************************************************************************
+ * Standard includes
+ ******************************************************************************/
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+
+#include <stdarg.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <assert.h>
+#include <errno.h>
+
+#include <unistd.h>
+#include <fcntl.h>
+#include <pthread.h>
+#include <signal.h>
+#include <limits.h>
+#include <sys/mman.h>
+#include <sys/ioctl.h>
+#include <sys/time.h>
+
+/*******************************************************************************
+ * Primitive types
+ ******************************************************************************/
+
+typedef uint32_t u32;
+typedef int32_t s32;
+typedef uint16_t u16;
+typedef int16_t s16;
+typedef uint8_t u8;
+typedef int8_t s8;
+
+/*******************************************************************************
+ * Macros definitions
+ ******************************************************************************/
+
+/* ...NULL-address specification */
+#define XF_PROXY_NULL (~0U)
+
+/* ...invalid proxy address */
+#define XF_PROXY_BADADDR XF_CFG_REMOTE_IPC_POOL_SIZE
+
+/*******************************************************************************
+ * Auxiliary helpers
+ ******************************************************************************/
+
+/* ...next power-of-two calculation */
+#define xf_next_power_of_two(v) __xf_power_of_two_1((v) - 1)
+#define __xf_power_of_two_1(v) __xf_power_of_two_2((v) | ((v) >> 1))
+#define __xf_power_of_two_2(v) __xf_power_of_two_3((v) | ((v) >> 2))
+#define __xf_power_of_two_3(v) __xf_power_of_two_4((v) | ((v) >> 4))
+#define __xf_power_of_two_4(v) __xf_power_of_two_5((v) | ((v) >> 8))
+#define __xf_power_of_two_5(v) __xf_power_of_two_6((v) | ((v) >> 16))
+#define __xf_power_of_two_6(v) ((v) + 1)
+
+/* ...check if non-zero value is a power-of-two */
+#define xf_is_power_of_two(v) (((v) & ((v) - 1)) == 0)
+
diff --git a/hifi/xaf/host-apf/include/xaf-api.h b/hifi/xaf/host-apf/include/xaf-api.h
new file mode 100644
index 00000000..5cebb430
--- /dev/null
+++ b/hifi/xaf/host-apf/include/xaf-api.h
@@ -0,0 +1,139 @@
+/*******************************************************************************
+* Copyright (C) 2018 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 use this Software with Cadence processor cores only and
+* not with any other processors and platforms, 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.
+
+******************************************************************************/
+
+
+/* ...number of max input buffers */
+#define XAF_MAX_INBUFS 2
+#define XAF_INBUF_SIZE 8192
+
+typedef enum {
+ XAF_DECODER = 0,
+ XAF_ENCODER = 1,
+ XAF_MIXER = 2,
+ XAF_PRE_PROC = 3,
+ XAF_POST_PROC = 4,
+} xaf_comp_type;
+
+typedef enum {
+ XAF_STARTING = 0,
+ XAF_INIT_DONE = 1,
+ XAF_NEED_INPUT = 2,
+ XAF_OUTPUT_READY = 3,
+ XAF_EXEC_DONE = 4,
+} xaf_comp_status;
+
+typedef enum {
+ XAF_START_FLAG = 1,
+ XAF_EXEC_FLAG = 2,
+ XAF_INPUT_OVER_FLAG = 3,
+ XAF_INPUT_READY_FLAG = 4,
+ XAF_NEED_OUTPUT_FLAG = 5,
+} xaf_comp_flag;
+
+typedef enum {
+ XAF_NO_ERROR = 0,
+ XAF_PTR_ERROR = -1,
+ XAF_INVALID_VALUE = -2,
+ XAF_ROUTING_ERROR = -3,
+ /*XAF_XOS_ERROR = -4,*/
+ XAF_API_ERR = -5,
+} XAF_ERR_CODE;
+
+typedef enum {
+ XAF_MEM_ID_DEV = 0,
+ XAF_MEM_ID_COMP = 1,
+} XAF_MEM_ID;
+
+/* structure for component memory sizes */
+typedef struct xaf_mem_size_s{
+ u32 persist;
+ u32 scratch;
+ u32 input;
+ u32 output;
+}xaf_mem_size_t;
+
+/* structure for host-side utility handles */
+typedef struct xaf_ap_utils_s{
+ int xf_cfg_remote_ipc_pool_size;
+ xaf_mem_size_t mem_size;
+}xaf_ap_utils_t;
+
+typedef struct xaf_format_s {
+ u32 sample_rate;
+ u32 channels;
+ u32 pcm_width;
+ u32 input_length;
+ u32 output_length;
+} xaf_format_t;
+
+#ifndef XAF_HOSTLESS
+typedef struct xaf_info_s {
+ void * buf;
+ u32 length;
+} xaf_info_t;
+#endif
+
+XAF_ERR_CODE xaf_adev_open(void **pp_adev, s32 audio_frmwk_buf_size, s32 audio_comp_buf_size, xaf_mem_malloc_fxn_t mm_malloc, xaf_mem_free_fxn_t mm_free);
+XAF_ERR_CODE xaf_adev_close(void *adev_ptr, xaf_comp_flag flag);
+
+XAF_ERR_CODE xaf_comp_create(void* p_adev, void **p_comp, xf_id_t comp_id, u32 ninbuf, u32 noutbuf, void *pp_inbuf[], xaf_comp_type comp_type);
+XAF_ERR_CODE xaf_comp_delete(void* p_comp);
+XAF_ERR_CODE xaf_comp_set_config(void *p_comp, s32 num_param, s32 *p_param);
+XAF_ERR_CODE xaf_comp_get_config(void *p_comp, s32 num_param, s32 *p_param);
+XAF_ERR_CODE xaf_comp_process(void *p_adev, void *p_comp, void *p_buf, u32 length, xaf_comp_flag flag);
+XAF_ERR_CODE xaf_connect(void *p_src, void *p_dest, s32 num_buf);
+
+/* Not available in this version yet.
+XAF_ERR_CODE xaf_disconnect(xaf_comp_t *p_comp);
+*/
+
+XAF_ERR_CODE xaf_comp_get_status(void *p_adev, void *p_comp, xaf_comp_status *p_status, xaf_info_t *p_info);
+
+/* ...check null pointer */
+#define XAF_CHK_PTR(ptr) \
+({ \
+ int __ret; \
+ \
+ if ((__ret = (int)(ptr)) == 0) \
+ { \
+ TRACE(ERROR, _x("Null pointer error: %d"), __ret); \
+ return XAF_PTR_ERROR; \
+ } \
+ __ret; \
+})
+
+/* ...check range */
+#define XAF_CHK_RANGE(val, min, max) \
+({ \
+ int __ret = val; \
+ \
+ if ((__ret < (int)min) || (__ret > (int)max)) \
+ { \
+ TRACE(ERROR, _x("Invalid value: %d"), __ret); \
+ return XAF_INVALID_VALUE; \
+ } \
+ __ret; \
+})
+
+
+
+
diff --git a/hifi/xaf/host-apf/include/xaf-structs.h b/hifi/xaf/host-apf/include/xaf-structs.h
new file mode 100644
index 00000000..f632600a
--- /dev/null
+++ b/hifi/xaf/host-apf/include/xaf-structs.h
@@ -0,0 +1,82 @@
+/*******************************************************************************
+* Copyright (C) 2018 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 use this Software with Cadence processor cores only and
+* not with any other processors and platforms, 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.
+
+******************************************************************************/
+
+/* ...size of auxiliary pool for communication with HiFi */
+#define XAF_AUX_POOL_SIZE 32
+
+/* ...length of auxiliary pool messages */
+#define XAF_AUX_POOL_MSG_LENGTH 128
+#define XAF_MAX_CONFIG_PARAMS (XAF_AUX_POOL_MSG_LENGTH >> 3)
+
+typedef struct xaf_comp xaf_comp_t;
+
+struct xaf_comp {
+ xf_handle_t handle;
+
+ u32 inp_routed;
+ u32 out_routed;
+ u32 inp_ports;
+ u32 out_ports;
+ u32 init_done;
+ u32 pending_resp;
+ u32 expect_out_cmd;
+ u32 input_over;
+
+ xaf_comp_type comp_type;
+ xaf_comp_status comp_status;
+ u32 start_cmd_issued;
+ u32 exec_cmd_issued;
+ void *start_buf;
+
+ xaf_format_t inp_format;
+ xaf_format_t out_format;
+
+ xf_pool_t *inpool;
+ xf_pool_t *outpool;
+ u32 noutbuf;
+
+ xaf_comp_t *next;
+
+ u32 ninbuf;
+ void *p_adev;
+ //xaf_comp_state comp_state;
+ void *comp_ptr;
+};
+
+typedef struct xaf_adev_s {
+ xf_proxy_t proxy;
+ xaf_comp_t *comp_chain;
+
+ u32 n_comp;
+ void *adev_ptr;
+ void *p_dspMem;
+ void *p_apMem;
+ void *p_dspLocalBuff;
+ void *p_apSharedMem;
+
+ xaf_ap_utils_t *p_ap_utils; //host-side utility structure handle
+ void *(*pxf_mem_malloc_fxn)(s32, s32);
+ void (*pxf_mem_free_fxn)(void *,s32);
+ //xaf_adev_state adev_state;
+
+} xaf_adev_t;
+
diff --git a/hifi/xaf/host-apf/include/xf-debug.h b/hifi/xaf/host-apf/include/xf-debug.h
new file mode 100644
index 00000000..83172302
--- /dev/null
+++ b/hifi/xaf/host-apf/include/xf-debug.h
@@ -0,0 +1,194 @@
+/*******************************************************************************
+* Copyright (C) 2018 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 use this Software with Cadence processor cores only and
+* not with any other processors and platforms, 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 __XF_H
+#error "xf-debug.h mustn't be included directly"
+#endif
+
+/*******************************************************************************
+ * Auxiliary macros (put into "xf-types.h"?)
+ ******************************************************************************/
+
+#ifndef offset_of
+#define offset_of(type, member) \
+ ((int)(intptr_t)&(((const type *)(0))->member))
+#endif
+
+#ifndef container_of
+#define container_of(ptr, type, member) \
+ ((type *)((void *)(ptr) - offset_of(type, member)))
+#endif
+
+/*******************************************************************************
+ * Bug check for constant conditions (file scope)
+ ******************************************************************************/
+
+#define __C_BUG(n) __C_BUG2(n)
+#define __C_BUG2(n) __c_bug_##n
+#define C_BUG(expr) typedef char __C_BUG(__LINE__)[(expr) ? -1 : 1]
+
+/*******************************************************************************
+ * Compilation-time types control
+ ******************************************************************************/
+
+#if XF_DEBUG
+#define __C_TYPE_CONTROL(d, type) ((void) ((d) != (type*) 0))
+#else
+#define __C_TYPE_CONTROL(d, type) ((void) 0)
+#endif
+
+/*******************************************************************************
+ * Unused variable
+ ******************************************************************************/
+
+#define C_UNUSED(v) (void)(0 ? (v) = (v), 1 : 0)
+
+/*******************************************************************************
+ * Auxiliary macros
+ ******************************************************************************/
+
+/* ...define a stub for unused declarator */
+#define __xf_stub(tag, line) __xf_stub2(tag, line)
+#define __xf_stub2(tag, line) typedef int __xf_##tag##_##line
+
+/* ...convert anything into string */
+#define __xf_string(x) __xf_string2(x)
+#define __xf_string2(x) #x
+
+/*******************************************************************************
+ * Tracing facility
+ ******************************************************************************/
+
+#if XF_TRACE
+
+/* ...tracing to communication processor */
+extern int xf_trace(const char *format, ...);
+
+/* ...tracing facility initialization */
+extern void xf_trace_init(const char *banner);
+
+/* ...initialize tracing facility */
+#define TRACE_INIT(banner) (xf_trace_init(banner))
+
+/* ...trace tag definition */
+#define TRACE_TAG(tag, on) enum { __xf_trace_##tag = on }
+
+/* ...check if the trace tag is enabled */
+#define TRACE_CFG(tag) (__xf_trace_##tag)
+
+/* ...tagged tracing primitive */
+#define TRACE(tag, fmt, ...) (void)(__xf_trace_##tag ? __xf_trace(tag, __xf_format##fmt, ## __VA_ARGS__), 1 : 0)
+
+/*******************************************************************************
+ * Tagged tracing formats
+ ******************************************************************************/
+
+/* ...tracing primitive */
+#define __xf_trace(tag, fmt, ...) \
+ ({ __attribute__((unused)) const char *__xf_tag = #tag; xf_trace(fmt, ## __VA_ARGS__); })
+
+/* ...just a format string */
+#define __xf_format_n(fmt) fmt
+
+/* ...module tag and trace tag shown */
+#define __xf_format_b(fmt) "[%s.%s] " fmt, __xf_string(MODULE_TAG), __xf_tag
+
+/* ...module tag, trace tag, file name and line shown */
+#define __xf_format_x(fmt) "[%s.%s] - %s@%d - " fmt, __xf_string(MODULE_TAG), __xf_tag, __FILE__, __LINE__
+
+/*******************************************************************************
+ * Globally defined tags
+ ******************************************************************************/
+
+/* ...unconditionally OFF */
+TRACE_TAG(0, 0);
+
+/* ...unconditionally ON */
+TRACE_TAG(1, 1);
+
+/* ...error output - on by default */
+TRACE_TAG(ERROR, 1);
+
+#else
+
+#define TRACE_INIT(banner) (void)0
+#define TRACE_TAG(tag, on) __xf_stub(trace_##tag, __LINE__)
+#define TRACE(tag, fmt, ...) (void)0
+#define __xf_trace(tag, fmt, ...) (void)0
+
+#endif /* XF_TRACE */
+
+/*******************************************************************************
+ * Bugchecks
+ ******************************************************************************/
+
+#if XF_DEBUG
+
+/* ...run-time bugcheck */
+#define BUG(cond, fmt, ...) \
+do \
+{ \
+ if (cond) \
+ { \
+ /* ...output message */ \
+ __xf_trace(BUG, __xf_format##fmt, ## __VA_ARGS__); \
+ \
+ /* ...and die */ \
+ abort(); \
+ } \
+} \
+while (0)
+
+#else
+#define BUG(cond, fmt, ...) (void)0
+#endif /* XF_DEBUG */
+
+/*******************************************************************************
+ * Run-time error processing
+ ******************************************************************************/
+
+/* ...check the API call succeeds */
+#define XF_CHK_API(cond) \
+({ \
+ int __ret; \
+ \
+ if ((__ret = (int)(cond)) < 0) \
+ { \
+ TRACE(ERROR, _x("API error: %d"), __ret); \
+ return __ret; \
+ } \
+ __ret; \
+})
+
+/* ...check the condition is true */
+#define XF_CHK_ERR(cond, error) \
+({ \
+ intptr_t __ret; \
+ \
+ if (!(__ret = (intptr_t)(cond))) \
+ { \
+ TRACE(ERROR, _x("check failed")); \
+ return (error); \
+ } \
+ (int)__ret; \
+})
+
diff --git a/hifi/xaf/host-apf/include/xf-opcode.h b/hifi/xaf/host-apf/include/xf-opcode.h
new file mode 100644
index 00000000..f585f5c2
--- /dev/null
+++ b/hifi/xaf/host-apf/include/xf-opcode.h
@@ -0,0 +1,297 @@
+/*******************************************************************************
+* Copyright (C) 2018 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 use this Software with Cadence processor cores only and
+* not with any other processors and platforms, 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 __XF_H
+#error "xf-opcode.h mustn't be included directly"
+#endif
+
+/*******************************************************************************
+ * Message routing composition - move somewhere else - tbd
+ ******************************************************************************/
+
+/* ...adjust IPC client of message going from user-space */
+#define XF_MSG_AP_FROM_USER(id, client) \
+ (((id) & ~(0xF << 2)) | (client))
+
+/* ...wipe out IPC client from message going to user-space */
+#define XF_MSG_AP_TO_USER(id) \
+ ((id) & ~(0xF << 18))
+
+/* ...port specification (12 bits) */
+#define __XF_PORT_SPEC(core, id, port) ((core) | ((id) << 2) | ((port) << 8))
+#define __XF_PORT_SPEC2(id, port) ((id) | ((port) << 8))
+#define XF_PORT_CORE(spec) ((spec) & 0x3)
+#define XF_PORT_CLIENT(spec) (((spec) >> 2) & 0x3F)
+#define XF_PORT_ID(spec) (((spec) >> 8) & 0xF)
+
+/* ...message id contains source and destination ports specification */
+#define __XF_MSG_ID(src, dst) (((src) & 0xFFFF) | (((dst) & 0xFFFF) << 16))
+#define XF_MSG_SRC(id) (((id) >> 0) & 0xFFFF)
+#define XF_MSG_SRC_CORE(id) (((id) >> 0) & 0x3)
+#define XF_MSG_SRC_CLIENT(id) (((id) >> 2) & 0x3F)
+#define XF_MSG_SRC_ID(id) (((id) >> 0) & 0xFF)
+#define XF_MSG_SRC_PORT(id) (((id) >> 8) & 0xF)
+#define XF_MSG_SRC_PROXY(id) (((id) >> 15) & 0x1)
+#define XF_MSG_DST(id) (((id) >> 16) & 0xFFFF)
+#define XF_MSG_DST_CORE(id) (((id) >> 16) & 0x3)
+#define XF_MSG_DST_CLIENT(id) (((id) >> 18) & 0x3F)
+#define XF_MSG_DST_ID(id) (((id) >> 16) & 0xFF)
+#define XF_MSG_DST_PORT(id) (((id) >> 24) & 0xF)
+#define XF_MSG_DST_PROXY(id) (((id) >> 31) & 0x1)
+
+/* ...special treatment of AP-proxy destination field */
+#define XF_AP_IPC_CLIENT(id) (((id) >> 18) & 0xF)
+#define XF_AP_CLIENT(id) (((id) >> 22) & 0x1FF)
+#define __XF_AP_PROXY(core) ((core) | 0x8000)
+#define __XF_DSP_PROXY(core) ((core) | 0x8000)
+#define __XF_AP_CLIENT(core, client) ((core) | ((client) << 6) | 0x8000)
+
+/*******************************************************************************
+ * Opcode composition
+ ******************************************************************************/
+
+/* ...opcode composition with command/response data tags */
+#define __XF_OPCODE(c, r, op) (((c) << 31) | ((r) << 30) | ((op) & 0x3F))
+
+/* ...accessors */
+#define XF_OPCODE_CDATA(opcode) ((opcode) & (1 << 31))
+#define XF_OPCODE_RDATA(opcode) ((opcode) & (1 << 30))
+#define XF_OPCODE_TYPE(opcode) ((opcode) & (0x3F))
+
+/*******************************************************************************
+ * Opcode types
+ ******************************************************************************/
+
+/* ...unregister client */
+#define XF_UNREGISTER __XF_OPCODE(0, 0, 0)
+
+/* ...register client at proxy */
+#define XF_REGISTER __XF_OPCODE(1, 0, 1)
+
+/* ...port routing command */
+#define XF_ROUTE __XF_OPCODE(1, 0, 2)
+
+/* ...port unrouting command */
+#define XF_UNROUTE __XF_OPCODE(1, 0, 3)
+
+/* ...shared buffer allocation */
+#define XF_ALLOC __XF_OPCODE(0, 0, 4)
+
+/* ...shared buffer freeing */
+#define XF_FREE __XF_OPCODE(0, 0, 5)
+
+/* ...set component parameters */
+#define XF_SET_PARAM __XF_OPCODE(1, 0, 6)
+
+/* ...get component parameters */
+#define XF_GET_PARAM __XF_OPCODE(1, 1, 7)
+
+/* ...input buffer reception */
+#define XF_EMPTY_THIS_BUFFER __XF_OPCODE(1, 0, 8)
+
+/* ...output buffer reception */
+#define XF_FILL_THIS_BUFFER __XF_OPCODE(0, 1, 9)
+
+/* ...flush specific port */
+#define XF_FLUSH __XF_OPCODE(0, 0, 10)
+
+/* ...start component operation */
+#define XF_START __XF_OPCODE(0, 0, 11)
+
+/* ...stop component operation */
+#define XF_STOP __XF_OPCODE(0, 0, 12)
+
+/* ...pause component operation */
+#define XF_PAUSE __XF_OPCODE(0, 0, 13)
+
+/* ...resume component operation */
+#define XF_RESUME __XF_OPCODE(0, 0, 14)
+
+/* ...extended parameter setting function */
+#define XF_SET_PARAM_EXT __XF_OPCODE(1, 1, 15)
+
+/* ...extended parameter retrieval function */
+#define XF_GET_PARAM_EXT __XF_OPCODE(1, 1, 16)
+
+/* ...total amount of supported decoder commands */
+#define __XF_OP_NUM 17
+
+/*******************************************************************************
+ * XF_START message definition
+ ******************************************************************************/
+
+typedef struct xf_start_msg
+{
+ /* ...effective sample rate */
+ u32 sample_rate;
+
+ /* ...number of channels */
+ u32 channels;
+
+ /* ...sample width */
+ u32 pcm_width;
+
+ /* ...minimal size of intput buffer */
+ u32 input_length;
+
+ /* ...size of output buffer */
+ u32 output_length;
+
+} __attribute__((__packed__)) xf_start_msg_t;
+
+/*******************************************************************************
+ * XF_GET_PARAM message
+ ******************************************************************************/
+
+/* ...message body (command/response) */
+typedef union xf_get_param_msg
+{
+ /* ...command structure */
+ struct
+ {
+ /* ...array of parameters requested */
+ u32 id[0];
+
+ } __attribute__((__packed__)) c;
+
+ /* ...response structure */
+ struct
+ {
+ /* ...array of parameters values */
+ u32 value[0];
+
+ } __attribute__((__packed__)) r;
+
+} xf_get_param_msg_t;
+
+/* ...length of the XF_GET_PARAM command/response */
+#define XF_GET_PARAM_CMD_LEN(params) (sizeof(u32) * (params))
+#define XF_GET_PARAM_RSP_LEN(params) (sizeof(u32) * (params))
+
+/*******************************************************************************
+ * XF_SET_PARAM message
+ ******************************************************************************/
+
+/* ...component initialization parameter */
+typedef struct xf_set_param_item
+{
+ /* ...index of parameter passed to SET_CONFIG_PARAM call */
+ u32 id;
+
+ /* ...value of parameter */
+ u32 value;
+
+} __attribute__ ((__packed__)) xf_set_param_item_t;
+
+/* ...message body (no response message? - tbd) */
+typedef struct xf_set_param_msg
+{
+ /* ...command message */
+ xf_set_param_item_t item[0];
+
+} __attribute__ ((__packed__)) xf_set_param_msg_t;
+
+/* ...length of the command message */
+#define XF_SET_PARAM_CMD_LEN(params) (sizeof(xf_set_param_item_t) * (params))
+
+/*******************************************************************************
+ * XF_SET_PARAM_EXT/XF_GET_PARAM_EXT message
+ ******************************************************************************/
+
+/* ...extended parameter descriptor */
+typedef struct xf_ext_param_desc
+{
+ /* ...index of parameter passed to SET/GET_CONFIG_PARAM call (16-bits only) */
+ u16 id;
+
+ /* ...length of embedded input/output parameter data (in bytes) */
+ u16 length;
+
+} __attribute__ ((__packed__, __aligned__(4))) xf_ext_param_desc_t;
+
+/* ...message body (no response message? - tbd) */
+typedef struct xf_ext_param_msg
+{
+ /* ...extended parameter descriptor */
+ xf_ext_param_desc_t desc;
+
+ /* ...parameter data (in the format expected by codec) */
+ u8 data[0];
+
+} __attribute__ ((__packed__)) xf_ext_param_msg_t;
+
+/* ...access macros */
+
+#define xf_ext_param_first(e) \
+ (&(e)->desc)
+
+#define xf_ext_param_next(d) \
+ (xf_ext_param_desc_t *)(((xf_ext_param_msg_t *)(d))->data + (((d)->length + 3) & ~3))
+
+#define xf_ext_param_length(e, d) \
+ ((u32)((u8 *)(d) - (u8 *)(ext)))
+
+#define xf_ext_param_data(d, t) \
+ ((t *)&(d)[1])
+
+#define xf_ext_param_setup(d, i, t, s) \
+ ((d)->id = (i), (d)->length = (s), xf_ext_param_data(d, t))
+
+
+/*******************************************************************************
+ * XF_ROUTE definition
+ ******************************************************************************/
+
+/* ...port routing command */
+typedef struct xf_route_port_msg
+{
+ /* ...source port specification */
+ u32 src;
+
+ /* ...destination port specification */
+ u32 dst;
+
+ /* ...number of buffers to allocate */
+ u32 alloc_number;
+
+ /* ...length of buffer to allocate */
+ u32 alloc_size;
+
+ /* ...alignment restriction for a buffer */
+ u32 alloc_align;
+
+} __attribute__((__packed__)) xf_route_port_msg_t;
+
+/*******************************************************************************
+ * XF_UNROUTE definition
+ ******************************************************************************/
+
+/* ...port unrouting command */
+typedef struct xf_unroute_port_msg
+{
+ /* ...source port specification */
+ u32 src;
+
+ /* ...destination port specification */
+ u32 dst;
+
+} __attribute__((__packed__)) xf_unroute_port_msg_t;
diff --git a/hifi/xaf/host-apf/include/xf-proto.h b/hifi/xaf/host-apf/include/xf-proto.h
new file mode 100644
index 00000000..095e353a
--- /dev/null
+++ b/hifi/xaf/host-apf/include/xf-proto.h
@@ -0,0 +1,82 @@
+/*******************************************************************************
+* Copyright (C) 2018 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 use this Software with Cadence processor cores only and
+* not with any other processors and platforms, 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 __XF_H
+#error "xf-proto.h mustn't be included directly"
+#endif
+
+/*******************************************************************************
+ * Forward types declarations
+ ******************************************************************************/
+
+/* ...component string identifier */
+typedef const char *xf_id_t;
+
+/* ...handle to proxy data */
+typedef struct xf_proxy xf_proxy_t;
+
+/* ...handle to component data */
+typedef struct xf_handle xf_handle_t;
+
+/* ...buffer pool */
+typedef struct xf_pool xf_pool_t;
+
+/* ...individual buffer from pool */
+typedef struct xf_buffer xf_buffer_t;
+
+/* ...buffer pool type */
+typedef u32 xf_pool_type_t;
+
+/* ...user-message */
+typedef struct xf_user_msg xf_user_msg_t;
+
+/* ...proxy-message */
+typedef struct xf_proxy_msg xf_proxy_msg_t;
+
+/* ...response callback */
+typedef void (*xf_response_cb)(xf_handle_t *h, xf_user_msg_t *msg);
+
+typedef void* xaf_mem_malloc_fxn_t(s32 size, s32 id);
+typedef void xaf_mem_free_fxn_t(void* ptr, s32 id);
+
+/*******************************************************************************
+ * High-level API functions
+ ******************************************************************************/
+
+/* ...component operations */
+extern int xf_open(xf_proxy_t *proxy, xf_handle_t *handle, xf_id_t id, u32 core, xf_response_cb cb);
+extern void xf_close(xf_handle_t *handle);
+extern int xf_command(xf_handle_t *handle, u32 dst, u32 opcode, void *buf, u32 length);
+extern int xf_route(xf_handle_t *src, u32 s_port, xf_handle_t *dst, u32 d_port, u32 num, u32 size, u32 align);
+extern int xf_unroute(xf_handle_t *src, u32 s_port);
+
+/* ...shared buffers operations */
+extern int xf_pool_alloc(xf_proxy_t *proxy, u32 number, u32 length, xf_pool_type_t type, xf_pool_t **pool, s32 id,
+ xaf_mem_malloc_fxn_t, xaf_mem_free_fxn_t);
+extern void xf_pool_free(xf_pool_t *pool, s32 id, xaf_mem_free_fxn_t);
+extern xf_buffer_t * xf_buffer_get(xf_pool_t *pool);
+extern void xf_buffer_put(xf_buffer_t *buffer);
+
+/* ...proxy operations */
+extern int xf_proxy_init(xf_proxy_t *proxy, u32 core, void *p_shmem);
+extern void xf_proxy_close(xf_proxy_t *proxy);
+
diff --git a/hifi/xaf/host-apf/include/xf-proxy.h b/hifi/xaf/host-apf/include/xf-proxy.h
new file mode 100644
index 00000000..90d70793
--- /dev/null
+++ b/hifi/xaf/host-apf/include/xf-proxy.h
@@ -0,0 +1,297 @@
+/*******************************************************************************
+* Copyright (C) 2018 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 use this Software with Cadence processor cores only and
+* not with any other processors and platforms, 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 __XF_H
+#error "xf-proxy.h mustn't be included directly"
+#endif
+
+/*******************************************************************************
+ * User-message description - move from here to API - tbd
+ ******************************************************************************/
+
+/* ...need that at all? hope no */
+struct xf_user_msg
+{
+ /* ...source component specification */
+ u32 id;
+
+ /* ...message opcode */
+ u32 opcode;
+
+ /* ...buffer length */
+ u32 length;
+
+ /* ...buffer pointer */
+ void *buffer;
+};
+
+/* ...proxy message - bad placing of that thing here - tbd */
+struct xf_proxy_msg
+{
+ /* ...session-id field */
+ uint32_t id;
+
+ /* ...message opcode */
+ uint32_t opcode;
+
+ /* ...buffer length */
+ uint32_t length;
+
+ /* ...buffer pointer */
+ uint64_t address;
+ uint64_t v_address;
+
+} __attribute__((__packed__));
+
+typedef struct xf_proxy_msg_driv
+{
+ /* ...session ID */
+ uint32_t id;
+
+ /* ...proxy API command/reponse code */
+ uint32_t opcode;
+
+ /* ...length of attached buffer */
+ uint32_t length;
+
+ /* ...physical address of message buffer */
+ uint64_t address;
+ uint64_t v_address;
+
+}__attribute__((__packed__)) xf_proxy_message_driv_t;
+/*******************************************************************************
+ * Buffer pools
+ ******************************************************************************/
+
+/* ...buffer pool type */
+enum xf_pool_type
+{
+ XF_POOL_AUX = 0,
+ XF_POOL_INPUT = 1,
+ XF_POOL_OUTPUT = 2
+};
+
+/* ...buffer link pointer */
+typedef union xf_buffer_link
+{
+ /* ...pointer to next free buffer in a pool (for free buffer) */
+ xf_buffer_t *next;
+
+ /* ...reference to a buffer pool (for allocated buffer) */
+ xf_pool_t *pool;
+
+} xf_buffer_link_t;
+
+/* ...buffer descriptor */
+struct xf_buffer
+{
+ /* ...virtual address of contiguous buffer */
+ void *address;
+
+ /* ...link pointer */
+ xf_buffer_link_t link;
+};
+
+/* ...buffer pool */
+struct xf_pool
+{
+ /* ...reference to proxy data */
+ xf_proxy_t *proxy;
+
+ /* ...length of individual buffer in a pool */
+ u32 length;
+
+ /* ...number of buffers in a pool */
+ u32 number;
+
+ /* ...pointer to pool memory */
+ void *p;
+
+ /* ...pointer to first free buffer in a pool */
+ xf_buffer_t *free;
+
+ /* ...individual buffers */
+ xf_buffer_t buffer[0];
+};
+
+/* ...accessor to buffer data */
+static inline void * xf_buffer_data(xf_buffer_t *buffer)
+{
+ return buffer->address;
+}
+
+/* ...length of buffer data */
+static inline size_t xf_buffer_length(xf_buffer_t *buffer)
+{
+ return buffer->link.pool->length;
+}
+
+/*******************************************************************************
+ * Proxy handle definition
+ ******************************************************************************/
+
+/* ...free clients list */
+typedef union xf_proxy_cmap_link
+{
+ /* ...index of next free client in the list */
+ u32 next;
+
+ /* ...pointer to allocated component handle */
+ xf_handle_t *handle;
+
+} xf_proxy_cmap_link_t;
+
+/* ...proxy data structure */
+struct xf_proxy
+{
+ /* ...platform-specific IPC data */
+ xf_proxy_ipc_data_t ipc;
+
+ /* ...auxiliary buffer pool for clients */
+ xf_pool_t *aux;
+
+ /* ...global proxy lock */
+ xf_lock_t lock;
+
+ /* ...proxy thread handle */
+ xf_thread_t thread;
+
+ /* ...proxy identifier (core of remote DSP hosting SHMEM interface) */
+ u32 core;
+
+ /* ...client association map */
+ xf_proxy_cmap_link_t cmap[XF_CFG_PROXY_MAX_CLIENTS];
+};
+
+/*******************************************************************************
+ * Auxiliary proxy helpers
+ ******************************************************************************/
+
+/* ...get proxy identifier */
+static inline u32 xf_proxy_id(xf_proxy_t *proxy)
+{
+ return proxy->core;
+}
+
+/* ...lock proxy data */
+static inline void xf_proxy_lock(xf_proxy_t *proxy)
+{
+ __xf_lock(&proxy->lock);
+}
+
+/* ...unlock proxy data */
+static inline void xf_proxy_unlock(xf_proxy_t *proxy)
+{
+ __xf_unlock(&proxy->lock);
+}
+
+/* ...translate proxy shared address into local virtual address */
+static inline void * xf_proxy_a2b(xf_proxy_t *proxy, u32 address)
+{
+ return xf_ipc_a2b(&proxy->ipc, address);
+}
+
+/* ...translate local virtual address into shared proxy address */
+static inline u32 xf_proxy_b2a(xf_proxy_t *proxy, void *b)
+{
+ return xf_ipc_b2a(&proxy->ipc, b);
+}
+
+/* ...submit asynchronous response message */
+static inline int xf_proxy_response_put(xf_proxy_t *proxy, xf_proxy_msg_t *msg)
+{
+ return xf_proxy_ipc_response_put(&proxy->ipc, msg);
+}
+
+/* ...retrieve asynchronous response message */
+static inline int xf_proxy_response_get(xf_proxy_t *proxy, xf_proxy_msg_t *msg)
+{
+ return xf_proxy_ipc_response_get(&proxy->ipc, msg);
+}
+
+/*******************************************************************************
+ * Component handle definition
+ ******************************************************************************/
+
+struct xf_handle
+{
+ /* ...platform-specific IPC data */
+ xf_ipc_data_t ipc;
+
+ /* ...reference to proxy data */
+ xf_proxy_t *proxy;
+
+ /* ...component lock */
+ xf_lock_t lock;
+
+ /* ...auxiliary control buffer for control transactions */
+ xf_buffer_t *aux;
+
+ /* ...global client-id of the component */
+ u32 id;
+
+ /* ...local client number (think about merging into "id" field - tbd) */
+ u32 client;
+
+ /* ...response processing hook */
+ xf_response_cb response;
+};
+
+/*******************************************************************************
+ * Auxiliary component helpers
+ ******************************************************************************/
+
+/* ...component client-id (global scope) */
+static inline u32 xf_handle_id(xf_handle_t *handle)
+{
+ return handle->id;
+}
+
+/* ...pointer to auxiliary buffer */
+static inline void * xf_handle_aux(xf_handle_t *handle)
+{
+ return xf_buffer_data(handle->aux);
+}
+
+/* ...acquire component lock */
+static inline void xf_lock(xf_handle_t *handle)
+{
+ __xf_lock(&handle->lock);
+}
+
+/* ...release component lock */
+static inline void xf_unlock(xf_handle_t *handle)
+{
+ __xf_unlock(&handle->lock);
+}
+
+/* ...put asynchronous response into local IPC */
+static inline int xf_response_put(xf_handle_t *handle, xf_user_msg_t *msg)
+{
+ return xf_ipc_response_put(&handle->ipc, msg);
+}
+
+/* ...get asynchronous response from local IPC */
+static inline int xf_response_get(xf_handle_t *handle, xf_user_msg_t *msg)
+{
+ return xf_ipc_response_get(&handle->ipc, msg);
+}
diff --git a/hifi/xaf/host-apf/include/xf.h b/hifi/xaf/host-apf/include/xf.h
new file mode 100644
index 00000000..6af69ce6
--- /dev/null
+++ b/hifi/xaf/host-apf/include/xf.h
@@ -0,0 +1,53 @@
+/*******************************************************************************
+* Copyright (C) 2018 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 use this Software with Cadence processor cores only and
+* not with any other processors and platforms, 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.
+
+******************************************************************************/
+
+#ifdef __XF_H
+#error "xf.h included more than once"
+#endif
+
+#define __XF_H
+
+/*******************************************************************************
+ * Common runtime framework
+ ******************************************************************************/
+
+/* ...target configuration */
+#include "xf-config.h"
+
+/* ...platform run-time */
+#include "xf-runtime.h"
+
+/* ...debugging facility */
+#include "xf-debug.h"
+
+/* ...API prototypes */
+#include "xf-proto.h"
+
+/* ...standard opcodes */
+#include "xf-opcode.h"
+
+/* ...platform-specific IPC layer */
+#include "xf-ipc.h"
+
+/* ...proxy definitions */
+#include "xf-proxy.h"
+