WS63 SDK 文档 7021f4f@fbb_ws63
ws63 和 ws63e 解决方案的 SDK 文档
载入中...
搜索中...
未找到
hcc_types.h
浏览该文件的文档.
1/*
2 * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2021-2023. All rights reserved.
3 * Description: hcc types.
4 */
5
6#ifndef __HCC_TYPES_H__
7#define __HCC_TYPES_H__
8
9#include "td_type.h"
10#include "hcc_cfg_comm.h"
11
17
18/*
19 * HCC default macro
20 */
21#define HCC_DEFAULT_ALIGN_LEN 1
22
23/* hcc tx transfer flow control */
24#define HCC_FC_NONE 0x0 /* 对调用者不进行流控,netbuf一直缓冲在hcc队列中,这种类型的数据包不宜过多 */
25#define HCC_FC_WAIT 0x1 /* 阻塞等待,如果是在中断上下文调用,该标记被自动清除,非中断上下文生效 */
26#define HCC_FC_NET 0x2 /* 对于网络层的流控 */
27#define HCC_FC_DROP 0x4 /* 流控采用丢包方式,流控时返回成功 */
28#define HCC_FC_ALL (HCC_FC_WAIT | HCC_FC_NET | HCC_FC_DROP)
29
30typedef struct _hcc_transfer_param {
33 td_u8 queue_id; /* 期望进入的队列号 */
34 td_u16 fc_flag; /* 流控标记 */
37
38typedef td_u32 (*hcc_msg_rx)(td_u8 *cb_data);
39
40/*
41 * 功能描述:业务数据结构内存释放函数
42 * queue_id: 队列ID号。使用场景:一个业务可能使用不同内存池管理,建议不同内存池的数据使用不同队列传输,
43 * 通过 queue_id 区分使用的内存池;
44 * buf: 业务实际传输数据,其中包含 hcc头和payload,hcc头由调用者分配空间,由hcc模块内部填充;
45 * len: buf数据的长度,为hcc头的长度+payload的总长度;
46 * user_param: 业务使用数据,使用场景:业务传输数据的buf为内部结构体的一部分,buf和内部结构需要同时释放和申请,
47 * 通过buf地址无法计算出其所在结构的首地址,因此增加用户数据指针,具体指针内容hcc模块不关心;
48 */
49typedef td_u32 (*hcc_adapt_priv_alloc)(hcc_queue_type queue_id, td_u32 len, td_u8 **buf, td_u8 **user_param);
50/*
51 * 功能描述:业务数据结构内存申请函数
52 * queue_id: 释放内存所在队列号;
53 */
54typedef td_void (*hcc_adapt_priv_free)(hcc_queue_type queue_id, td_u8 *buf, td_u8 *user_param);
55/*
56 * 功能描述:业务开始流控函数,停止或减缓业务数据发送
57 * queue_id: 需要开始流控的队列号。
58 */
60/*
61 * 功能描述:业务停止流控函数,恢复业务数据发送
62 * queue_id: 需要停止流控的队列号。
63 */
65/*
66 * 功能描述:业务数据接收处理函数
67 * queue_id: 接收数据所在队列号;
68 */
70 td_u8 *buf, td_u32 len, td_u8 *user_param);
78
79#pragma pack(push, 1)
80typedef struct _hcc_queue_ctrl_ {
81 td_u32 service_type : 4; // 队列所属的业务类型
82 td_u32 sub_type : 4; // 队列所属的业务子类型
83 td_u32 transfer_mode : 3; // 队列发送模式: 单条发送、聚合发送 接收mode也用该字节 // hcc_transfer_mode
84 td_u32 fc_enable : 1; // 队列流控使能,初始化默认打开
85 td_u32 flow_type : 4; // 队列流控类型, hcc_flowctrl_type
86 td_u32 low_waterline : 8; // 队列的低水线
87 td_u32 high_waterline : 8; // 队列的高水线
88
89 td_u16 extend; // ipc配置为队列中buff最大长度
90 td_u8 burst_limit; // 队列每次处理数据包的上限,达到上限让出机会给其他队列处理;
91 td_u8 credit_bottom_value; // flow_type 为 HCC_FLOWCTRL_CREDIT 时,该字段生效,低于该值将不再发送;
93#pragma pack(pop)
94
95typedef struct {
96 td_u8 dir; /* hcc_queue_dir */
97 td_u8 queue_id; /* hcc_queue_type */
99} hcc_queue_cfg; // 配置队列信息
100#endif
enum _hcc_queue_type hcc_queue_type
td_void(* hcc_flowctl_start_subq)(hcc_queue_type queue_id)
Definition hcc_types.h:59
td_void(* hcc_flowctl_stop_subq)(hcc_queue_type queue_id)
Definition hcc_types.h:64
struct _hcc_transfer_param hcc_transfer_param
struct _hcc_queue_ctrl_ hcc_queue_ctrl
_hcc_queue_dir_
Definition hcc_types.h:12
@ HCC_DIR_COUNT
Definition hcc_types.h:15
@ HCC_DIR_TX
Definition hcc_types.h:13
@ HCC_DIR_RX
Definition hcc_types.h:14
td_void(* hcc_adapt_priv_free)(hcc_queue_type queue_id, td_u8 *buf, td_u8 *user_param)
Definition hcc_types.h:54
td_u32(* hcc_adapt_priv_alloc)(hcc_queue_type queue_id, td_u32 len, td_u8 **buf, td_u8 **user_param)
Definition hcc_types.h:49
td_u32(* hcc_adapt_priv_rx_process)(hcc_queue_type queue_id, td_u8 sub_type, td_u8 *buf, td_u32 len, td_u8 *user_param)
Definition hcc_types.h:69
enum _hcc_queue_dir_ hcc_queue_dir
struct _hcc_adapt_ops_ hcc_adapt_ops
td_u32(* hcc_msg_rx)(td_u8 *cb_data)
Definition hcc_types.h:38
Definition hcc_types.h:71
hcc_flowctl_stop_subq stop_subq
Definition hcc_types.h:74
hcc_adapt_priv_rx_process rx_proc
Definition hcc_types.h:76
hcc_adapt_priv_free free
Definition hcc_types.h:72
hcc_adapt_priv_alloc alloc
Definition hcc_types.h:73
hcc_flowctl_start_subq start_subq
Definition hcc_types.h:75
Definition hcc_types.h:80
td_u8 burst_limit
Definition hcc_types.h:90
td_u32 low_waterline
Definition hcc_types.h:86
td_u16 extend
Definition hcc_types.h:89
td_u32 flow_type
Definition hcc_types.h:85
td_u32 fc_enable
Definition hcc_types.h:84
td_u8 credit_bottom_value
Definition hcc_types.h:91
td_u32 sub_type
Definition hcc_types.h:82
td_u32 service_type
Definition hcc_types.h:81
td_u32 high_waterline
Definition hcc_types.h:87
td_u32 transfer_mode
Definition hcc_types.h:83
Definition hcc_types.h:30
td_u8 queue_id
Definition hcc_types.h:33
td_u8 sub_type
Definition hcc_types.h:32
td_u16 fc_flag
Definition hcc_types.h:34
td_u8 * user_param
Definition hcc_types.h:35
td_u8 service_type
Definition hcc_types.h:31
Definition hcc_types.h:95
td_u8 queue_id
Definition hcc_types.h:97
hcc_queue_ctrl queue_ctrl
Definition hcc_types.h:98
td_u8 dir
Definition hcc_types.h:96
unsigned short td_u16
Definition td_type.h:37
unsigned char td_u8
Definition td_type.h:36
void td_void
Definition td_type.h:49
unsigned int td_u32
Definition td_type.h:38