1 /******************************************************************************* 2 * Copyright (C) 2018 Cadence Design Systems, Inc. 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining 5 * a copy of this software and associated documentation files (the 6 * "Software"), to use this Software with Cadence processor cores only and 7 * not with any other processors and platforms, subject to 8 * the following conditions: 9 * 10 * The above copyright notice and this permission notice shall be included 11 * in all copies or substantial portions of the Software. 12 * 13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 14 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 15 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 16 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 17 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 18 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 19 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 20 21 ******************************************************************************/ 22 23 /******************************************************************************* 24 * xa-pcm-api.h 25 * 26 * Generic PCM format converter API 27 * 28 ******************************************************************************/ 29 30 #ifndef __XA_PCM_API_H__ 31 #define __XA_PCM_API_H__ 32 33 /******************************************************************************* 34 * Includes 35 ******************************************************************************/ 36 37 #include "xa_type_def.h" 38 #include "xa_error_standards.h" 39 #include "xa_apicmd_standards.h" 40 #include "xa_memory_standards.h" 41 42 /******************************************************************************* 43 * Constants definitions 44 ******************************************************************************/ 45 46 /* ...codec-specific configuration parameters */ 47 enum xa_config_param_pcm { 48 XA_PCM_CONFIG_PARAM_SAMPLE_RATE = 0, 49 XA_PCM_CONFIG_PARAM_IN_PCM_WIDTH = 1, 50 XA_PCM_CONFIG_PARAM_IN_CHANNELS = 2, 51 XA_PCM_CONFIG_PARAM_OUT_PCM_WIDTH = 3, 52 XA_PCM_CONFIG_PARAM_OUT_CHANNELS = 4, 53 XA_PCM_CONFIG_PARAM_CHANROUTING = 5, 54 XA_PCM_CONFIG_PARAM_NUM = 6, 55 }; 56 57 /* ...component identifier (informative) */ 58 #define XA_CODEC_PCM 16 59 60 /******************************************************************************* 61 * Class 0: API Errors 62 ******************************************************************************/ 63 64 #define XA_PCM_API_NONFATAL(e) \ 65 XA_ERROR_CODE(xa_severity_nonfatal, xa_class_api, XA_CODEC_PCM, (e)) 66 67 #define XA_PCM_API_FATAL(e) \ 68 XA_ERROR_CODE(xa_severity_fatal, xa_class_api, XA_CODEC_PCM, (e)) 69 70 enum xa_error_nonfatal_api_pcm { 71 XA_PCM_API_NONFATAL_MAX = XA_PCM_API_NONFATAL(0) 72 }; 73 74 enum xa_error_fatal_api_pcm { 75 XA_PCM_API_FATAL_MAX = XA_PCM_API_FATAL(0) 76 }; 77 78 /******************************************************************************* 79 * Class 1: Configuration Errors 80 ******************************************************************************/ 81 82 #define XA_PCM_CONFIG_NONFATAL(e) \ 83 XA_ERROR_CODE(xa_severity_nonfatal, xa_class_config, XA_CODEC_PCM, (e)) 84 85 #define XA_PCM_CONFIG_FATAL(e) \ 86 XA_ERROR_CODE(xa_severity_fatal, xa_class_config, XA_CODEC_PCM, (e)) 87 88 enum xa_error_nonfatal_config_pcm { 89 XA_PCM_CONFIG_NONFATAL_RANGE = XA_PCM_CONFIG_NONFATAL(0), 90 XA_PCM_CONFIG_NONFATAL_STATE = XA_PCM_CONFIG_NONFATAL(1), 91 XA_PCM_CONFIG_NONFATAL_MAX = XA_PCM_CONFIG_NONFATAL(2) 92 }; 93 94 enum xa_error_fatal_config_pcm { 95 XA_PCM_CONFIG_FATAL_RANGE = XA_PCM_CONFIG_FATAL(0), 96 XA_PCM_CONFIG_FATAL_MAX = XA_PCM_CONFIG_FATAL(1) 97 }; 98 99 /******************************************************************************* 100 * Class 2: Execution Class Errors 101 ******************************************************************************/ 102 103 #define XA_PCM_EXEC_NONFATAL(e) \ 104 XA_ERROR_CODE(xa_severity_nonfatal, xa_class_execute, XA_CODEC_PCM, (e)) 105 106 #define XA_PCM_EXEC_FATAL(e) \ 107 XA_ERROR_CODE(xa_severity_fatal, xa_class_execute, XA_CODEC_PCM, (e)) 108 109 enum xa_error_nonfatal_execute_pcm { 110 XA_PCM_EXEC_NONFATAL_STATE = XA_PCM_EXEC_NONFATAL(0), 111 XA_PCM_EXEC_NONFATAL_NO_DATA = XA_PCM_EXEC_NONFATAL(1), 112 XA_PCM_EXEC_NONFATAL_INPUT = XA_PCM_EXEC_NONFATAL(2), 113 XA_PCM_EXEC_NONFATAL_OUTPUT = XA_PCM_EXEC_NONFATAL(3), 114 XA_PCM_EXEC_NONFATAL_MAX = XA_PCM_EXEC_NONFATAL(4) 115 }; 116 117 enum xa_error_fatal_execute_pcm { 118 XA_PCM_EXEC_FATAL_STATE = XA_PCM_EXEC_FATAL(0), 119 XA_PCM_EXEC_FATAL_INPUT = XA_PCM_EXEC_FATAL(1), 120 XA_PCM_EXEC_FATAL_OUTPUT = XA_PCM_EXEC_FATAL(2), 121 XA_PCM_EXEC_FATAL_MAX = XA_PCM_EXEC_FATAL(3) 122 }; 123 124 /******************************************************************************* 125 * API function definition 126 ******************************************************************************/ 127 128 #if defined(USE_DLL) && defined(_WIN32) 129 #define DLL_SHARED __declspec(dllimport) 130 #elif defined (_WINDLL) 131 #define DLL_SHARED __declspec(dllexport) 132 #else 133 #define DLL_SHARED 134 #endif 135 136 #if defined(__cplusplus) 137 extern "C" { 138 #endif /* __cplusplus */ 139 DLL_SHARED xa_codec_func_t xa_pcm_codec; 140 #if defined(__cplusplus) 141 } 142 #endif /* __cplusplus */ 143 144 #endif /* __XA_PCM_API_H__ */ 145 146