pvrsrv_devvar.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  1. /*************************************************************************/ /*!
  2. @File
  3. @Title Services Device Variable interface header
  4. @Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
  5. @Description Defines the client side interface for device variables
  6. @License Dual MIT/GPLv2
  7. The contents of this file are subject to the MIT license as set out below.
  8. Permission is hereby granted, free of charge, to any person obtaining a copy
  9. of this software and associated documentation files (the "Software"), to deal
  10. in the Software without restriction, including without limitation the rights
  11. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  12. copies of the Software, and to permit persons to whom the Software is
  13. furnished to do so, subject to the following conditions:
  14. The above copyright notice and this permission notice shall be included in
  15. all copies or substantial portions of the Software.
  16. Alternatively, the contents of this file may be used under the terms of
  17. the GNU General Public License Version 2 ("GPL") in which case the provisions
  18. of GPL are applicable instead of those above.
  19. If you wish to allow use of your version of this file only under the terms of
  20. GPL, and not to allow others to use your version of this file under the terms
  21. of the MIT license, indicate your decision by deleting the provisions above
  22. and replace them with the notice and other provisions required by GPL as set
  23. out in the file called "GPL-COPYING" included in this distribution. If you do
  24. not delete the provisions above, a recipient may use your version of this file
  25. under the terms of either the MIT license or GPL.
  26. This License is also included in this distribution in the file called
  27. "MIT-COPYING".
  28. EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
  29. PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
  30. BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  31. PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
  32. COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  33. IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  34. CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  35. */ /**************************************************************************/
  36. #ifndef PVRSRV_DEVVAR_H
  37. #define PVRSRV_DEVVAR_H
  38. #include "img_types.h"
  39. #include "img_defs.h"
  40. #include "pvr_debug.h"
  41. #include <powervr/pvrsrv_sync_ext.h>
  42. #if defined(__cplusplus)
  43. extern "C" {
  44. #endif
  45. #define DEVVAR_MAX_NAME_LEN 32
  46. typedef struct SYNC_PRIM_CONTEXT_TAG *PDEVVARCTX;
  47. typedef struct PVRSRV_CLIENT_SYNC_PRIM_TAG *PDEVVAR;
  48. typedef struct PVRSRV_DEV_VAR_UPDATE_TAG
  49. {
  50. PDEVVAR psDevVar; /*!< Pointer to the dev var */
  51. IMG_UINT32 ui32UpdateValue; /*!< the update value */
  52. } PVRSRV_DEV_VAR_UPDATE;
  53. /*************************************************************************/ /*!
  54. @Function PVRSRVDevVarContextCreate
  55. @Description Create a new device variable context
  56. @Input psDevConnection Device to create the device
  57. variable context on
  58. @Output phDevVarContext Handle to the created device
  59. variable context
  60. @Return PVRSRV_OK if the device variable context was successfully
  61. created
  62. */
  63. /*****************************************************************************/
  64. IMG_EXPORT PVRSRV_ERROR
  65. PVRSRVDevVarContextCreate(const PVRSRV_DEV_CONNECTION *psDevConnection,
  66. PDEVVARCTX *phDevVarContext);
  67. /*************************************************************************/ /*!
  68. @Function PVRSRVDevVarContextDestroy
  69. @Description Destroy a device variable context
  70. @Input hDevVarContext Handle to the device variable
  71. context to destroy
  72. @Return None
  73. */
  74. /*****************************************************************************/
  75. IMG_EXPORT void
  76. PVRSRVDevVarContextDestroy(PDEVVARCTX hDevVarContext);
  77. /*************************************************************************/ /*!
  78. @Function PVRSRVDevVarAlloc
  79. @Description Allocate a new device variable on the specified device
  80. variable context. The device variable's value is initialised
  81. with the value passed in ui32InitialValue.
  82. @Input hDevVarContext Handle to the device variable
  83. context
  84. @Input ui32InitialValue Value to initially assign to the
  85. new variable
  86. @Input pszDevVarName Name assigned to the device variable
  87. (for debug purposes)
  88. @Output ppsDevVar Created device variable
  89. @Return PVRSRV_OK if the device variable was successfully created
  90. */
  91. /*****************************************************************************/
  92. IMG_EXPORT PVRSRV_ERROR
  93. PVRSRVDevVarAllocI(PDEVVARCTX hDevVarContext,
  94. PDEVVAR *ppsDevVar,
  95. IMG_UINT32 ui32InitialValue,
  96. const IMG_CHAR *pszDevVarName
  97. PVR_DBG_FILELINE_PARAM);
  98. #define PVRSRVDevVarAlloc(hDevVarContext, ppsDevVar, ui32InitialValue, pszDevVarName) \
  99. PVRSRVDevVarAllocI( (hDevVarContext), (ppsDevVar), (ui32InitialValue), (pszDevVarName) \
  100. PVR_DBG_FILELINE )
  101. /*************************************************************************/ /*!
  102. @Function PVRSRVDevVarFree
  103. @Description Free a device variable
  104. @Input psDevVar The device variable to free
  105. @Return None
  106. */
  107. /*****************************************************************************/
  108. IMG_EXPORT void
  109. PVRSRVDevVarFree(PDEVVAR psDevVar);
  110. /*************************************************************************/ /*!
  111. @Function PVRSRVDevVarSet
  112. @Description Set the device variable to a value
  113. @Input psDevVar The device variable to set
  114. @Input ui32Value Value to set it to
  115. @Return None
  116. */
  117. /*****************************************************************************/
  118. IMG_EXPORT void
  119. PVRSRVDevVarSet(PDEVVAR psDevVar,
  120. IMG_UINT32 ui32Value);
  121. /*************************************************************************/ /*!
  122. @Function PVRSRVDevVarGet
  123. @Description Get the current value of the device variable
  124. @Input psDevVar The device variable to get the
  125. value of
  126. @Return Value of the variable
  127. */
  128. /*****************************************************************************/
  129. IMG_EXPORT IMG_UINT32
  130. PVRSRVDevVarGet(PDEVVAR psDevVar);
  131. /*************************************************************************/ /*!
  132. @Function PVRSRVDevVarGetFirmwareAddr
  133. @Description Returns the address of the associated firmware value for a
  134. specified device integer (not exposed to client)
  135. @Input psDevVar The device variable to resolve
  136. @Return The firmware address of the device variable
  137. */
  138. /*****************************************************************************/
  139. IMG_EXPORT IMG_UINT32
  140. PVRSRVDevVarGetFirmwareAddr(PDEVVAR psDevVar);
  141. #if defined(PDUMP)
  142. /*************************************************************************/ /*!
  143. @Function PVRSRVDevVarPDump
  144. @Description PDump the current value of the device variable
  145. @Input psDevVar The device variable to PDump
  146. @Return None
  147. */
  148. /*****************************************************************************/
  149. IMG_EXPORT void
  150. PVRSRVDevVarPDump(PDEVVAR psDevVar);
  151. /*************************************************************************/ /*!
  152. @Function PVRSRVDevVarPDumpPol
  153. @Description Do a PDump poll of the device variable
  154. @Input psDevVar The device variable to PDump
  155. @Input ui32Value Value to Poll for
  156. @Input ui32Mask PDump mask operator
  157. @Input ui32PDumpFlags PDump flags
  158. @Return None
  159. */
  160. /*****************************************************************************/
  161. IMG_EXPORT void
  162. PVRSRVDevVarPDumpPol(PDEVVAR psDevVar,
  163. IMG_UINT32 ui32Value,
  164. IMG_UINT32 ui32Mask,
  165. PDUMP_POLL_OPERATOR eOperator,
  166. IMG_UINT32 ui32PDumpFlags);
  167. /*************************************************************************/ /*!
  168. @Function PVRSRVDevVarPDumpCBP
  169. @Description Do a PDump CB poll using the device variable
  170. @Input psDevVar The device variable to PDump
  171. @Input uiWriteOffset Current write offset of buffer
  172. @Input uiPacketSize Size of the packet to write into CB
  173. @Input uiBufferSize Size of the CB
  174. @Return None
  175. */
  176. /*****************************************************************************/
  177. IMG_EXPORT void
  178. PVRSRVDevVarPDumpCBP(PDEVVAR psDevVar,
  179. IMG_UINT64 uiWriteOffset,
  180. IMG_UINT64 uiPacketSize,
  181. IMG_UINT64 uiBufferSize);
  182. #else /* PDUMP */
  183. #ifdef INLINE_IS_PRAGMA
  184. #pragma inline(PVRSRVDevVarPDump)
  185. #endif
  186. static INLINE void
  187. PVRSRVDevVarPDump(PDEVVAR psDevVar)
  188. {
  189. PVR_UNREFERENCED_PARAMETER(psDevVar);
  190. }
  191. #ifdef INLINE_IS_PRAGMA
  192. #pragma inline(PVRSRVDevVarPDumpPol)
  193. #endif
  194. static INLINE void
  195. PVRSRVDevVarPDumpPol(PDEVVAR psDevVar,
  196. IMG_UINT32 ui32Value,
  197. IMG_UINT32 ui32Mask,
  198. PDUMP_POLL_OPERATOR eOperator,
  199. IMG_UINT32 ui32PDumpFlags)
  200. {
  201. PVR_UNREFERENCED_PARAMETER(psDevVar);
  202. PVR_UNREFERENCED_PARAMETER(ui32Value);
  203. PVR_UNREFERENCED_PARAMETER(ui32Mask);
  204. PVR_UNREFERENCED_PARAMETER(eOperator);
  205. PVR_UNREFERENCED_PARAMETER(ui32PDumpFlags);
  206. }
  207. #ifdef INLINE_IS_PRAGMA
  208. #pragma inline(PVRSRVDevVarPDumpCBP)
  209. #endif
  210. static INLINE void
  211. PVRSRVDevVarPDumpCBP(PDEVVAR psDevVar,
  212. IMG_UINT64 uiWriteOffset,
  213. IMG_UINT64 uiPacketSize,
  214. IMG_UINT64 uiBufferSize)
  215. {
  216. PVR_UNREFERENCED_PARAMETER(psDevVar);
  217. PVR_UNREFERENCED_PARAMETER(uiWriteOffset);
  218. PVR_UNREFERENCED_PARAMETER(uiPacketSize);
  219. PVR_UNREFERENCED_PARAMETER(uiBufferSize);
  220. }
  221. #endif /* PDUMP */
  222. #if defined(__cplusplus)
  223. }
  224. #endif
  225. #endif /* PVRSRV_DEVVAR_H */