csi_dsp_core.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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. */
  23. #ifndef _CSI_DSP_CORE_H
  24. #define _CSI_DSP_CORE_H
  25. #include <string.h>
  26. #include "xrp_api.h"
  27. #include "csi_dsp_task_defs.h"
  28. #include "csi_dsp_post_process_defs.h"
  29. #include "dsp_ps_ns.h"
  30. #include "list.h"
  31. #include <pthread.h>
  32. #ifdef __cplusplus
  33. extern "C" {
  34. #endif
  35. struct csi_dsp_logger{
  36. struct xrp_queue *comm_queue;
  37. struct log_ops{
  38. int (*create)(int mode);
  39. int(*enable)();
  40. int (*disable)();
  41. };
  42. };
  43. struct csi_dsp_monitor{
  44. struct xrp_queue *comm_queue;
  45. struct mon_ops{
  46. int(*enable)();
  47. int (*disable)();
  48. };
  49. };
  50. typedef struct dsp_handler_item{
  51. struct list_head head;
  52. void* handler;
  53. }dsp_handler_item_t;
  54. struct csi_dsp_instance{
  55. int id;
  56. struct xrp_device *device;
  57. struct xrp_queue *comm_queue;
  58. struct csi_dsp_logger *logger_impl;
  59. struct csi_dsp_monitor *monitor_impl;
  60. struct xrp_report *report_impl;
  61. struct list_head task_list;
  62. };
  63. struct csi_dsp_task_handler{
  64. int task_id;
  65. char task_ns[TASK_NAME_LINE];
  66. csi_dsp_task_mode_e mode;
  67. struct csi_dsp_instance *instance;
  68. struct xrp_queue *queue;
  69. struct csi_dsp_task_fe_para fe;
  70. struct csi_dsp_task_be_para be;
  71. struct csi_dsp_algo_config_par algo;
  72. struct xrp_buffer_group *buffers; //store task level buf info
  73. int priority;
  74. int report_id;
  75. uint32_t report_size;
  76. int (*cb)(void*context,void*data);
  77. void *context;
  78. void *private;
  79. };
  80. typedef struct task_event_item{
  81. struct list_head head;
  82. struct xrp_event * event;
  83. struct csi_sw_task_req* req;
  84. csi_dsp_status_e req_status;
  85. }task_event_item_t;
  86. typedef struct csi_dsp_sw_task_manager{
  87. struct list_head event_list;
  88. int event_num;
  89. pthread_mutex_t mutex;
  90. }csi_dsp_sw_task_manager_t;
  91. int csi_dsp_test_config(void* dsp ,struct csi_dsp_ip_test_par* config_para,void* buf);
  92. int csi_dsp_cmd_send(const struct xrp_queue *queue,int cmd_type,void * cmd_payload,
  93. size_t payload_size,void *resp, size_t resp_size,struct xrp_buffer_group *buffer_group);
  94. int csi_dsp_enable_heartbeat_check(struct csi_dsp_instance *dsp ,int secs);
  95. int csi_dsp_disable_heartbeat_check();
  96. int csi_dsp_buf_flush( struct xrp_device *device,struct csi_dsp_buffer *buffers);
  97. #ifdef __cplusplus
  98. }
  99. #endif
  100. #endif