iekc64_error.h

来自「一个小的测试程序」· C头文件 代码 · 共 81 行

H
81
字号

#ifndef _IEKC64_ERROR_H_
#define _IEKC64_ERROR_H_

#ifdef __cplusplus
extern "C" {
#endif

/*--------------------------------------------------------------------------*/
/*! Defines the standard IEKLIB status code.<br>
	 Positive or nul values represent a successful call to a API funtion.<br>
	 Negative values represent a failure in the call.<br>
	 Status code should be build in each module include file using the
	 IEKC64_ERR_CODE() macro.<br>
	 Status code returned by API function calls can be tested using the macro
	 IEKC64_SUCCESS() here below.
*/
typedef Int32         IEKC64_STATUS;

/*--------------------------------------------------------------------------*/
/*! Defines the module identifiers for IEKLIB.<br>
    These values are used when defining module's status codes.
*/
enum IEKLIB_MODULE_ID
{
	IEKC64_CLK = 1,
	IEKC64_EPLD,
	IEKC64_FPGA,
	IEKC64_I2C,
	IEKC64_FLASH,
	IEKC64_BT835,
	IEKC64_BT864,
	IEKC64_AIC23,
	IEKC64_LED,
	IEKC64_DMA,
	IEKC64_EPLDDSP,
	IEKC64_EPLDVGA,
	IEKC64_AUD,
	IEKC64_VIDEO,
	IEKC64_INIT,
	IEKC64_INTR,
	IEKC64_PCI,
	IEKC64_PLL,
	IEKC64_EEPROM,
	IEKC64_UART
};

/*--------------------------------------------------------------------------*/
/*! Error code builder.<br>
    This macro is used in module's header files to build an
	 error code. Error codes built using this macro will make
	 IEKC64_SUCCESS() return FALSE.
	 \param module Module identifier, must be one of IEKLIB_MODULE_ID
	 \param code   Error code local to module.
	 \return A negative error code that makes IEKC64_SUCCESS() returning FALSE
*/
#define IEKC64_ERR_CODE(module,code)       (IEKC64_STATUS)(0x80000000 | \
                                    		((module) << 16) | \
                                    		(code))

/*--------------------------------------------------------------------------*/
/*! Status code tester.<br>
    Using this macro to test if an status code represents a success or
	 a failure makes code more readable.
	 \param status A IEKC64_STATUS status returned by an API call.
	 \return TRUE if the status represents a successful call or FALSE if the
				status represents a failure.
*/
#define IEKC64_SUCCESS(status)           (((IEKC64_STATUS)(status)) >= 0)

/*--------------------------------------------------------------------------*/
/*! Default status code for successful function call. */
#define IEKC64_OK                   (0)


#ifdef __cplusplus
}
#endif

#endif /* ifndef _IEK_ERROR_H_ */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?