mirror of
https://github.com/thead-yocto-mirror/xtensa_dsp
synced 2026-06-21 09:12:29 +02:00
Compare commits
2 Commits
Linux_SDK_
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0e6887d7aa | ||
|
|
496326e34f |
@@ -59,52 +59,6 @@ int csi_dsp_cmd_send(const struct xrp_queue *queue,int cmd_type,void * cmd_paylo
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*********************************/
|
||||
static int dsp_register_report_item_to_dsp(struct csi_dsp_task_handler *task)
|
||||
{
|
||||
int resp =0;
|
||||
struct report_config_msg config;
|
||||
if(!task || task->report_id<0 || !task->instance || !task->instance->comm_queue)
|
||||
{
|
||||
DSP_PRINT(ERROR,"param check fail\n");
|
||||
return -1;
|
||||
}
|
||||
config.report_id=task->report_id;
|
||||
memcpy(config.task,task->task_ns,TASK_NAME_LINE);
|
||||
if(csi_dsp_cmd_send(task->instance->comm_queue,PS_CMD_REPORT_CONFIG,&config,sizeof(struct report_config_msg),&resp,sizeof(resp),NULL))
|
||||
{
|
||||
DSP_PRINT(ERROR,"register_report_item_to_dsp fail\n");
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// int csi_dsp_register_report_fix_id(struct csi_dsp_task_handler *task,
|
||||
// int (*cb)(void*context,void*data),
|
||||
// void* context,
|
||||
// size_t data_size)
|
||||
// {
|
||||
// if(task->report_id<0)
|
||||
// {
|
||||
// printf("report id is invalid\n");
|
||||
// return -1;
|
||||
// }
|
||||
// if(xrp_add_report_item_with_id(task->instance->report_impl,
|
||||
// cb,task->report_id,context,data_size)<0)
|
||||
// {
|
||||
// return -1;
|
||||
// }
|
||||
// if(dsp_register_report_item_to_dsp(task))
|
||||
// {
|
||||
// return -1;
|
||||
// }
|
||||
// printf("new reprot %d is created and register to DSP\n",task->report_id);
|
||||
// return 0;
|
||||
|
||||
// }
|
||||
|
||||
|
||||
int csi_dsp_delete_instance(void* dsp)
|
||||
{
|
||||
if(!dsp)
|
||||
@@ -711,7 +665,7 @@ int csi_dsp_task_start(void *task_ctx)
|
||||
DSP_PRINT(ERROR,"csi_dsp_task_start resp due to %d\n",resp);
|
||||
return -1;
|
||||
}
|
||||
DSP_PRINT(INFO,"task start sucessful!\n",task->task_id);
|
||||
DSP_PRINT(INFO,"task:%d start sucessful!\n",task->task_id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -734,8 +688,9 @@ int csi_dsp_task_stop(void *task_ctx)
|
||||
}
|
||||
if(resp != CSI_DSP_OK)
|
||||
{
|
||||
printf("csi_dsp_task_start fail due to %d\n",resp);
|
||||
DSP_PRINT(ERROR,"csi_dsp_task_start fail due to %d\n",resp);
|
||||
}
|
||||
DSP_PRINT(INFO,"task:%d stop!\n",task->task_id);
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
@@ -84,34 +84,6 @@ int csi_dsp_disable_heartbeat_check()
|
||||
return setitimer(ITIMER_REAL,&val,NULL);
|
||||
|
||||
}
|
||||
void isp_algo_result_handler(void *context,void *data)
|
||||
{
|
||||
s_cmd_t *msg=(s_cmd_t *)data;
|
||||
printf("report recived:%x\n",msg->cmd);
|
||||
switch(msg->cmd)
|
||||
{
|
||||
case CSI_DSP_REPORT_ISP_ERR:
|
||||
printf("ISP error:%d\n",msg->data[0]);
|
||||
break;
|
||||
case CSI_DSP_REPORT_RY_ERR:
|
||||
printf("Post ISP error\n",msg->data[0]);
|
||||
break;
|
||||
case CSI_DSP_REPORT_ALGO_ERR:
|
||||
printf("algo err\n");
|
||||
break;
|
||||
case CSI_DSP_REPORT_VI_PRE_ERR:
|
||||
break;
|
||||
case CSI_DSP_REPORT_RESULT:
|
||||
break;
|
||||
case CSI_DSP_REPORT_HEARTBEAT_ERR:
|
||||
printf("heartbeat not detect\n");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
int csi_dsp_buf_flush( struct xrp_device *device,struct csi_dsp_buffer *buffers)
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
*
|
||||
* General properties:
|
||||
* 1. Post porcess define data and strcut, visiable for APP
|
||||
* 2. user define data shared bedtween DSP ans host
|
||||
* 2. user define data shared between DSP and host
|
||||
*/
|
||||
|
||||
#ifndef _CSI_DSP_POST_DEFS_H
|
||||
@@ -37,8 +37,6 @@ extern "C" {
|
||||
#define CSI_DSP_MAX_BUFFER 8
|
||||
typedef uint8_t dsp_id_t;
|
||||
|
||||
|
||||
|
||||
typedef enum csi_dsp_img_fmt{
|
||||
CSI_DSP_IMG_FMT_RAW8 =0,
|
||||
CSI_DSP_IMG_FMT_RAW10_UNALGIN,
|
||||
@@ -72,7 +70,6 @@ enum buffer_property{
|
||||
};
|
||||
|
||||
struct csi_dsp_plane {
|
||||
|
||||
int fd;
|
||||
uint32_t stride; /* if buffer type is image */
|
||||
uint32_t size;
|
||||
@@ -99,7 +96,7 @@ struct csi_dsp_buffer {
|
||||
struct csi_dsp_plane planes[3];
|
||||
};
|
||||
struct csi_dsp_algo_config_par{
|
||||
int16_t algo_id;
|
||||
int16_t algo_id;
|
||||
int task_id;
|
||||
uint64_t algo_ptr;
|
||||
uint64_t sett_ptr;
|
||||
|
||||
@@ -38,7 +38,7 @@ extern "C" {
|
||||
#define MAX_REPORT_SIZE 256
|
||||
|
||||
#define CSI_DSP_HW_TASK_EXTRA_BUF_START_INDEX 2
|
||||
typedef struct {
|
||||
typedef struct _sisp_config_par{
|
||||
uint16_t id;
|
||||
uint16_t hor;
|
||||
uint16_t ver;
|
||||
@@ -64,22 +64,7 @@ typedef struct vipre_config_par{
|
||||
uint64_t buffer_addr[12];
|
||||
}vipre_config_par_t;
|
||||
|
||||
typedef struct {
|
||||
uint16_t algo_id;
|
||||
float gamma; // float鍙傛暟
|
||||
float coef1;
|
||||
float coef2;
|
||||
float coef3;
|
||||
float coef4;
|
||||
short beta; // short鍨嬪弬鏁<E5BCAC>
|
||||
short beta1;
|
||||
short beta2;
|
||||
short beta3;
|
||||
short beta4;
|
||||
}salgo_config_par;
|
||||
|
||||
|
||||
typedef enum{
|
||||
typedef enum csi_dsp_report{
|
||||
CSI_DSP_REPORT_NORMAL,
|
||||
CSI_DSP_REPORT_RESULT,
|
||||
CSI_DSP_REPORT_RESULT_WITH_EXRA_PARAM,
|
||||
@@ -100,19 +85,13 @@ typedef enum{
|
||||
CSI_DSP_REPORT_MAX
|
||||
}csi_dsp_report_e;
|
||||
|
||||
typedef struct dsp_frame{
|
||||
uint64_t p_frame_buff[3];
|
||||
uint32_t frame_buff_size[3];
|
||||
int32_t frame_width;
|
||||
int32_t frame_height;
|
||||
int32_t frame_pitch;
|
||||
uint8_t pixel_res;
|
||||
uint8_t num_channels;
|
||||
int8_t fmt;
|
||||
}dsp_frame_t;
|
||||
|
||||
|
||||
|
||||
typedef struct csi_dsp_report_item{
|
||||
csi_dsp_report_e type;
|
||||
union{
|
||||
char data[MAX_REPORT_SIZE];
|
||||
struct csi_dsp_buffer buf;
|
||||
};
|
||||
}csi_dsp_report_item_t;
|
||||
typedef enum csi_dsp_task_mode{
|
||||
CSI_DSP_TASK_SW_TO_SW =0x1<<0, /*SW Queue to handle in / data/exception */
|
||||
CSI_DSP_TASK_SW_TO_HW =0x1<<1, /*SW Queue to handle in and exception / Report handlere exception,HW handl out*/
|
||||
@@ -125,40 +104,6 @@ typedef enum csi_dsp_task_mode{
|
||||
//#define CSI_DSP_TASK_SW (CSI_DSP_TASK_SW_TO_HW|CSI_DSP_TASK_SW_TO_SW)
|
||||
//#define CSI_DSP_TASK_HW (CSI_DSP_TASK_HW_TO_SW|CSI_DSP_TASK_HW_TO_HW)
|
||||
|
||||
typedef enum csi_dsp_status{
|
||||
CSI_DSP_ERR_ILLEGAL_PARAM = -100,
|
||||
CSI_DSP_TASK_NOT_VALID,
|
||||
CSI_DSP_TASK_ALLOC_FAIL,
|
||||
CSI_DSP_TASK_ADD_TO_SCHEDULER_FAIL,
|
||||
CSI_DSP_TASK_ALREADY_RUNNING,
|
||||
CSI_DSP_TASK_START_FAIL,
|
||||
CSI_DSP_REPORTER_NOT_INIT,
|
||||
CSI_DSP_FE_NOT_VALID,
|
||||
CSI_DSP_FE_CONFIG_FAIL,
|
||||
CSI_DSP_BE_CONFIG_FAIL,
|
||||
CSI_DSP_BE_NOT_VALID,
|
||||
CSI_DSP_ALGO_INVALID,
|
||||
CSI_DSP_ALGO_ERR,
|
||||
CSI_DSP_FE_ERR,
|
||||
CSI_DSP_BE_ERR,
|
||||
CSI_DSP_BUF_TYPE_ERR,
|
||||
CSI_DSP_ALGO_LOAD_FAIL,
|
||||
CSI_DSP_MALLO_FAIL,
|
||||
CSI_DSP_ALGO_BUF_FAIL,
|
||||
CSI_DSP_FAIL,
|
||||
CSI_DSP_OK = 0,
|
||||
}csi_dsp_status_e;
|
||||
|
||||
struct csi_dsp_task_create_req{
|
||||
csi_dsp_task_mode_e type;
|
||||
int priority;
|
||||
};
|
||||
|
||||
|
||||
|
||||
struct csi_dsp_task_comm_resp{
|
||||
csi_dsp_status_e status;
|
||||
};
|
||||
enum csi_dsp_fe_type{
|
||||
CSI_DSP_FE_TYPE_CPU,
|
||||
CSI_DSP_FE_TYPE_ISP,
|
||||
@@ -179,21 +124,21 @@ enum csi_dsp_task_cfg{
|
||||
|
||||
};
|
||||
|
||||
struct csi_dsp_task_fe_para{
|
||||
typedef struct csi_dsp_task_fe_para{
|
||||
enum csi_dsp_fe_type frontend_type;
|
||||
int task_id;
|
||||
union{
|
||||
sisp_config_par isp_param;
|
||||
vipre_config_par_t vipre_param;
|
||||
};
|
||||
};
|
||||
}csi_dsp_task_fe_para_t;
|
||||
typedef struct _sw_be_config_par{
|
||||
int num_buf;
|
||||
struct csi_dsp_buffer bufs[1];
|
||||
|
||||
}sw_be_config_par;
|
||||
|
||||
struct csi_dsp_task_be_para{
|
||||
typedef struct csi_dsp_task_be_para{
|
||||
enum csi_dsp_be_type backend_type;
|
||||
int task_id;
|
||||
union{
|
||||
@@ -201,15 +146,8 @@ struct csi_dsp_task_be_para{
|
||||
sw_be_config_par sw_param;
|
||||
};
|
||||
|
||||
};
|
||||
}csi_dsp_task_be_para_t;
|
||||
|
||||
typedef struct csi_dsp_report_item{
|
||||
csi_dsp_report_e type;
|
||||
union{
|
||||
char data[MAX_REPORT_SIZE];
|
||||
struct csi_dsp_buffer buf;
|
||||
};
|
||||
}csi_dsp_report_item_t;
|
||||
|
||||
typedef struct csi_dsp_algo_load_req{
|
||||
uint16_t algo_id;
|
||||
@@ -217,16 +155,6 @@ typedef struct csi_dsp_algo_load_req{
|
||||
uint64_t algo_ptr;
|
||||
}csi_dsp_algo_load_req_t;
|
||||
|
||||
typedef struct csi_dsp_algo_load_resp{
|
||||
csi_dsp_status_e status;
|
||||
uint16_t algo_id;
|
||||
uint16_t buf_desc_num;
|
||||
uint16_t info_prop_des_num;
|
||||
uint16_t set_prop_des_num;
|
||||
}csi_dsp_algo_load_resp_t;
|
||||
|
||||
|
||||
void isp_algo_result_handler(void *context,void *data);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -110,6 +110,47 @@ struct csi_dsp_task_start_req{
|
||||
char task_ns[TASK_NAME_LINE];
|
||||
};
|
||||
|
||||
typedef enum csi_dsp_status{
|
||||
CSI_DSP_ERR_ILLEGAL_PARAM = -100,
|
||||
CSI_DSP_TASK_NOT_VALID,
|
||||
CSI_DSP_TASK_ALLOC_FAIL,
|
||||
CSI_DSP_TASK_ADD_TO_SCHEDULER_FAIL,
|
||||
CSI_DSP_TASK_ALREADY_RUNNING,
|
||||
CSI_DSP_TASK_START_FAIL,
|
||||
CSI_DSP_REPORTER_NOT_INIT,
|
||||
CSI_DSP_FE_NOT_VALID,
|
||||
CSI_DSP_FE_CONFIG_FAIL,
|
||||
CSI_DSP_BE_CONFIG_FAIL,
|
||||
CSI_DSP_BE_NOT_VALID,
|
||||
CSI_DSP_ALGO_INVALID,
|
||||
CSI_DSP_ALGO_ERR,
|
||||
CSI_DSP_FE_ERR,
|
||||
CSI_DSP_BE_ERR,
|
||||
CSI_DSP_BUF_TYPE_ERR,
|
||||
CSI_DSP_ALGO_LOAD_FAIL,
|
||||
CSI_DSP_MALLO_FAIL,
|
||||
CSI_DSP_ALGO_BUF_FAIL,
|
||||
CSI_DSP_FAIL,
|
||||
CSI_DSP_OK = 0,
|
||||
}csi_dsp_status_e;
|
||||
|
||||
struct csi_dsp_task_create_req{
|
||||
csi_dsp_task_mode_e type;
|
||||
int priority;
|
||||
};
|
||||
|
||||
typedef struct csi_dsp_algo_load_resp{
|
||||
csi_dsp_status_e status;
|
||||
uint16_t algo_id;
|
||||
uint16_t buf_desc_num;
|
||||
uint16_t info_prop_des_num;
|
||||
uint16_t set_prop_des_num;
|
||||
}csi_dsp_algo_load_resp_t;
|
||||
|
||||
struct csi_dsp_task_comm_resp{
|
||||
csi_dsp_status_e status;
|
||||
};
|
||||
|
||||
struct csi_dsp_task_create_resp{
|
||||
|
||||
csi_dsp_status_e status;
|
||||
@@ -129,15 +170,6 @@ struct csi_dsp_ip_test_par{
|
||||
int result_buf_size;
|
||||
};
|
||||
|
||||
// struct csi_dsp_algo_config_par{
|
||||
// uint16_t algo_id;
|
||||
// char* algo;
|
||||
// union
|
||||
// {
|
||||
// float gam_coef[4];
|
||||
// short beta_coef[4];
|
||||
// };
|
||||
// };
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -86,7 +86,7 @@ TEST_GROUP(DspPostProcessTestBasic)
|
||||
{
|
||||
|
||||
csi_dsp_task_release_request(req);
|
||||
FAIL_TEST("Add buffer:%d\n");
|
||||
FAIL_TEST("Add buffer fail\n");
|
||||
}
|
||||
|
||||
int *buf;
|
||||
@@ -134,10 +134,23 @@ TEST_GROUP(DspPostProcessTestBasic)
|
||||
printf("plane:%d, buf2 data:%d\n",j,buf[0]);
|
||||
}
|
||||
|
||||
struct setting{
|
||||
int with;
|
||||
int height;
|
||||
}setting_config;
|
||||
|
||||
setting_config.height = with;
|
||||
setting_config.with =height;
|
||||
if(csi_dsp_request_set_property(req,&setting_config,sizeof(setting_config)))
|
||||
{
|
||||
csi_dsp_task_release_request(req);
|
||||
FAIL_TEST("set property fail\n");
|
||||
}
|
||||
|
||||
if(csi_dsp_request_enqueue(req))
|
||||
{
|
||||
csi_dsp_task_release_request(req);
|
||||
FAIL_TEST("Add buffer:%d\n");
|
||||
FAIL_TEST("Add buffer fail\n");
|
||||
}
|
||||
gettimeofday(&time_enqueue, 0);
|
||||
req = csi_dsp_request_dequeue(task);
|
||||
|
||||
@@ -79,25 +79,37 @@ TEST(DspViEnhanceProcessTest,Isp2Dsp2RyProcessTestBasic)
|
||||
FAIL_TEST("reporter create fail\n");
|
||||
}
|
||||
struct csi_dsp_task_fe_para config_params;
|
||||
|
||||
config_params.frontend_type = CSI_DSP_FE_TYPE_ISP;
|
||||
config_params.task_id = -1;
|
||||
config_params.isp_param.id=0;
|
||||
config_params.isp_param.hor=640;
|
||||
config_params.isp_param.ver=480;
|
||||
config_params.isp_param.data_fmt=CSI_DSP_IMG_FMT_RAW12_ALGIN;
|
||||
config_params.isp_param.line_in_entry=640*2;
|
||||
config_params.isp_param.line_stride=640*2;
|
||||
config_params.isp_param.buffer_size=640*2*16*2;
|
||||
config_params.isp_param.buffer_addr=0xb0000000;
|
||||
|
||||
if(csi_dsp_task_config_frontend(vi_task,&config_params))
|
||||
if(csi_dsp_task_get_frontend(vi_task,&config_params))
|
||||
{
|
||||
FAIL_TEST("get isp config fail\n");
|
||||
}
|
||||
|
||||
config_params.frontend_type = CSI_DSP_FE_TYPE_ISP;
|
||||
config_params.task_id = -1;
|
||||
config_params.isp_param.id=0;
|
||||
config_params.isp_param.hor=640;
|
||||
config_params.isp_param.ver=480;
|
||||
config_params.isp_param.data_fmt=CSI_DSP_IMG_FMT_RAW12_ALGIN;
|
||||
config_params.isp_param.line_in_entry=640*2;
|
||||
config_params.isp_param.line_stride=640*2;
|
||||
config_params.isp_param.buffer_size=640*2*16*2;
|
||||
config_params.isp_param.buffer_addr=0xb0000000;
|
||||
|
||||
|
||||
if(csi_dsp_task_config_frontend(vi_task,&config_params))
|
||||
{
|
||||
FAIL_TEST("isp config fail\n");
|
||||
}
|
||||
|
||||
struct csi_dsp_task_be_para post_config;
|
||||
|
||||
if(csi_dsp_task_get_backend(vi_task,&post_config))
|
||||
{
|
||||
FAIL_TEST("get post-isp config fail\n");
|
||||
}
|
||||
|
||||
|
||||
post_config.backend_type = CSI_DSP_BE_TYPE_POST_ISP;
|
||||
post_config.task_id = -1;
|
||||
|
||||
|
||||
@@ -14,6 +14,34 @@ struct message{
|
||||
char message[PAYLOAD_SIZE];
|
||||
};
|
||||
|
||||
static void isp_algo_result_handler(void *context,void *data)
|
||||
{
|
||||
csi_dsp_report_item_t *msg=(csi_dsp_report_item_t *)data;
|
||||
printf("report recived:%x\n",msg->type);
|
||||
switch(msg->type)
|
||||
{
|
||||
case CSI_DSP_REPORT_ISP_ERR:
|
||||
printf("ISP error:%d\n",msg->data[0]);
|
||||
break;
|
||||
case CSI_DSP_REPORT_RY_ERR:
|
||||
printf("Post ISP error\n",msg->data[0]);
|
||||
break;
|
||||
case CSI_DSP_REPORT_ALGO_ERR:
|
||||
printf("algo err\n");
|
||||
break;
|
||||
case CSI_DSP_REPORT_VI_PRE_ERR:
|
||||
break;
|
||||
case CSI_DSP_REPORT_RESULT:
|
||||
break;
|
||||
case CSI_DSP_REPORT_HEARTBEAT_ERR:
|
||||
printf("heartbeat not detect\n");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
// void vi_callback( void *context,void * data)
|
||||
// {}
|
||||
int main(int argc, char *argv[])
|
||||
|
||||
Reference in New Issue
Block a user