1 /*
2  *  Copyright 2008-2024 NXP
3  *
4  *  SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 
8 /*! \file wmerrno.h
9  *  \brief Error Management
10  */
11 #ifndef WM_ERRNO_H
12 #define WM_ERRNO_H
13 
14 #include <wifi_config_default.h>
15 
16 /* Get the module index number from error code (4th byte from LSB)*/
17 #define get_module_base(code) ((code & 0xF000) >> 12)
18 
19 /* Get notifier message type i.e Error, Warning or Info (3rd byte from LSB)*/
20 #define get_notifier_msg_type(code) ((code & 0x0F00) >> 8)
21 
22 /* Get module notifier code (2nd and 1st byte from LSB)*/
23 #define get_code(code) (code & 0xFF)
24 
25 #define MOD_ERROR_START(x) ((x) << 12 | 0)
26 #define MOD_WARN_START(x)  ((x) << 12 | 1)
27 #define MOD_INFO_START(x)  ((x) << 12 | 2)
28 
29 /* Create Module index */
30 #define MOD_GENERIC 0
31 /** Unused */
32 #define MOD_UNUSED_3 2
33 /** HTTPD module index */
34 #define MOD_HTTPD 3
35 /** Application framework module index */
36 #define MOD_AF 4
37 /** FTFS module index */
38 #define MOD_FTFS 5
39 /** RFGET module index */
40 #define MOD_RFGET 6
41 /** JSON module index  */
42 #define MOD_JSON 7
43 /** TELNETD module index */
44 #define MOD_TELNETD 8
45 /** SIMPLE MDNS module index */
46 #define MOD_SMDNS 9
47 /** EXML module index */
48 #define MOD_EXML 10
49 /** DHCPD module index */
50 #define MOD_DHCPD 11
51 /** MDNS module index */
52 #define MOD_MDNS 12
53 /** SYSINFO module index */
54 #define MOD_SYSINFO 13
55 /** Unused module index */
56 #define MOD_UNUSED_1 14
57 /** CRYPTO module index */
58 #define MOD_CRYPTO 15
59 /** HTTP-CLIENT module index */
60 #define MOD_HTTPC 16
61 /** PROVISIONING module index */
62 #define MOD_PROV 17
63 /** SPI module index */
64 #define MOD_SPI 18
65 /** PSM module index */
66 #define MOD_PSM 19
67 /** TTCP module index */
68 #define MOD_TTCP 20
69 /** DIAGNOSTICS module index */
70 #define MOD_DIAG 21
71 /** Unused module index */
72 #define MOD_UNUSED_2 22
73 /** WPS module index */
74 #define MOD_WPS 23
75 /** WLAN module index */
76 #define MOD_WLAN 24
77 /** USB module index */
78 #define MOD_USB 25
79 /** WIFI driver module index */
80 #define MOD_WIFI 26
81 /** Critical error module index */
82 #define MOD_CRIT_ERR 27
83 /** Last module index .Applications can define their own modules beyond this */
84 #define MOD_ERR_LAST 50
85 
86 /* Globally unique success code */
87 #define WM_SUCCESS 0
88 
89 /* First Generic Error codes */
90 #define WM_GEN_E_BASE MOD_ERROR_START(MOD_GENERIC)
91 #define WM_FAIL       1
92 #define WM_E_PERM     2  /*Operation not permitted */
93 #define WM_E_NOENT    3  /*No such file or directory */
94 #define WM_E_SRCH     4  /*No such process */
95 #define WM_E_INTR     5  /*Interrupted system call */
96 #define WM_E_IO       6  /*I/O error */
97 #define WM_E_NXIO     7  /*No such device or address */
98 #define WM_E_2BIG     8  /*Argument list too long */
99 #define WM_E_NOEXEC   9  /*Exec format error */
100 #define WM_E_BADF     10 /* Bad file number */
101 #define WM_E_CHILD    11 /* No child processes */
102 #define WM_E_AGAIN    12 /* Try again */
103 #define WM_E_NOMEM    13 /* Out of memory */
104 #define WM_E_ACCES    14 /* Permission denied */
105 #define WM_E_FAULT    15 /* Bad address */
106 #define WM_E_NOTBLK   16 /* Block device required */
107 #define WM_E_BUSY     17 /* Device or resource busy */
108 #define WM_E_EXIST    18 /* File exists */
109 #define WM_E_XDEV     19 /* Cross-device link */
110 #define WM_E_NODEV    20 /* No such device */
111 #define WM_E_NOTDIR   21 /* Not a directory */
112 #define WM_E_ISDIR    22 /* Is a directory */
113 #define WM_E_INVAL    23 /* Invalid argument */
114 #define WM_E_NFILE    24 /* File table overflow */
115 #define WM_E_MFILE    25 /* Too many open files */
116 #define WM_E_NOTTY    26 /* Not a typewriter */
117 #define WM_E_TXTBSY   27 /* Text file busy */
118 #define WM_E_FBIG     28 /* File too large */
119 #define WM_E_NOSPC    29 /* No space left on device */
120 #define WM_E_SPIPE    30 /* Illegal seek */
121 #define WM_E_ROFS     31 /* Read-only file system */
122 #define WM_E_MLINK    32 /* Too many links */
123 #define WM_E_PIPE     33 /* Broken pipe */
124 #define WM_E_DOM      34 /* Math argument out of domain of func */
125 #define WM_E_RANGE    35 /* Math result not representable */
126 
127 /* WMSDK generic error codes */
128 #define WM_E_CRC     36 /* Error in CRC check */
129 #define WM_E_UNINIT  37 /* Module is not yet initialized */
130 #define WM_E_TIMEOUT 38 /* Timeout occurred during operation */
131 
132 /* Defined for Hostcmd specific API*/
133 #define WM_E_INBIG 39 /* Input buffer too big */
134 #define WM_E_INSMALL                                                                                         \
135     40 /* A finer version for WM_E_INVAL, where it clearly specifies that input is much smaller than minimum \
136           requirement */
137 #define WM_E_OUTBIG 41 /* Data output exceeds the size provided */
138 
139 #endif                 /* ! WM_ERRNO_H */
140