├── .gitignore ├── errors.h ├── README.md ├── Makefile ├── LICENSE ├── player.c └── errors.c /.gitignore: -------------------------------------------------------------------------------- 1 | audioplayer 2 | compile_flags.txt 3 | *.o 4 | -------------------------------------------------------------------------------- /errors.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | const char *hi_errstr(int error); 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Simple audioplayer for HI3516EV300 2 | 3 | Usage: 4 | 5 | ```console 6 | $ curl -s https://chanson.hostingradio.ru:8041/chanson128.mp3 --output - | audioplayer 7 | ``` 8 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | CC=arm-openipc-linux-musleabi-gcc 2 | MAJ=$(HOME)/git/majestic 3 | CFLAGS=-I$(MAJ)/lib/liblame.hi3516ev300/include -I$(MAJ)/thirdparty/nda/hi3516ev300/include 4 | LDFLAGS=-L$(MAJ)/lib/liblame.hi3516ev300/lib -L$(MAJ)/thirdparty/nda/hi3516ev300/lib 5 | LDLIBS=-lmp3lame -lmpi -lsecurec -lupvqe -ldnvqe -lVoiceEngine 6 | 7 | audioplayer: player.o errors.o 8 | $(CC) -o $@ $^ $(LDFLAGS) $(LDLIBS) 9 | sudo cp $@ /mnt/noc/sdk 10 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 OpenIPC 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /player.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | #include "errors.h" 13 | 14 | static void hip_debug(const char *format, va_list ap) { printf(format, ap); } 15 | 16 | static void hip_error(const char *format, va_list ap) { printf(format, ap); } 17 | 18 | static void hip_info(const char *format, va_list ap) { printf(format, ap); } 19 | 20 | static void chk_hip_error(int ret) { assert(ret != -1); } 21 | 22 | hip_t dec; 23 | 24 | static bool init_decoder() { 25 | dec = hip_decode_init(); 26 | if (NULL == dec) { 27 | printf("hip_decode_init failed.\n"); 28 | return false; 29 | } 30 | 31 | hip_set_errorf(dec, hip_error); 32 | hip_set_debugf(dec, hip_debug); 33 | hip_set_msgf(dec, hip_info); 34 | 35 | return true; 36 | } 37 | 38 | static void deinit_decoder() { 39 | int ret = hip_decode_exit(dec); 40 | chk_hip_error(ret); 41 | } 42 | 43 | static AUDIO_DEV AoDev = 0; 44 | static AO_CHN AoChn = 0; 45 | static ADEC_CHN AdChn = 0; 46 | 47 | #define SAMPLE_AUDIO_PTNUMPERFRM 320 48 | #define MP3_SAMPLE (SAMPLE_AUDIO_PTNUMPERFRM * sizeof(short)) 49 | 50 | static HI_S32 AUDIO_AoBindAdec(AUDIO_DEV AoDev, AO_CHN AoChn, ADEC_CHN AdChn) { 51 | MPP_CHN_S stSrcChn, stDestChn; 52 | stSrcChn.enModId = HI_ID_ADEC; 53 | stSrcChn.s32DevId = 0; 54 | stSrcChn.s32ChnId = AdChn; 55 | stDestChn.enModId = HI_ID_AO; 56 | stDestChn.s32DevId = AoDev; 57 | stDestChn.s32ChnId = AoChn; 58 | return HI_MPI_SYS_Bind(&stSrcChn, &stDestChn); 59 | } 60 | 61 | static void init_hw() { 62 | int ret; 63 | 64 | ret = HI_MPI_SYS_Init(); 65 | if (ret != HI_SUCCESS) { 66 | printf("error %s\n", hi_errstr(ret)); 67 | } 68 | 69 | ADEC_ATTR_LPCM_S stAdecLpcm = {0}; 70 | ADEC_CHN_ATTR_S stAdecAttr = { 71 | .enType = PT_LPCM, 72 | .u32BufSize = 20, 73 | .pValue = &stAdecLpcm, 74 | .enMode = ADEC_MODE_PACK, 75 | }; 76 | ret = HI_MPI_ADEC_CreateChn(AdChn, &stAdecAttr); 77 | if (ret != HI_SUCCESS) { 78 | printf("1error %s\n", hi_errstr(ret)); 79 | } 80 | 81 | AIO_ATTR_S stAioAttr = { 82 | .enSamplerate = 44100, 83 | .enBitwidth = AUDIO_BIT_WIDTH_16, 84 | .enWorkmode = AIO_MODE_I2S_MASTER, 85 | .enSoundmode = AUDIO_SOUND_MODE_MONO, 86 | .u32FrmNum = 30, 87 | .u32PtNumPerFrm = SAMPLE_AUDIO_PTNUMPERFRM, 88 | .u32ChnCnt = 1, 89 | .enI2sType = AIO_I2STYPE_INNERCODEC, 90 | }; 91 | ret = HI_MPI_AO_SetPubAttr(AoDev, &stAioAttr); 92 | #if 0 93 | if (ret != HI_SUCCESS) { 94 | printf("error %s\n", hi_errstr(ret)); 95 | } 96 | #endif 97 | 98 | ret = HI_MPI_AO_Enable(AoDev); 99 | if (ret != HI_SUCCESS) { 100 | printf("error %s\n", hi_errstr(ret)); 101 | } 102 | 103 | ret = HI_MPI_AO_EnableChn(AoDev, AdChn); 104 | if (ret != HI_SUCCESS) { 105 | printf("error %s\n", hi_errstr(ret)); 106 | } 107 | 108 | ret = AUDIO_AoBindAdec(AoDev, AoChn, AdChn); 109 | if (ret != HI_SUCCESS) { 110 | printf("error %s\n", hi_errstr(ret)); 111 | } 112 | 113 | ret = HI_MPI_AO_SetVolume(AoDev, -10); 114 | if (ret != HI_SUCCESS) { 115 | printf("error %s\n", hi_errstr(ret)); 116 | } 117 | } 118 | 119 | static void deinit_hw() {} 120 | 121 | int main() { 122 | init_decoder(); 123 | init_hw(); 124 | 125 | FILE *f = stdin; 126 | 127 | unsigned char mp3buf[4096]; 128 | short pcm_l[0x10000], pcm_r[0x10000]; 129 | int nread; 130 | 131 | while ((nread = fread(mp3buf, 1, sizeof(mp3buf), f))) { 132 | 133 | int samples = hip_decode(dec, mp3buf, nread, pcm_l, pcm_r); 134 | unsigned char *sptr = (unsigned char *)pcm_l; 135 | unsigned char *end = sptr + samples * sizeof(short); 136 | while (sptr < end) { 137 | int len = end - sptr; 138 | if (len > MP3_SAMPLE) 139 | len = MP3_SAMPLE; 140 | 141 | AUDIO_STREAM_S stAudioStream = { 142 | .pStream = sptr, 143 | .u32Len = len, 144 | }; 145 | int ret = HI_MPI_ADEC_SendStream(AdChn, &stAudioStream, HI_TRUE); 146 | if (ret != HI_SUCCESS) { 147 | printf("error %s\n", hi_errstr(ret)); 148 | } 149 | 150 | ret = HI_MPI_ADEC_SendEndOfStream(AdChn, HI_FALSE); 151 | if (ret != HI_SUCCESS) { 152 | printf("error %s\n", hi_errstr(ret)); 153 | } 154 | sptr += len; 155 | } 156 | } 157 | 158 | deinit_hw(); 159 | deinit_decoder(); 160 | } 161 | 162 | const unsigned short int *__ctype_b; 163 | 164 | int __fgetc_unlocked(FILE *stream) { return fgetc(stream); } 165 | 166 | size_t _stdlib_mb_cur_max(void) { return 0; } 167 | -------------------------------------------------------------------------------- /errors.c: -------------------------------------------------------------------------------- 1 | #include "errors.h" 2 | #include 3 | 4 | const char *hi_errstr(int error) { 5 | switch (error) { 6 | case 0xA0028003: 7 | return "ERR_SYS_ILLEGAL_PARAM (0xA0028003): The parameter " 8 | "configuration is invalid"; 9 | case 0xA0028006: 10 | return "ERR_SYS_NULL_PTR (0xA0028006): The pointer is null"; 11 | case 0xA0028009: 12 | return "ERR_SYS_NOT_PERM (0xA0028009): The operation is forbidden"; 13 | case 0xA0028010: 14 | return "ERR_SYS_NOTREADY (0xA0028010): The system control attributes " 15 | "are not configured"; 16 | case 0xA0028012: 17 | return "ERR_SYS_BUSY (0xA0028012): The system is busy"; 18 | case 0xA002800C: 19 | return "ERR_SYS_NOMEM (0xA002800C): The memory fails to be allocated " 20 | "due to some causes such as insufficient system memory"; 21 | 22 | case 0xA0018003: 23 | return "ERR_VB_ILLEGAL_PARAM (0xA0018003): The parameter configuration " 24 | "is invalid"; 25 | case 0xA0018005: 26 | return "ERR_VB_UNEXIST (0xA0018005): The VB pool does not exist"; 27 | case 0xA0018006: 28 | return "ERR_VB_NULL_PTR (0xA0018006): The pointer is null"; 29 | case 0xA0018009: 30 | return "ERR_VB_NOT_PERM (0xA0018009): The operation is forbidden"; 31 | case 0xA001800C: 32 | return "ERR_VB_NOMEM (0xA001800C): The memory fails to be allocated"; 33 | case 0xA001800D: 34 | return "ERR_VB_NOBUF (0xA001800D): The buffer fails to be allocated"; 35 | case 0xA0018010: 36 | return "ERR_VB_NOTREADY (0xA0018010): The system control attributes " 37 | "are not configured"; 38 | case 0xA0018012: 39 | return "ERR_VB_BUSY (0xA0018012): The system is busy"; 40 | case 0xA0018040: 41 | return "ERR_VB_2MPOOLS (0xA0018040): Too many VB pools are created"; 42 | 43 | case 0xA01C8006: 44 | return "ERR_ISP_NULL_PTR (0xA01C8006): The input pointer is null"; 45 | case 0xA01C8003: 46 | return "ERR_ISP_ILLEGAL_PARAM (0xA01C8003): The input parameter is " 47 | "invalid"; 48 | case 0xA01C8008: 49 | return "ERR_ISP_NOT_SUPPORT (0xA01C8008): This function is not " 50 | "supported by the ISP"; 51 | case 0xA01C8043: 52 | return "ERR_ISP_SNS_UNREGISTER (0xA01C8043): The sensor is not " 53 | "registered"; 54 | case 0xA01C8041: 55 | return "ERR_ISP_MEM_NOT_INIT (0xA01C8041): The external registers are " 56 | "not initialized"; 57 | case 0xA01C8040: 58 | return "ERR_ISP_NOT_INIT (0xA01C8040): The ISP is not initialized"; 59 | case 0xA01C8044: 60 | return "ERR_ISP_INVALID_ADDR (0xA01C8044): The address is invalid"; 61 | case 0xA01C8042: 62 | return "ERR_ISP_ATTR_NOT_CFG (0xA01C8042): The attribute is not " 63 | "configured"; 64 | 65 | case 0xA0108001: 66 | return "ERR_VI_INVALID_DEVID (0xA0108001): The VI device ID is " 67 | "invalid"; 68 | case 0xA0108002: 69 | return "ERR_VI_INVALID_CHNID (0xA0108002): The VI channel ID is " 70 | "invalid"; 71 | case 0xA0108003: 72 | return "ERR_VI_INVALID_PARA (0xA0108003): The VI parameter is invalid"; 73 | case 0xA0108006: 74 | return "ERR_VI_INVALID_NULL_PTR (0xA0108006): The pointer of the input " 75 | "parameter is null"; 76 | case 0xA0108007: 77 | return "ERR_VI_FAILED_NOTCONFIG (0xA0108007): The attributes of the " 78 | "video device are not set"; 79 | case 0xA0108008: 80 | return "ERR_VI_NOT_SUPPORT (0xA0108008): The operation is not " 81 | "supported"; 82 | case 0xA0108009: 83 | return "ERR_VI_NOT_PERM (0xA0108009): The operation is forbidden"; 84 | case 0xA010800C: 85 | return "ERR_VI_NOMEM (0xA010800C): The memory fails to be allocated"; 86 | case 0xA010800E: 87 | return "ERR_VI_BUF_EMPTY (0xA010800E): The VI buffer is empty"; 88 | case 0xA010800F: 89 | return "ERR_VI_BUF_FULL (0xA010800F): The VI buffer is full"; 90 | case 0xA0108010: 91 | return "ERR_VI_SYS_NOTREADY (0xA0108010): The VI system is not " 92 | "initialized"; 93 | case 0xA0108012: 94 | return "ERR_VI_BUSY (0xA0108012): The VI system is busy"; 95 | case 0xA0108040: 96 | return "ERR_VI_FAILED_NOTENABLE (0xA0108040): The VI device or VI " 97 | "channel is not enabled"; 98 | case 0xA0108041: 99 | return "ERR_VI_FAILED_NOTDISABLE (0xA0108041): The VI device or VI " 100 | "channel is not disabled"; 101 | case 0xA0108042: 102 | return "ERR_VI_FAILED_CHNOTDISABLE (0xA0108042): The VI channel is not " 103 | "disabled"; 104 | case 0xA0108043: 105 | return "ERR_VI_CFG_TIMEOUT (0xA0108043): The video attribute " 106 | "configuration times out"; 107 | case 0xA0108044: 108 | return "ERR_VI_NORM_UNMATCH (0xA0108044): Mismatch occurs"; 109 | case 0xA0108045: 110 | return "ERR_VI_INVALID_WAYID (0xA0108045): The video channel ID is " 111 | "invalid"; 112 | case 0xA0108046: 113 | return "ERR_VI_INVALID_PHYCHNID (0xA0108046): The physical video " 114 | "channel ID is invalid"; 115 | case 0xA0108047: 116 | return "ERR_VI_FAILED_NOTBIND (0xA0108047): The video channel is not " 117 | "bound"; 118 | case 0xA0108048: 119 | return "ERR_VI_FAILED_BINDED (0xA0108048): The video channel is bound"; 120 | case 0xA0108049: 121 | return "ERR_VI_DIS_PROCESS_FAIL (0xA0108049): The DIS fails to run"; 122 | 123 | case 0xA00F8001: 124 | return "ERR_VO_INVALID_DEVID (0xA00F8001): The device ID does not fall " 125 | "within the value range"; 126 | case 0xA00F8002: 127 | return "ERR_VO_INVALID_CHNID (0xA00F8002): The channel ID does not " 128 | "fall within the value range"; 129 | case 0xA00F8003: 130 | return "ERR_VO_ILLEGAL_PARAM (0xA00F8003): The parameter value does " 131 | "not fall within the value range"; 132 | case 0xA00F8006: 133 | return "ERR_VO_NULL_PTR (0xA00F8006): The pointer is null"; 134 | case 0xA00F8008: 135 | return "ERR_VO_NOT_SUPPORT (0xA00F8008): The operation is not " 136 | "supported"; 137 | case 0xA00F8009: 138 | return "ERR_VO_NOT_PERMIT (0xA00F8009): The operation is forbidden"; 139 | case 0xA00F800C: 140 | return "ERR_VO_NO_MEM (0xA00F800C): The memory is insufficient"; 141 | case 0xA00F8010: 142 | return "ERR_VO_SYS_NOTREADY (0xA00F8010): The system is not " 143 | "initialized"; 144 | case 0xA00F8012: 145 | return "ERR_VO_BUSY (0xA00F8012): The resources are unavailable"; 146 | case 0xA00F8040: 147 | return "ERR_VO_DEV_NOT_CONFIG (0xA00F8040): The VO device is not " 148 | "configured"; 149 | case 0xA00F8041: 150 | return "ERR_VO_DEV_NOT_ENABLE (0xA00F8041): The VO device is not " 151 | "enabled"; 152 | case 0xA00F8042: 153 | return "ERR_VO_DEV_HAS_ENABLED (0xA00F8042): The VO device has been " 154 | "enabled"; 155 | case 0xA00F8043: 156 | return "ERR_VO_DEV_HAS_BINDED (0xA00F8043): The device has been bound"; 157 | case 0xA00F8044: 158 | return "ERR_VO_DEV_NOT_BINDED (0xA00F8044): The device is not bound"; 159 | case 0xA00F8045: 160 | return "ERR_VO_VIDEO_NOT_ENABLE (0xA00F8045): The video layer is not " 161 | "enabled"; 162 | case 0xA00F8046: 163 | return "ERR_VO_VIDEO_NOT_DISABLE (0xA00F8046): The video layer is not " 164 | "disabled"; 165 | case 0xA00F8047: 166 | return "ERR_VO_VIDEO_NOT_CONFIG (0xA00F8047): The video layer is not " 167 | "configured"; 168 | case 0xA00F8048: 169 | return "ERR_VO_CHN_NOT_DISABLE (0xA00F8048): The VO channel is not " 170 | "disabled"; 171 | case 0xA00F8049: 172 | return "ERR_VO_CHN_NOT_ENABLE (0xA00F8049): No VO channel is enabled"; 173 | case 0xA00F804A: 174 | return "ERR_VO_CHN_NOT_CONFIG (0xA00F804A): The VO channel is not " 175 | "configured"; 176 | case 0xA00F804B: 177 | return "ERR_VO_CHN_NOT_ALLOC (0xA00F804B): No VO channel is allocated"; 178 | case 0xA00F804C: 179 | return "ERR_VO_INVALID_PATTERN (0xA00F804C): The pattern is invalid"; 180 | case 0xA00F804D: 181 | return "ERR_VO_INVALID_POSITION (0xA00F804D): The cascade position is " 182 | "invalid"; 183 | case 0xA00F804E: 184 | return "ERR_VO_WAIT_TIMEOUT (0xA00F804E): Waiting times out"; 185 | case 0xA00F804F: 186 | return "ERR_VO_INVALID_VFRAME (0xA00F804F): The video frame is " 187 | "invalid"; 188 | case 0xA00F8050: 189 | return "ERR_VO_INVALID_RECT_PARA (0xA00F8050): The rectangle parameter " 190 | "is invalid"; 191 | case 0xA00F8051: 192 | return "ERR_VO_SETBEGIN_ALREADY (0xA00F8051): The SETBEGIN MPI has " 193 | "been configured"; 194 | case 0xA00F8052: 195 | return "ERR_VO_SETBEGIN_NOTYET (0xA00F8052): The SETBEGIN MPI is not " 196 | "configured"; 197 | case 0xA00F8053: 198 | return "ERR_VO_SETEND_ALREADY (0xA00F8053): The SETEND MPI has been " 199 | "configured"; 200 | case 0xA00F8054: 201 | return "ERR_VO_SETEND_NOTYET (0xA00F8054): The SETEND MPI is not " 202 | "configured"; 203 | case 0xA00F8065: 204 | return "ERR_VO_GFX_NOT_DISABLE (0xA00F8065): The graphics layer is not " 205 | "disabled"; 206 | case 0xA00F8066: 207 | return "ERR_VO_GFX_NOT_BIND (0xA00F8066): The graphics layer is not " 208 | "bound"; 209 | case 0xA00F8067: 210 | return "ERR_VO_GFX_NOT_UNBIND (0xA00F8067): The graphics layer is not " 211 | "unbound"; 212 | case 0xA00F8068: 213 | return "ERR_VO_GFX_INVALID_ID (0xA00F8068): The graphics layer ID does " 214 | "not fall within the value range"; 215 | case 0xA00F806b: 216 | return "ERR_VO_CHN_AREA_OVERLAP (0xA00F806b): The VO channel areas " 217 | "overlap"; 218 | case 0xA00F806d: 219 | return "ERR_VO_INVALID_LAYERID (0xA00F806d): The video layer ID does " 220 | "not fall within the value range"; 221 | case 0xA00F806e: 222 | return "ERR_VO_VIDEO_HAS_BINDED (0xA00F806e): The video layer has been " 223 | "bound"; 224 | case 0xA00F806f: 225 | return "ERR_VO_VIDEO_NOT_BINDED (0xA00F806f): The video layer is not " 226 | "bound"; 227 | 228 | case 0xA0078001: 229 | return "ERR_VPSS_INVALID_DEVID (0xA0078001): The VPSS group ID is " 230 | "invalid"; 231 | case 0xA0078002: 232 | return "ERR_VPSS_INVALID_CHNID (0xA0078002): The VPSS channel ID is " 233 | "invalid"; 234 | case 0xA0078003: 235 | return "ERR_VPSS_ILLEGAL_PARAM (0xA0078003): The VPSS parameter is " 236 | "invalid"; 237 | case 0xA0078004: 238 | return "ERR_VPSS_EXIST (0xA0078004): A VPSS group is created"; 239 | case 0xA0078005: 240 | return "ERR_VPSS_UNEXIST (0xA0078005): No VPSS group is created"; 241 | case 0xA0078006: 242 | return "ERR_VPSS_NULL_PTR (0xA0078006): The pointer of the input " 243 | "parameter is null"; 244 | case 0xA0078008: 245 | return "ERR_VPSS_NOT_SUPPORT (0xA0078008): The operation is not " 246 | "supported"; 247 | case 0xA0078009: 248 | return "ERR_VPSS_NOT_PERM (0xA0078009): The operation is forbidden"; 249 | case 0xA007800C: 250 | return "ERR_VPSS_NOMEM (0xA007800C): The memory fails to be allocated"; 251 | case 0xA007800D: 252 | return "ERR_VPSS_NOBUF (0xA007800D): The buffer pool fails to be " 253 | "allocated"; 254 | case 0xA007800E: 255 | return "ERR_VPSS_BUF_EMPTY (0xA007800E): The picture queue is empty"; 256 | case 0xA0078010: 257 | return "ERR_VPSS_NOTREADY (0xA0078010): The VPSS is not initialized"; 258 | case 0xA0078012: 259 | return "ERR_VPSS_BUSY (0xA0078012): The VPSS is busy"; 260 | 261 | case 0xA0088002: 262 | return "ERR_VENC_INVALID_CHNID (0xA0088002): The channel ID is " 263 | "invalid"; 264 | case 0xA0088003: 265 | return "ERR_VENC_ILLEGAL_PARAM (0xA0088003): The parameter is invalid"; 266 | case 0xA0088004: 267 | return "ERR_VENC_EXIST (0xA0088004): The device, channel or resource " 268 | "to be created or applied for exists"; 269 | case 0xA0088005: 270 | return "ERR_VENC_UNEXIST (0xA0088005): The device, channel or resource " 271 | "to be used or destroyed does not exist"; 272 | case 0xA0088006: 273 | return "ERR_VENC_NULL_PTR (0xA0088006): The parameter pointer is null"; 274 | case 0xA0088007: 275 | return "ERR_VENC_NOT_CONFIG (0xA0088007): No parameter is set before " 276 | "use"; 277 | case 0xA0088008: 278 | return "ERR_VENC_NOT_SUPPORT (0xA0088008): The parameter or function " 279 | "is not supported"; 280 | case 0xA0088009: 281 | return "ERR_VENC_NOT_PERM (0xA0088009): The operation, for example, " 282 | "modifying static parameters, is forbidden"; 283 | case 0xA008800C: 284 | return "ERR_VENC_NOMEM (0xA008800C): The memory fails to be allocated " 285 | "due to some causes such as insufficient system memory"; 286 | case 0xA008800D: 287 | return "ERR_VENC_NOBUF (0xA008800D): The buffer fails to be allocated " 288 | "due to some causes such as oversize of the data buffer applied " 289 | "for"; 290 | case 0xA008800E: 291 | return "ERR_VENC_BUF_EMPTY (0xA008800E): The buffer is empty"; 292 | case 0xA008800F: 293 | return "ERR_VENC_BUF_FULL (0xA008800F): The buffer is full"; 294 | case 0xA0088010: 295 | return "ERR_VENC_SYS_NOTREADY (0xA0088010): The system is not " 296 | "initialized or the corresponding module is not loaded"; 297 | case 0xA0088012: 298 | return "ERR_VENC_BUSY (0xA0088012): The VENC system is busy"; 299 | 300 | case 0xA0098001: 301 | return "ERR_VDA_INVALID_DEVID (0xA0098001): The device ID exceeds the " 302 | "valid range"; 303 | case 0xA0098002: 304 | return "ERR_VDA_INVALID_CHNID (0xA0098002): The channel ID exceeds the " 305 | "valid range"; 306 | case 0xA0098003: 307 | return "ERR_VDA_ILLEGAL_PARAM (0xA0098003): The parameter value " 308 | "exceeds its valid range"; 309 | case 0xA0098004: 310 | return "ERR_VDA_EXIST (0xA0098004): The device, channel, or resource " 311 | "to be created or applied for already exists"; 312 | case 0xA0098005: 313 | return "ERR_VDA_UNEXIST (0xA0098005): The device, channel, or resource " 314 | "to be used or destroyed does not exist"; 315 | case 0xA0098006: 316 | return "ERR_VDA_NULL_PTR (0xA0098006): The pointer is null"; 317 | case 0xA0098007: 318 | return "ERR_VDA_NOT_CONFIG (0xA0098007): The system or VDA channel is " 319 | "not configured"; 320 | case 0xA0098008: 321 | return "ERR_VDA_NOT_SUPPORT (0xA0098008): The parameter or function is " 322 | "not supported"; 323 | case 0xA0098009: 324 | return "ERR_VDA_NOT_PERM (0xA0098009): The operation, for example, " 325 | "attempting to modify the value of a static parameter, is " 326 | "forbidden"; 327 | case 0xA009800C: 328 | return "ERR_VDA_NOMEM (0xA009800C): The memory fails to be allocated " 329 | "due to some causes such as insufficient system memory"; 330 | case 0xA009800D: 331 | return "ERR_VDA_NOBUF (0xA009800D): The buffer fails to be allocated " 332 | "due to some causes such as oversize of the data buffer applied " 333 | "for"; 334 | case 0xA009800E: 335 | return "ERR_VDA_BUF_EMPTY (0xA009800E): The buffer is empty"; 336 | case 0xA009800F: 337 | return "ERR_VDA_BUF_FULL (0xA009800F): The buffer is full"; 338 | case 0xA0098010: 339 | return "ERR_VDA_SYS_NOTREADY (0xA0098010): The system is not " 340 | "initialized or the corresponding module is not loaded"; 341 | case 0xA0098012: 342 | return "ERR_VDA_BUSY (0xA0098012): The system is busy"; 343 | 344 | case 0xA0038001: 345 | return "ERR_RGN_INVALID_DEVID (0xA0038001): The device ID exceeds the " 346 | "valid range"; 347 | case 0xA0038002: 348 | return "ERR_RGN_INVALID_CHNID (0xA0038002): The channel ID is " 349 | "incorrect or the region handle is invalid"; 350 | case 0xA0038003: 351 | return "ERR_RGN_ILLEGAL_PARAM (0xA0038003): The parameter value " 352 | "exceeds its valid range"; 353 | case 0xA0038004: 354 | return "ERR_RGN_EXIST (0xA0038004): The device, channel, or resource " 355 | "to be created already exists"; 356 | case 0xA0038005: 357 | return "ERR_RGN_UNEXIST (0xA0038005): The device, channel, or resource " 358 | "to be used or destroyed does not exist"; 359 | case 0xA0038006: 360 | return "ERR_RGN_NULL_PTR (0xA0038006): The pointer is null"; 361 | case 0xA0038007: 362 | return "ERR_RGN_NOT_CONFIG (0xA0038007): The module is not configured"; 363 | case 0xA0038008: 364 | return "ERR_RGN_NOT_SUPPORT (0xA0038008): The parameter or function is " 365 | "not supported"; 366 | case 0xA0038009: 367 | return "ERR_RGN_NOT_PERM (0xA0038009): The operation, for example, " 368 | "attempting to modify the value of a static parameter, is " 369 | "forbidden"; 370 | case 0xA003800C: 371 | return "ERR_RGN_NOMEM (0xA003800C): The memory fails to be allocated " 372 | "due to some causes such as insufficient system memory"; 373 | case 0xA003800D: 374 | return "ERR_RGN_NOBUF (0xA003800D): The buffer fails to be allocated " 375 | "due to some causes such as oversize of the data buffer applied " 376 | "for"; 377 | case 0xA003800E: 378 | return "ERR_RGN_BUF_EMPTY (0xA003800E): The buffer is empty"; 379 | case 0xA003800F: 380 | return "ERR_RGN_BUF_FULL (0xA003800F): The buffer is full"; 381 | case 0xA0038010: 382 | return "ERR_RGN_NOTREADY (0xA0038010): The system is not initialized " 383 | "or the corresponding module is not loaded"; 384 | case 0xA0038011: 385 | return "ERR_RGN_BADADDR (0xA0038011): The address is invalid"; 386 | case 0xA0038012: 387 | return "ERR_RGN_BUSY (0xA0038012): The system is busy"; 388 | 389 | case 0xA0158001: 390 | return "ERR_AI_INVALID_DEVID (0xA0158001): The AI device ID is " 391 | "invalid"; 392 | case 0xA0158002: 393 | return "ERR_AI_INVALID_CHNID (0xA0158002): The AI channel ID is " 394 | "invalid"; 395 | case 0xA0158003: 396 | return "ERR_AI_ILLEGAL_PARAM (0xA0158003): The settings of the AI " 397 | "parameters are invalid"; 398 | case 0xA0158005: 399 | return "ERR_AI_NOT_ENABLED (0xA0158005): The AI device or AI channel " 400 | "is not enabled"; 401 | case 0xA0158006: 402 | return "ERR_AI_NULL_PTR (0xA0158006): The input parameter pointer is " 403 | "null"; 404 | case 0xA0158007: 405 | return "ERR_AI_NOT_CONFIG (0xA0158007): The attributes of an AI device " 406 | "are not set"; 407 | case 0xA0158008: 408 | return "ERR_AI_NOT_SUPPORT (0xA0158008): The operation is not " 409 | "supported"; 410 | case 0xA0158009: 411 | return "ERR_AI_NOT_PERM (0xA0158009): The operation is forbidden"; 412 | case 0xA015800C: 413 | return "ERR_AI_NOMEM (0xA015800C): The memory fails to be allocated"; 414 | case 0xA015800D: 415 | return "ERR_AI_NOBUF (0xA015800D): The AI buffer is insufficient"; 416 | case 0xA015800E: 417 | return "ERR_AI_BUF_EMPTY (0xA015800E): The AI buffer is empty"; 418 | case 0xA015800F: 419 | return "ERR_AI_BUF_FULL (0xA015800F): The AI buffer is full"; 420 | case 0xA0158010: 421 | return "ERR_AI_SYS_NOTREADY (0xA0158010): The AI system is not " 422 | "initialized"; 423 | case 0xA0158012: 424 | return "ERR_AI_BUSY (0xA0158012): The AI system is busy"; 425 | case 0xA0158041: 426 | return "ERR_AI_VQE_ERR (0xA0158041): A VQE processing error occurs in " 427 | "the AI channel"; 428 | 429 | case 0xA0168001: 430 | return "ERR_AO_INVALID_DEVID (0xA0168001): The AO device ID is " 431 | "invalid"; 432 | case 0xA0168002: 433 | return "ERR_AO_INVALID_CHNID (0xA0168002): The AO channel ID is " 434 | "invalid"; 435 | case 0xA0168003: 436 | return "ERR_AO_ILLEGAL_PARAM (0xA0168003): The settings of the AO " 437 | "parameters are invalid"; 438 | case 0xA0168005: 439 | return "ERR_AO_NOT_ENABLED (0xA0168005): The AO device or AO channel " 440 | "is not enabled"; 441 | case 0xA0168006: 442 | return "ERR_AO_NULL_PTR (0xA0168006): The output parameter pointer is " 443 | "null"; 444 | case 0xA0168007: 445 | return "ERR_AO_NOT_CONFIG (0xA0168007): The attributes of an AO device " 446 | "are not set"; 447 | case 0xA0168008: 448 | return "ERR_AO_NOT_SUPPORT (0xA0168008): The operation is not " 449 | "supported"; 450 | case 0xA0168009: 451 | return "ERR_AO_NOT_PERM (0xA0168009): The operation is forbidden"; 452 | case 0xA016800C: 453 | return "ERR_AO_NOMEM (0xA016800C): The system memory is insufficient"; 454 | case 0xA016800D: 455 | return "ERR_AO_NOBUF (0xA016800D): The AO buffer is insufficient"; 456 | case 0xA016800E: 457 | return "ERR_AO_BUF_EMPTY (0xA016800E): The AO buffer is empty"; 458 | case 0xA016800F: 459 | return "ERR_AO_BUF_FULL (0xA016800F): The AO buffer is full"; 460 | case 0xA0168010: 461 | return "ERR_AO_SYS_NOTREADY (0xA0168010): The AO system is not " 462 | "initialized"; 463 | case 0xA0168012: 464 | return "ERR_AO_BUSY (0xA0168012): The AO system is busy"; 465 | case 0xA0168041: 466 | return "ERR_AO_VQE_ERR (0xA0168041): A VQE processing error occurs in " 467 | "the AO channel"; 468 | 469 | case 0xA0178001: 470 | return "ERR_AENC_INVALID_DEVID (0xA0178001): The AENC device ID is " 471 | "invalid"; 472 | case 0xA0178002: 473 | return "ERR_AENC_INVALID_CHNID (0xA0178002): The AENC channel ID is " 474 | "invalid"; 475 | case 0xA0178003: 476 | return "ERR_AENC_ILLEGAL_PARAM (0xA0178003): The settings of the AENC " 477 | "parameters are invalid"; 478 | case 0xA0178004: 479 | return "ERR_AENC_EXIST (0xA0178004): An AENC channel is created"; 480 | case 0xA0178005: 481 | return "ERR_AENC_UNEXIST (0xA0178005): An AENC channel is not created"; 482 | case 0xA0178006: 483 | return "ERR_AENC_NULL_PTR (0xA0178006): The input parameter pointer is " 484 | "null"; 485 | case 0xA0178007: 486 | return "ERR_AENC_NOT_CONFIG (0xA0178007): The AENC channel is not " 487 | "configured"; 488 | case 0xA0178008: 489 | return "ERR_AENC_NOT_SUPPORT (0xA0178008): The operation is not " 490 | "supported"; 491 | case 0xA0178009: 492 | return "ERR_AENC_NOT_PERM (0xA0178009): The operation is forbidden"; 493 | case 0xA017800C: 494 | return "ERR_AENC_NOMEM (0xA017800C): The system memory is " 495 | "insufficient"; 496 | case 0xA017800D: 497 | return "ERR_AENC_NOBUF (0xA017800D): The buffer for AENC channels " 498 | "fails to be allocated"; 499 | case 0xA017800E: 500 | return "ERR_AENC_BUF_EMPTY (0xA017800E): The AENC channel buffer is " 501 | "empty"; 502 | case 0xA017800F: 503 | return "ERR_AENC_BUF_FULL (0xA017800F): The AENC channel buffer is " 504 | "full"; 505 | case 0xA0178010: 506 | return "ERR_AENC_SYS_NOTREADY (0xA0178010): The system is not " 507 | "initialized"; 508 | case 0xA0178040: 509 | return "ERR_AENC_ENCODER_ERR (0xA0178040): An AENC data error occurs"; 510 | case 0xA0178041: 511 | return "ERR_AENC_VQE_ERR (0xA0178041): A VQE processing error occurs " 512 | "in the AENC channel"; 513 | 514 | case 0xA0188001: 515 | return "ERR_ADEC_INVALID_DEVID (0xA0188001): The ADEC device is " 516 | "invalid"; 517 | case 0xA0188002: 518 | return "ERR_ADEC_INVALID_CHNID (0xA0188002): The ADEC channel ID is " 519 | "invalid"; 520 | case 0xA0188003: 521 | return "ERR_ADEC_ILLEGAL_PARAM (0xA0188003): The settings of the ADEC " 522 | "parameters are invalid"; 523 | case 0xA0188004: 524 | return "ERR_ADEC_EXIST (0xA0188004): An ADEC channel is created"; 525 | case 0xA0188005: 526 | return "ERR_ADEC_UNEXIST (0xA0188005): An ADEC channel is not created"; 527 | case 0xA0188006: 528 | return "ERR_ADEC_NULL_PTR (0xA0188006): The input parameter pointer is " 529 | "null"; 530 | case 0xA0188007: 531 | return "ERR_ADEC_NOT_CONFIG (0xA0188007): The attributes of an ADEC " 532 | "channel are not set"; 533 | case 0xA0188008: 534 | return "ERR_ADEC_NOT_SUPPORT (0xA0188008): The operation is not " 535 | "supported"; 536 | case 0xA0188009: 537 | return "ERR_ADEC_NOT_PERM (0xA0188009): The operation is forbidden"; 538 | case 0xA018800C: 539 | return "ERR_ADEC_NOMEM (0xA018800C): The system memory is " 540 | "insufficient"; 541 | case 0xA018800D: 542 | return "ERR_ADEC_NOBUF (0xA018800D): The buffer for ADEC channels " 543 | "fails to be allocated"; 544 | case 0xA018800E: 545 | return "ERR_ADEC_BUF_EMPTY (0xA018800E): The ADEC channel buffer is " 546 | "empty"; 547 | case 0xA018800F: 548 | return "ERR_ADEC_BUF_FULL (0xA018800F): The ADEC channel buffer is " 549 | "full"; 550 | case 0xA0188010: 551 | return "ERR_ADEC_SYS_NOTREADY (0xA0188010): The system is not " 552 | "initialized"; 553 | case 0xA0188040: 554 | return "ERR_ADEC_DECODER_ERR (0xA0188040): An ADEC data error occurs"; 555 | case 0xA0188041: 556 | return "ERR_ADEC_BUF_LACK (0xA0188041): An insufficient buffer occurs " 557 | "in the ADEC channel"; 558 | 559 | case 0xA02D800E: 560 | return "ERR_VGS_BUF_EMPTY (0xA02D800E): The VGS jobs, tasks, or nodes " 561 | "are used up"; 562 | case 0xA02D8003: 563 | return "ERR_VGS_ILLEGAL_PARAM (0xA02D8003): The VGS parameter value is " 564 | "invalid"; 565 | case 0xA02D8006: 566 | return "ERR_VGS_NULL_PTR (0xA02D8006): The input parameter pointer is " 567 | "null"; 568 | case 0xA02D8008: 569 | return "ERR_VGS_NOT_SUPPORT (0xA02D8008): The operation is not " 570 | "supported"; 571 | case 0xA02D8009: 572 | return "ERR_VGS_NOT_PERMITTED (0xA02D8009): The operation is " 573 | "forbidden"; 574 | case 0xA02D800D: 575 | return "ERR_VGS_NOBUF (0xA02D800D): The memory fails to be allocated"; 576 | case 0xA02D8010: 577 | return "ERR_VGS_SYS_NOTREADY (0xA02D8010): The system is not " 578 | "initialized"; 579 | 580 | case 0xA033800D: 581 | return "ERR_FISHEYE_NOBUF (0xA033800D): The memory fails to be " 582 | "allocated"; 583 | case 0xA033800E: 584 | return "ERR_FISHEYE_BUF_EMPTY (0xA033800E): The jobs, tasks, or nodes " 585 | "of the fisheye subsystem are used up"; 586 | case 0xA0338006: 587 | return "ERR_FISHEYE_NULL_PTR (0xA0338006): The pointer of the input " 588 | "parameter is null"; 589 | case 0xA0338003: 590 | return "ERR_FISHEYE_ILLEGAL_PARAM (0xA0338003): The configuration of " 591 | "fisheye parameters is invalid"; 592 | case 0xA0338010: 593 | return "ERR_FISHEYE_SYS_NOTREADY (0xA0338010): The system is not " 594 | "initialized"; 595 | case 0xA0338008: 596 | return "ERR_FISHEYE_NOT_SUPPORT (0xA0338008): This operation is not " 597 | "supported"; 598 | case 0xA0338009: 599 | return "ERR_FISHEYE_NOT_PERMITTED (0xA0338009): This operation is not " 600 | "allowed"; 601 | 602 | case 0x804D0001: 603 | return "ERR_CIPHER_NOT_INIT (0x804D0001): The cipher device is not " 604 | "initialized"; 605 | case 0x804D0002: 606 | return "ERR_CIPHER_INVALID_HANDLE (0x804D0002): The handle ID is " 607 | "invalid"; 608 | case 0x804D0003: 609 | return "ERR_CIPHER_INVALID_POINT (0x804D0003): The pointer is null"; 610 | case 0x804D0004: 611 | return "ERR_CIPHER_INVALID_PARA (0x804D0004): The parameter is " 612 | "invalid"; 613 | case 0x804D0005: 614 | return "ERR_CIPHER_FAILED_INIT (0x804D0005): The cipher module fails " 615 | "to be initialized"; 616 | case 0x804D0006: 617 | return "ERR_CIPHER_FAILED_GETHANDLE (0x804D0006): The handle fails to " 618 | "be obtained"; 619 | 620 | case 0xA0648001: 621 | return "ERR_TDE_DEV_NOT_OPEN (0xA0648001): The TDE device is not " 622 | "started"; 623 | case 0xA0648002: 624 | return "ERR_TDE_DEV_OPEN_FAILED (0xA0648002): The TDE device fails to " 625 | "be started"; 626 | case 0xA0648003: 627 | return "ERR_TDE_NULL_PTR (0xA0648003): The pointer of the input " 628 | "parameter is null"; 629 | case 0xA0648004: 630 | return "ERR_TDE_NO_MEM (0xA0648004): The memory fails to be allocated"; 631 | case 0xA0648005: 632 | return "ERR_TDE_INVALID_HANDLE (0xA0648005): The task handle is " 633 | "invalid"; 634 | case 0xA0648006: 635 | return "ERR_TDE_INVALID_PARA (0xA0648006): The input parameter is " 636 | "invalid"; 637 | case 0xA0648007: 638 | return "ERR_TDE_NOT_ALIGNED (0xA0648007): The position, width, height, " 639 | "or stride of the picture is not aligned as required"; 640 | case 0xA0648008: 641 | return "ERR_TDE_MINIFICATION (0xA0648008): The multiple of down " 642 | "scaling exceeds the limitation (the maximum value is 255)"; 643 | case 0xA0648009: 644 | return "ERR_TDE_CLIP_AREA (0xA0648009): The operation area does not " 645 | "overlap the clipped area"; 646 | case 0xA064800A: 647 | return "ERR_TDE_JOB_TIMEOUT (0xA064800A): Waiting times out"; 648 | case 0xA064800B: 649 | return "ERR_TDE_UNSUPPORTED_OPERATION (0xA064800B): The operation is " 650 | "not supported"; 651 | case 0xA064800C: 652 | return "ERR_TDE_QUERY_TIMEOUT (0xA064800C): The specific task is not " 653 | "complete due to timeout"; 654 | case 0xA064800E: 655 | return "ERR_TDE_INTERRUPT (0xA064800E): Waiting for task completion is " 656 | "interrupted"; 657 | 658 | case 0xA01D8001: 659 | return "HI_ERR_IVE_INVALID_DEVID (0xA01D8001): The device ID is " 660 | "invalid"; 661 | case 0xA01D8002: 662 | return "HI_ERR_IVE_INVALID_CHNID (0xA01D8002): The channel group ID or " 663 | "the region handle is invalid"; 664 | case 0xA01D8003: 665 | return "HI_ERR_IVE_ILLEGAL_PARAM (0xA01D8003): The parameter is " 666 | "invalid"; 667 | case 0xA01D8004: 668 | return "HI_ERR_IVE_EXIST (0xA01D8004): The device, channel, or " 669 | "resource to be created already exists"; 670 | case 0xA01D8005: 671 | return "HI_ERR_IVE_UNEXIST (0xA01D8005): The device, channel, or " 672 | "resource to be used or destroyed does not exist"; 673 | case 0xA01D8006: 674 | return "HI_ERR_IVE_NULL_PTR (0xA01D8006): The pointer is null"; 675 | case 0xA01D8007: 676 | return "HI_ERR_IVE_NOT_CONFIG (0xA01D8007): The module is not " 677 | "configured"; 678 | case 0xA01D8008: 679 | return "HI_ERR_IVE_NOT_SUPPORT (0xA01D8008): The parameter or function " 680 | "is not supported"; 681 | case 0xA01D8009: 682 | return "HI_ERR_IVE_NOT_PERM (0xA01D8009): The operation, for example, " 683 | "modifying the value of a static parameter, is forbidden"; 684 | case 0xA01D800C: 685 | return "HI_ERR_IVE_NOMEM (0xA01D800C): The memory fails to be " 686 | "allocated for the reasons such as system memory insufficiency"; 687 | case 0xA01D800D: 688 | return "HI_ERR_IVE_NOBUF (0xA01D800D): The buffer fails to be " 689 | "allocated. The reason may be that the requested picture buffer " 690 | "is too large"; 691 | case 0xA01D800E: 692 | return "HI_ERR_IVE_BUF_EMPTY (0xA01D800E): There is no picture in the " 693 | "buffer"; 694 | case 0xA01D800F: 695 | return "HI_ERR_IVE_BUF_FULL (0xA01D800F): The buffer is full of " 696 | "pictures"; 697 | case 0xA01D8010: 698 | return "HI_ERR_IVE_NOTREADY (0xA01D8010): The system is not " 699 | "initialized or the corresponding module driver is not loaded"; 700 | case 0xA01D8011: 701 | return "HI_ERR_IVE_BADADDR (0xA01D8011): The address is invalid"; 702 | case 0xA01D8012: 703 | return "HI_ERR_IVE_BUSY (0xA01D8012): The system is busy"; 704 | case 0xA01D8040: 705 | return "HI_ERR_IVE_SYS_TIMEOUT (0xA01D8040): The IVE times out"; 706 | case 0xA01D8041: 707 | return "HI_ERR_IVE_QUERY_TIMEOUT (0xA01D8041): The query times out"; 708 | case 0xA01D8042: 709 | return "HI_ERR_IVE_OPEN_FILE (0xA01D8042): Opening a file fails"; 710 | case 0xA01D8043: 711 | return "HI_ERR_IVE_READ_FILE (0xA01D8043): Reading a file fails"; 712 | case 0xA01D8044: 713 | return "HI_ERR_IVE_WRITE_FILE (0xA01D8044): Writing to a file fails"; 714 | case 0xA0308002: 715 | return "HI_ERR_ODT_INVALID_CHNID (0xA0308002): The on-die termination " 716 | "(ODT) channel group ID or the region handle is invalid"; 717 | case 0xA0308004: 718 | return "HI_ERR_ODT_EXIST (0xA0308004): The device, channel, or " 719 | "resource to be created already exists"; 720 | case 0xA0308005: 721 | return "HI_ERR_ODT_UNEXIST (0xA0308005): The device, channel, or " 722 | "resource to be used or destroyed does not exist"; 723 | case 0xA0308009: 724 | return "HI_ERR_ODT_NOT_PERM (0xA0308009): The operation, for example, " 725 | "modifying the value of a static parameter, is forbidden"; 726 | case 0xA0308010: 727 | return "HI_ERR_ODT_NOTREADY (0xA0308010): The ODT is not initialized"; 728 | case 0xA0308012: 729 | return "HI_ERR_ODT_BUSY (0xA0308012): The ODT is busy"; 730 | 731 | default: { 732 | static char err_buf[64]; 733 | int len = sprintf(err_buf, "Unknown error code (%X).", error); 734 | err_buf[len + 1] = 0; 735 | return err_buf; 736 | } 737 | } 738 | } 739 | --------------------------------------------------------------------------------