• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /******************************************************************************
2  *
3  * Copyright (C) 2018 The Android Open Source Project
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at:
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *****************************************************************************
18  * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
19 */
20 
21 /*****************************************************************************/
22 /*                                                                           */
23 /*  File Name         : osal_error.c                                         */
24 /*                                                                           */
25 /*  Description       : This file contains all the error code mappings across*/
26 /*                      platforms.                                           */
27 /*                                                                           */
28 /*  List of Functions : get_windows_error                                    */
29 /*                      get_linux_error                                      */
30 /*                      get_ti_bios_error                                    */
31 /*                                                                           */
32 /*  Issues / Problems : None                                                 */
33 /*                                                                           */
34 /*  Revision History  :                                                      */
35 /*                                                                           */
36 /*         DD MM YYYY   Author(s)       Changes (Describe the changes made)  */
37 /*         30 03 2006   Ittiam          Draft                                */
38 /*                                                                           */
39 /*****************************************************************************/
40 
41 /*****************************************************************************/
42 /* File Includes                                                             */
43 /*****************************************************************************/
44 
45 /* System includes files */
46 
47 #include <errno.h>
48 
49 /* User include files */
50 #include "cast_types.h"
51 #include "osal_errno.h"
52 
53 /*****************************************************************************/
54 /* Global Variable Definitions                                               */
55 /*****************************************************************************/
56 
57 WORD32 osal_errno[] = {
58     OSAL_NOERROR,
59     OSAL_PERM, /*  EPERM                   */
60     OSAL_NOENT, /*  ENOENT                  */
61     OSAL_SRCH, /*  ESRCH                   */
62     OSAL_INTR, /*  EINTR                   */
63     OSAL_IO, /*  EIO                     */
64     OSAL_NXIO, /*  ENXIO                   */
65     OSAL_2BIG, /*  E2BIG                   */
66     OSAL_NOEXEC, /*  ENOEXEC                 */
67     OSAL_BADF, /*  EBADF                   */
68     OSAL_CHILD, /*  ECHILD                  */
69     OSAL_AGAIN, /*  EAGAIN, EDEADLOCK       */
70     OSAL_NOMEM, /*  ENOMEM                  */
71     OSAL_ACCES, /*  EACCES                  */
72     OSAL_FAULT, /*  EFAULT                  */
73     OSAL_NOTBLK, /*  ENOTBLK                 */
74     OSAL_BUSY, /*  EBUSY                   */
75     OSAL_EXIST, /*  EEXIST                  */
76     OSAL_XDEV, /*  EXDEV                   */
77     OSAL_NODEV, /*  ENODEV                  */
78     OSAL_NOTDIR, /*  ENOTDIR                 */
79     OSAL_ISDIR, /*  EISDIR                  */
80     OSAL_INVAL, /*  EINVAL                  */
81     OSAL_NFILE, /*  ENFILE                  */
82     OSAL_MFILE, /*  EMFILE                  */
83     OSAL_NOTTY, /*  ENOTTY                  */
84     OSAL_TXTBSY, /*  ETXTBSY                 */
85     OSAL_FBIG, /*  EFBIG                   */
86     OSAL_NOSPC, /*  ENOSPC                  */
87     OSAL_SPIPE, /*  ESPIPE                  */
88     OSAL_ROFS, /*  EROFS                   */
89     OSAL_MLINK, /*  EMLINK                  */
90     OSAL_PIPE, /*  EPIPE                   */
91     OSAL_DOM, /*  EDOM                    */
92     OSAL_RANGE, /*  ERANGE                  */
93     OSAL_DEADLK, /*  EDEADLK, EDEADLOCK      */
94     OSAL_NAMETOOLONG, /*  ENAMETOOLONG            */
95     OSAL_NOLCK, /*  ENOLCK                  */
96     OSAL_NOSYS, /*  ENOSYS                  */
97     OSAL_NOTEMPTY, /*  ENOTEMPTY               */
98     OSAL_LOOP, /*  ELOOP                   */
99     OSAL_NOERROR,
100     OSAL_NOMSG, /*  ENOMSG                  */
101     OSAL_IDRM, /*  EIDRM                   */
102     OSAL_CHRNG, /*  ECHRNG                  */
103     OSAL_L2NSYNC, /*  EL2NSYNC                */
104     OSAL_L3HLT, /*  EL3HLT                  */
105     OSAL_L3RST, /*  EL3RST                  */
106     OSAL_LNRNG, /*  ELNRNG                  */
107     OSAL_UNATCH, /*  EUNATCH                 */
108     OSAL_NOCSI, /*  ENOCSI                  */
109     OSAL_L2HLT, /*  EL2HLT                  */
110     OSAL_BADE, /*  EBADE                   */
111     OSAL_BADR, /*  EBADR                   */
112     OSAL_XFULL, /*  EXFULL                  */
113     OSAL_NOANO, /*  ENOANO                  */
114     OSAL_BADRQC, /*  EBADRQC                 */
115     OSAL_BADSLT, /*  EBADSLT                 */
116     OSAL_NOERROR,
117     OSAL_BFONT, /*  EBFONT                  */
118     OSAL_NOSTR, /*  ENOSTR                  */
119     OSAL_NODATA, /*  ENODATA                 */
120     OSAL_TIME, /*  ETIME                   */
121     OSAL_NOSR, /*  ENOSR                   */
122     OSAL_NONET, /*  ENONET                  */
123     OSAL_NOPKG, /*  ENOPKG                  */
124     OSAL_REMOTE, /*  EREMOTE                 */
125     OSAL_NOLINK, /*  ENOLINK                 */
126     OSAL_ADV, /*  EADV                    */
127     OSAL_SRMNT, /*  ESRMNT                  */
128     OSAL_COMM, /*  ECOMM                   */
129     OSAL_PROTO, /*  EPROTO                  */
130     OSAL_MULTIHOP, /*  EMULTIHOP               */
131     OSAL_DOTDOT, /*  EDOTDOT                 */
132     OSAL_BADMSG, /*  EBADMSG                 */
133     OSAL_OVERFLOW, /*  EOVERFLOW               */
134     OSAL_NOTUNIQ, /*  ENOTUNIQ                */
135     OSAL_BADFD, /*  EBADFD                  */
136     OSAL_REMCHG, /*  EREMCHG                 */
137     OSAL_LIBACC, /*  ELIBACC                 */
138     OSAL_LIBBAD, /*  ELIBBAD                 */
139     OSAL_LIBSCN, /*  ELIBSCN                 */
140     OSAL_LIBMAX, /*  ELIBMAX                 */
141     OSAL_LIBEXEC, /*  ELIBEXEC                */
142     OSAL_ILSEQ, /*  EILSEQ                  */
143     OSAL_RESTART, /*  ERESTART                */
144     OSAL_STRPIPE, /*  ESTRPIPE                */
145     OSAL_USERS, /*  EUSERS                  */
146     OSAL_NOTSOCK, /*  ENOTSOCK                */
147     OSAL_DESTADDRREQ, /*  EDESTADDRREQ            */
148     OSAL_MSGSIZE, /*  EMSGSIZE                */
149     OSAL_PROTOTYPE, /*  EPROTOTYPE              */
150     OSAL_NOPROTOOPT, /*  ENOPROTOOPT             */
151     OSAL_PROTONOSUPPORT, /*  EPROTONOSUPPORT         */
152     OSAL_SOCKTNOSUPPORT, /*  ESOCKTNOSUPPORT         */
153     OSAL_OPNOTSUPP, /*  EOPNOTSUPP              */
154     OSAL_PFNOSUPPORT, /*  EPFNOSUPPORT            */
155     OSAL_AFNOSUPPORT, /*  EAFNOSUPPORT            */
156     OSAL_ADDRINUSE, /*  EADDRINUSE              */
157     OSAL_ADDRNOTAVAIL, /*  EADDRNOTAVAIL           */
158     OSAL_NETDOWN, /*  ENETDOWN                */
159     OSAL_NETUNREACH, /*  ENETUNREACH             */
160     OSAL_NETRESET, /*  ENETRESET               */
161     OSAL_CONNABORTED, /*  ECONNABORTED            */
162     OSAL_CONNRESET, /*  ECONNRESET              */
163     OSAL_NOBUFS, /*  ENOBUFS                 */
164     OSAL_ISCONN, /*  EISCONN                 */
165     OSAL_NOTCONN, /*  ENOTCONN                */
166     OSAL_SHUTDOWN, /*  ESHUTDOWN               */
167     OSAL_TOOMANYREFS, /*  ETOOMANYREFS            */
168     OSAL_TIMEDOUT, /*  ETIMEDOUT               */
169     OSAL_CONNREFUSED, /*  ECONNREFUSED            */
170     OSAL_HOSTDOWN, /*  EHOSTDOWN               */
171     OSAL_HOSTUNREACH, /*  EHOSTUNREACH            */
172     OSAL_ALREADY, /*  EALREADY                */
173     OSAL_INPROGRESS, /*  EINPROGRESS             */
174     OSAL_STALE, /*  ESTALE                  */
175     OSAL_UCLEAN, /*  EUCLEAN                 */
176     OSAL_NOTNAM, /*  ENOTNAM                 */
177     OSAL_NAVAIL, /*  ENAVAIL                 */
178     OSAL_ISNAM, /*  EISNAM                  */
179     OSAL_REMOTEIO, /*  EREMOTEIO               */
180     OSAL_DQUOT, /*  EDQUOT                  */
181     OSAL_NOMEDIUM, /*  ENOMEDIUM               */
182     OSAL_MEDIUMTYPE, /*  EMEDIUMTYPE             */
183     OSAL_CANCELED, /*  ECANCELED               */
184     OSAL_NOKEY, /*  ENOKEY                  */
185     OSAL_KEYEXPIRED, /*  EKEYEXPIRED             */
186     OSAL_KEYREVOKED, /*  EKEYREVOKED             */
187     OSAL_KEYREJECTED, /*  EKEYREJECTED            */
188 };
189 
190 /*****************************************************************************/
191 /*                                                                           */
192 /*  Function Name : get_linux_error                                          */
193 /*                                                                           */
194 /*  Description   : This function returns the error code for Redhat Linux    */
195 /*                  platform.                                                */
196 /*                                                                           */
197 /*  Inputs        : None                                                     */
198 /*  Globals       : None                                                     */
199 /*                                                                           */
200 /*  Processing    : Returns OSAL error code if error is a listed OSAL error  */
201 /*                  code. Or else returns platform depedent error code.      */
202 /*                                                                           */
203 /*  Outputs       : Error code                                               */
204 /*                                                                           */
205 /*  Returns       : If error is one of OSAL listed error code - OSAL_<ERROR> */
206 /*                  Else system error code.                                  */
207 /*                                                                           */
208 /*  Issues        : None                                                     */
209 /*                                                                           */
210 /*  Revision History:                                                        */
211 /*                                                                           */
212 /*         DD MM YYYY   Author(s)       Changes (Describe the changes made)  */
213 /*         30 03 2006   Ittiam          Draft                                */
214 /*                                                                           */
215 /*****************************************************************************/
216 
get_linux_error(void)217 UWORD32 get_linux_error(void)
218 {
219     /* Under Linux platform, error codes 0 - 130 are supported */
220     if(130 > errno)
221         return osal_errno[errno];
222 
223     return errno;
224 }
225