hi_dsp.h 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. /******************************************************************************
  2. Copyright (C), 2001-2017, Hisilicon Tech. Co., Ltd.
  3. ******************************************************************************
  4. File Name : hi_dsp.h
  5. Version : Initial Draft
  6. Author : Hisilicon multimedia software (SVP) group
  7. Created : 2017/10/17
  8. Description :
  9. History :
  10. 1.Date : 2017/10/17
  11. Author :
  12. Modification: Created file
  13. ******************************************************************************/
  14. #ifndef _HI_DSP_H_
  15. #define _HI_DSP_H_
  16. #ifdef __cplusplus
  17. #if __cplusplus
  18. extern "C"{
  19. #endif
  20. #endif
  21. #include "hi_comm_svp.h"
  22. //if sdk environment,include hi_common.h,else typedef HI_S32 SVP_DSP_HANDLE
  23. #include "hi_common.h"
  24. /**************************************SVP_DSP Error Code***********************************************************************/
  25. typedef enum hiEN_SVP_DSP_ERR_CODE_E
  26. {
  27. ERR_SVP_DSP_SYS_TIMEOUT = 0x40, /* SVP_DSP process timeout */
  28. ERR_SVP_DSP_QUERY_TIMEOUT = 0x41, /* SVP_DSP query timeout */
  29. ERR_SVP_DSP_CFG_ERR = 0x42, /* SVP_DSP Configure error */
  30. ERR_SVP_DSP_BUTT
  31. }EN_SVP_DSP_ERR_CODE_E;
  32. /*Invalid device ID*/
  33. #define HI_ERR_SVP_DSP_INVALID_DEVID HI_DEF_ERR(HI_ID_SVP_DSP, EN_ERR_LEVEL_ERROR, EN_ERR_INVALID_DEVID)
  34. /*Invalid channel ID*/
  35. #define HI_ERR_SVP_DSP_INVALID_CHNID HI_DEF_ERR(HI_ID_SVP_DSP, EN_ERR_LEVEL_ERROR, EN_ERR_INVALID_CHNID)
  36. /*At least one parameter is illegal. For example, an illegal enumeration value exists.*/
  37. #define HI_ERR_SVP_DSP_ILLEGAL_PARAM HI_DEF_ERR(HI_ID_SVP_DSP, EN_ERR_LEVEL_ERROR, EN_ERR_ILLEGAL_PARAM)
  38. /*The channel exists.*/
  39. #define HI_ERR_SVP_DSP_EXIST HI_DEF_ERR(HI_ID_SVP_DSP, EN_ERR_LEVEL_ERROR, EN_ERR_EXIST)
  40. /*The UN exists.*/
  41. #define HI_ERR_SVP_DSP_UNEXIST HI_DEF_ERR(HI_ID_SVP_DSP, EN_ERR_LEVEL_ERROR, EN_ERR_UNEXIST)
  42. /*A null point is used.*/
  43. #define HI_ERR_SVP_DSP_NULL_PTR HI_DEF_ERR(HI_ID_SVP_DSP, EN_ERR_LEVEL_ERROR, EN_ERR_NULL_PTR)
  44. /*Try to enable or initialize the system, device, or channel before configuring attributes.*/
  45. #define HI_ERR_SVP_DSP_NOT_CONFIG HI_DEF_ERR(HI_ID_SVP_DSP, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_CONFIG)
  46. /*The operation is not supported currently.*/
  47. #define HI_ERR_SVP_DSP_NOT_SURPPORT HI_DEF_ERR(HI_ID_SVP_DSP, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_SUPPORT)
  48. /*The operation, changing static attributes for example, is not permitted.*/
  49. #define HI_ERR_SVP_DSP_NOT_PERM HI_DEF_ERR(HI_ID_SVP_DSP, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_PERM)
  50. /*A failure caused by the malloc memory occurs.*/
  51. #define HI_ERR_SVP_DSP_NOMEM HI_DEF_ERR(HI_ID_SVP_DSP, EN_ERR_LEVEL_ERROR, EN_ERR_NOMEM)
  52. /*A failure caused by the malloc buffer occurs.*/
  53. #define HI_ERR_SVP_DSP_NOBUF HI_DEF_ERR(HI_ID_SVP_DSP, EN_ERR_LEVEL_ERROR, EN_ERR_NOBUF)
  54. /*The buffer is empty.*/
  55. #define HI_ERR_SVP_DSP_BUF_EMPTY HI_DEF_ERR(HI_ID_SVP_DSP, EN_ERR_LEVEL_ERROR, EN_ERR_BUF_EMPTY)
  56. /*No buffer is provided for storing new data.*/
  57. #define HI_ERR_SVP_DSP_BUF_FULL HI_DEF_ERR(HI_ID_SVP_DSP, EN_ERR_LEVEL_ERROR, EN_ERR_BUF_FULL)
  58. /*The system is not ready because it may be not initialized or loaded.
  59. *The error code is returned when a device file fails to be opened. */
  60. #define HI_ERR_SVP_DSP_NOTREADY HI_DEF_ERR(HI_ID_SVP_DSP, EN_ERR_LEVEL_ERROR, EN_ERR_SYS_NOTREADY)
  61. /*The source address or target address is incorrect during the operations such as calling copy_from_user or copy_to_user.*/
  62. #define HI_ERR_SVP_DSP_BADADDR HI_DEF_ERR(HI_ID_SVP_DSP, EN_ERR_LEVEL_ERROR, EN_ERR_BADADDR)
  63. /*The resource is busy during the operations such as destroying a VENC channel without deregistering it.*/
  64. #define HI_ERR_SVP_DSP_BUSY HI_DEF_ERR(HI_ID_SVP_DSP, EN_ERR_LEVEL_ERROR, EN_ERR_BUSY)
  65. /*SVP_DSP process timeout*/
  66. #define HI_ERR_SVP_DSP_SYS_TIMEOUT HI_DEF_ERR(HI_ID_SVP_DSP, EN_ERR_LEVEL_ERROR, ERR_SVP_DSP_SYS_TIMEOUT)
  67. /*SVP_DSP query timeout*/
  68. #define HI_ERR_SVP_DSP_QUERY_TIMEOUT HI_DEF_ERR(HI_ID_SVP_DSP, EN_ERR_LEVEL_ERROR, ERR_SVP_DSP_QUERY_TIMEOUT)
  69. /*SVP_DSP configure error*/
  70. #define HI_ERR_SVP_DSP_CFG_ERR HI_DEF_ERR(HI_ID_SVP_DSP, EN_ERR_LEVEL_ERROR, ERR_SVP_DSP_CFG_ERR)
  71. /*SVP_DSP core id*/
  72. typedef enum hiSVP_DSP_ID_E
  73. {
  74. SVP_DSP_ID_0 = 0x0,
  75. SVP_DSP_ID_1 = 0x1,
  76. SVP_DSP_ID_2 = 0x2,
  77. SVP_DSP_ID_3 = 0x3,
  78. SVP_DSP_ID_BUTT
  79. }SVP_DSP_ID_E;
  80. /*SVP_DSP priority*/
  81. typedef enum hiSVP_DSP_PRI_E
  82. {
  83. SVP_DSP_PRI_0 = 0x0,
  84. SVP_DSP_PRI_1 = 0x1,
  85. SVP_DSP_PRI_2 = 0x2,
  86. SVP_DSP_PRI_BUTT
  87. }SVP_DSP_PRI_E;
  88. /*SVP_DSP memory type*/
  89. typedef enum hiSVP_DSP_MEM_TYPE_E
  90. {
  91. SVP_DSP_MEM_TYPE_SYS_DDR_DSP_0 = 0x0,
  92. SVP_DSP_MEM_TYPE_IRAM_DSP_0 = 0x1,
  93. SVP_DSP_MEM_TYPE_DRAM_0_DSP_0 = 0x2,
  94. SVP_DSP_MEM_TYPE_DRAM_1_DSP_0 = 0x3,
  95. SVP_DSP_MEM_TYPE_SYS_DDR_DSP_1 = 0x4,
  96. SVP_DSP_MEM_TYPE_IRAM_DSP_1 = 0x5,
  97. SVP_DSP_MEM_TYPE_DRAM_0_DSP_1 = 0x6,
  98. SVP_DSP_MEM_TYPE_DRAM_1_DSP_1 = 0x7,
  99. SVP_DSP_MEM_TYPE_SYS_DDR_DSP_2 = 0x8,
  100. SVP_DSP_MEM_TYPE_IRAM_DSP_2 = 0x9,
  101. SVP_DSP_MEM_TYPE_DRAM_0_DSP_2 = 0xA,
  102. SVP_DSP_MEM_TYPE_DRAM_1_DSP_2 = 0xB,
  103. SVP_DSP_MEM_TYPE_SYS_DDR_DSP_3 = 0xC,
  104. SVP_DSP_MEM_TYPE_IRAM_DSP_3 = 0xD,
  105. SVP_DSP_MEM_TYPE_DRAM_0_DSP_3 = 0xE,
  106. SVP_DSP_MEM_TYPE_DRAM_1_DSP_3 = 0xF,
  107. SVP_DSP_MEM_TYPE_BUTT
  108. }SVP_DSP_MEM_TYPE_E;
  109. /*SVP_DSP cmd*/
  110. typedef enum hiSVP_DSP_CMD_E
  111. {
  112. SVP_DSP_CMD_INIT = 0x0,
  113. SVP_DSP_CMD_EXIT = 0x1,
  114. SVP_DSP_CMD_ERODE_3X3 = 0x2,
  115. SVP_DSP_CMD_DILATE_3X3 = 0x3,
  116. #if CONFIG_HI_PHOTO_SUPPORT
  117. SVP_DSP_CMD_PHOTO_PROC,
  118. #endif
  119. SVP_DSP_CMD_BUTT
  120. }SVP_DSP_CMD_E;
  121. /*SVP_DSP ARM->DSP request message*/
  122. typedef struct hiSVP_DSP_MESSAGE_S
  123. {
  124. HI_U32 u32CMD; /*CMD ID, user-defined SVP_DSP_CMD_BUTT + */
  125. HI_U32 u32MsgId; /*Message ID*/
  126. HI_U64 u64Body; /*Message body*/
  127. HI_U32 u32BodyLen; /*Length of pBody*/
  128. } SVP_DSP_MESSAGE_S;
  129. #ifdef __cplusplus
  130. #if __cplusplus
  131. }
  132. #endif
  133. #endif
  134. #endif/*_HI_DSP_H_*/