WS63 SDK 文档 7021f4f@fbb_ws63
ws63 和 ws63e 解决方案的 SDK 文档
载入中...
搜索中...
未找到
hcc_test.h
浏览该文件的文档.
1/*
2 * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2021-2023. All rights reserved.
3 * Description: HCC TEST
4 */
5
6#ifndef HCC_TEST_HEADER
7#define HCC_TEST_HEADER
8
9#include "td_type.h"
10#include "hcc_cfg_comm.h"
11#ifndef CONFIG_HCC_SUPPORT_NON_OS
12#include "soc_osal.h"
13#endif
14
15#define HCC_TEST_ARGC_MAX 5
16#define HCC_TEST_REMOTE_CMD_ARGC_LEN 4 /* argc 1Byte + reserve 2Bytes */
17#define HCC_TEST_SUBTYPE_DATA 0 /* test业务子类型:测试数据 */
18#define HCC_TEST_SUBTYPE_COMMAND 5 /* test业务子类型:测试命令 */
19#define HCC_TEST_CMD_STR "hcc_test_cmd"
20
21typedef struct _hcc_test_result_ {
22 td_u32 trans_rate; /* 测试速率, 单位:Mbps */
23 td_u32 trans_bits; /* 测试传输总bit */
24 td_u64 trans_time; /* 测试耗时, 单位:us */
26
37
38typedef struct _hcc_test_stat_ {
39 td_bool test_stop; /* 开始进行流控,测试停止 */
41
42#define HCC_TEST_TASK_STOP 0
43#define HCC_TEST_TASK_START 1
57
62
63typedef enum {
64 HCC_TEST_CMD_TEST_INIT = 0, /* 测试模块初始化 */
65 HCC_TEST_CMD_INIT_ALL_PARAM_AND_START_TEST = 1, /* 设置收发必须的参数后启动测试,参数同HCC_TEST_CMD_INIT_ALL_PARAM */
66 HCC_TEST_CMD_TEST_MSG = 2, /* 发送 message */
67 HCC_TEST_CMD_SET_QUEUE = 3, /* 设置模式 */
68 HCC_TEST_CMD_SET_TX_CHANNEL = 4, /* 设置测试发送的逻辑通道 */
69 HCC_TEST_CMD_TEST_REG_OPT = 5, /* 测试寄存器读写接口 */
70 HCC_TEST_CMD_START_TEST = 6, /* 开始测试 */
71 HCC_TEST_CMD_INIT_ALL_PARAM = 7, /* 初始化所有测试参数,顺序依次为: 发送次数、帧长度、期望接收数量 */
72 HCC_TEST_CMD_PRINT_RESULT = 8, /* 打印测试统计量 */
73 HCC_TEST_CMD_M2S = 9, /* test host to slave */
74
75 HCC_TEST_CMD_ENABLE_TX_THREAD = 10, /* 发送使能/禁能线程 */
76 HCC_TEST_CMD_ENABLE_RX_THREAD = 11, /* 接收使能/禁能线程 */
79 HCC_TEST_CMD_SET_TX_DATA = 14, /* 设置测试发送的数据内容 */
80 HCC_TEST_CMD_SET_REG_ADDR = 15, /* 设置寄存器地址 */
81 HCC_TEST_CMD_SET_MODE = 16, /* 设置模式 */
82
83 HCC_TEST_PRINT_QUEUE_INFO = 20, /* 队列信息打印 */
84 HCC_TEST_PRINT_SERVICE_INFO = 21, /* 业务信息打印 */
85 HCC_TEST_PRINT_BUS_INFO = 22, /* bus层维测信息打印 */
86 HCC_TEST_CMD_REMOTE = 31, /* 发给远端处理 */
89
90/********************** TEST SERVICE *****************************/
95
96/********************** TEST *****************************/
100
102
124/********************** TEST host device *****************************/
131td_u32 hcc_test_rx_proc(hcc_queue_type queue_id, td_u8 sub_type, td_u8 *buf, td_u32 len, td_u8 *user_param);
134int hcc_test_cmd_proc(int argc, char *argv[]);
137
138static inline td_u64 hcc_get_timestamp(td_void)
139{
140#ifndef CONFIG_HCC_SUPPORT_NON_OS
141 osal_timeval tv;
143 return (td_u64)(tv.tv_sec * 1000000 + tv.tv_usec); /* ms转化 us * 1000000 */
144#else
145 return 0;
146#endif
147}
148
149typedef td_s32 (*hcc_test_proc)(td_u32 *argv, td_u32 argc);
151#endif /* HCC_TEST_HEADER */
void osal_gettimeofday(osal_timeval *tv)
Obtaining the Current System Kernel Time.
Definition osal_timer.c:197
enum _hcc_queue_type hcc_queue_type
td_void hcc_test_set_trans_time_us(td_u64 us)
td_void hcc_test_start(td_void)
#define HCC_TEST_ARGC_MAX
Definition hcc_test.h:15
td_void hcc_test_set_test_stop(td_bool stop)
td_u8 hcc_test_get_test_chan(td_void)
td_void hcc_test_set_stop_time(td_u64 us)
td_void hcc_test_deinit(td_void)
td_bool hcc_test_get_m2s_status(td_void)
td_void hcc_test_reset_rx_stat(td_void)
td_u32 hcc_test_get_test_service(td_void)
td_u64 hcc_test_get_trans_time_us(td_void)
struct _hcc_test_para_ hcc_test_para
td_u32 hcc_test_get_test_data(td_void)
td_void hcc_adapt_test_free(hcc_queue_type queue_id, td_u8 *buf, td_u8 *user_param)
td_u32 hcc_test_get_trans_bits(td_void)
td_void hcc_test_print_test_result(td_void)
struct _hcc_test_stat_ hcc_test_stat
td_u32 hcc_test_get_exp_rx_cnt(td_void)
td_s32 hcc_test_proc_local_cmd(td_u32 *argv, td_u32 argc)
hcc_test_info * hcc_test_get_test_info(td_void)
td_u32 hcc_test_get_trans_rate(td_void)
td_u64 hcc_test_get_stop_time(td_void)
td_u16 hcc_test_get_frame_size(td_void)
td_void hcc_test_set_start_time(td_u64 us)
td_void hcc_test_init(td_void)
td_void hcc_test_set_trans_bits(td_u32 bits)
td_void hcc_test_set_trans_rate(td_u32 rate)
struct _hcc_test_result_ hcc_test_result
int hcc_test_cmd_proc(int argc, char *argv[])
td_void hcc_test_msg_init(td_void)
hcc_queue_type hcc_test_get_test_queue_id(td_void)
td_void hcc_test(td_void)
td_void hcc_test_start_test_after_init_paras(td_void)
td_void hcc_test_cmd_register(hcc_test_proc test_proc)
td_bool hcc_test_is_test_stop(td_void)
td_u32 hcc_test_rx_proc(hcc_queue_type queue_id, td_u8 sub_type, td_u8 *buf, td_u32 len, td_u8 *user_param)
td_void hcc_test_set_test_queue_id(td_u32 queue_id)
struct _hcc_test_cmd_args_ hcc_test_cmd_args
td_s32 hcc_test_proc_remote_cmd(td_u32 *argv, td_u32 argc)
td_s32(* hcc_test_proc)(td_u32 *argv, td_u32 argc)
Definition hcc_test.h:149
td_void hcc_test_get_credit(td_void)
td_void hcc_test_register_opt(td_u32 cmd)
td_s32 hcc_test_cmd_ctrl_init(void)
td_u32 hcc_test_get_loop_cnt(td_void)
struct _hcc_test_info_ hcc_test_info
hcc_test_cmd
Definition hcc_test.h:63
@ HCC_TEST_PRINT_QUEUE_INFO
Definition hcc_test.h:83
@ HCC_TEST_CMD_M2S
Definition hcc_test.h:73
@ HCC_TEST_CMD_REMOTE
Definition hcc_test.h:86
@ HCC_TEST_CMD_TEST_MSG
Definition hcc_test.h:66
@ HCC_TEST_CMD_SET_TX_DATA
Definition hcc_test.h:79
@ HCC_TEST_PRINT_BUS_INFO
Definition hcc_test.h:85
@ HCC_TEST_CMD_SET_MODE
Definition hcc_test.h:81
@ HCC_TEST_CMD_INIT_ALL_PARAM
Definition hcc_test.h:71
@ HCC_TEST_CMD_MAX
Definition hcc_test.h:87
@ HCC_TEST_PRINT_SERVICE_INFO
Definition hcc_test.h:84
@ HCC_TEST_CMD_SET_REG_ADDR
Definition hcc_test.h:80
@ HCC_TEST_CMD_SET_QUEUE
Definition hcc_test.h:67
@ HCC_TEST_CMD_START_TEST
Definition hcc_test.h:70
@ HCC_TEST_GET_CREDIT
Definition hcc_test.h:78
@ HCC_TEST_CMD_SET_TX_CHANNEL
Definition hcc_test.h:68
@ HCC_TEST_UPDATE_CREDIT
Definition hcc_test.h:77
@ HCC_TEST_CMD_ENABLE_TX_THREAD
Definition hcc_test.h:75
@ HCC_TEST_CMD_TEST_REG_OPT
Definition hcc_test.h:69
@ HCC_TEST_CMD_TEST_INIT
Definition hcc_test.h:64
@ HCC_TEST_CMD_PRINT_RESULT
Definition hcc_test.h:72
@ HCC_TEST_CMD_ENABLE_RX_THREAD
Definition hcc_test.h:76
@ HCC_TEST_CMD_INIT_ALL_PARAM_AND_START_TEST
Definition hcc_test.h:65
td_void hcc_test_set_register_addr(td_u32 addr, td_u32 offset, td_u32 value)
td_u64 hcc_test_get_start_time(td_void)
Definition hcc_test.h:58
td_u32 argv[5]
Definition hcc_test.h:59
td_u8 argc
Definition hcc_test.h:60
Definition hcc_test.h:44
osal_wait hcc_test_wq
Definition hcc_test.h:48
osal_atomic hcc_test_start
Definition hcc_test.h:47
td_u64 stop_time
Definition hcc_test.h:55
hcc_test_stat test_stat
Definition hcc_test.h:52
osal_task * hcc_test_thread_handler
Definition hcc_test.h:49
hcc_test_result test_data
Definition hcc_test.h:53
td_u64 start_time
Definition hcc_test.h:54
hcc_test_para test_para
Definition hcc_test.h:51
Definition hcc_test.h:27
td_u32 test_data
Definition hcc_test.h:30
hcc_queue_type test_queue_id
Definition hcc_test.h:35
td_u8 channel_id
Definition hcc_test.h:32
td_u8 test_service
Definition hcc_test.h:33
td_u32 loop_cnt
Definition hcc_test.h:28
td_u8 master_to_slave
Definition hcc_test.h:34
td_u16 frame_size
Definition hcc_test.h:31
td_u32 expect_rx_cnt
Definition hcc_test.h:29
Definition hcc_test.h:21
td_u32 trans_rate
Definition hcc_test.h:22
td_u32 trans_bits
Definition hcc_test.h:23
td_u64 trans_time
Definition hcc_test.h:24
Definition hcc_test.h:38
td_bool test_stop
Definition hcc_test.h:39
Definition osal_atomic.h:18
Definition osal_task.h:49
Definition osal_timer.h:25
long tv_sec
Definition osal_timer.h:26
long tv_usec
Definition osal_timer.h:27
Definition osal_wait.h:21
unsigned short td_u16
Definition td_type.h:37
unsigned char td_u8
Definition td_type.h:36
td_u8 td_bool
Definition td_type.h:50
void td_void
Definition td_type.h:49
unsigned int td_u32
Definition td_type.h:38
int td_s32
Definition td_type.h:44
unsigned long long td_u64
Definition td_type.h:39