| USBD ROM Stack 2.0 ROM based USB device stack

error.h
Go to the documentation of this file.
1 /*
2 %
3 % Copyright 2012 NXP Semiconductors,
4 % 411 E Plumeria Dr San Jose CA USA
5 % All rights are reserved. Reproduction in whole or in part is prohibited
6 % without the prior written consent of the copyright owner.
7 %
8 */
9
10 /*
11 +++ IDENTIFICATION
12
13 PACKAGE :
14 COMPONENT :
15 INTERFACE :
16 TEMPLATE VERSION : 3
17 */
18 #ifndef __LPC_ERROR_H__
19 #define __LPC_ERROR_H__
20
38 typedef enum { LPC_OK = 0, ERR_FAILED = -1, ERR_TIME_OUT = -2, ERR_BUSY = -3,
44 /* ISP related errors */
45 ERR_ISP_BASE = 0x00000000,
46 /*0x00000001*/ ERR_ISP_INVALID_COMMAND = ERR_ISP_BASE + 1,
47 /*0x00000002*/ ERR_ISP_SRC_ADDR_ERROR, /* Source address not on word boundary */
48 /*0x00000003*/ ERR_ISP_DST_ADDR_ERROR, /* Destination address not on word or 256 byte boundary */
49 /*0x00000004*/ ERR_ISP_SRC_ADDR_NOT_MAPPED,
50 /*0x00000005*/ ERR_ISP_DST_ADDR_NOT_MAPPED,
51 /*0x00000006*/ ERR_ISP_COUNT_ERROR, /* Byte count is not multiple of 4 or is not a permitted value */
52 /*0x00000007*/ ERR_ISP_INVALID_SECTOR,
53 /*0x00000008*/ ERR_ISP_SECTOR_NOT_BLANK,
54 /*0x00000009*/ ERR_ISP_SECTOR_NOT_PREPARED_FOR_WRITE_OPERATION,
55 /*0x0000000A*/ ERR_ISP_COMPARE_ERROR,
56 /*0x0000000B*/ ERR_ISP_BUSY,/* Flash programming hardware interface is busy */
57 /*0x0000000C*/ ERR_ISP_PARAM_ERROR, /* Insufficient number of parameters */
58 /*0x0000000D*/ ERR_ISP_ADDR_ERROR, /* Address not on word boundary */
59 /*0x0000000E*/ ERR_ISP_ADDR_NOT_MAPPED,
60 /*0x0000000F*/ ERR_ISP_CMD_LOCKED, /* Command is locked */
61 /*0x00000010*/ ERR_ISP_INVALID_CODE,/* Unlock code is invalid */
62 /*0x00000011*/ ERR_ISP_INVALID_BAUD_RATE,
63 /*0x00000012*/ ERR_ISP_INVALID_STOP_BIT,
64 /*0x00000013*/ ERR_ISP_CODE_READ_PROTECTION_ENABLED,
65 /*0x00000014*/ ERR_ISP_INVALID_FLASH_UNIT,
66 /*0x00000015*/ ERR_ISP_USER_CODE_CHECKSUM,
67 /*0x00000016*/ ERR_ISP_SETTING_ACTIVE_PARTITION,
68 /*0x00000017*/ ERR_ISP_IRC_NO_POWER,
69 /*0x00000018*/ ERR_ISP_FLASH_NO_POWER,
70 /*0x00000019*/ ERR_ISP_EEPROM_NO_POWER,
71 /*0x0000001A*/ ERR_ISP_EEPROM_NO_CLOCK,
72 /*0x0000001B*/ ERR_ISP_FLASH_NO_CLOCK,
73 /*0x0000001C*/ ERR_ISP_REINVOKE_ISP_CONFIG,
74 /*0x0000001D*/ ERR_ISP_NO_VALID_IMAGE,
75 /*0x0000001E*/ ERR_ISP_ADDR_NOT_SEQUENTIAL, /* loading not sequential */
76
77 /* ROM API related errors */
78 ERR_API_BASE = 0x00010000, ERR_API_INVALID_PARAMS = ERR_API_BASE + 1, ERR_API_INVALID_PARAM1, ERR_API_INVALID_PARAM2, ERR_API_INVALID_PARAM3, ERR_API_MOD_INIT,
85 /* SPIFI API related errors */
86 ERR_SPIFI_BASE = 0x00020000,
87 /*0x00020001*/ ERR_SPIFI_DEVICE_ERROR = ERR_SPIFI_BASE + 1,
88 /*0x00020002*/ ERR_SPIFI_INTERNAL_ERROR,
89 /*0x00020003*/ ERR_SPIFI_TIMEOUT,
90 /*0x00020004*/ ERR_SPIFI_OPERAND_ERROR,
91 /*0x00020005*/ ERR_SPIFI_STATUS_PROBLEM,
92 /*0x00020006*/ ERR_SPIFI_UNKNOWN_EXT,
93 /*0x00020007*/ ERR_SPIFI_UNKNOWN_ID,
94 /*0x00020008*/ ERR_SPIFI_UNKNOWN_TYPE,
95 /*0x00020009*/ ERR_SPIFI_UNKNOWN_MFG,
96 /*0x0002000A*/ ERR_SPIFI_NO_DEVICE,
97 /*0x0002000B*/ ERR_SPIFI_ERASE_NEEDED,
98
99 SEC_AES_NO_ERROR = 0,
100 /* Security API related errors */
101 ERR_SEC_AES_BASE = 0x00030000,
102 /*0x00030001*/ ERR_SEC_AES_WRONG_CMD = ERR_SEC_AES_BASE + 1,
103 /*0x00030002*/ ERR_SEC_AES_NOT_SUPPORTED,
104 /*0x00030003*/ ERR_SEC_AES_KEY_ALREADY_PROGRAMMED,
105 /*0x00030004*/ ERR_SEC_AES_DMA_CHANNEL_CFG,
106 /*0x00030005*/ ERR_SEC_AES_DMA_MUX_CFG,
107 /*0x00030006*/ SEC_AES_DMA_BUSY,
108 /*0x00030007*/ SEC_AES_BAD_KEYSIZE,
109 /*0x00030008*/ SEC_AES_KEY_NOTVALID,
110
111 /* USB device stack related errors */
112 ERR_USBD_BASE = 0x00040000, ERR_USBD_INVALID_REQ = ERR_USBD_BASE + 1, ERR_USBD_UNHANDLED, ERR_USBD_STALL, ERR_USBD_SEND_ZLP, ERR_USBD_SEND_DATA, ERR_USBD_BAD_DESC, ERR_USBD_BAD_CFG_DESC, ERR_USBD_BAD_INTF_DESC, ERR_USBD_BAD_EP_DESC, ERR_USBD_BAD_MEM_BUF, ERR_USBD_TOO_MANY_CLASS_HDLR,
125 /* CGU related errors */
126 ERR_CGU_BASE = 0x00050000,
127 /*0x00050001*/ ERR_CGU_NOT_IMPL = ERR_CGU_BASE + 1,
128 /*0x00050002*/ ERR_CGU_INVALID_PARAM,
129 /*0x00050003*/ ERR_CGU_INVALID_SLICE,
130 /*0x00050004*/ ERR_CGU_OUTPUT_GEN,
131 /*0x00050005*/ ERR_CGU_DIV_SRC,
132 /*0x00050006*/ ERR_CGU_DIV_VAL,
133 /*0x00050007*/ ERR_CGU_SRC,
134
135 /* I2C related errors */
136 ERR_I2C_BASE = 0x00060000,
137 /*0x00060000*/ ERR_I2C_BUSY = ERR_I2C_BASE,
138 /*0x00060001*/ ERR_I2C_NAK,
139 /*0x00060002*/ ERR_I2C_BUFFER_OVERFLOW,
140 /*0x00060003*/ ERR_I2C_BYTE_COUNT_ERR,
141 /*0x00060004*/ ERR_I2C_LOSS_OF_ARBRITRATION,
142 /*0x00060005*/ ERR_I2C_SLAVE_NOT_ADDRESSED,
143 /*0x00060006*/ ERR_I2C_LOSS_OF_ARBRITRATION_NAK_BIT,
144 /*0x00060007*/ ERR_I2C_GENERAL_FAILURE,
145 /*0x00060008*/ ERR_I2C_REGS_SET_TO_DEFAULT,
146 /*0x00060009*/ ERR_I2C_TIMEOUT,
147 /*0x0006000A*/ ERR_I2C_BUFFER_UNDERFLOW,
148 /*0x0006000B*/ ERR_I2C_PARAM,
149
150 /* OTP related errors */
151 ERR_OTP_BASE = 0x00070000,
152 /*0x00070001*/ ERR_OTP_WR_ENABLE_INVALID = ERR_OTP_BASE + 1,
153 /*0x00070002*/ ERR_OTP_SOME_BITS_ALREADY_PROGRAMMED,
154 /*0x00070003*/ ERR_OTP_ALL_DATA_OR_MASK_ZERO,
155 /*0x00070004*/ ERR_OTP_WRITE_ACCESS_LOCKED,
156 /*0x00070005*/ ERR_OTP_READ_DATA_MISMATCH,
157 /*0x00070006*/ ERR_OTP_USB_ID_ENABLED,
158 /*0x00070007*/ ERR_OTP_ETH_MAC_ENABLED,
159 /*0x00070008*/ ERR_OTP_AES_KEYS_ENABLED,
160 /*0x00070009*/ ERR_OTP_ILLEGAL_BANK,
161 /*0x0007000A*/ ERR_OTP_SHUFFLER_CONFIG_NOT_VALID,
162 /*0x0007000B*/ ERR_OTP_SHUFFLER_NOT_ENABLED,
163 /*0x0007000C*/ ERR_OTP_SHUFFLER_CAN_ONLY_PROG_SINGLE_KEY,
164 /*0x0007000D*/ ERR_OTP_ILLEGAL_PROGRAM_DATA,
165 /*0x0007000E*/ ERR_OTP_READ_ACCESS_LOCKED,
166
167 /* UART related errors */
168 ERR_UART_BASE = 0x00080000,
169 /*0x00080001*/ ERR_UART_RXD_BUSY = ERR_UART_BASE + 1, // UART rxd is busy
170 /*0x00080002*/ ERR_UART_TXD_BUSY, // UART txd is busy
171 /*0x00080003*/ ERR_UART_OVERRUN_FRAME_PARITY_NOISE, // overrun err, frame err, parity err, RxNoise err
172 /*0x00080004*/ ERR_UART_UNDERRUN, // underrun err
173 /*0x00080005*/ ERR_UART_PARAM, // parameter is error
174 /*0x00080006*/ ERR_UART_BAUDRATE, // baudrate setting is error
175
176 /* CAN related errors */
177 ERR_CAN_BASE = 0x00090000,
178 /*0x00090001*/ ERR_CAN_BAD_MEM_BUF = ERR_CAN_BASE + 1,
179 /*0x00090002*/ ERR_CAN_INIT_FAIL,
180 /*0x00090003*/ ERR_CANOPEN_INIT_FAIL,
181
182 /* SPIFI Lite API related errors */
183 ERR_SPIFI_LITE_BASE = 0x000A0000,
184 /*0x000A0001*/ ERR_SPIFI_LITE_INVALID_ARGUMENTS = ERR_SPIFI_LITE_BASE + 1,
185 /*0x000A0002*/ ERR_SPIFI_LITE_BUSY,
186 /*0x000A0003*/ ERR_SPIFI_LITE_MEMORY_MODE_ON,
187 /*0x000A0004*/ ERR_SPIFI_LITE_MEMORY_MODE_OFF,
188 /*0x000A0005*/ ERR_SPIFI_LITE_IN_DMA,
189 /*0x000A0006*/ ERR_SPIFI_LITE_NOT_IN_DMA,
190 /*0x000A0100*/ PENDING_SPIFI_LITE,
191
192 /* CLK related errors */
193 ERR_CLK_BASE = 0x000B0000,
194 /*0x000B0001*/ ERR_CLK_NOT_IMPL = ERR_CLK_BASE + 1,
195 /*0x000B0002*/ ERR_CLK_INVALID_PARAM,
196 /*0x000B0003*/ ERR_CLK_INVALID_SLICE,
197 /*0x000B0004*/ ERR_CLK_OUTPUT_GEN,
198 /*0x000B0005*/ ERR_CLK_DIV_SRC,
199 /*0x000B0006*/ ERR_CLK_DIV_VAL,
200 /*0x000B0007*/ ERR_CLK_SRC,
201 /*0x000B0008*/ ERR_CLK_PLL_FIN_TOO_SMALL,
202 /*0x000B0009*/ ERR_CLK_PLL_FIN_TOO_LARGE,
203 /*0x000B000A*/ ERR_CLK_PLL_FOUT_TOO_SMALL,
204 /*0x000B000B*/ ERR_CLK_PLL_FOUT_TOO_LARGE,
205 /*0x000B000C*/ ERR_CLK_PLL_NO_SOLUTION,
206 /*0x000B000D*/ ERR_CLK_PLL_MIN_PCT,
207 /*0x000B000E*/ ERR_CLK_PLL_MAX_PCT,
208 /*0x000B000F*/ ERR_CLK_OSC_FREQ,
209 /*0x000B0010*/ ERR_CLK_CFG,
210 /*0x000B0011*/ ERR_CLK_TIMEOUT,
211 /*0x000B0012*/ ERR_CLK_BASE_OFF,
212 /*0x000B0013*/ ERR_CLK_OFF_DEADLOCK,
213 /*0x000B0014*/ ERR_CLK_M_OUT_OF_RANGE,
214 /*0x000B0015*/ ERR_CLK_N_OUT_OF_RANGE,
215 /*0x000B0016*/ ERR_CLK_P_OUT_OF_RANGE,
216
217 /*Power API*/
218 ERR_PWR_BASE = 0x000C0000,
219 /*0x000C0001*/ PWR_ERROR_ILLEGAL_MODE = ERR_PWR_BASE + 1,
220 /*0x000C0002*/ PWR_ERROR_CLOCK_FREQ_TOO_HIGH,
221 /*0x000C0003*/ PWR_ERROR_INVALID_STATE,
222 /*0x000C0004*/ PWR_ERROR_INVALID_CFG,
223 /*0x000C0005*/ PWR_ERROR_PVT_OFF_MAX_VOLTAGE,
224
225 /* DMA related errors */
226 ERR_DMA_BASE = 0x000D0000,
227 /*0x000D0001*/ ERR_DMA_ERROR_INT = ERR_DMA_BASE + 1,
228 /*0x000D0002*/ ERR_DMA_CHANNEL_NUMBER,
229 /*0x000D0003*/ ERR_DMA_CHANNEL_DISABLED,
230 /*0x000D0004*/ ERR_DMA_BUSY,
231 /*0x000D0005*/ ERR_DMA_NOT_ALIGNMENT,
232 /*0x000D0006*/ ERR_DMA_PING_PONG_EN,
233 /*0x000D0007*/ ERR_DMA_CHANNEL_VALID_PENDING,
234 /*0x000D0008*/ ERR_DMA_PARAM,
235 /*0x000D0009*/ ERR_DMA_QUEUE_EMPTY,
236 /*0x000D000A*/ ERR_DMA_GENERAL,
237
238 /* SPI related errors */
239 ERR_SPI_BASE = 0x000E0000,
240 /*0x000E0000*/ ERR_SPI_BUSY = ERR_SPI_BASE,
241 /*0x000E0001*/ ERR_SPI_RXOVERRUN,
242 /*0x000E0002*/ ERR_SPI_TXUNDERRUN,
243 /*0x000E0003*/ ERR_SPI_SELNASSERT,
244 /*0x000E0004*/ ERR_SPI_SELNDEASSERT,
245 /*0x000E0005*/ ERR_SPI_CLKSTALL,
246 /*0x000E0006*/ ERR_SPI_PARAM,
247 /*0x000E0007*/ ERR_SPI_INVALID_LENGTH,
248
249 /* ADC related errors */
250 ERR_ADC_BASE = 0x000F0000,
251 /*0x000F0001*/ ERR_ADC_OVERRUN = ERR_ADC_BASE + 1,
252 /*0x000F0002*/ ERR_ADC_INVALID_CHANNEL,
253 /*0x000F0003*/ ERR_ADC_INVALID_SEQUENCE,
254 /*0x000F0004*/ ERR_ADC_INVALID_SETUP,
255 /*0x000F0005*/ ERR_ADC_PARAM,
256 /*0x000F0006*/ ERR_ADC_INVALID_LENGTH,
257 /*0x000F0007*/ ERR_ADC_NO_POWER,
258
259 /* Debugger Mailbox related errors */
260 ERR_DM_BASE = 0x00100000,
261 /*0x00100001*/ ERR_DM_NOT_ENTERED = ERR_DM_BASE + 1,
262 /*0x00100002*/ ERR_DM_UNKNOWN_CMD,
263 /*0x00100003*/ ERR_DM_COMM_FAIL
264
265 } ErrorCode_t;
266
267 #define offsetof(s, m) (int) &(((s *) 0)->m)
268 #define COMPILE_TIME_ASSERT(pred) switch (0) { \
269 case 0: \
270 case pred:; }
271
272 // define common callback function type
273 typedef void (*CALLBK_T)(unsigned int res0, unsigned int res1);
274 #endif /* __LPC_ERROR_H__ */
ErrorCode_t
ErrorCode_t
Definition: error.h:38
ERR_USBD_SEND_DATA
Definition: error.h:117
ERR_USBD_BAD_MEM_BUF
Definition: error.h:122
ERR_USBD_BAD_INTF_DESC
Definition: error.h:120
ERR_USBD_BAD_EP_DESC
Definition: error.h:121
ERR_USBD_BAD_CFG_DESC
Definition: error.h:119
ERR_TIME_OUT
Definition: error.h:41
ERR_API_INVALID_PARAMS
Definition: error.h:79
ERR_USBD_BAD_DESC
Definition: error.h:118
ERR_USBD_UNHANDLED
Definition: error.h:114
ERR_API_INVALID_PARAM2
Definition: error.h:81
ERR_API_MOD_INIT
Definition: error.h:83
ERR_API_INVALID_PARAM3
Definition: error.h:82
ERR_BUSY
Definition: error.h:42
ERR_API_INVALID_PARAM1
Definition: error.h:80
ERR_USBD_STALL
Definition: error.h:115
ERR_USBD_SEND_ZLP
Definition: error.h:116
ERR_USBD_INVALID_REQ
Definition: error.h:113
ERR_USBD_TOO_MANY_CLASS_HDLR
Definition: error.h:123
ERR_FAILED
Definition: error.h:40
LPC_OK
Definition: error.h:39