• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2012-2019 NXP
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 /*
18  * UWB Status Values - Function Return Codes
19  */
20 
21 #ifndef PHUWBSTATUS_H
22 #define PHUWBSTATUS_H
23 
24 #include <phUwbTypes.h>
25 #include <uci_defs.h>
26 
27 /* Internally required by PHUWBSTVAL. */
28 #define PHUWBSTSHL8 (8U)
29 /* Required by PHUWBSTVAL. */
30 #define PHUWBSTBLOWER ((tHAL_UWB_STATUS)(0x00FFU))
31 
32 /*
33  *  UWB Status Composition Macro
34  *
35  *  This is the macro which must be used to compose status values.
36  *
37  *  phUwbCompID Component ID, as defined in phUwbCompId.h .
38  *  phUwbStatus Status values, as defined in phUwbStatus.h .
39  *
40  *  The macro is not required for the UWBSTATUS_SUCCESS value.
41  *  This is the only return value to be used directly.
42  *  For all other values it shall be used in assignment and conditional
43  * statements, e.g.:
44  *     tHAL_UWB_STATUS status = PHUWBSTVAL(phUwbCompID, phUwbStatus); ...
45  *     if (status == PHUWBSTVAL(phUwbCompID, phUwbStatus)) ...
46  */
47 #define PHUWBSTVAL(phUwbCompID, phUwbStatus)               \
48   (((phUwbStatus) == (UWBSTATUS_SUCCESS))                  \
49        ? (UWBSTATUS_SUCCESS)                               \
50        : ((((tHAL_UWB_STATUS)(phUwbStatus)) & (PHUWBSTBLOWER)) | \
51           (((uint16_t)(phUwbCompID)) << (PHUWBSTSHL8))))
52 
53 /*
54  * PHUWBSTATUS
55  * Get grp_retval from Status Code
56  */
57 #define PHUWBSTATUS(phUwbStatus) ((phUwbStatus)&0x00FFU)
58 #define PHUWBCID(phUwbStatus) (((phUwbStatus)&0xFF00U) >> 8)
59 
60 /*
61  *  Status Codes
62  *
63  *  Generic Status codes for the UWB components. Combined with the Component ID
64  *  they build the value (status) returned by each function.
65  *  Example:
66  *      grp_comp_id "Component ID" -  e.g. 0x10, plus
67  *      status code as listed in this file - e.g. 0x03
68  *      result in a status value of 0x0003.
69  */
70 
71 /*
72  * The function indicates successful completion
73  */
74 #define UWBSTATUS_SUCCESS UCI_STATUS_OK
75 
76 /*
77  *  The function indicates successful completion
78  */
79 #define UWBSTATUS_OK (UCI_STATUS_OK)
80 
81 
82 /*
83  * Device specifier/handle value is invalid for the operation
84  */
85 #define UWBSTATUS_INVALID_DEVICE (0x0001)
86 
87 /*
88  * A non-blocking function returns this immediately to indicate
89  * that an internal operation is in progress
90  */
91 #define UWBSTATUS_PENDING (0x0002)
92 
93 /*
94  * A board communication error occurred
95  * (e.g. Configuration went wrong)
96  */
97 #define UWBSTATUS_BOARD_COMMUNICATION_ERROR (0x0003)
98 
99 /*
100  * At least one parameter could not be properly interpreted
101  */
102 #define UWBSTATUS_INVALID_PARAMETER (UCI_STATUS_INVALID_PARAM)
103 
104 /*
105  * Not enough resources Memory, Timer etc(e.g. allocation failed.)
106  */
107 #define UWBSTATUS_INSUFFICIENT_RESOURCES (0x0005)
108 
109 /*
110  * Invalid State of the particular state machine
111  */
112 #define UWBSTATUS_INVALID_STATE (0x0006)
113 
114 /*
115  * This Layer is Not initialized, hence initialization required.
116  */
117 #define UWBSTATUS_NOT_INITIALISED (0x0007)
118 
119 /*
120  * The Layer is already initialized, hence initialization repeated.
121  */
122 #define UWBSTATUS_ALREADY_INITIALISED (0x0008)
123 
124 /*
125  * The operation is currently not possible or not allowed
126  */
127 #define UWBSTATUS_NOT_ALLOWED (0x0009)
128 
129 /*
130  * FW version error while performing FW download,
131  * FW major version mismatch (cannot downgrade FW major version) or FW version
132  * already upto date
133  * User may be trying to flash Mobile FW on top of Infra FW, which is not
134  * allowed
135  * Download appropriate version of FW
136  */
137 #define UWBSTATUS_FW_VERSION_ERROR (0x000A)
138 
139 /*
140  *  The system is busy with the previous operation.
141  */
142 #define UWBSTATUS_BUSY (0x000B)
143 
144 /* NDEF Mapping error codes */
145 
146 /* Read operation failed */
147 #define UWBSTATUS_READ_FAILED (0x000C)
148 
149 /*
150  * Write operation failed
151  */
152 #define UWBSTATUS_WRITE_FAILED (0x000D)
153 
154 /*
155  * Response Time out for the control message(UWBC not responded)
156  */
157 #define UWBSTATUS_RESPONSE_TIMEOUT (0x000E)
158 
159 /*
160  * The function/command has been aborted
161  */
162 #define UWBSTATUS_CMD_ABORTED (0x000F)
163 
164 /*
165  * Shutdown in progress, cannot handle the request at this time.
166  */
167 #define UWBSTATUS_SHUTDOWN (0x0010)
168 
169 /*
170  * Invalid handle for the operation
171  */
172 #define UWBSTATUS_INVALID_HANDLE (0x0011)
173 
174 /*
175  * Requested command is not supported
176  */
177 #define UWBSTATUS_COMMAND_NOT_SUPPORTED (0x0012)
178 
179 /*
180  * Requested Retransmit command
181  */
182 #define UWBSTATUS_COMMAND_RETRANSMIT (0x0013)
183 
184 /*
185  * File Not Found error
186  */
187 #define UWBSTATUS_FILE_NOT_FOUND (0x0014)
188 
189 /*
190  * Invalid Command Length
191  */
192 #define UWBSTATUS_INVALID_COMMAND_LENGTH (0x0015)
193 
194 /*
195  * Status code for failure
196  */
197 #define UWBSTATUS_FAILED (0x00FF)
198 
199 #endif /* PHUWBSTATUS_H */
200