mpi_pciv.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. /******************************************************************************
  2. Copyright (C), 2001-2011, Hisilicon Tech. Co., Ltd.
  3. ******************************************************************************
  4. File Name : mpi_pciv.h
  5. Version : Initial Draft
  6. Author : Hisilicon Hi3511 MPP Team
  7. Created : 2009/06/23
  8. Last Modified :
  9. Description : mpi functions declaration
  10. Function List :
  11. History :
  12. 1.Date : 2009/06/23
  13. Author : z44949
  14. Modification: Create
  15. ******************************************************************************/
  16. #ifndef __MPI_PCIV_H__
  17. #define __MPI_PCIV_H__
  18. #include "hi_common.h"
  19. #include "hi_comm_video.h"
  20. #include "hi_comm_pciv.h"
  21. #ifdef __cplusplus
  22. #if __cplusplus
  23. extern "C"{
  24. #endif
  25. #endif /* __cplusplus */
  26. /*****************************************************************************
  27. Description : Create and initialize the pciv channel.
  28. Input : pcivChn ** The pciv channel id between [0, PCIV_MAX_CHN_NUM)
  29. pPcivAttr ** The attribute of pciv channel
  30. Output : None
  31. Return Value : HI_SUCCESS if success.
  32. HI_FAILURE if failure
  33. See Also : HI_MPI_PCIV_Destroy
  34. *****************************************************************************/
  35. HI_S32 HI_MPI_PCIV_Create(PCIV_CHN pcivChn,const PCIV_ATTR_S *pPcivAttr);
  36. /*****************************************************************************
  37. Description : Destroy the pciv channel
  38. Input : pcivChn ** The pciv channel id
  39. Output : None
  40. Return Value : HI_SUCCESS if success.
  41. HI_FAILURE if failure
  42. See Also : HI_MPI_PCIV_Create
  43. *****************************************************************************/
  44. HI_S32 HI_MPI_PCIV_Destroy(PCIV_CHN pcivChn);
  45. /*****************************************************************************
  46. Description : Set the attribute of pciv channel
  47. Input : pcivChn ** The pciv channel id
  48. pPcivAttr ** The attribute of pciv channel
  49. Output : None
  50. Return Value : HI_SUCCESS if success.
  51. HI_FAILURE if failure
  52. See Also : HI_MPI_PCIV_GetAttr
  53. *****************************************************************************/
  54. HI_S32 HI_MPI_PCIV_SetAttr(PCIV_CHN pcivChn,const PCIV_ATTR_S *pPcivAttr);
  55. /*****************************************************************************
  56. Description : Get the attribute of pciv channel
  57. Input : pcivChn ** The pciv channel id
  58. Output : pPcivAttr ** The attribute of pciv channel
  59. Return Value : HI_SUCCESS if success.
  60. HI_FAILURE if failure
  61. See Also : HI_MPI_PCIV_SetAttr
  62. *****************************************************************************/
  63. HI_S32 HI_MPI_PCIV_GetAttr(PCIV_CHN pcivChn, PCIV_ATTR_S *pPcivAttr);
  64. /*****************************************************************************
  65. Description : Start to send or receive video frame
  66. Input : pcivChn ** The pciv channel id
  67. Output : None
  68. Return Value : HI_SUCCESS if success.
  69. HI_FAILURE if failure
  70. See Also : HI_MPI_PCIV_Stop
  71. *****************************************************************************/
  72. HI_S32 HI_MPI_PCIV_Start(PCIV_CHN pcivChn);
  73. /*****************************************************************************
  74. Description : Stop send or receive video frame
  75. Input : pcivChn ** The pciv channel id
  76. Output : None
  77. Return Value : HI_SUCCESS if success.
  78. HI_FAILURE if failure
  79. See Also : HI_MPI_PCIV_Start
  80. *****************************************************************************/
  81. HI_S32 HI_MPI_PCIV_Stop(PCIV_CHN pcivChn);
  82. /*****************************************************************************
  83. Description : Create a series of dma task
  84. Input : pTask ** The task list to create
  85. Output : None
  86. Return Value : HI_SUCCESS if success.
  87. HI_FAILURE if failure
  88. See Also : None
  89. *****************************************************************************/
  90. HI_S32 HI_MPI_PCIV_DmaTask(PCIV_DMA_TASK_S *pTask);
  91. /*****************************************************************************
  92. Description : Alloc 'u32BlkSize' bytes memory and give the physical address
  93. The memory used by PCI must be located within the PCI window,
  94. So you should call this function to alloc it.
  95. Input : u32BlkSize ** The size of each memory block
  96. u32BlkCnt ** The count of memory block
  97. Output : u64PhyAddr ** The physical address of the memory
  98. Return Value : HI_SUCCESS if success.
  99. HI_FAILURE if failure
  100. See Also : None
  101. *****************************************************************************/
  102. HI_S32 HI_MPI_PCIV_Malloc(HI_U32 u32BlkSize, HI_U32 u32BlkCnt, HI_U64 au64PhyAddr[]);
  103. /*****************************************************************************
  104. Description : free memory with the physical address
  105. Input : u32BlkCnt ** The count of memory block
  106. u64PhyAddr ** The physical address of the memory
  107. Output : None
  108. Return Value : HI_SUCCESS if success.
  109. HI_FAILURE if failure
  110. See Also : None
  111. *****************************************************************************/
  112. HI_S32 HI_MPI_PCIV_Free(HI_U32 u32BlkCnt,const HI_U64 au64PhyAddr[]);
  113. /*****************************************************************************
  114. Description : Alloc 'u32BlkSize' bytes memory and give the physical address for one pciv channel
  115. The memory used by PCI host, pciv slave cann't use this interface.
  116. Input : pcivChn **pciv channel
  117. u32BlkSize ** The size of each memory block
  118. u32BlkCnt ** The count of memory block
  119. Output : u64PhyAddr ** The physical address of the memory
  120. Return Value : HI_SUCCESS if success.
  121. HI_FAILURE if failure
  122. See Also : None
  123. *****************************************************************************/
  124. HI_S32 HI_MPI_PCIV_MallocChnBuffer(PCIV_CHN pcivChn, HI_U32 u32BlkSize, HI_U32 u32BlkCnt, HI_U64 au64PhyAddr[]);
  125. /*****************************************************************************
  126. Description : free pciv channel memory with the physical address
  127. The memory used by PCI host, pciv slave cann't use this interface.
  128. Input : pcivChn ** pciv channel
  129. u32BlkCnt ** The count of memory block
  130. Output : None
  131. Return Value : HI_SUCCESS if success.
  132. HI_FAILURE if failure
  133. See Also : None
  134. *****************************************************************************/
  135. HI_S32 HI_MPI_PCIV_FreeChnBuffer(PCIV_CHN pcivChn, HI_U32 u32BlkCnt);
  136. /*****************************************************************************
  137. Description : Get the board ID of this board
  138. Input : None
  139. Output : None
  140. Return Value : The board ID if success
  141. HI_FAILURE or HI_ERR_PCIV_SYS_NOTREADY if failure
  142. See Also : HI_MPI_PCIV_GetBaseWindow
  143. *****************************************************************************/
  144. HI_S32 HI_MPI_PCIV_GetLocalId(HI_VOID);
  145. /*****************************************************************************
  146. Description : Enum all the connected chip.Call this function as follow.
  147. {
  148. HI_S32 s32ChipID[PCIV_MAX_CHIPNUM], i, s32Ret;
  149. s32Ret = HI_MPI_PCIV_EnumChip(s32ChipID);
  150. HI_ASSERT(HI_SUCCESS == s32Ret);
  151. for(i=0; i<PCIV_MAX_CHIPNUM; i++)
  152. {
  153. if(s32ChipID[i] == -1) break;
  154. printf("The chip%d is connected\n", s32ChipID[i]);
  155. }
  156. printf("Total %d chips are connected\n", i);
  157. }
  158. Input : s32ChipID ** The chip id array
  159. Output : None
  160. Return Value : HI_SUCCESS if success.
  161. HI_FAILURE if failure
  162. See Also : HI_MPI_PCIV_GetLocalId
  163. HI_MPI_PCIV_GetBaseWindow
  164. *****************************************************************************/
  165. HI_S32 HI_MPI_PCIV_EnumChip(HI_S32 as32ChipID[PCIV_MAX_CHIPNUM]);
  166. /*****************************************************************************
  167. Description : On the host, you can get all the slave borad's NP,PF and CFG window
  168. On the slave, you can only get the PF AHB Addres of itself.
  169. Input : s32ChipId ** The chip Id which you want to access
  170. Output : pBase ** On host pBase->u32NpWinBase,
  171. pBase->u32PfWinBase,
  172. pBase->u32CfgWinBase
  173. On Slave pBase->u32PfAHBAddr
  174. Return Value : HI_SUCCESS if success.
  175. HI_FAILURE if failure
  176. See Also : HI_MPI_PCIV_GetLocalId
  177. *****************************************************************************/
  178. HI_S32 HI_MPI_PCIV_GetBaseWindow(HI_S32 s32ChipId, PCIV_BASEWINDOW_S *pBase);
  179. /*****************************************************************************
  180. Description : Only on the slave chip, you need to create some VB Pool.
  181. Those pool will bee created on the PCI Window Zone.
  182. Input : pCfg.u32PoolCount ** The total number of pool want to create
  183. pCfg.u32BlkSize[] ** The size of each VB block
  184. pCfg.u32BlkCount[]** The number of each VB block
  185. Output : None
  186. Return Value : HI_SUCCESS if success.
  187. HI_ERR_PCIV_SYS_NOTREADY
  188. HI_ERR_PCIV_NULL_PTR
  189. HI_ERR_PCIV_NOMEM
  190. HI_ERR_PCIV_BUSY
  191. HI_ERR_PCIV_NOT_SUPPORT
  192. HI_FAILURE
  193. See Also : HI_MPI_PCIV_GetLocalId
  194. *****************************************************************************/
  195. HI_S32 HI_MPI_PCIV_WinVbCreate(const PCIV_WINVBCFG_S *pCfg);
  196. /*****************************************************************************
  197. Description : Destroy the pools which's size is equal to the pCfg.u32BlkSize[]
  198. Input : pCfg.u32PoolCount ** The total number of pool want to destroy
  199. pCfg.u32BlkSize[] ** The size of each VB block
  200. pCfg.u32BlkCount[]** Don't care this parament
  201. Output : None
  202. Return Value : HI_SUCCESS if success.
  203. HI_ERR_PCIV_SYS_NOTREADY
  204. HI_ERR_PCIV_NOT_SUPPORT
  205. HI_FAILURE
  206. See Also : HI_MPI_PCIV_GetLocalId
  207. *****************************************************************************/
  208. HI_S32 HI_MPI_PCIV_WinVbDestroy(HI_VOID);
  209. /*****************************************************************************
  210. Description : Show the image in VO device from PCI
  211. Input : pcivChn ** The pciv channel id
  212. Output : None
  213. Return Value :
  214. *****************************************************************************/
  215. HI_S32 HI_MPI_PCIV_Show(PCIV_CHN pcivChn);
  216. /*****************************************************************************
  217. Description : Hide the image in VO device from PCI
  218. Input : pcivChn ** The pciv channel id
  219. Output : None
  220. Return Value :
  221. *****************************************************************************/
  222. HI_S32 HI_MPI_PCIV_Hide(PCIV_CHN pcivChn);
  223. /*****************************************************************************
  224. Description : Get pre-processing parameter, e.g. filter coef.
  225. Input : pcivChn ** The pciv channel id
  226. Output : PCIV_PREPROC_CFG_S ** The pre-processing parameter of pciv channel
  227. Return Value :HI_SUCCESS if success.
  228. HI_FAILURE if failure
  229. See Also : HI_MPI_PCIV_SetPreProcCfg
  230. *****************************************************************************/
  231. HI_S32 HI_MPI_PCIV_GetPreProcCfg(PCIV_CHN pcivChn,PCIV_PREPROC_CFG_S *pstCfg);
  232. /*****************************************************************************
  233. Description : Set pre-processing parameter, e.g. filter coef.
  234. Input : pcivChn ** The pciv channel id
  235. PCIV_PREPROC_CFG_S ** The pre-processing parameter of pciv channel
  236. Output : NONE
  237. Return Value :HI_SUCCESS if success.
  238. HI_FAILURE if failure
  239. See Also : HI_MPI_PCIV_GetPreProcCfg
  240. *****************************************************************************/
  241. HI_S32 HI_MPI_PCIV_SetPreProcCfg(PCIV_CHN pcivChn,const PCIV_PREPROC_CFG_S *pstCfg);
  242. #ifdef __cplusplus
  243. #if __cplusplus
  244. }
  245. #endif
  246. #endif /* __cplusplus */
  247. #endif /* __MPI_VENC_H__ */