2023-07-13 11:27:03 +08:00
|
|
|
|
#ifndef __DUP_APE_COM_H__
|
|
|
|
|
#define __DUP_APE_COM_H__
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*error code*/
|
|
|
|
|
#define EQUEEMPTY 20
|
|
|
|
|
|
|
|
|
|
#define EMATCH 21
|
|
|
|
|
|
|
|
|
|
#define EINVAL 22 /*invalid argment*/
|
|
|
|
|
|
|
|
|
|
#define EREREG 23 /*re registration*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
enum hwque_status{
|
|
|
|
|
hwque_false,
|
|
|
|
|
hwque_true
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef unsigned int uint32_t;
|
|
|
|
|
typedef unsigned short uint16_t;
|
|
|
|
|
typedef unsigned char uint8_t;
|
|
|
|
|
typedef unsigned long long uint64_t;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define NULL ((void*)0)
|
|
|
|
|
|
2023-08-18 20:30:52 +08:00
|
|
|
|
#define QUE_MAX_NR 16
|
2023-07-13 11:27:03 +08:00
|
|
|
|
|
|
|
|
|
#define HW_QUE_NR 8
|
|
|
|
|
|
|
|
|
|
#define QUE_NR 16
|
|
|
|
|
|
2023-09-06 15:48:54 +08:00
|
|
|
|
#define B_128_16BLCOKS 8
|
2023-08-18 20:30:52 +08:00
|
|
|
|
|
2023-07-13 11:27:03 +08:00
|
|
|
|
#define B_256_32BLOCKS 32
|
|
|
|
|
#define BLOCKS_64 64
|
|
|
|
|
|
|
|
|
|
//#define QUE_NR 32
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define SHM_QUE_MAX 8
|
|
|
|
|
#define MAP_QUE_MAX 16
|
|
|
|
|
|
|
|
|
|
typedef enum{
|
|
|
|
|
CPSM_SM = 0,
|
|
|
|
|
JSSM_SM,
|
|
|
|
|
SM_NR
|
|
|
|
|
|
|
|
|
|
}ENUM_SHM;
|
|
|
|
|
|
|
|
|
|
typedef struct hw_que_reg_msg{
|
|
|
|
|
|
|
|
|
|
uint32_t hw_base_reg;
|
|
|
|
|
uint32_t hw_size_reg;
|
|
|
|
|
uint32_t hw_depth_reg;
|
|
|
|
|
uint32_t hw_start_addr;
|
|
|
|
|
int cpuid;
|
|
|
|
|
uint32_t ape_vector_id;
|
|
|
|
|
uint32_t arm_vector_id;
|
|
|
|
|
|
|
|
|
|
}hw_reg_desc_t;
|
|
|
|
|
|
|
|
|
|
typedef struct shm_desc{
|
|
|
|
|
hw_reg_desc_t queid[SHM_QUE_MAX];
|
|
|
|
|
uint32_t hw_sm_ctrl_reg;
|
|
|
|
|
uint32_t width_bits;
|
|
|
|
|
uint32_t que_depths;
|
|
|
|
|
|
|
|
|
|
}shm_obj;
|
|
|
|
|
|
|
|
|
|
typedef struct mpu_shm{
|
|
|
|
|
shm_obj shm_type_s[SM_NR];
|
|
|
|
|
int v_map_queid[MAP_QUE_MAX];
|
|
|
|
|
|
|
|
|
|
}mpu_shm_obj;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct{
|
2023-08-18 20:30:52 +08:00
|
|
|
|
unsigned int out_failed_cnt;
|
|
|
|
|
unsigned int in_failed_cnt;
|
|
|
|
|
unsigned int out_success_cnt;
|
|
|
|
|
unsigned int in_success_cnt;
|
2023-10-12 10:28:46 +08:00
|
|
|
|
unsigned int in_que_depth_addr;
|
|
|
|
|
unsigned int out_que_depth_addr;
|
2023-07-13 11:27:03 +08:00
|
|
|
|
|
|
|
|
|
}hwq_db_info ;
|
|
|
|
|
|
|
|
|
|
typedef struct{
|
2023-09-06 15:48:54 +08:00
|
|
|
|
hwq_db_info per_hwq[QUE_MAX_NR];
|
|
|
|
|
|
2023-07-13 11:27:03 +08:00
|
|
|
|
}hwq_debug_t;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2023-09-06 15:48:54 +08:00
|
|
|
|
函数名称:smart_hq_init
|
|
|
|
|
输入参数: cpuid
|
|
|
|
|
返回类型: int
|
|
|
|
|
返回值: 小于0 表示失败
|
|
|
|
|
返回值:等于0 表示成功
|
|
|
|
|
函数功能:硬件队列初始化
|
2023-07-13 11:27:03 +08:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
extern int smart_hq_init(int cpuid);
|
|
|
|
|
|
|
|
|
|
/*
|
2023-09-06 15:48:54 +08:00
|
|
|
|
函数名称:smart_get_hq_vector
|
|
|
|
|
输入参数: cpuid
|
|
|
|
|
输入参数:queid
|
|
|
|
|
返回类型: int
|
|
|
|
|
返回值:小于等于0 表示失败
|
|
|
|
|
函数功能:获取当前硬件队列中断号
|
2023-07-13 11:27:03 +08:00
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
extern int smart_get_hq_vector(int cpuid,int queid);
|
|
|
|
|
|
|
|
|
|
|
2023-09-06 15:48:54 +08:00
|
|
|
|
/********************
|
2023-08-18 20:30:52 +08:00
|
|
|
|
|
2023-09-06 15:48:54 +08:00
|
|
|
|
函数名称:smart_in_que
|
|
|
|
|
函数参数:queid 队列编号
|
|
|
|
|
函数参数:val 入队值
|
|
|
|
|
函数功能:硬件队列入队
|
|
|
|
|
函数使用注意点1: 多核生产者入队时需要加锁
|
2023-08-18 20:30:52 +08:00
|
|
|
|
|
|
|
|
|
******************/
|
|
|
|
|
|
|
|
|
|
|
2023-09-06 15:48:54 +08:00
|
|
|
|
extern int smart_in_que(int queid,uint32_t val);
|
2023-08-18 20:30:52 +08:00
|
|
|
|
|
|
|
|
|
|
2023-07-13 11:27:03 +08:00
|
|
|
|
/*
|
2023-09-06 15:48:54 +08:00
|
|
|
|
函数名称:smart_que_is_full
|
|
|
|
|
输入参数: queid
|
|
|
|
|
返回类型:int
|
|
|
|
|
返回值: 1 表示 true
|
|
|
|
|
返回值: 0 表示 false
|
2023-07-13 11:27:03 +08:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
extern int smart_que_is_full(int queid);
|
|
|
|
|
|
2023-08-18 20:30:52 +08:00
|
|
|
|
/*********************
|
2023-09-06 15:48:54 +08:00
|
|
|
|
函数名称:smart_out_que
|
|
|
|
|
函数参数:queid 队列编号
|
|
|
|
|
输出参数:idx 获取当前队列的索引值
|
|
|
|
|
函数功能:队列出队获取当前队列的索引值
|
2023-08-18 20:30:52 +08:00
|
|
|
|
|
|
|
|
|
*********************/
|
|
|
|
|
|
2023-07-13 11:27:03 +08:00
|
|
|
|
extern int smart_out_que(int queid,uint32_t *val);
|
|
|
|
|
|
|
|
|
|
/*
|
2023-09-06 15:48:54 +08:00
|
|
|
|
函数名称:smart_que_is_empty
|
|
|
|
|
输入参数: queid
|
|
|
|
|
返回类型: int
|
|
|
|
|
返回值: 1 表示true
|
|
|
|
|
返回值:0 表示false
|
2023-07-13 11:27:03 +08:00
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
extern int smart_que_is_empty(int queid);
|
|
|
|
|
|
|
|
|
|
/*
|
2023-09-06 15:48:54 +08:00
|
|
|
|
函数名称:smart_get_que_info
|
|
|
|
|
输入参数: queid
|
|
|
|
|
输出参数 *dep
|
|
|
|
|
输出参数: *width
|
|
|
|
|
输出参数: *used
|
|
|
|
|
输出参数: *cpuid
|
|
|
|
|
返回类型: int
|
|
|
|
|
返回值:0 表示成功,非0 表示失败
|
|
|
|
|
|
2023-07-13 11:27:03 +08:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
extern int smart_get_que_info(int queid,int *dep,int *width,int *used,int *cpuid);
|
|
|
|
|
|
|
|
|
|
/*
|
2023-09-06 15:48:54 +08:00
|
|
|
|
// 函数名称:smart_enable_q_nempty
|
|
|
|
|
函数名称:smart_hq_nempty_int_enable
|
|
|
|
|
输入参数: queid
|
|
|
|
|
返回值:int
|
|
|
|
|
函数功能:使能非空中断
|
2023-07-13 11:27:03 +08:00
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
2023-10-12 10:28:46 +08:00
|
|
|
|
//extern void smart_enable_q_nempty(int queid);
|
2023-09-06 15:48:54 +08:00
|
|
|
|
//extern void smart_hq_nempty_int_enable(int queid);
|
2023-10-12 10:28:46 +08:00
|
|
|
|
extern int smart_enable_q_nempty(int queid);
|
2023-07-13 11:27:03 +08:00
|
|
|
|
|
2023-09-06 15:48:54 +08:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
// 函数名称:smart_disable_q_nempty
|
|
|
|
|
函数名称:smart_hq_nempty_int_disable
|
|
|
|
|
输入参数: queid
|
|
|
|
|
返回值:int
|
|
|
|
|
函数功能:去使能非空中断
|
|
|
|
|
|
|
|
|
|
*/
|
2023-07-13 11:27:03 +08:00
|
|
|
|
|
|
|
|
|
extern void smart_disable_q_nempty(int queid);
|
2023-09-06 15:48:54 +08:00
|
|
|
|
//extern void smart_hq_nempty_int_disable(int queid);
|
|
|
|
|
|
2023-07-13 11:27:03 +08:00
|
|
|
|
|
|
|
|
|
/*
|
2023-09-06 15:48:54 +08:00
|
|
|
|
函数名称:smart_que_bind
|
|
|
|
|
输入参数: queid
|
|
|
|
|
输入参数;cpuid
|
|
|
|
|
返回类型:int
|
|
|
|
|
返回值 : 0 表示返回成功,非0 表示返回失败
|
|
|
|
|
|
|
|
|
|
函数功能:去使能非空中断
|
|
|
|
|
|
2023-07-13 11:27:03 +08:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
extern int smart_que_bind(int cpuid,int queid);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2023-09-06 15:48:54 +08:00
|
|
|
|
函数名称:smart_hq_debug_init
|
|
|
|
|
输入参数: debug_base_addr
|
|
|
|
|
输入参数;len_bytes
|
|
|
|
|
返回类型:int
|
|
|
|
|
返回值:0 表示成功
|
|
|
|
|
函数功能:调试初始化接口
|
|
|
|
|
|
|
|
|
|
注意:
|
|
|
|
|
通过地址与,长度指定相应的buf 数据空间,存放相应的中断调试信息
|
|
|
|
|
这些调试信息已经格式化,地址由用户指定,len_bytes 不能小于sizeof(hwq_debug_t)
|
|
|
|
|
数据格式化结构是: hwq_debug_t
|
|
|
|
|
|
|
|
|
|
数据格式 example:
|
|
|
|
|
typedef struct{
|
|
|
|
|
unsigned int out_failed_cnt;
|
|
|
|
|
unsigned int in_failed_cnt;
|
|
|
|
|
unsigned int out_success_cnt;
|
|
|
|
|
unsigned int in_success_cnt;
|
|
|
|
|
unsigned int cur_que_depth;
|
|
|
|
|
unsigned int bind_cpuid;
|
|
|
|
|
|
|
|
|
|
}hwq_db_info ;
|
|
|
|
|
|
|
|
|
|
typedef struct{
|
|
|
|
|
hwq_db_info per_hwq[HW_QUE_NR];
|
|
|
|
|
|
|
|
|
|
}hwq_debug_t;
|
2023-08-18 20:30:52 +08:00
|
|
|
|
|
2023-07-13 11:27:03 +08:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
extern int smart_hq_debug_init( uint32_t debug_base_addr, uint32_t len_bytes);
|
|
|
|
|
|
|
|
|
|
/*
|
2023-09-06 15:48:54 +08:00
|
|
|
|
函数名称:smart_get_inque_ok_cnt
|
|
|
|
|
输入参数: queid
|
|
|
|
|
返回类型:int
|
|
|
|
|
返回值 : 小于等于0表示失败
|
|
|
|
|
函数功能:获取当前入队成功计数
|
2023-07-13 11:27:03 +08:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
extern int smart_get_inque_ok_cnt(int queid);
|
|
|
|
|
|
|
|
|
|
/*
|
2023-09-06 15:48:54 +08:00
|
|
|
|
函数名称:smart_get_inque_failed_cnt
|
|
|
|
|
输入参数: queid
|
|
|
|
|
返回类型:int
|
|
|
|
|
返回值 : 小于等于0表示失败
|
|
|
|
|
函数功能:获取当前入队失败计数
|
2023-07-13 11:27:03 +08:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
extern int smart_get_inque_failed_cnt(int queid);
|
|
|
|
|
|
|
|
|
|
/*
|
2023-09-06 15:48:54 +08:00
|
|
|
|
函数名称:smart_get_outque_ok_cnt
|
|
|
|
|
输入参数: queid
|
|
|
|
|
返回类型:int
|
|
|
|
|
返回值:小于等于0表示失败
|
|
|
|
|
函数功能:获取当前出队成功计数
|
2023-07-13 11:27:03 +08:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
extern int smart_get_outque_ok_cnt(int queid);
|
|
|
|
|
|
|
|
|
|
/*
|
2023-09-06 15:48:54 +08:00
|
|
|
|
函数名称:smart_get_outque_failed_cnt
|
|
|
|
|
输入参数: queid
|
|
|
|
|
返回类型:int
|
|
|
|
|
返回值: 0表示成功,非0表示失败
|
|
|
|
|
函数功能:获取当前出队失败计数
|
2023-07-13 11:27:03 +08:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
extern int smart_get_outque_failed_cnt(int queid);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|