334 lines
6.6 KiB
C
334 lines
6.6 KiB
C
#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)
|
||
|
||
|
||
#define HW_QUE_NR 8
|
||
|
||
#define QUE_NR 16
|
||
|
||
#define B_128_16BLCOKS 8
|
||
#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{
|
||
int out_failed_cnt;
|
||
int in_failed_cnt;
|
||
int out_success_cnt;
|
||
int in_success_cnt;
|
||
int cur_que_depth;
|
||
int bind_cpuid;
|
||
|
||
}hwq_db_info ;
|
||
|
||
typedef struct{
|
||
hwq_db_info per_hwq[HW_QUE_NR];
|
||
|
||
}hwq_debug_t;
|
||
|
||
|
||
|
||
/*
|
||
函数名称:smart_hq_init
|
||
输入参数: cpuid
|
||
返回类型: int
|
||
返回值: 小于0 表示失败
|
||
返回值: 0 表示成功
|
||
函数功能: 硬件队列初始化
|
||
|
||
*/
|
||
|
||
extern int smart_hq_init(int cpuid);
|
||
|
||
/*
|
||
函数名称:smart_get_hq_vector
|
||
输入参数: cpuid
|
||
输入参数:queid
|
||
返回类型: int
|
||
返回值:小于等于0 表示失败
|
||
函数功能: 获取当前硬件队列中断号
|
||
|
||
*/
|
||
|
||
extern int smart_get_hq_vector(int cpuid,int queid);
|
||
|
||
|
||
/*
|
||
函数名称:smart_in_que
|
||
输入参数: cpuid
|
||
输入参数:val
|
||
返回类型: int
|
||
返回值: 非0 表示失败
|
||
返回值: 0 表示成功
|
||
函数功能: 硬件队列入队
|
||
|
||
*/
|
||
|
||
extern int smart_in_que(int queid,uint32_t val);
|
||
|
||
/*
|
||
函数名称:smart_que_is_full
|
||
输入参数: queid
|
||
返回类型:int
|
||
返回值: 1 表示 true
|
||
返回值: 0 表示 false
|
||
说明:下一版本返回值会更改enum ,
|
||
enum hwque_status smart_que_is_full(int queid);
|
||
返回值只能选择 hwque_false 和hwque_true
|
||
*/
|
||
|
||
extern int smart_que_is_full(int queid);
|
||
|
||
/*
|
||
函数名称:smart_out_que
|
||
输入参数: queid
|
||
输出参数: val
|
||
返回类型:int
|
||
返回值: 0 表示成功
|
||
返回值: 非0表示失败
|
||
函数功能:队列出队
|
||
|
||
*/
|
||
|
||
extern int smart_out_que(int queid,uint32_t *val);
|
||
|
||
/*
|
||
函数名称:smart_que_is_empty
|
||
输入参数: queid
|
||
返回类型: int
|
||
返回值: 1 表示true
|
||
返回值: 0 表示false
|
||
|
||
*/
|
||
extern int smart_que_is_empty(int queid);
|
||
|
||
/*
|
||
函数名称:smart_get_que_info
|
||
输入参数: queid
|
||
输出参数:*dep
|
||
输出参数: *width
|
||
输出参数: *used
|
||
输出参数:*cpuid
|
||
返回类型: int
|
||
返回值: 非0 表示失败
|
||
返回值: 0 表示成功
|
||
|
||
*/
|
||
|
||
extern int smart_get_que_info(int queid,int *dep,int *width,int *used,int *cpuid);
|
||
|
||
/*
|
||
函数名称:smart_enable_q_nempty
|
||
输入参数: queid
|
||
返回值: 无
|
||
|
||
*/
|
||
|
||
extern void smart_enable_q_nempty(int queid);
|
||
|
||
/*
|
||
函数名称:smart_disable_q_nempty
|
||
输入参数: queid
|
||
返回值: 无
|
||
函数功能:使能非空中断
|
||
|
||
*/
|
||
|
||
extern void smart_disable_q_nempty(int queid);
|
||
|
||
/*
|
||
函数名称:smart_que_bind
|
||
输入参数: queid
|
||
输入参数;cpuid
|
||
返回类型:int
|
||
返回值 ; 非0 表示失败
|
||
返回值: 0 表示成功
|
||
函数功能:去使能非空中断
|
||
|
||
*/
|
||
|
||
extern int smart_que_bind(int cpuid,int queid);
|
||
|
||
|
||
/*
|
||
|
||
函数名称:hwq_debug_cfg
|
||
参数 is_enable 调试开关
|
||
参数 debug_base_addr 调试信息存储基地址
|
||
参数 len_bytes 调试buf 长度
|
||
|
||
|
||
记录8个队列的基本信息
|
||
|
||
que0 = {int out_failed_cnt;
|
||
int in_failed_cnt;
|
||
int out_success_cnt;
|
||
int in_success_cnt;
|
||
int cur_que_depth;
|
||
int bind_cpuid;}
|
||
que1 = {int out_failed_cnt;
|
||
int in_failed_cnt;
|
||
int out_success_cnt;
|
||
int in_success_cnt;
|
||
int cur_que_depth;
|
||
int bind_cpuid;}
|
||
que2 = {int out_failed_cnt;
|
||
int in_failed_cnt;
|
||
int out_success_cnt;
|
||
int in_success_cnt;
|
||
int cur_que_depth;
|
||
int bind_cpuid;}
|
||
que3 = {int out_failed_cnt;
|
||
int in_failed_cnt;
|
||
int out_success_cnt;
|
||
int in_success_cnt;
|
||
int cur_que_depth;
|
||
int bind_cpuid;}
|
||
que4 = {int out_failed_cnt;
|
||
int in_failed_cnt;
|
||
int out_success_cnt;
|
||
int in_success_cnt;
|
||
int cur_que_depth;
|
||
int bind_cpuid;}
|
||
que5 = {int out_failed_cnt;
|
||
int in_failed_cnt;
|
||
int out_success_cnt;
|
||
int in_success_cnt;
|
||
int cur_que_depth;
|
||
int bind_cpuid;}
|
||
que6 = {int out_failed_cnt;
|
||
int in_failed_cnt;
|
||
int out_success_cnt;
|
||
int in_success_cnt;
|
||
int cur_que_depth;
|
||
int bind_cpuid;}
|
||
que7 = {int out_failed_cnt;
|
||
int in_failed_cnt;
|
||
int out_success_cnt;
|
||
int in_success_cnt;
|
||
int cur_que_depth;
|
||
int bind_cpuid;}
|
||
|
||
*/
|
||
|
||
/*
|
||
函数名称:smart_hq_debug_init
|
||
输入参数: debug_base_addr
|
||
输入参数;len_bytes
|
||
返回类型:int
|
||
返回值 ; 非0 表示失败
|
||
返回值:0 表示成功
|
||
函数功能:调试初始化接口
|
||
*/
|
||
|
||
extern int smart_hq_debug_init( uint32_t debug_base_addr, uint32_t len_bytes);
|
||
|
||
/*
|
||
函数名称:smart_get_inque_ok_cnt
|
||
输入参数: queid
|
||
返回类型:int
|
||
返回值 ; 小于等于0表示失败
|
||
函数功能:获取当前入队成功计数
|
||
*/
|
||
|
||
extern int smart_get_inque_ok_cnt(int queid);
|
||
|
||
/*
|
||
函数名称:smart_get_inque_failed_cnt
|
||
输入参数: queid
|
||
返回类型:int
|
||
返回值 ; 小于等于0表示失败
|
||
函数功能:获取当前入队失败计数
|
||
*/
|
||
|
||
extern int smart_get_inque_failed_cnt(int queid);
|
||
|
||
/*
|
||
函数名称:smart_get_outque_ok_cnt
|
||
输入参数: queid
|
||
返回类型:int
|
||
返回值 ; 小于等于0表示失败
|
||
函数功能:获取当前出队成功计数
|
||
*/
|
||
|
||
extern int smart_get_outque_ok_cnt(int queid);
|
||
|
||
/*
|
||
函数名称:smart_get_outque_failed_cnt
|
||
输入参数: queid
|
||
返回类型:int
|
||
返回值 ; 小于等于0表示失败
|
||
函数功能:获取当前出队失败计数
|
||
*/
|
||
|
||
extern int smart_get_outque_failed_cnt(int queid);
|
||
|
||
|
||
#endif
|