WS63 SDK 文档 7021f4f@fbb_ws63
ws63 和 ws63e 解决方案的 SDK 文档
载入中...
搜索中...
未找到
hcc_comm.h
浏览该文件的文档.
1/*
2 * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2021-2023. All rights reserved.
3 * Description: hcc commom types.
4 */
5
6#ifndef HCC_COMMON_TYPE_H
7#define HCC_COMMON_TYPE_H
8
9#include "td_type.h"
10#if defined(HSO_SUPPORT)
11#include "log_def.h"
12#include "log_module_id.h"
13#endif
14
15#if !(defined(_PRE_OS_VERSION_LINUX) && defined(_PRE_OS_VERSION) && (_PRE_OS_VERSION_LINUX == _PRE_OS_VERSION))
16#if defined(HSO_SUPPORT)
17#if defined(CONFIG_HCC_SUPPORT_NON_OS)
18#include "log_oam_logger.h"
19#else
20#include "soc_diag_util.h"
21#endif
22#endif
23#include "debug_print.h"
24#endif
25
26/* HCC 打印接口 */
27#ifdef CONFIG_HCC_DEBUG_PRINT
28#if defined(_PRE_OS_VERSION_LINUX) && defined(_PRE_OS_VERSION) && (_PRE_OS_VERSION_LINUX == _PRE_OS_VERSION)
29#define hcc_printf(fmt, arg...) printk("[HCC] "fmt, ##arg)
30#elif defined(CONFIG_HCC_SUPPORT_NON_OS)
31#define hcc_printf(fmt, arg...) print_str("[HCC] "fmt, ##arg)
32#else
33#define hcc_printf(fmt, arg...) PRINT("[HCC] "fmt, ##arg)
34#endif
35
36#else
37#define hcc_printf(fmt, arg...)
38#endif /* CONFIG_HCC_DEBUG_PRINT */
39
40#if defined(_PRE_OS_VERSION_LINUX) && defined(_PRE_OS_VERSION) && (_PRE_OS_VERSION_LINUX == _PRE_OS_VERSION)
41#define hcc_debug(fmt, arg...) printk("[HCC] "fmt, ##arg)
42#define hcc_printf_err_log(fmt, arg...) printk("[HCC] [ERROR] "fmt, ##arg)
43#define hcc_dfx_print(fmt, arg...) printk("[HCC] [DFX] "fmt, ##arg)
44#elif defined(CONFIG_HCC_SUPPORT_NON_OS)
45#define hcc_debug(fmt, arg...) print_str("[HCC] " fmt, ##arg)
46#if defined(HSO_SUPPORT)
47#define var_args_max_12(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, ...) a12
48#define var_args_cnt(unused, args...) var_args_max_12(unused, ##args, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)
49#define hcc_printf_err_log(fmt, arg...) pf_log_alter(0, 0, 0, fmt, var_args_cnt(unused, ##arg), ##arg)
50#else
51#define hcc_printf_err_log(fmt, arg...) print_str("[HCC] [ERROR] "fmt, ##arg)
52#endif
53#define hcc_dfx_print(fmt, arg...) print_str("[HCC] " fmt, ##arg)
54
55#else
56#define hcc_debug(fmt, arg...) PRINT(fmt, ##arg)
57#if defined(HSO_SUPPORT)
58#define hcc_printf_err_log(fmt, arg...) uapi_diag_error_log(0, fmt, ##arg)
59#else
60#define hcc_printf_err_log(fmt, arg...) PRINT("[HCC] [ERROR] "fmt, ##arg)
61#endif
62
63#define hcc_dfx_print(fmt, arg...) PRINT(fmt, ##arg)
64#endif
65
66#ifdef HCC_PRINT_PERFORM
67#include "tcxo.h"
68static inline td_u64 hcc_test_get_us(td_void)
69{
70 return uapi_tcxo_get_us();
71}
72#else
73static inline td_u64 hcc_test_get_us(td_void)
74{
75 return 0;
76}
77#endif
78static inline td_u64 hcc_calc_time_us(td_u64 start, td_u64 stop)
79{
80 return start > stop ? (start - stop) : (stop - start);
81}
82#endif /* HCC_COMMON_TYPE_H */
uint64_t uapi_tcxo_get_us(void)
获取TCXO计数微秒值。
Definition tcxo.c:86
void td_void
Definition td_type.h:49
unsigned long long td_u64
Definition td_type.h:39