📄 printf.h
字号:
/****************************************************************************
*
* ALi
* All Rights Reserved. 2003 Copyright (C)
* File: printf.h
*
* Description: This file contains all functions definition
* of LIBC printf.
*
* History:
* Date Author Version Comment
* ==== ====== ======= =======
* 2003.12.05 Ver 0.2 Support wDVD Standard TDS
* Common Service:
*.ERRMSG & DEBUGPRINTF
*.ASSERTMSG & ASSERT_ADDR
****************************************************************************/
#ifndef _LIB_C_PRINTF_H
#define _LIB_C_PRINTF_H
#include <sys_config.h>
#include <osal/osal.h>
#include <hal/machine.h>
void soc_printf(const char *fmt, ...);
void libc_printf(const char *fmt, ...);
#define FIXED_PRINTF libc_printf
#define ERRMSG DEBUGPRINTF
#ifdef _DEBUG_VERSION_
#ifdef _DEBUG_PRINTF_
#define PRINTF libc_printf
#define DEBUGPRINTF libc_printf
#else
#define PRINTF(...) do{}while(0)
#define DEBUGPRINTF(...) do{}while(0)
#endif /* _DEBUG_PRINTF_ */
#else /* _DEBUG_VERSION_ */
//extern PRINTF(const char *fmt, ...); /* This is for Able project only */
#ifdef _DEBUG_PRINTF_
#define PRINTF libc_printf
#define DEBUGPRINTF libc_printf
#else
#define PRINTF(...) do{}while(0)
#define DEBUGPRINTF(...) do{}while(0)
#endif /* _DEBUG_PRINTF_ */
#define ENTER_FUNCTION DEBUGPRINTF("Function %s: Begin.\n",__FUNCTION__)
#define LEAVE_FUNCTION DEBUGPRINTF("Function %s: End From %d line. \n", __FUNCTION__, __LINE__)
#endif /* _DEBUG_VERSION_ */
#ifdef ASSERT
#undef ASSERT
#endif
#ifdef _DEBUG_PRINTF_
#define ASSERT(expression) \
{ \
if (!(expression)) \
{ \
DEBUGPRINTF("assertion(%s) failed: file \"%s\", line %d\n", \
#expression, __FILE__, __LINE__); \
SDBBP(); \
} \
}
#define ASSERTMSG(expression, message) \
{ \
if (!(expression)) \
{ \
DEBUGPRINTF("assertion(%s) failed: file \"%s\", line %d, message %s\n", \
#expression, __FILE__, __LINE__, #message); \
SDBBP(); \
} \
}
#define ASSERT_ADDR(address) \
{ \
if((UINT32)(address)<0x010||((UINT32)(address)>=0x0180&&(UINT32)(address)<0x01a0)) \
{ \
DEBUGPRINTF("assertion address failed: [%s]=[0x%08x] in file \"%s\", line %d\n", \
#address,(address),__FILE__, __LINE__); \
SDBBP(); \
} \
}
#else
#define ASSERT(expression) \
{ \
if (!(expression)) \
{ \
sys_watchdog_reboot(); \
} \
}
#define ASSERTMSG(expression, message) \
{ \
if (!(expression)) \
{ \
sys_watchdog_reboot(); \
} \
}
#define ASSERT_ADDR(address) \
{ \
if((UINT32)(address)<0x010||((UINT32)(address)>=0x0180&&(UINT32)(address)<0x01a0)) \
{ \
sys_watchdog_reboot(); \
} \
}
#endif
#endif /* _LIB_C_PRINTF_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -