csi_dsp_api.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  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 CSI DSP API.
  21. *
  22. * General properties:
  23. * 1. API Handler DSP TASK CREATE
  24. * 2. API Handler DSP ALGO config
  25. * 3. API
  26. */
  27. #ifndef _CSI_DSP_API_H
  28. #define _CSI_DSP_API_H
  29. #include <string.h>
  30. #include <stdint.h>
  31. #include "csi_dsp_task_defs.h"
  32. #ifdef __cplusplus
  33. extern "C" {
  34. #endif
  35. /************* CPU interafce*********************************/
  36. /**
  37. * @description: * Open DSP device by index.
  38. * @param {int} dsp_id dsp index to create
  39. * @return {*} pointer to the opened device or NULL in case of error
  40. */
  41. void *csi_dsp_create_instance(int dsp_id);
  42. /**
  43. * @description: Close DSP device by index.
  44. * @param {void} *dsp ,dsp index to close
  45. * @return {int} return 0 when delete success, not 0 in case of error
  46. */
  47. int csi_dsp_delete_instance(void *dsp);
  48. /**
  49. * @description: create an task on an instance
  50. * Task have a dependece Algo
  51. * for CSI_DSP_TASK_HW (CSI_DSP_TASK_SW_TO_HW|CSI_DSP_TASK_SW_TO_SW)
  52. * both csi_dsp_task_config_frontend and csi_dsp_task_config_backend are needed to call
  53. * for CSI_DSP_TASK_SW_TO_SW use task req to handle seperate process req on this task
  54. * @param {void *} point to an dsp instance
  55. * @param {csi_dsp_task_mode_e} task_type
  56. * @return {*}pointer to the createrf task or NULL in case of error
  57. */
  58. void *csi_dsp_create_task(void * instance,csi_dsp_task_mode_e task_type);
  59. /**
  60. * @description: create a report handler on an instance
  61. * @param {void*} point to an dsp instance
  62. * @return {int} return 0 when create success, not 0 in case of error
  63. */
  64. int csi_dsp_create_reporter(void* dsp);
  65. /**
  66. * @description: destroy a report handler on an instance
  67. * @param {void} point to an dsp instance
  68. * @return {int} return 0 when create success, not 0 in case of error
  69. */
  70. int csi_dsp_destroy_reporter(void *dsp);
  71. /**
  72. * @description: destroy a task handler
  73. * @param {void} *task, point to an task handler
  74. * @return {int} return 0 when credestroy success, not 0 in case of error
  75. */
  76. void csi_dsp_destroy_task(void *task);
  77. /**
  78. * @description: config a task's frontend ,for SW Task
  79. * @param {void} *task
  80. * @param {csi_dsp_task_fe_para} *config_para
  81. * @return {*}
  82. */
  83. int csi_dsp_task_config_frontend(void *task,struct csi_dsp_task_fe_para *config_para);
  84. /**
  85. * @description:
  86. * @param {void} *task
  87. * @param {csi_dsp_task_fe_para} *config_para
  88. * @return {*}
  89. */
  90. int csi_dsp_task_get_frontend(void *task,struct csi_dsp_task_fe_para *config_para);
  91. /**
  92. * @description:
  93. * @param {void} *task
  94. * @param {csi_dsp_task_be_para} *config_para
  95. * @return {*}
  96. */
  97. int csi_dsp_task_config_backend(void *task,struct csi_dsp_task_be_para *config_para);
  98. /**
  99. * @description:
  100. * @param {void} *task
  101. * @param {csi_dsp_task_be_para} *config_para
  102. * @return {*}
  103. */
  104. int csi_dsp_task_get_backend(void *task,struct csi_dsp_task_be_para *config_para);
  105. /**
  106. * @description:
  107. * @param {void} *task
  108. * @param {csi_dsp_algo_config_par} *config_para
  109. * @return {*}
  110. */
  111. int csi_dsp_task_config_algo(void *task,struct csi_dsp_algo_config_par *config_para);
  112. /**
  113. * @description:
  114. * @param {void} *task_ctx
  115. * @param {csi_dsp_algo_load_req_t*} config_para
  116. * @return {*}
  117. */
  118. int csi_dsp_task_load_algo(void *task_ctx, csi_dsp_algo_load_req_t* config_para);
  119. /**
  120. * @description:
  121. * @param {void} *task_ctx
  122. * @return {*}
  123. */
  124. int csi_dsp_task_acquire_algo(void *task_ctx,char*name);
  125. /**
  126. * @description:
  127. * @param {void} *task
  128. * @return {*}
  129. */
  130. int csi_dsp_task_start(void *task);
  131. /**
  132. * @description:
  133. * @param {void} *task
  134. * @return {*}
  135. */
  136. int csi_dsp_task_stop(void *task);
  137. /**
  138. * @description:
  139. * @param {void} *task
  140. * @param { } int
  141. * @param {void*} context
  142. * @param {size_t} data_size
  143. * @return {*}
  144. */
  145. int csi_dsp_task_register_cb(void *task,
  146. int (*cb)(void*context,void*data),
  147. void* context,
  148. size_t data_size);
  149. /**
  150. * @description:
  151. * @param {void} *task
  152. * @return {*}
  153. */
  154. int csi_dsp_ps_task_unregister_cb(void *task);
  155. /**
  156. * @description:
  157. * @param {void} *task
  158. * @return {*}
  159. */
  160. struct csi_sw_task_req* csi_dsp_task_create_request(void *task);
  161. /**
  162. * @description:
  163. * @param {void *} task_ctx
  164. * @param {csi_dsp_buffer *} buffer
  165. * @return {*}
  166. */
  167. int csi_dsp_task_create_buffer(void * task_ctx,struct csi_dsp_buffer * buffer);
  168. /**
  169. * @description:
  170. * @param {void *} task_ctx
  171. * @param {csi_dsp_buffer *} buffer
  172. * @return {*}
  173. */
  174. int csi_dsp_task_free_buffer(void * task_ctx,struct csi_dsp_buffer * buffer);
  175. /**
  176. * @description:
  177. * @param {csi_sw_task_req*} req
  178. * @param {csi_dsp_buffer *} buffer
  179. * @return {*}
  180. */
  181. int csi_dsp_request_add_buffer(struct csi_sw_task_req* req,struct csi_dsp_buffer * buffer);
  182. /**
  183. * @description:
  184. * @param {csi_sw_task_req*} req
  185. * @param {void*} property
  186. * @param {size_t} sz
  187. * @return {*}
  188. */
  189. int csi_dsp_request_set_property(struct csi_sw_task_req* req,void* property,size_t sz);
  190. /**
  191. * @description:
  192. * @param {csi_sw_task_req*} req
  193. * @return {*}
  194. */
  195. int csi_dsp_request_enqueue(struct csi_sw_task_req* req);
  196. /**
  197. * @description:
  198. * @param {void} *task
  199. * @return {*}
  200. */
  201. struct csi_sw_task_req* csi_dsp_request_dequeue(void *task);
  202. /**
  203. * @description:
  204. * @param {csi_sw_task_req*} req
  205. * @return {*}
  206. */
  207. int csi_dsp_task_release_request(struct csi_sw_task_req* req);
  208. int csi_dsp_task_update_backend_buf(void *task_ctx,struct csi_dsp_task_be_para* config_para);
  209. int csi_dsp_test_config(void* dsp ,struct csi_dsp_ip_test_par* config_para,void* buf);
  210. #ifdef __cplusplus
  211. }
  212. #endif
  213. #endif