yb_arm/driver/tfu/stc/inc/ucp_printf.h
2025-05-20 01:20:32 +08:00

79 lines
2.7 KiB
C

// +FHDR------------------------------------------------------------
// Copyright (c) 2022 SmartLogic.
// ALL RIGHTS RESERVED
// -----------------------------------------------------------------
// Filename : ucp_printf.h
// Author : xianfeng.du
// Created On : 2022-06-25
// Last Modified :
// -----------------------------------------------------------------
// Description:
//
//
// -FHDR------------------------------------------------------------
#ifndef __UCP_RINTF_H__
#define __UCP_RINTF_H__
#include <stdio.h>
//#include <stddef.h>
#define PRINT_OFF 0x00000000 // close all PRINT
#define PRINT_ERROR 0x00000001
#define PRINT_WARN 0x00000002
#define PRINT_LOG 0x00000004
#define PRINT_DEBUG 0x00000008
#define PRINT_TICK 0x00000010
#define PRINT_SHELL 0x00000020
//#define UCP_PRINT_LEVEL (PRINT_OFF)
//#define UCP_PRINT_LEVEL (PRINT_ERROR | PRINT_WARN |PRINT_LOG | PRINT_TICK| PRINT_DEBUG|PRINT_SHELL)
#define UCP_PRINT_LEVEL (PRINT_ERROR |PRINT_DEBUG| PRINT_SHELL)
//#define UCP_PRINT_LEVEL (PRINT_ERROR)
#if (UCP_PRINT_LEVEL & PRINT_ERROR)
//#define UCP_PRINT_ERROR(fmt, args...) printf(__FILE__ ": [ERROR]: %d: %s():" fmt "\n", __LINE__, __func__, ##args)
#define UCP_PRINT_ERROR(fmt, args...) printf("[ERROR]:" fmt "\n", ##args)
#else
#define UCP_PRINT_ERROR(fmt, args...)
#endif
#if (UCP_PRINT_LEVEL & PRINT_WARN)
//#define UCP_PRINT_WARN(fmt, args...) printf(__FILE__ ": [WARN]: %d: %s():" fmt "\n", __LINE__, __func__, ##args)
#define UCP_PRINT_WARN(fmt, args...) printf("[WARN]:" fmt "\n", ##args)
#else
#define UCP_PRINT_WARN(fmt, args...)
#endif
#if (UCP_PRINT_LEVEL & PRINT_LOG)
//#define UCP_PRINT_LOG(fmt, args...) printf(__FILE__ ": [LOG]: %d: %s():" fmt "\n", __LINE__, __func__, ##args)
#define UCP_PRINT_LOG(fmt, args...) printf("[LOG]:" fmt "\n", ##args)
#else
#define UCP_PRINT_LOG(fmt, args...)
#endif
#if (UCP_PRINT_LEVEL & PRINT_DEBUG)
//#define UCP_PRINT_LOG(fmt, args...) printf(__FILE__ ": [LOG]: %d: %s():" fmt "\n", __LINE__, __func__, ##args)
#define UCP_PRINT_DEBUG(fmt, args...) printf("[DEBUG]:" fmt "\n", ##args)
#else
#define UCP_PRINT_DEBUG(fmt, args...)
#endif
#if (UCP_PRINT_LEVEL & PRINT_TICK)
//#define UCP_PRINT_TICK(fmt, args...) printf(__FILE__ ": [TICK]: %d: %s():" fmt "\n", __LINE__, __func__, ##args)
#define UCP_PRINT_TICK(fmt, args...) printf("[TICK]:" fmt "\n", ##args)
#else
#define UCP_PRINT_TICK(fmt, args...)
#endif
#if (UCP_PRINT_LEVEL & PRINT_SHELL)
//#define UCP_PRINT_SHELL(fmt, args...) printf(__FILE__ ": [SHELL]: %d: %s():" fmt "\n", __LINE__, __func__, ##args)
#define UCP_PRINT_SHELL(fmt, args...) printf("[SHELL:]" fmt, ##args)
#else
#define UCP_PRINT_SHELL(fmt, args...)
#endif
#endif