DM USB: enable log level feature for USB subsystem

Change the DPRINTF macro to UPRINTF for USB subsystem. The
UPRINTF will print log according to certain log level.

Change-Id: I5db8813357c9f684c25f23650e7c914f9063f842
Signed-off-by: Wu, Xiaoguang <xiaoguang.wu@intel.com>
Reviewed-by: Shuo Liu <shuo.a.liu@intel.com>
Reviewed-by: Yu Wang <yu1.wang@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Wu, Xiaoguang
2018-04-13 22:07:03 +08:00
committed by lijinxia
parent 3b616010e0
commit 8f3f66bae5
4 changed files with 256 additions and 244 deletions

View File

@@ -141,6 +141,18 @@ enum USB_ERRCODE {
#define USB_DATA_XFER_UNLOCK(x) \
pthread_mutex_unlock(&((x)->mtx))
#define LOG_TAG "USB: "
#define LFTL 0
#define LWRN 1
#define LINF 2
#define LDBG 3
#define LVRB 4
#define UPRINTF(lvl, fmt, args...) \
do { if (lvl <= usb_log_level) printf(LOG_TAG fmt, ##args); } while (0)
extern int usb_log_level;
inline int usb_get_log_level(void) { return usb_log_level; }
inline void usb_set_log_level(int level) { usb_log_level = level; }
struct usb_devemu *usb_emu_finddev(char *name);
struct usb_data_xfer_block *usb_data_xfer_append(struct usb_data_xfer *xfer,