Руслан Урядинский / libuavcan

Dependents:   UAVCAN UAVCAN_Subscriber

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers error.h Source File

error.h

00001 /*
00002  * @brief Error code returned by Boot ROM drivers/library functions
00003  *  @ingroup Common
00004  *
00005  *  This file contains unified error codes to be used across driver,
00006  *  middleware, applications, hal and demo software.
00007  *
00008  *
00009  * @note
00010  * Copyright(C) NXP Semiconductors, 2012
00011   * All rights reserved.
00012  *
00013  * @par
00014  * Software that is described herein is for illustrative purposes only
00015  * which provides customers with programming information regarding the
00016  * LPC products.  This software is supplied "AS IS" without any warranties of
00017  * any kind, and NXP Semiconductors and its licensor disclaim any and
00018  * all warranties, express or implied, including all implied warranties of
00019  * merchantability, fitness for a particular purpose and non-infringement of
00020  * intellectual property rights.  NXP Semiconductors assumes no responsibility
00021  * or liability for the use of the software, conveys no license or rights under any
00022  * patent, copyright, mask work right, or any other intellectual property rights in
00023  * or to any products. NXP Semiconductors reserves the right to make changes
00024  * in the software without notification. NXP Semiconductors also makes no
00025  * representation or warranty that such application will be suitable for the
00026  * specified use without further testing or modification.
00027  *
00028  * @par
00029  * Permission to use, copy, modify, and distribute this software and its
00030  * documentation is hereby granted, under NXP Semiconductors' and its
00031  * licensor's relevant copyrights in the software, without fee, provided that it
00032  * is used in conjunction with NXP Semiconductors microcontrollers.  This
00033  * copyright, permission, and disclaimer notice must appear in all copies of
00034  * this code.
00035  */
00036 
00037 #ifndef __LPC_ERROR_H__
00038 #define __LPC_ERROR_H__
00039 
00040 /** Error code returned by Boot ROM drivers/library functions
00041 *
00042 *  Error codes are a 32-bit value with :
00043 *      - The 16 MSB contains the peripheral code number
00044 *      - The 16 LSB contains an error code number associated to that peripheral
00045 *
00046 */
00047 typedef enum
00048 {
00049   /**\b 0x00000000*/ LPC_OK=0, /**< enum value returned on Success */
00050   /**\b 0xFFFFFFFF*/ ERR_FAILED = -1, /**< enum value returned on general failure */
00051   /**\b 0xFFFFFFFE*/ ERR_TIME_OUT = -2, /**< enum value returned on general timeout */
00052   /**\b 0xFFFFFFFD*/ ERR_BUSY = -3, /**< enum value returned when resource is busy */
00053 
00054   /* ISP related errors */
00055   ERR_ISP_BASE = 0x00000000,
00056   /*0x00000001*/ ERR_ISP_INVALID_COMMAND = ERR_ISP_BASE + 1,
00057   /*0x00000002*/ ERR_ISP_SRC_ADDR_ERROR, /* Source address not on word boundary */
00058   /*0x00000003*/ ERR_ISP_DST_ADDR_ERROR, /* Destination address not on word or 256 byte boundary */
00059   /*0x00000004*/ ERR_ISP_SRC_ADDR_NOT_MAPPED,
00060   /*0x00000005*/ ERR_ISP_DST_ADDR_NOT_MAPPED,
00061   /*0x00000006*/ ERR_ISP_COUNT_ERROR, /* Byte count is not multiple of 4 or is not a permitted value */
00062   /*0x00000007*/ ERR_ISP_INVALID_SECTOR,
00063   /*0x00000008*/ ERR_ISP_SECTOR_NOT_BLANK,
00064   /*0x00000009*/ ERR_ISP_SECTOR_NOT_PREPARED_FOR_WRITE_OPERATION,
00065   /*0x0000000A*/ ERR_ISP_COMPARE_ERROR,
00066   /*0x0000000B*/ ERR_ISP_BUSY, /* Flash programming hardware interface is busy */
00067   /*0x0000000C*/ ERR_ISP_PARAM_ERROR, /* Insufficient number of parameters */
00068   /*0x0000000D*/ ERR_ISP_ADDR_ERROR, /* Address not on word boundary */
00069   /*0x0000000E*/ ERR_ISP_ADDR_NOT_MAPPED,
00070   /*0x0000000F*/ ERR_ISP_CMD_LOCKED, /* Command is locked */
00071   /*0x00000010*/ ERR_ISP_INVALID_CODE, /* Unlock code is invalid */
00072   /*0x00000011*/ ERR_ISP_INVALID_BAUD_RATE,
00073   /*0x00000012*/ ERR_ISP_INVALID_STOP_BIT,
00074   /*0x00000013*/ ERR_ISP_CODE_READ_PROTECTION_ENABLED,
00075 
00076   /* ROM API related errors */
00077   ERR_API_BASE = 0x00010000,
00078   /**\b 0x00010001*/ ERR_API_INVALID_PARAMS = ERR_API_BASE + 1, /**< Invalid parameters*/
00079   /**\b 0x00010002*/ ERR_API_INVALID_PARAM1, /**< PARAM1 is invalid */
00080   /**\b 0x00010003*/ ERR_API_INVALID_PARAM2, /**< PARAM2 is invalid */
00081   /**\b 0x00010004*/ ERR_API_INVALID_PARAM3, /**< PARAM3 is invalid */
00082   /**\b 0x00010005*/ ERR_API_MOD_INIT, /**< API is called before module init */
00083 
00084   /* SPIFI API related errors */
00085   ERR_SPIFI_BASE = 0x00020000,
00086   /*0x00020001*/ ERR_SPIFI_DEVICE_ERROR =ERR_SPIFI_BASE+1,
00087   /*0x00020002*/ ERR_SPIFI_INTERNAL_ERROR,
00088   /*0x00020003*/ ERR_SPIFI_TIMEOUT,
00089   /*0x00020004*/ ERR_SPIFI_OPERAND_ERROR,
00090   /*0x00020005*/ ERR_SPIFI_STATUS_PROBLEM,
00091   /*0x00020006*/ ERR_SPIFI_UNKNOWN_EXT,
00092   /*0x00020007*/ ERR_SPIFI_UNKNOWN_ID,
00093   /*0x00020008*/ ERR_SPIFI_UNKNOWN_TYPE,
00094   /*0x00020009*/ ERR_SPIFI_UNKNOWN_MFG,
00095 
00096   /* Security API related errors */
00097   ERR_SEC_BASE = 0x00030000,
00098   /*0x00030001*/    ERR_SEC_AES_WRONG_CMD=ERR_SEC_BASE+1,
00099   /*0x00030002*/    ERR_SEC_AES_NOT_SUPPORTED,
00100   /*0x00030003*/    ERR_SEC_AES_KEY_ALREADY_PROGRAMMED,
00101 
00102 
00103   /* USB device stack related errors */
00104   ERR_USBD_BASE = 0x00040000,
00105   /**\b 0x00040001*/ ERR_USBD_INVALID_REQ = ERR_USBD_BASE + 1, /**< invalid request */
00106   /**\b 0x00040002*/ ERR_USBD_UNHANDLED, /**< Callback did not process the event */
00107   /**\b 0x00040003*/ ERR_USBD_STALL,     /**< Stall the endpoint on which the call back is called */
00108   /**\b 0x00040004*/ ERR_USBD_SEND_ZLP,  /**< Send ZLP packet on the endpoint on which the call back is called */
00109   /**\b 0x00040005*/ ERR_USBD_SEND_DATA, /**< Send data packet on the endpoint on which the call back is called */
00110   /**\b 0x00040006*/ ERR_USBD_BAD_DESC,  /**< Bad descriptor*/
00111   /**\b 0x00040007*/ ERR_USBD_BAD_CFG_DESC,/**< Bad config descriptor*/
00112   /**\b 0x00040008*/ ERR_USBD_BAD_INTF_DESC,/**< Bad interface descriptor*/
00113   /**\b 0x00040009*/ ERR_USBD_BAD_EP_DESC,/**< Bad endpoint descriptor*/
00114   /**\b 0x0004000a*/ ERR_USBD_BAD_MEM_BUF, /**< Bad alignment of buffer passed. */
00115   /**\b 0x0004000b*/ ERR_USBD_TOO_MANY_CLASS_HDLR, /**< Too many class handlers. */
00116 
00117   /* CGU  related errors */
00118   ERR_CGU_BASE = 0x00050000,
00119   /*0x00050001*/ ERR_CGU_NOT_IMPL=ERR_CGU_BASE+1,
00120   /*0x00050002*/ ERR_CGU_INVALID_PARAM,
00121   /*0x00050003*/ ERR_CGU_INVALID_SLICE,
00122   /*0x00050004*/ ERR_CGU_OUTPUT_GEN,
00123   /*0x00050005*/ ERR_CGU_DIV_SRC,
00124   /*0x00050006*/ ERR_CGU_DIV_VAL,
00125   /*0x00050007*/ ERR_CGU_SRC
00126 
00127 } ErrorCode_t;
00128 
00129 
00130 
00131 //#define offsetof(s,m)   (int)&(((s *)0)->m)
00132 #define COMPILE_TIME_ASSERT(pred)    switch(0){case 0:case pred:;}
00133 
00134 #endif /* __LPC_ERROR_H__ */