131 lines
5.7 KiB
C
131 lines
5.7 KiB
C
/** ##########################################################################
|
|
** Filename : error.h
|
|
** Project :
|
|
** Module :
|
|
** Processor :
|
|
** Version : V1.0
|
|
** Compiler :
|
|
** Date/Time :
|
|
** Abstract :
|
|
** Contents : 错误机制的提示
|
|
** Note :
|
|
**
|
|
** (c) Copyright dmdz Co.,Ltd
|
|
** --------------------------------------------------------------------------
|
|
** R E V I S I O N H I S T O R Y
|
|
** --------------------------------------------------------------------------
|
|
** Date Ver Author Description
|
|
|
|
** -20140313- --V0.0-- --mingyea--- --初版--
|
|
** -20230602- --V1.0-- --mingyea--- --增加err_flag_e 负数定义宏--
|
|
|
|
** #########################################################################*/
|
|
#ifndef ERROR__H
|
|
#define ERROR__H
|
|
|
|
/*---------------------------------------------------------------------------
|
|
- I N C L U D E F I L E S
|
|
----------------------------------------------------------------------------*/
|
|
|
|
/*---------------------------------------------------------------------------
|
|
- D E F I N E S / M A C R O S
|
|
----------------------------------------------------------------------------*/
|
|
//#define ERROR_NEGATIVE
|
|
|
|
#ifdef ERROR_NEGATIVE
|
|
typedef signed short err_flag_e;
|
|
|
|
#define ERR_OK 0 /* OK */
|
|
#define ERR_SPEED (-1) /* This device does not work in the active speed mode. */
|
|
#define ERR_RANGE (-2) /* Parameter out of range. */
|
|
#define ERR_VALUE (-3) /* Parameter of incorrect value. */
|
|
#define ERR_OVERFLOW (-4) /* Timer overflow. */
|
|
#define ERR_MATH (-5) /* Overflow during evaluation. */
|
|
#define ERR_ENABLED (-6) /* Device is enabled. */
|
|
#define ERR_DISABLED (-7) /* Device is disabled. */
|
|
#define ERR_BUSY (-8) /* Device is busy. */
|
|
#define ERR_ID_NOEXIST (-9) /* ID not exist . */
|
|
#define ERR_ID_INVALID (-10) /* ID is invalid . */
|
|
#define ERR_NOTAVAIL (-11) /* Requested value or method not available. */
|
|
#define ERR_RXEMPTY (-12) /* No data in receiver. */
|
|
#define ERR_TXFULL (-13) /* Transmitter is full. */
|
|
#define ERR_BUSOFF (-14) /* Bus not available. */
|
|
#define ERR_OVERRUN (-15) /* Overrun error is detected. */
|
|
#define ERR_FRAMING (-16) /* Framing error is detected. */
|
|
#define ERR_PARITY (-17) /* Parity error is detected. */
|
|
#define ERR_NOISE (-18) /* Noise error is detected. */
|
|
#define ERR_IDLE (-19) /* Idle error is detected. */
|
|
#define ERR_FAULT (-20) /* Fault error is detected. */
|
|
#define ERR_BREAK (-21) /* Break char is received during communication. */
|
|
#define ERR_CRC (-22) /* CRC error is detected. */
|
|
#define ERR_ARBITR (-23) /* A node losts arbitration. This error occurs if two nodes start transmission at the same time. */
|
|
#define ERR_PROTECT (-24) /* Protection error is detected. */
|
|
#define ERR_UNDERFLOW (-25) /* Underflow error is detected. */
|
|
#define ERR_UNDERRUN (-26) /* Underrun error is detected. */
|
|
#define ERR_COMMON (-27) /* Common error of a device. */
|
|
#define ERR_LINSYNC (-28) /* LIN synchronization error is detected. */
|
|
#define ERR_FAILED (-29) /* Requested functionality or process failed. */
|
|
|
|
#else
|
|
/*总的错误提示 */
|
|
typedef enum
|
|
{
|
|
ERR_OK= 0, /* OK */
|
|
ERR_SPEED, /* This device does not work in the active speed mode. */
|
|
ERR_RANGE, /* Parameter out of range. */
|
|
ERR_VALUE, /* Parameter of incorrect value. */
|
|
ERR_OVERFLOW , /* Timer overflow. */
|
|
ERR_MATH , /* Overflow during evaluation. */
|
|
ERR_ENABLED , /* Device is enabled. */
|
|
ERR_DISABLED , /* Device is disabled. */
|
|
ERR_BUSY , /* Device is busy. */
|
|
ERR_ID_NOEXIST, /* ID not exist . */
|
|
ERR_ID_INVALID, /* ID is invalid . */
|
|
ERR_NOTAVAIL, /* Requested value or method not available. */
|
|
ERR_RXEMPTY , /* No data in receiver. */
|
|
ERR_TXFULL , /* Transmitter is full. */
|
|
ERR_BUSOFF , /* Bus not available. */
|
|
ERR_OVERRUN , /* Overrun error is detected. */
|
|
ERR_FRAMING , /* Framing error is detected. */
|
|
ERR_PARITY , /* Parity error is detected. */
|
|
ERR_NOISE , /* Noise error is detected. */
|
|
ERR_IDLE , /* Idle error is detected. */
|
|
ERR_FAULT , /* Fault error is detected. */
|
|
ERR_BREAK , /* Break char is received during communication. */
|
|
ERR_CRC , /* CRC error is detected. */
|
|
ERR_ARBITR , /* A node losts arbitration. This error occurs if two nodes start transmission at the same time. */
|
|
ERR_PROTECT, /* Protection error is detected. */
|
|
ERR_UNDERFLOW ,/* Underflow error is detected. */
|
|
ERR_UNDERRUN ,/* Underrun error is detected. */
|
|
ERR_COMMON ,/* Common error of a device. */
|
|
ERR_LINSYNC ,/* LIN synchronization error is detected. */
|
|
ERR_FAILED ,/* Requested functionality or process failed. */
|
|
ERR_QFULL /* Queue is full. */
|
|
}err_flag_e;
|
|
|
|
#endif
|
|
|
|
/*---------------------------------------------------------------------------
|
|
- T Y P E D E F I N I T I O N S
|
|
----------------------------------------------------------------------------*/
|
|
|
|
/*---------------------------------------------------------------------------
|
|
- G L O B A L V A R I A B L E S
|
|
- only configuration table allowed here,variables are not allowed!
|
|
----------------------------------------------------------------------------*/
|
|
|
|
/*---------------------------------------------------------------------------
|
|
- C O N S T A N T S
|
|
----------------------------------------------------------------------------*/
|
|
|
|
/*---------------------------------------------------------------------------
|
|
- F U N C T I O N P R O T O T Y P E
|
|
----------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
#endif /* ERROR__H */
|
|
|
|
/* [] END OF FILE */
|
|
|