csi_dsp_task_defs.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. /*
  2. * Copyright (c) 2021 Alibaba Group. All rights reserved.
  3. * License-Identifier: Apache-2.0
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License"); you may
  6. * not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  13. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. *
  17. */
  18. /*!
  19. * \file
  20. * \brief This section defines DSP shared strcut for CPU&DSP&APP.
  21. *
  22. * General properties:
  23. * 1. Post porcess define data and strcut, visiable for APP
  24. * 2. user define data shared bedtween DSP ans host
  25. */
  26. #ifndef _CSI_DSP_TASK_DEFS_H
  27. #define _CSI_DSP_TASK_DEFS_H
  28. #include <string.h>
  29. #include <stdint.h>
  30. #include "csi_dsp_post_process_defs.h"
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34. #define MAX_REPORT_SIZE 256
  35. #define CSI_DSP_HW_TASK_EXTRA_BUF_START_INDEX 2
  36. typedef struct {
  37. uint16_t id;
  38. uint16_t hor;
  39. uint16_t ver;
  40. uint16_t data_fmt;
  41. uint16_t line_in_entry;
  42. uint16_t line_stride;
  43. uint32_t buffer_size;
  44. uint64_t buffer_addr;
  45. }sisp_config_par;
  46. typedef sisp_config_par spost_isp_config_par;
  47. // typedef sisp_config_par svipre_config_par;
  48. typedef struct vipre_config_par{
  49. uint8_t id;
  50. uint8_t act_channel;
  51. uint8_t data_fmt;
  52. uint8_t buffer_num;
  53. uint16_t line_num;
  54. uint16_t hor;
  55. uint16_t ver;
  56. uint16_t line_stride;
  57. uint32_t buffer_size;
  58. uint64_t buffer_addr[12];
  59. }vipre_config_par_t;
  60. typedef struct {
  61. uint16_t algo_id;
  62. float gamma; // float鍙傛暟
  63. float coef1;
  64. float coef2;
  65. float coef3;
  66. float coef4;
  67. short beta; // short鍨嬪弬鏁�
  68. short beta1;
  69. short beta2;
  70. short beta3;
  71. short beta4;
  72. }salgo_config_par;
  73. typedef enum{
  74. CSI_DSP_REPORT_NORMAL,
  75. CSI_DSP_REPORT_RESULT,
  76. CSI_DSP_REPORT_RESULT_WITH_EXRA_PARAM,
  77. CSI_DSP_REPORT_ALGO_ERR,
  78. CSI_DSP_REPORT_PS_ERR,
  79. CSI_DSP_REPORT_ISP_ERR,
  80. CSI_DSP_REPORT_RY_ERR,
  81. CSI_DSP_REPORT_VI_PRE_ERR,
  82. CSI_DSP_REPORT_NO_BUF,
  83. CSI_DSP_REPORT_HEARTBEAT_ERR,
  84. CSI_DSP_HW_FRAME_DROP,
  85. CSI_DSP_REPORT_EXRA_PARAM,
  86. }csi_dsp_report_e;
  87. typedef struct dsp_frame{
  88. uint64_t p_frame_buff[3];
  89. uint32_t frame_buff_size[3];
  90. int32_t frame_width;
  91. int32_t frame_height;
  92. int32_t frame_pitch;
  93. uint8_t pixel_res;
  94. uint8_t num_channels;
  95. int8_t fmt;
  96. }dsp_frame_t;
  97. typedef enum csi_dsp_task_mode{
  98. CSI_DSP_TASK_SW_TO_SW =0x1<<0, /*SW Queue to handle in / data/exception */
  99. CSI_DSP_TASK_SW_TO_HW =0x1<<1, /*SW Queue to handle in and exception / Report handlere exception,HW handl out*/
  100. CSI_DSP_TASK_HW_TO_SW =0x1<<2, /* HW send handle in, Report handler out and exception*/
  101. CSI_DSP_TASK_HW_TO_HW =0x01<<3, /* Hw handler in&out Report handler exception*/
  102. CSI_DSP_TASK_SW = (CSI_DSP_TASK_SW_TO_HW|CSI_DSP_TASK_SW_TO_SW),
  103. CSI_DSP_TASK_HW = (CSI_DSP_TASK_HW_TO_SW|CSI_DSP_TASK_HW_TO_HW),
  104. }csi_dsp_task_mode_e;
  105. //#define CSI_DSP_TASK_SW (CSI_DSP_TASK_SW_TO_HW|CSI_DSP_TASK_SW_TO_SW)
  106. //#define CSI_DSP_TASK_HW (CSI_DSP_TASK_HW_TO_SW|CSI_DSP_TASK_HW_TO_HW)
  107. typedef enum csi_dsp_status{
  108. CSI_DSP_ERR_ILLEGAL_PARAM = -100,
  109. CSI_DSP_TASK_NOT_VALID,
  110. CSI_DSP_TASK_ALLOC_FAIL,
  111. CSI_DSP_TASK_ADD_TO_SCHEDULER_FAIL,
  112. CSI_DSP_TASK_ALREADY_RUNNING,
  113. CSI_DSP_TASK_START_FAIL,
  114. CSI_DSP_REPORTER_NOT_INIT,
  115. CSI_DSP_FE_NOT_VALID,
  116. CSI_DSP_FE_CONFIG_FAIL,
  117. CSI_DSP_BE_CONFIG_FAIL,
  118. CSI_DSP_BE_NOT_VALID,
  119. CSI_DSP_ALGO_INVALID,
  120. CSI_DSP_ALGO_ERR,
  121. CSI_DSP_FE_ERR,
  122. CSI_DSP_BE_ERR,
  123. CSI_DSP_BUF_TYPE_ERR,
  124. CSI_DSP_ALGO_LOAD_FAIL,
  125. CSI_DSP_MALLO_FAIL,
  126. CSI_DSP_ALGO_BUF_FAIL,
  127. CSI_DSP_FAIL,
  128. CSI_DSP_OK = 0,
  129. }csi_dsp_status_e;
  130. struct csi_dsp_task_create_req{
  131. csi_dsp_task_mode_e type;
  132. int priority;
  133. };
  134. struct csi_dsp_task_comm_resp{
  135. csi_dsp_status_e status;
  136. };
  137. enum csi_dsp_fe_type{
  138. CSI_DSP_FE_TYPE_CPU,
  139. CSI_DSP_FE_TYPE_ISP,
  140. CSI_DSP_FE_TYPE_VIPRE,
  141. CSI_DSP_FE_TYPE_INVALID,
  142. };
  143. enum csi_dsp_be_type{
  144. CSI_DSP_BE_TYPE_HOST,
  145. CSI_DSP_BE_TYPE_POST_ISP,
  146. CSI_DSP_BE_TYPE_INVALID,
  147. };
  148. enum csi_dsp_task_cfg{
  149. CSI_DSP_TASK_IDLE,
  150. CSI_DSP_TASK_START,
  151. CSI_DSP_TASK_STOP,
  152. };
  153. struct csi_dsp_task_fe_para{
  154. enum csi_dsp_fe_type frontend_type;
  155. int task_id;
  156. union{
  157. sisp_config_par isp_param;
  158. vipre_config_par_t vipre_param;
  159. };
  160. };
  161. typedef struct _sw_be_config_par{
  162. int num_buf;
  163. struct csi_dsp_buffer bufs[1];
  164. }sw_be_config_par;
  165. struct csi_dsp_task_be_para{
  166. enum csi_dsp_be_type backend_type;
  167. int task_id;
  168. union{
  169. sisp_config_par post_isp_param;
  170. sw_be_config_par sw_param;
  171. };
  172. };
  173. typedef struct csi_dsp_report_item{
  174. csi_dsp_report_e type;
  175. union{
  176. char data[MAX_REPORT_SIZE];
  177. struct csi_dsp_buffer buf;
  178. };
  179. }csi_dsp_report_item_t;
  180. typedef struct csi_dsp_algo_load_req{
  181. uint16_t algo_id;
  182. int task_id;
  183. uint64_t algo_ptr;
  184. }csi_dsp_algo_load_req_t;
  185. typedef struct csi_dsp_algo_load_resp{
  186. csi_dsp_status_e status;
  187. uint16_t algo_id;
  188. uint16_t buf_desc_num;
  189. uint16_t info_prop_des_num;
  190. uint16_t set_prop_des_num;
  191. }csi_dsp_algo_load_resp_t;
  192. void isp_algo_result_handler(void *context,void *data);
  193. #ifdef __cplusplus
  194. }
  195. #endif
  196. #endif