You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.5 KiB
53 lines
1.5 KiB
/*
|
|
* Copyright (c) Hisilicon Technologies Co., Ltd. 2014-2020. All rights reserved.
|
|
* Description: debug.h
|
|
* Author: SmartMedia_BSP
|
|
* Create: 2014-06-04
|
|
*/
|
|
|
|
#ifndef DEBUGH
|
|
#define DEBUGH
|
|
|
|
#include <platform.h>
|
|
#include <stdio.h>
|
|
#include <boot.h>
|
|
|
|
#define ASSERT assert
|
|
#define ASSERT1 assert1
|
|
|
|
#ifdef CONFIG_DEBUG
|
|
# include <trace.h>
|
|
# define assert(_p) if (!(_p)) { \
|
|
printf("%s(%s,%d):assert:(%s)\n", __FILE__, __FUNCTION__, __LINE__, #_p); \
|
|
dump_stack();}
|
|
# define assert1(_p, _fmt, args...) if (!(_p)) { \
|
|
printf("%s(%s,%d):assert:(%s)\n" _fmt, __FILE__, __FUNCTION__, __LINE__, #_p, ##args); \
|
|
dump_stack();}
|
|
#else
|
|
# define assert(_p) ((void)0)
|
|
# define assert1(_p, _fmt, args...) ((void)0)
|
|
#endif
|
|
|
|
#ifdef MODULE_DEBUG
|
|
# define dbgout(_fmt, args...) printf(_fmt, ##args)
|
|
# define fdbgout(_fmt, args...) \
|
|
printf(_YELLOW "%s(%d): " _fmt _NONE, __FILE__, __LINE__, ##args)
|
|
#else
|
|
# define dbgout(_fmt, args...)
|
|
# define fdbgout(_fmt, args...)
|
|
#endif
|
|
|
|
#ifndef MOULE_NAME
|
|
# define __module_name(_x) _x
|
|
# define MOULE_NAME __module_name(__FILE__)": "
|
|
#endif /* MOULE_NAME */
|
|
|
|
#define pr_error(_fmt, args...) printf(MOULE_NAME "*** " _fmt, ##args)
|
|
#define pr_warn(_fmt, args...) printf(MOULE_NAME "!!! " _fmt, ##args)
|
|
#define pr_info(_fmt, args...) printf(MOULE_NAME _fmt, ##args)
|
|
#define pr_debug(_fmt, args...) printf(MOULE_NAME "debug! " _fmt, ##args)
|
|
|
|
int dump_hex(uint32 addr, char *buf, uint32 sz_buf, uint32 width);
|
|
|
|
#endif /* DEBUGH */
|