lishuang.xie e34abce4e1 update New Feature#1113
1. update component to week40
2. add new function smart_no_idle_sw_init
3. change name of smart_ddr_spinlock_init
4. change type of smart_task_del and smart_enable_q_nempty
5. if call smart_enable_q_nempty return faild, we'll call 8 times
6. if call smart_task_del return faild, we'll record
7. smart_reclaim_init_res() don't be called!!!
8. test:
   8.1 SPU(case14)+ARM(case3) :PASS
   8.2 SPU(case20)+ARM(case20):PASS
   8.3 SPU(case21)+ARM(case21):PASS
   8.4 SPU(case34)+ARM(case5) :PASS
   8.5 SPU(case44)+ARM(case5) :PASS
2023-10-12 10:28:46 +08:00

297 lines
6.2 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#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 QUE_MAX_NR 16
#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{
unsigned int out_failed_cnt;
unsigned int in_failed_cnt;
unsigned int out_success_cnt;
unsigned int in_success_cnt;
unsigned int in_que_depth_addr;
unsigned int out_que_depth_addr;
}hwq_db_info ;
typedef struct{
hwq_db_info per_hwq[QUE_MAX_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
函数参数queid 队列编号
函数参数val 入队值
函数功能:硬件队列入队
函数使用注意点1 多核生产者入队时需要加锁
******************/
extern int smart_in_que(int queid,uint32_t val);
/*
函数名称smart_que_is_full
输入参数: queid
返回类型int
返回值: 1 表示 true
返回值: 0 表示 false
*/
extern int smart_que_is_full(int queid);
/*********************
函数名称smart_out_que
函数参数queid 队列编号
输出参数idx 获取当前队列的索引值
函数功能:队列出队获取当前队列的索引值
*********************/
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
函数名称smart_hq_nempty_int_enable
输入参数: queid
返回值int
函数功能:使能非空中断
*/
//extern void smart_enable_q_nempty(int queid);
//extern void smart_hq_nempty_int_enable(int queid);
extern int smart_enable_q_nempty(int queid);
/*
// 函数名称smart_disable_q_nempty
函数名称:smart_hq_nempty_int_disable
输入参数: queid
返回值int
函数功能:去使能非空中断
*/
extern void smart_disable_q_nempty(int queid);
//extern void smart_hq_nempty_int_disable(int queid);
/*
函数名称smart_que_bind
输入参数: queid
输入参数cpuid
返回类型int
返回值 : 0 表示返回成功非0 表示返回失败
函数功能:去使能非空中断
*/
extern int smart_que_bind(int cpuid,int queid);
/*
函数名称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;
*/
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表示成功非0表示失败
函数功能:获取当前出队失败计数
*/
extern int smart_get_outque_failed_cnt(int queid);
#endif