296 lines
6.2 KiB
C
Raw Normal View History

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)
#define QUE_MAX_NR 16
2023-07-13 11:27:03 +08:00
#define HW_QUE_NR 8
#define QUE_NR 16
#define B_128_16BLCOKS 8
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{
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_val;
unsigned int out_que_depth_val;
2023-07-13 11:27:03 +08:00
}hwq_db_info ;
typedef struct{
hwq_db_info per_hwq[QUE_MAX_NR];
2023-07-13 11:27:03 +08:00
}hwq_debug_t;
/*
smart_hq_init
: cpuid
: int
0
0
2023-07-13 11:27:03 +08:00
*/
extern int smart_hq_init(int cpuid);
/*
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);
/********************
smart_in_que
queid
val
使1
******************/
extern int smart_in_que(int queid,uint32_t val);
2023-07-13 11:27:03 +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);
/*********************
smart_out_que
queid
idx
*********************/
2023-07-13 11:27:03 +08:00
extern int smart_out_que(int queid,uint32_t *val);
/*
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);
/*
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);
/*
// 函数名称smart_enable_q_nempty
smart_hq_nempty_int_enable
: queid
int
:使
2023-07-13 11:27:03 +08:00
*/
extern void smart_enable_q_nempty(int queid);
//extern void smart_hq_nempty_int_enable(int queid);
2023-07-13 11:27:03 +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);
//extern void smart_hq_nempty_int_disable(int queid);
2023-07-13 11:27:03 +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);
/*
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-07-13 11:27:03 +08:00
*/
extern int smart_hq_debug_init( uint32_t debug_base_addr, uint32_t len_bytes);
/*
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);
/*
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);
/*
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);
/*
smart_get_outque_failed_cnt
: queid
int
: 00
2023-07-13 11:27:03 +08:00
*/
extern int smart_get_outque_failed_cnt(int queid);
#endif