csi_dsp_task_defs.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  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_HW_ERROR,
  87. CSI_DSP_REPORT_HW_VIPRE_NM_OVERFLOW_FLOW,
  88. CSI_DSP_REPORT_HW_VIPRE_FIFO_ERROR,
  89. CSI_DSP_REPORT_HW_VIPRE_BUS_ERROR,
  90. CSI_DSP_REPORT_HW_ERROR_END,
  91. CSI_DSP_REPORT_MAX
  92. }csi_dsp_report_e;
  93. typedef struct dsp_frame{
  94. uint64_t p_frame_buff[3];
  95. uint32_t frame_buff_size[3];
  96. int32_t frame_width;
  97. int32_t frame_height;
  98. int32_t frame_pitch;
  99. uint8_t pixel_res;
  100. uint8_t num_channels;
  101. int8_t fmt;
  102. }dsp_frame_t;
  103. typedef enum csi_dsp_task_mode{
  104. CSI_DSP_TASK_SW_TO_SW =0x1<<0, /*SW Queue to handle in / data/exception */
  105. CSI_DSP_TASK_SW_TO_HW =0x1<<1, /*SW Queue to handle in and exception / Report handlere exception,HW handl out*/
  106. CSI_DSP_TASK_HW_TO_SW =0x1<<2, /* HW send handle in, Report handler out and exception*/
  107. CSI_DSP_TASK_HW_TO_HW =0x01<<3, /* Hw handler in&out Report handler exception*/
  108. CSI_DSP_TASK_SW = (CSI_DSP_TASK_SW_TO_HW|CSI_DSP_TASK_SW_TO_SW),
  109. CSI_DSP_TASK_HW = (CSI_DSP_TASK_HW_TO_SW|CSI_DSP_TASK_HW_TO_HW),
  110. }csi_dsp_task_mode_e;
  111. //#define CSI_DSP_TASK_SW (CSI_DSP_TASK_SW_TO_HW|CSI_DSP_TASK_SW_TO_SW)
  112. //#define CSI_DSP_TASK_HW (CSI_DSP_TASK_HW_TO_SW|CSI_DSP_TASK_HW_TO_HW)
  113. typedef enum csi_dsp_status{
  114. CSI_DSP_ERR_ILLEGAL_PARAM = -100,
  115. CSI_DSP_TASK_NOT_VALID,
  116. CSI_DSP_TASK_ALLOC_FAIL,
  117. CSI_DSP_TASK_ADD_TO_SCHEDULER_FAIL,
  118. CSI_DSP_TASK_ALREADY_RUNNING,
  119. CSI_DSP_TASK_START_FAIL,
  120. CSI_DSP_REPORTER_NOT_INIT,
  121. CSI_DSP_FE_NOT_VALID,
  122. CSI_DSP_FE_CONFIG_FAIL,
  123. CSI_DSP_BE_CONFIG_FAIL,
  124. CSI_DSP_BE_NOT_VALID,
  125. CSI_DSP_ALGO_INVALID,
  126. CSI_DSP_ALGO_ERR,
  127. CSI_DSP_FE_ERR,
  128. CSI_DSP_BE_ERR,
  129. CSI_DSP_BUF_TYPE_ERR,
  130. CSI_DSP_ALGO_LOAD_FAIL,
  131. CSI_DSP_MALLO_FAIL,
  132. CSI_DSP_ALGO_BUF_FAIL,
  133. CSI_DSP_FAIL,
  134. CSI_DSP_OK = 0,
  135. }csi_dsp_status_e;
  136. struct csi_dsp_task_create_req{
  137. csi_dsp_task_mode_e type;
  138. int priority;
  139. };
  140. struct csi_dsp_task_comm_resp{
  141. csi_dsp_status_e status;
  142. };
  143. enum csi_dsp_fe_type{
  144. CSI_DSP_FE_TYPE_CPU,
  145. CSI_DSP_FE_TYPE_ISP,
  146. CSI_DSP_FE_TYPE_VIPRE,
  147. CSI_DSP_FE_TYPE_INVALID,
  148. };
  149. enum csi_dsp_be_type{
  150. CSI_DSP_BE_TYPE_HOST,
  151. CSI_DSP_BE_TYPE_POST_ISP,
  152. CSI_DSP_BE_TYPE_INVALID,
  153. };
  154. enum csi_dsp_task_cfg{
  155. CSI_DSP_TASK_IDLE,
  156. CSI_DSP_TASK_START,
  157. CSI_DSP_TASK_STOP,
  158. };
  159. struct csi_dsp_task_fe_para{
  160. enum csi_dsp_fe_type frontend_type;
  161. int task_id;
  162. union{
  163. sisp_config_par isp_param;
  164. vipre_config_par_t vipre_param;
  165. };
  166. };
  167. typedef struct _sw_be_config_par{
  168. int num_buf;
  169. struct csi_dsp_buffer bufs[1];
  170. }sw_be_config_par;
  171. struct csi_dsp_task_be_para{
  172. enum csi_dsp_be_type backend_type;
  173. int task_id;
  174. union{
  175. sisp_config_par post_isp_param;
  176. sw_be_config_par sw_param;
  177. };
  178. };
  179. typedef struct csi_dsp_report_item{
  180. csi_dsp_report_e type;
  181. union{
  182. char data[MAX_REPORT_SIZE];
  183. struct csi_dsp_buffer buf;
  184. };
  185. }csi_dsp_report_item_t;
  186. typedef struct csi_dsp_algo_load_req{
  187. uint16_t algo_id;
  188. int task_id;
  189. uint64_t algo_ptr;
  190. }csi_dsp_algo_load_req_t;
  191. typedef struct csi_dsp_algo_load_resp{
  192. csi_dsp_status_e status;
  193. uint16_t algo_id;
  194. uint16_t buf_desc_num;
  195. uint16_t info_prop_des_num;
  196. uint16_t set_prop_des_num;
  197. }csi_dsp_algo_load_resp_t;
  198. void isp_algo_result_handler(void *context,void *data);
  199. #ifdef __cplusplus
  200. }
  201. #endif
  202. #endif