Home | History | Annotate | Download | only in audio
      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 * NOTE, ANY CHANGES TO THIS FILE MAY AFFECT UNDERLYING AUDIO / SPEECH CODEC
     25 * LIBRARY COMPONENT FROM CADENCE DESIGN SYSTEMS, INC.
     26 *
     27 ******************************************************************************/
     28 
     29 
     30 #ifndef __XA_ERROR_STANDARDS_H__
     31 #define __XA_ERROR_STANDARDS_H__
     32 
     33 /*****************************************************************************/
     34 /* File includes                                                             */
     35 /*  xa_type_def.h                                                            */
     36 /*****************************************************************************/
     37 
     38 /*****************************************************************************/
     39 /* Constant hash defines                                                     */
     40 /*****************************************************************************/
     41 #define XA_NO_ERROR	0
     42 #define XA_FATAL_ERROR	0x80000000
     43 
     44 enum xa_error_severity {
     45   xa_severity_nonfatal = 0,
     46   xa_severity_fatal    = 0xffffffff
     47 };
     48 
     49 enum xa_error_class {
     50   xa_class_api     = 0,
     51   xa_class_config  = 1,
     52   xa_class_execute = 2,
     53   xa_class_proxy   = 3
     54 };
     55 
     56 #define XA_CODEC_GENERIC	0
     57 
     58 #define XA_ERROR_CODE(severity, class, codec, index)	((severity << 15) | (class << 11) | (codec << 6) | index)
     59 #define XA_ERROR_SEVERITY(code)	(((code) & XA_FATAL_ERROR) != 0)
     60 #define XA_ERROR_CLASS(code)	(((code) >> 11) & 0x0f)
     61 #define XA_ERROR_CODEC(code)    (((code) >>  6) & 0x1f)
     62 #define XA_ERROR_SUBCODE(code)	(((code) >>  0) & 0x3f)
     63 
     64 /* Our convention is that only api-class errors can be generic ones. */
     65 
     66 /*****************************************************************************/
     67 /* Class 0: API Errors                                                       */
     68 /*****************************************************************************/
     69 /* Non Fatal Errors */
     70 /* (none) */
     71 /* Fatal Errors */
     72 enum xa_error_fatal_api_generic {
     73   XA_API_FATAL_MEM_ALLOC        = XA_ERROR_CODE(xa_severity_fatal, xa_class_api, XA_CODEC_GENERIC, 0),
     74   XA_API_FATAL_MEM_ALIGN        = XA_ERROR_CODE(xa_severity_fatal, xa_class_api, XA_CODEC_GENERIC, 1),
     75   XA_API_FATAL_INVALID_CMD      = XA_ERROR_CODE(xa_severity_fatal, xa_class_api, XA_CODEC_GENERIC, 2),
     76   XA_API_FATAL_INVALID_CMD_TYPE = XA_ERROR_CODE(xa_severity_fatal, xa_class_api, XA_CODEC_GENERIC, 3)
     77 };
     78 
     79 #endif /* __XA_ERROR_STANDARDS_H__ */
     80