xref: /freebsd/sys/contrib/ncsw/etc/error.c (revision 63d1fd5970ec814904aa0f4580b10a0d302d08b2)
1 /* Copyright (c) 2008-2011 Freescale Semiconductor, Inc.
2  * All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are met:
6  *     * Redistributions of source code must retain the above copyright
7  *       notice, this list of conditions and the following disclaimer.
8  *     * Redistributions in binary form must reproduce the above copyright
9  *       notice, this list of conditions and the following disclaimer in the
10  *       documentation and/or other materials provided with the distribution.
11  *     * Neither the name of Freescale Semiconductor nor the
12  *       names of its contributors may be used to endorse or promote products
13  *       derived from this software without specific prior written permission.
14  *
15  *
16  * ALTERNATIVELY, this software may be distributed under the terms of the
17  * GNU General Public License ("GPL") as published by the Free Software
18  * Foundation, either version 2 of that License or (at your option) any
19  * later version.
20  *
21  * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
22  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24  * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
25  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
28  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 /*
34 
35  @File          error.c
36 
37  @Description   General errors and events reporting utilities.
38 *//***************************************************************************/
39 
40 #if (defined(DEBUG_ERRORS) && (DEBUG_ERRORS > 0))
41 
42 const char *dbgLevelStrings[] =
43 {
44      "CRITICAL"
45     ,"MAJOR"
46     ,"MINOR"
47     ,"WARNING"
48     ,"INFO"
49     ,"TRACE"
50 };
51 
52 const char *errTypeStrings[] =
53 {
54      "Invalid State"                        /* E_INVALID_STATE */
55     ,"Invalid Operation"                    /* E_INVALID_OPERATION */
56     ,"Unsupported Operation"                /* E_NOT_SUPPORTED */
57     ,"No Device"                            /* E_NO_DEVICE */
58     ,"Invalid Handle"                       /* E_INVALID_HANDLE */
59     ,"Invalid ID"                           /* E_INVALID_ID */
60     ,"Unexpected NULL Pointer"              /* E_NULL_POINTER */
61     ,"Invalid Value"                        /* E_INVALID_VALUE */
62     ,"Invalid Selection"                    /* E_INVALID_SELECTION */
63     ,"Invalid Communication Mode"           /* E_INVALID_COMM_MODE */
64     ,"Invalid Byte Order"                   /* E_INVALID_BYTE_ORDER */
65     ,"Invalid Memory Type"                  /* E_INVALID_MEMORY_TYPE */
66     ,"Invalid Interrupt Queue"              /* E_INVALID_INTR_QUEUE */
67     ,"Invalid Priority"                     /* E_INVALID_PRIORITY */
68     ,"Invalid Clock"                        /* E_INVALID_CLOCK */
69     ,"Invalid Rate"                         /* E_INVALID_RATE */
70     ,"Invalid Address"                      /* E_INVALID_ADDRESS */
71     ,"Invalid Bus"                          /* E_INVALID_BUS */
72     ,"Conflict In Bus Selection"            /* E_BUS_CONFLICT */
73     ,"Conflict In Settings"                 /* E_CONFLICT */
74     ,"Incorrect Alignment"                  /* E_NOT_ALIGNED */
75     ,"Value Out Of Range"                   /* E_NOT_IN_RANGE */
76     ,"Invalid Frame"                        /* E_INVALID_FRAME */
77     ,"Frame Is Empty"                       /* E_EMPTY_FRAME */
78     ,"Buffer Is Empty"                      /* E_EMPTY_BUFFER */
79     ,"Memory Allocation Failed"             /* E_NO_MEMORY */
80     ,"Resource Not Found"                   /* E_NOT_FOUND */
81     ,"Resource Is Unavailable"              /* E_NOT_AVAILABLE */
82     ,"Resource Already Exists"              /* E_ALREADY_EXISTS */
83     ,"Resource Is Full"                     /* E_FULL */
84     ,"Resource Is Empty"                    /* E_EMPTY */
85     ,"Resource Is Busy"                     /* E_BUSY */
86     ,"Resource Already Free"                /* E_ALREADY_FREE */
87     ,"Read Access Failed"                   /* E_READ_FAILED */
88     ,"Write Access Failed"                  /* E_WRITE_FAILED */
89     ,"Send Operation Failed"                /* E_SEND_FAILED */
90     ,"Receive Operation Failed"             /* E_RECEIVE_FAILED */
91     ,"Operation Timed Out"                  /* E_TIMEOUT */
92 };
93 
94 
95 #if (defined(REPORT_EVENTS) && (REPORT_EVENTS > 0))
96 
97 const char *eventStrings[] =
98 {
99      "Rx Discard"                           /* EV_RX_DISCARD */
100     ,"Rx Error"                             /* EV_RX_ERROR */
101     ,"Tx Error"                             /* EV_TX_ERROR */
102     ,"No Buffer Objects"                    /* EV_NO_BUFFERS */
103     ,"No MB-Frame Objects"                  /* EV_NO_MB_FRAMES */
104     ,"No SB-Frame Objects"                  /* EV_NO_SB_FRAMES */
105     ,"Tx Queue Is Full"                     /* EV_TX_QUEUE_FULL */
106     ,"Rx Queue Is Full"                     /* EV_RX_QUEUE_FULL */
107     ,"Interrupts Queue Is Full"             /* EV_INTR_QUEUE_FULL */
108     ,"Data Buffer Is Unavailable"           /* EV_NO_DATA_BUFFER */
109     ,"Objects Pool Is Empty"                /* EV_OBJ_POOL_EMPTY */
110     ,"Illegal bus access"                   /* EV_BUS_ERROR */
111     ,"PTP Tx Timestamps Queue Is Full"      /* EV_PTP_TXTS_QUEUE_FULL */
112     ,"PTP Rx Timestamps Queue Is Full"      /* EV_PTP_RXTS_QUEUE_FULL */
113 };
114 
115 #endif /* (defined(REPORT_EVENTS) && (REPORT_EVENTS > 0)) */
116 
117 #endif /* (defined(DEBUG_ERRORS) && (DEBUG_ERRORS > 0)) */
118 
119