hi_comm_ive.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. /******************************************************************************
  2. Copyright (C), 2001-2014, Hisilicon Tech. Co., Ltd.
  3. ******************************************************************************
  4. File Name : hi_comm_ive.h
  5. Version : Initial Draft
  6. Author : Hisilicon multimedia software (IVE) group
  7. Created : 2011/05/16
  8. Description :
  9. 1.Date : 2011/05/16
  10. Modification: Created file
  11. 2.Date : 2013/07/01~2014/08/08
  12. Modification: Add MPI function
  13. ******************************************************************************/
  14. #ifndef _HI_COMM_IVE_H_
  15. #define _HI_COMM_IVE_H_
  16. #ifdef __cplusplus
  17. #if __cplusplus
  18. extern "C"{
  19. #endif
  20. #endif
  21. #include "hi_type.h"
  22. #include "hi_errno.h"
  23. /*-----------------------------------------------*
  24. * The fixed-point data type, will be used to *
  25. * represent float data in hardware calculations.*
  26. *-----------------------------------------------*/
  27. /*--u8bit----------------------------------------*/
  28. typedef unsigned char HI_U0Q8;
  29. typedef unsigned char HI_U1Q7;
  30. typedef unsigned char HI_U5Q3;
  31. /*--u16bit---------------------------------------*/
  32. typedef unsigned short HI_U0Q16;
  33. typedef unsigned short HI_U4Q12;
  34. typedef unsigned short HI_U6Q10;
  35. typedef unsigned short HI_U8Q8;
  36. typedef unsigned short HI_U9Q7;
  37. typedef unsigned short HI_U12Q4;
  38. typedef unsigned short HI_U14Q2;
  39. typedef unsigned short HI_U5Q11;
  40. typedef unsigned short HI_U1Q15;
  41. /*--s16bit---------------------------------------*/
  42. typedef short HI_S9Q7;
  43. typedef short HI_S14Q2;
  44. typedef short HI_S1Q15;
  45. /*--u32bit---------------------------------------*/
  46. typedef unsigned int HI_U22Q10;
  47. typedef unsigned int HI_U25Q7;
  48. typedef unsigned int HI_U21Q11;
  49. typedef unsigned int HI_U14Q18;
  50. /*--s32bit---------------------------------------*/
  51. typedef int HI_S25Q7;
  52. typedef int HI_S16Q16;
  53. typedef int HI_S14Q18;
  54. /*-----------------------------------------------*
  55. * The fixed-point data type combine with flag_bits.*
  56. *-----------------------------------------------*/
  57. /* 8bits unsigned integer,4bits decimal fraction,4bits flag_bits */
  58. typedef unsigned short HI_U8Q4F4;
  59. /* Type of the IVE_IMAGE_S data.Aded by tanbing 2013-7-22 */
  60. typedef enum hiIVE_IMAGE_TYPE_E
  61. {
  62. IVE_IMAGE_TYPE_U8C1 = 0x0,
  63. IVE_IMAGE_TYPE_S8C1 = 0x1,
  64. IVE_IMAGE_TYPE_YUV420SP = 0x2, /*YUV420 SemiPlanar*/
  65. IVE_IMAGE_TYPE_YUV422SP = 0x3, /*YUV422 SemiPlanar*/
  66. IVE_IMAGE_TYPE_YUV420P = 0x4, /*YUV420 Planar */
  67. IVE_IMAGE_TYPE_YUV422P = 0x5, /*YUV422 planar */
  68. IVE_IMAGE_TYPE_S8C2_PACKAGE = 0x6,
  69. IVE_IMAGE_TYPE_S8C2_PLANAR = 0x7,
  70. IVE_IMAGE_TYPE_S16C1 = 0x8,
  71. IVE_IMAGE_TYPE_U16C1 = 0x9,
  72. IVE_IMAGE_TYPE_U8C3_PACKAGE = 0xa,
  73. IVE_IMAGE_TYPE_U8C3_PLANAR = 0xb,
  74. IVE_IMAGE_TYPE_S32C1 = 0xc,
  75. IVE_IMAGE_TYPE_U32C1 = 0xd,
  76. IVE_IMAGE_TYPE_S64C1 = 0xe,
  77. IVE_IMAGE_TYPE_U64C1 = 0xf,
  78. IVE_IMAGE_TYPE_BUTT
  79. }IVE_IMAGE_TYPE_E;
  80. /* Definition of the IVE_IMAGE_S. Added by Tan Bing, 2013-7-22. */
  81. typedef struct hiIVE_IMAGE_S
  82. {
  83. HI_U64 au64PhyAddr[3]; /* RW;The physical address of the image */
  84. HI_U64 au64VirAddr[3]; /* RW;The virtual address of the image */
  85. HI_U32 au32Stride[3]; /* RW;The stride of the image */
  86. HI_U32 u32Width; /* RW;The width of the image */
  87. HI_U32 u32Height; /* RW;The height of the image */
  88. IVE_IMAGE_TYPE_E enType; /* RW;The type of the image */
  89. }IVE_IMAGE_S;
  90. typedef IVE_IMAGE_S IVE_SRC_IMAGE_S;
  91. typedef IVE_IMAGE_S IVE_DST_IMAGE_S;
  92. /*
  93. * Definition of the IVE_MEM_INFO_S.This struct special purpose for input or ouput, such as Hist, CCL, ShiTomasi.
  94. * Added by Chen Quanfu, 2013-7-23.
  95. */
  96. typedef struct hiIVE_MEM_INFO_S
  97. {
  98. HI_U64 u64PhyAddr; /* RW;The physical address of the memory */
  99. HI_U64 u64VirAddr; /* RW;The virtual address of the memory */
  100. HI_U32 u32Size; /* RW;The size of memory */
  101. }IVE_MEM_INFO_S;
  102. typedef IVE_MEM_INFO_S IVE_SRC_MEM_INFO_S;
  103. typedef IVE_MEM_INFO_S IVE_DST_MEM_INFO_S;
  104. /* Data struct ,created by Chen Quanfu 2013-07-19 */
  105. typedef struct hiIVE_DATA_S
  106. {
  107. HI_U64 u64PhyAddr; /* RW;The physical address of the data */
  108. HI_U64 u64VirAddr; /* RW;The virtaul address of the data */
  109. HI_U32 u32Stride; /* RW;The stride of 2D data by byte */
  110. HI_U32 u32Width; /* RW;The width of 2D data by byte */
  111. HI_U32 u32Height; /* RW;The height of 2D data by byte */
  112. HI_U32 u32Reserved;
  113. }IVE_DATA_S;
  114. typedef IVE_DATA_S IVE_SRC_DATA_S;
  115. typedef IVE_DATA_S IVE_DST_DATA_S;
  116. /* Definition of the union of IVE_8BIT_U.Added by Tan Bing, 2013-7-22.*/
  117. typedef union hiIVE_8BIT_U
  118. {
  119. HI_S8 s8Val;
  120. HI_U8 u8Val;
  121. }IVE_8BIT_U;
  122. /* Definition of u16 point */
  123. typedef struct hiIVE_POINT_U16_S
  124. {
  125. HI_U16 u16X; /* RW;The X coordinate of the point */
  126. HI_U16 u16Y; /* RW;The Y coordinate of the point */
  127. }IVE_POINT_U16_S;
  128. /*
  129. * Definition of s16 point
  130. */
  131. typedef struct hiIVE_POINT_S16_S
  132. {
  133. HI_U16 s16X; /* RW;The X coordinate of the point */
  134. HI_U16 s16Y; /* RW;The Y coordinate of the point */
  135. }IVE_POINT_S16_S;
  136. /*
  137. *Float point represented by Fixed-point SQ25.7
  138. */
  139. typedef struct hiIVE_POINT_S25Q7_S
  140. {
  141. HI_S25Q7 s25q7X; /* RW;The X coordinate of the point */
  142. HI_S25Q7 s25q7Y; /* RW;The Y coordinate of the point */
  143. }IVE_POINT_S25Q7_S;
  144. /* Definition of rectangle */
  145. typedef struct hiIVE_RECT_U16_S
  146. {
  147. HI_U16 u16X; /* RW;The location of X axis of the rectangle */
  148. HI_U16 u16Y; /* RW;The location of Y axis of the rectangle */
  149. HI_U16 u16Width; /* RW;The width of the rectangle */
  150. HI_U16 u16Height; /* RW;The height of the rectangle */
  151. }IVE_RECT_U16_S;
  152. typedef struct hiIVE_LOOK_UP_TABLE_S
  153. {
  154. IVE_MEM_INFO_S stTable;
  155. HI_U16 u16ElemNum; /* RW;LUT's elements number*/
  156. HI_U8 u8TabInPreci;
  157. HI_U8 u8TabOutNorm;
  158. HI_S32 s32TabInLower; /* RW;LUT's original input lower limit*/
  159. HI_S32 s32TabInUpper; /* RW;LUT's original input upper limit*/
  160. }IVE_LOOK_UP_TABLE_S;
  161. typedef enum hiEN_IVE_ERR_CODE_E
  162. {
  163. ERR_IVE_SYS_TIMEOUT = 0x40, /* IVE process timeout */
  164. ERR_IVE_QUERY_TIMEOUT = 0x41, /* IVE query timeout */
  165. ERR_IVE_OPEN_FILE = 0x42, /* IVE open file error */
  166. ERR_IVE_READ_FILE = 0x43, /* IVE read file error */
  167. ERR_IVE_WRITE_FILE = 0x44, /* IVE write file error */
  168. ERR_IVE_BUS_ERR = 0x45,
  169. ERR_IVE_BUTT
  170. }EN_IVE_ERR_CODE_E;
  171. typedef enum hiEN_FD_ERR_CODE_E
  172. {
  173. ERR_FD_SYS_TIMEOUT = 0x40, /* FD process timeout */
  174. ERR_FD_CFG = 0x41, /* FD configuration error */
  175. ERR_FD_FACE_NUM_OVER = 0x42, /* FD candidate face number over*/
  176. ERR_FD_OPEN_FILE = 0x43, /* FD open file error */
  177. ERR_FD_READ_FILE = 0x44, /* FD read file error */
  178. ERR_FD_WRITE_FILE = 0x45, /* FD write file error */
  179. ERR_FD_BUTT
  180. }EN_FD_ERR_CODE_E;
  181. /************************************************IVE error code ***********************************/
  182. /*Invalid device ID*/
  183. #define HI_ERR_IVE_INVALID_DEVID HI_DEF_ERR(HI_ID_IVE, EN_ERR_LEVEL_ERROR, EN_ERR_INVALID_DEVID)
  184. /*Invalid channel ID*/
  185. #define HI_ERR_IVE_INVALID_CHNID HI_DEF_ERR(HI_ID_IVE, EN_ERR_LEVEL_ERROR, EN_ERR_INVALID_CHNID)
  186. /*At least one parameter is illegal. For example, an illegal enumeration value exists.*/
  187. #define HI_ERR_IVE_ILLEGAL_PARAM HI_DEF_ERR(HI_ID_IVE, EN_ERR_LEVEL_ERROR, EN_ERR_ILLEGAL_PARAM)
  188. /*The channel exists.*/
  189. #define HI_ERR_IVE_EXIST HI_DEF_ERR(HI_ID_IVE, EN_ERR_LEVEL_ERROR, EN_ERR_EXIST)
  190. /*The UN exists.*/
  191. #define HI_ERR_IVE_UNEXIST HI_DEF_ERR(HI_ID_IVE, EN_ERR_LEVEL_ERROR, EN_ERR_UNEXIST)
  192. /*A null point is used.*/
  193. #define HI_ERR_IVE_NULL_PTR HI_DEF_ERR(HI_ID_IVE, EN_ERR_LEVEL_ERROR, EN_ERR_NULL_PTR)
  194. /*Try to enable or initialize the system, device, or channel before configuring attributes.*/
  195. #define HI_ERR_IVE_NOT_CONFIG HI_DEF_ERR(HI_ID_IVE, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_CONFIG)
  196. /*The operation is not supported currently.*/
  197. #define HI_ERR_IVE_NOT_SURPPORT HI_DEF_ERR(HI_ID_IVE, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_SUPPORT)
  198. /*The operation, changing static attributes for example, is not permitted.*/
  199. #define HI_ERR_IVE_NOT_PERM HI_DEF_ERR(HI_ID_IVE, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_PERM)
  200. /*A failure caused by the malloc memory occurs.*/
  201. #define HI_ERR_IVE_NOMEM HI_DEF_ERR(HI_ID_IVE, EN_ERR_LEVEL_ERROR, EN_ERR_NOMEM)
  202. /*A failure caused by the malloc buffer occurs.*/
  203. #define HI_ERR_IVE_NOBUF HI_DEF_ERR(HI_ID_IVE, EN_ERR_LEVEL_ERROR, EN_ERR_NOBUF)
  204. /*The buffer is empty.*/
  205. #define HI_ERR_IVE_BUF_EMPTY HI_DEF_ERR(HI_ID_IVE, EN_ERR_LEVEL_ERROR, EN_ERR_BUF_EMPTY)
  206. /*No buffer is provided for storing new data.*/
  207. #define HI_ERR_IVE_BUF_FULL HI_DEF_ERR(HI_ID_IVE, EN_ERR_LEVEL_ERROR, EN_ERR_BUF_FULL)
  208. /*The system is not ready because it may be not initialized or loaded.
  209. *The error code is returned when a device file fails to be opened. */
  210. #define HI_ERR_IVE_NOTREADY HI_DEF_ERR(HI_ID_IVE, EN_ERR_LEVEL_ERROR, EN_ERR_SYS_NOTREADY)
  211. /*The source address or target address is incorrect during the operations such as calling copy_from_user or copy_to_user.*/
  212. #define HI_ERR_IVE_BADADDR HI_DEF_ERR(HI_ID_IVE, EN_ERR_LEVEL_ERROR, EN_ERR_BADADDR)
  213. /*The resource is busy during the operations such as destroying a VENC channel without deregistering it.*/
  214. #define HI_ERR_IVE_BUSY HI_DEF_ERR(HI_ID_IVE, EN_ERR_LEVEL_ERROR, EN_ERR_BUSY)
  215. /*IVE process timeout: 0xA01D8040*/
  216. #define HI_ERR_IVE_SYS_TIMEOUT HI_DEF_ERR(HI_ID_IVE, EN_ERR_LEVEL_ERROR, ERR_IVE_SYS_TIMEOUT)
  217. /*IVE query timeout: 0xA01D8041*/
  218. #define HI_ERR_IVE_QUERY_TIMEOUT HI_DEF_ERR(HI_ID_IVE, EN_ERR_LEVEL_ERROR, ERR_IVE_QUERY_TIMEOUT)
  219. /*IVE open file error: 0xA01D8042*/
  220. #define HI_ERR_IVE_OPEN_FILE HI_DEF_ERR(HI_ID_IVE, EN_ERR_LEVEL_ERROR, ERR_IVE_OPEN_FILE)
  221. /*IVE read file error: 0xA01D8043*/
  222. #define HI_ERR_IVE_READ_FILE HI_DEF_ERR(HI_ID_IVE, EN_ERR_LEVEL_ERROR, ERR_IVE_READ_FILE)
  223. /*IVE read file error: 0xA01D8044*/
  224. #define HI_ERR_IVE_WRITE_FILE HI_DEF_ERR(HI_ID_IVE, EN_ERR_LEVEL_ERROR, ERR_IVE_WRITE_FILE)
  225. /*IVE Bus error: 0xA01D8045*/
  226. #define HI_ERR_IVE_BUS_ERR HI_DEF_ERR(HI_ID_IVE, EN_ERR_LEVEL_ERROR, ERR_IVE_BUS_ERR)
  227. /************************************************FD error code ***********************************/
  228. /*Invalid device ID*/
  229. #define HI_ERR_FD_INVALID_DEVID HI_DEF_ERR(HI_ID_FD, EN_ERR_LEVEL_ERROR, EN_ERR_INVALID_DEVID)
  230. /*Invalid channel ID*/
  231. #define HI_ERR_FD_INVALID_CHNID HI_DEF_ERR(HI_ID_FD, EN_ERR_LEVEL_ERROR, EN_ERR_INVALID_CHNID)
  232. /*At least one parameter is illegal. For example, an illegal enumeration value exists.*/
  233. #define HI_ERR_FD_ILLEGAL_PARAM HI_DEF_ERR(HI_ID_FD, EN_ERR_LEVEL_ERROR, EN_ERR_ILLEGAL_PARAM)
  234. /*The channel exists.*/
  235. #define HI_ERR_FD_EXIST HI_DEF_ERR(HI_ID_FD, EN_ERR_LEVEL_ERROR, EN_ERR_EXIST)
  236. /*The UN exists.*/
  237. #define HI_ERR_FD_UNEXIST HI_DEF_ERR(HI_ID_FD, EN_ERR_LEVEL_ERROR, EN_ERR_UNEXIST)
  238. /*A null point is used.*/
  239. #define HI_ERR_FD_NULL_PTR HI_DEF_ERR(HI_ID_FD, EN_ERR_LEVEL_ERROR, EN_ERR_NULL_PTR)
  240. /*Try to enable or initialize the system, device, or channel before configuring attributes.*/
  241. #define HI_ERR_FD_NOT_CONFIG HI_DEF_ERR(HI_ID_FD, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_CONFIG)
  242. /*The operation is not supported currently.*/
  243. #define HI_ERR_FD_NOT_SURPPORT HI_DEF_ERR(HI_ID_FD, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_SUPPORT)
  244. /*The operation, changing static attributes for example, is not permitted.*/
  245. #define HI_ERR_FD_NOT_PERM HI_DEF_ERR(HI_ID_FD, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_PERM)
  246. /*A failure caused by the malloc memory occurs.*/
  247. #define HI_ERR_FD_NOMEM HI_DEF_ERR(HI_ID_FD, EN_ERR_LEVEL_ERROR, EN_ERR_NOMEM)
  248. /*A failure caused by the malloc buffer occurs.*/
  249. #define HI_ERR_FD_NOBUF HI_DEF_ERR(HI_ID_FD, EN_ERR_LEVEL_ERROR, EN_ERR_NOBUF)
  250. /*The buffer is empty.*/
  251. #define HI_ERR_FD_BUF_EMPTY HI_DEF_ERR(HI_ID_FD, EN_ERR_LEVEL_ERROR, EN_ERR_BUF_EMPTY)
  252. /*No buffer is provided for storing new data.*/
  253. #define HI_ERR_FD_BUF_FULL HI_DEF_ERR(HI_ID_FD, EN_ERR_LEVEL_ERROR, EN_ERR_BUF_FULL)
  254. /*The system is not ready because it may be not initialized or loaded.
  255. *The error code is returned when a device file fails to be opened. */
  256. #define HI_ERR_FD_NOTREADY HI_DEF_ERR(HI_ID_FD, EN_ERR_LEVEL_ERROR, EN_ERR_SYS_NOTREADY)
  257. /*The source address or target address is incorrect during the operations such as calling copy_from_user or copy_to_user.*/
  258. #define HI_ERR_FD_BADADDR HI_DEF_ERR(HI_ID_FD, EN_ERR_LEVEL_ERROR, EN_ERR_BADADDR)
  259. /*The resource is busy during the operations such as destroying a VENC channel without deregistering it.*/
  260. #define HI_ERR_FD_BUSY HI_DEF_ERR(HI_ID_FD, EN_ERR_LEVEL_ERROR, EN_ERR_BUSY)
  261. /*FD process timeout: 0xA02F8040*/
  262. #define HI_ERR_FD_SYS_TIMEOUT HI_DEF_ERR(HI_ID_FD, EN_ERR_LEVEL_ERROR, ERR_FD_SYS_TIMEOUT)
  263. /*FD configuration error: 0xA02F8041*/
  264. #define HI_ERR_FD_CFG HI_DEF_ERR(HI_ID_FD, EN_ERR_LEVEL_ERROR, ERR_FD_CFG)
  265. /*FD candidate face number over: 0xA02F8042*/
  266. #define HI_ERR_FD_FACE_NUM_OVER HI_DEF_ERR(HI_ID_FD, EN_ERR_LEVEL_ERROR, ERR_FD_FACE_NUM_OVER)
  267. /*FD open file error: 0xA02F8043*/
  268. #define HI_ERR_FD_OPEN_FILE HI_DEF_ERR(HI_ID_FD, EN_ERR_LEVEL_ERROR, ERR_FD_OPEN_FILE)
  269. /*FD read file error: 0xA02F8044*/
  270. #define HI_ERR_FD_READ_FILE HI_DEF_ERR(HI_ID_FD, EN_ERR_LEVEL_ERROR, ERR_FD_READ_FILE)
  271. /*FD read file error: 0xA02F8045*/
  272. #define HI_ERR_FD_WRITE_FILE HI_DEF_ERR(HI_ID_FD, EN_ERR_LEVEL_ERROR, ERR_FD_WRITE_FILE)
  273. /************************************************ODT error code ***********************************/
  274. /*ODT Invalid channel ID: 0xA0308002*/
  275. #define HI_ERR_ODT_INVALID_CHNID HI_DEF_ERR(HI_ID_ODT, EN_ERR_LEVEL_ERROR, EN_ERR_INVALID_CHNID)
  276. /*ODT exist: 0xA0308004*/
  277. #define HI_ERR_ODT_EXIST HI_DEF_ERR(HI_ID_ODT, EN_ERR_LEVEL_ERROR, EN_ERR_EXIST)
  278. /*ODT unexist: 0xA0308005*/
  279. #define HI_ERR_ODT_UNEXIST HI_DEF_ERR(HI_ID_ODT, EN_ERR_LEVEL_ERROR, EN_ERR_UNEXIST)
  280. /*ODT The operation, changing static attributes for example, is not permitted: 0xA0308009*/
  281. #define HI_ERR_ODT_NOT_PERM HI_DEF_ERR(HI_ID_ODT, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_PERM)
  282. /*ODT the system is not ready because it may be not initialized: 0xA0308010*/
  283. #define HI_ERR_ODT_NOTREADY HI_DEF_ERR(HI_ID_ODT, EN_ERR_LEVEL_ERROR, EN_ERR_SYS_NOTREADY)
  284. /*ODT busy: 0xA0308012*/
  285. #define HI_ERR_ODT_BUSY HI_DEF_ERR(HI_ID_ODT, EN_ERR_LEVEL_ERROR, EN_ERR_BUSY)
  286. #ifdef __cplusplus
  287. #if __cplusplus
  288. }
  289. #endif
  290. #endif
  291. #endif/*__HI_COMM_IVE_H__*/