csi_dsp_post_process_defs.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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_POST_DEFS_H
  27. #define _CSI_DSP_POST_DEFS_H
  28. #include <string.h>
  29. #include <stdint.h>
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33. #define CSI_DSP_MAX_BUFFER 8
  34. typedef uint8_t dsp_id_t;
  35. typedef enum csi_dsp_img_fmt{
  36. CSI_DSP_IMG_FMT_RAW8 =0,
  37. CSI_DSP_IMG_FMT_RAW10_UNALGIN,
  38. CSI_DSP_IMG_FMT_RAW10_ALGIN,
  39. CSI_DSP_IMG_FMT_RAW12_UNALGIN,
  40. CSI_DSP_IMG_FMT_RAW12_ALGIN,
  41. CSI_DSP_IMG_FMT_RAW16_UNALGIN,
  42. CSI_DSP_IMG_FMT_RAW16_ALGIN,
  43. CSI_DSP_IMG_FMT_NV12,
  44. CSI_DSP_IMG_FMT_NV21,
  45. CSI_DSP_IMG_FMT_I420, /* 420 3P Y/U/V */
  46. CSI_DSP_IMG_FMT_YV12, /* 420 3P Y/V/U */
  47. CSI_DSP_IMG_FMT_YUY2, /* 422 1P YUYV */
  48. CSI_DSP_IMG_FMT_YVYU, /* 422 1P YVYU */
  49. CSI_DSP_IMG_FMT_YV16, /* 422 3P Y/V/U */
  50. CSI_DSP_IMG_FMT_Y, /* Y only */
  51. CSI_DSP_IMG_FMT_420_CHROME, /* u or v only */
  52. CSI_DSP_IMG_FMT_422_CHROME, /* u or v only */
  53. CSI_DSP_IMG_FMT_420_UV_IL, /* uv interleave*/
  54. CSI_DSP_IMG_FMT_422_UV_IL, /* uv interleave*/
  55. CSI_DSP_IMG_FMT_INVALID,
  56. } csi_dsp_img_fmt_e;
  57. enum buffer_property{
  58. CSI_DSP_BUFFER_IN,
  59. CSI_DSP_BUFFER_OUT,
  60. CSI_DSP_BUFFER_IN_OUT,
  61. };
  62. struct csi_dsp_plane {
  63. int fd;
  64. uint32_t stride; /* if buffer type is image */
  65. uint32_t size;
  66. uint64_t buf_phy;
  67. uint64_t buf_vir;
  68. };
  69. typedef enum csi_dsp_buf_type {
  70. CSI_DSP_BUF_TYPE_DMA_BUF_IMPORT, // memory allocated via dma-buf from extern
  71. CSI_DSP_BUF_TYPE_DMA_BUF_EXPORT, // memory allocated via dma-buf from internal
  72. CSI_DSP_BUF_ALLOC_APP, // memory allocated via APP malloc
  73. CSI_DSP_BUF_ALLOC_DRV, // memory allocated via DSP Drvier
  74. CSI_DSP_BUF_ALLOC_FM, // memory will auto acquire by DSP FM
  75. } csi_dsp_buf_type_e;
  76. struct csi_dsp_buffer {
  77. dsp_id_t buf_id;
  78. enum buffer_property dir;
  79. csi_dsp_buf_type_e type;
  80. uint8_t format;
  81. uint8_t plane_count;
  82. uint32_t width;
  83. uint32_t height;
  84. struct csi_dsp_plane planes[3];
  85. };
  86. struct csi_dsp_algo_config_par{
  87. int16_t algo_id;
  88. int task_id;
  89. uint64_t algo_ptr;
  90. uint64_t sett_ptr;
  91. uint32_t sett_length;
  92. uint64_t bufs_ptr;
  93. uint32_t buf_num;
  94. uint32_t algo_size;
  95. };
  96. typedef enum csi_dsp_sw_req_status {
  97. CSI_DSP_SW_REQ_IDLE,
  98. CSI_DSP_SW_REQ_RUNNING,
  99. CSI_DSP_SW_REQ_FAIL,
  100. CSI_DSP_SW_REQ_DONE,
  101. } csi_dsp_sw_req_status_e;
  102. struct csi_sw_task_req{
  103. uint16_t algo_id;
  104. uint16_t request_id;
  105. uint16_t buffer_num;
  106. csi_dsp_sw_req_status_e status;
  107. uint32_t sett_length;
  108. uint64_t sett_ptr;
  109. struct csi_dsp_buffer buffers[CSI_DSP_MAX_BUFFER];
  110. void *task;
  111. void* priv;
  112. };
  113. typedef enum csi_dsp_algo_lib_id{
  114. CSI_DSP_ALGO_LIB_COPY,
  115. CSI_DSP_ALGO_LIB_0,
  116. CSI_DSP_ALGO_LIB_1,
  117. }csi_dsp_algo_lib_id_e;
  118. #ifdef __cplusplus
  119. }
  120. #endif
  121. #endif