1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
|
/*
* Copyright (c) 2015, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef __CPE_ERR__
#define __CPE_ERR__
#include <linux/errno.h>
/* ERROR CODES */
/* Success. The operation completed with no errors. */
#define CPE_EOK 0x00000000
/* General failure. */
#define CPE_EFAILED 0x00000001
/* Bad operation parameter. */
#define CPE_EBADPARAM 0x00000002
/* Unsupported routine or operation. */
#define CPE_EUNSUPPORTED 0x00000003
/* Unsupported version. */
#define CPE_EVERSION 0x00000004
/* Unexpected problem encountered. */
#define CPE_EUNEXPECTED 0x00000005
/* Unhandled problem occurred. */
#define CPE_EPANIC 0x00000006
/* Unable to allocate resource. */
#define CPE_ENORESOURCE 0x00000007
/* Invalid handle. */
#define CPE_EHANDLE 0x00000008
/* Operation is already processed. */
#define CPE_EALREADY 0x00000009
/* Operation is not ready to be processed. */
#define CPE_ENOTREADY 0x0000000A
/* Operation is pending completion. */
#define CPE_EPENDING 0x0000000B
/* Operation could not be accepted or processed. */
#define CPE_EBUSY 0x0000000C
/* Operation aborted due to an error. */
#define CPE_EABORTED 0x0000000D
/* Operation preempted by a higher priority. */
#define CPE_EPREEMPTED 0x0000000E
/* Operation requests intervention to complete. */
#define CPE_ECONTINUE 0x0000000F
/* Operation requests immediate intervention to complete. */
#define CPE_EIMMEDIATE 0x00000010
/* Operation is not implemented. */
#define CPE_ENOTIMPL 0x00000011
/* Operation needs more data or resources. */
#define CPE_ENEEDMORE 0x00000012
/* Operation does not have memory. */
#define CPE_ENOMEMORY 0x00000014
/* Item does not exist. */
#define CPE_ENOTEXIST 0x00000015
/* Operation is finished. */
#define CPE_ETERMINATED 0x00000016
/* Max count for adsp error code sent to HLOS*/
#define CPE_ERR_MAX (CPE_ETERMINATED + 1)
/* ERROR STRING */
/* Success. The operation completed with no errors. */
#define CPE_EOK_STR "CPE_EOK"
/* General failure. */
#define CPE_EFAILED_STR "CPE_EFAILED"
/* Bad operation parameter. */
#define CPE_EBADPARAM_STR "CPE_EBADPARAM"
/* Unsupported routine or operation. */
#define CPE_EUNSUPPORTED_STR "CPE_EUNSUPPORTED"
/* Unsupported version. */
#define CPE_EVERSION_STR "CPE_EVERSION"
/* Unexpected problem encountered. */
#define CPE_EUNEXPECTED_STR "CPE_EUNEXPECTED"
/* Unhandled problem occurred. */
#define CPE_EPANIC_STR "CPE_EPANIC"
/* Unable to allocate resource. */
#define CPE_ENORESOURCE_STR "CPE_ENORESOURCE"
/* Invalid handle. */
#define CPE_EHANDLE_STR "CPE_EHANDLE"
/* Operation is already processed. */
#define CPE_EALREADY_STR "CPE_EALREADY"
/* Operation is not ready to be processed. */
#define CPE_ENOTREADY_STR "CPE_ENOTREADY"
/* Operation is pending completion. */
#define CPE_EPENDING_STR "CPE_EPENDING"
/* Operation could not be accepted or processed. */
#define CPE_EBUSY_STR "CPE_EBUSY"
/* Operation aborted due to an error. */
#define CPE_EABORTED_STR "CPE_EABORTED"
/* Operation preempted by a higher priority. */
#define CPE_EPREEMPTED_STR "CPE_EPREEMPTED"
/* Operation requests intervention to complete. */
#define CPE_ECONTINUE_STR "CPE_ECONTINUE"
/* Operation requests immediate intervention to complete. */
#define CPE_EIMMEDIATE_STR "CPE_EIMMEDIATE"
/* Operation is not implemented. */
#define CPE_ENOTIMPL_STR "CPE_ENOTIMPL"
/* Operation needs more data or resources. */
#define CPE_ENEEDMORE_STR "CPE_ENEEDMORE"
/* Operation does not have memory. */
#define CPE_ENOMEMORY_STR "CPE_ENOMEMORY"
/* Item does not exist. */
#define CPE_ENOTEXIST_STR "CPE_ENOTEXIST"
/* Operation is finished. */
#define CPE_ETERMINATED_STR "CPE_ETERMINATED"
/* Unexpected error code. */
#define CPE_ERR_MAX_STR "CPE_ERR_MAX"
struct cpe_err_code {
int lnx_err_code;
char *cpe_err_str;
};
static struct cpe_err_code cpe_err_code_info[CPE_ERR_MAX+1] = {
{ 0, CPE_EOK_STR},
{ -ENOTRECOVERABLE, CPE_EFAILED_STR},
{ -EINVAL, CPE_EBADPARAM_STR},
{ -ENOSYS, CPE_EUNSUPPORTED_STR},
{ -ENOPROTOOPT, CPE_EVERSION_STR},
{ -ENOTRECOVERABLE, CPE_EUNEXPECTED_STR},
{ -ENOTRECOVERABLE, CPE_EPANIC_STR},
{ -ENOSPC, CPE_ENORESOURCE_STR},
{ -EBADR, CPE_EHANDLE_STR},
{ -EALREADY, CPE_EALREADY_STR},
{ -EPERM, CPE_ENOTREADY_STR},
{ -EINPROGRESS, CPE_EPENDING_STR},
{ -EBUSY, CPE_EBUSY_STR},
{ -ECANCELED, CPE_EABORTED_STR},
{ -EAGAIN, CPE_EPREEMPTED_STR},
{ -EAGAIN, CPE_ECONTINUE_STR},
{ -EAGAIN, CPE_EIMMEDIATE_STR},
{ -EAGAIN, CPE_ENOTIMPL_STR},
{ -ENODATA, CPE_ENEEDMORE_STR},
{ -EADV, CPE_ERR_MAX_STR},
{ -ENOMEM, CPE_ENOMEMORY_STR},
{ -ENODEV, CPE_ENOTEXIST_STR},
{ -EADV, CPE_ETERMINATED_STR},
{ -EADV, CPE_ERR_MAX_STR},
};
static inline int cpe_err_get_lnx_err_code(u32 cpe_error)
{
if (cpe_error > CPE_ERR_MAX)
return cpe_err_code_info[CPE_ERR_MAX].lnx_err_code;
else
return cpe_err_code_info[cpe_error].lnx_err_code;
}
static inline char *cpe_err_get_err_str(u32 cpe_error)
{
if (cpe_error > CPE_ERR_MAX)
return cpe_err_code_info[CPE_ERR_MAX].cpe_err_str;
else
return cpe_err_code_info[cpe_error].cpe_err_str;
}
#endif
|