]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - android-sdk/device-ti-proprietary-open.git/blob - omap5/sgx_src/eurasia_km/include4/services.h
jacinto6: sgx: add memtrack library
[android-sdk/device-ti-proprietary-open.git] / omap5 / sgx_src / eurasia_km / include4 / services.h
1 /*************************************************************************/ /*!
2 @Title          Services API Header
3 @Copyright      Copyright (c) Imagination Technologies Ltd. All Rights Reserved
4 @Description    Exported services API details
5 @License        Dual MIT/GPLv2
7 The contents of this file are subject to the MIT license as set out below.
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
19 Alternatively, the contents of this file may be used under the terms of
20 the GNU General Public License Version 2 ("GPL") in which case the provisions
21 of GPL are applicable instead of those above.
23 If you wish to allow use of your version of this file only under the terms of
24 GPL, and not to allow others to use your version of this file under the terms
25 of the MIT license, indicate your decision by deleting the provisions above
26 and replace them with the notice and other provisions required by GPL as set
27 out in the file called "GPL-COPYING" included in this distribution. If you do
28 not delete the provisions above, a recipient may use your version of this file
29 under the terms of either the MIT license or GPL.
31 This License is also included in this distribution in the file called
32 "MIT-COPYING".
34 EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
35 PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
36 BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
37 PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
38 COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
39 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
40 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
41 */ /**************************************************************************/
43 #ifndef __SERVICES_H__
44 #define __SERVICES_H__
46 #if defined (__cplusplus)
47 extern "C" {
48 #endif
50 #include "img_defs.h"
51 #include "servicesext.h"
52 #include "pdumpdefs.h"
55 /* The comment below is the front page for code-generated doxygen documentation */
56 /*!
57  ******************************************************************************
58  @mainpage
59  This document details the APIs and implementation of the Consumer Services.
60  It is intended to be used in conjunction with the Consumer Services
61  Software Architectural Specification and the Consumer Services Software
62  Functional Specification.
63  *****************************************************************************/
65 /******************************************************************************
66  *      #defines
67  *****************************************************************************/
69 /* 4k page size definition */
70 #define PVRSRV_4K_PAGE_SIZE             4096UL
72 #define PVRSRV_MAX_CMD_SIZE             1024/*!< max size in bytes of a command */
74 #define PVRSRV_MAX_DEVICES              16      /*!< Largest supported number of devices on the system */
76 #define EVENTOBJNAME_MAXLENGTH (50)
78 /*
79         Flags associated with memory allocation
80         (bits 0-11)
81 */
82 #define PVRSRV_MEM_READ                                         (1U<<0)
83 #define PVRSRV_MEM_WRITE                                        (1U<<1)
84 #define PVRSRV_MEM_CACHE_CONSISTENT                     (1U<<2)
85 #define PVRSRV_MEM_NO_SYNCOBJ                           (1U<<3)
86 #define PVRSRV_MEM_INTERLEAVED                          (1U<<4)
87 #define PVRSRV_MEM_DUMMY                                        (1U<<5)
88 #define PVRSRV_MEM_EDM_PROTECT                          (1U<<6)
89 #define PVRSRV_MEM_ZERO                                         (1U<<7)
90 #define PVRSRV_MEM_USER_SUPPLIED_DEVVADDR       (1U<<8)
91 #define PVRSRV_MEM_RAM_BACKED_ALLOCATION        (1U<<9)
92 #define PVRSRV_MEM_NO_RESMAN                            (1U<<10)
93 #define PVRSRV_MEM_EXPORTED                                     (1U<<11)
96 /*
97         Heap Attribute flags
98         (bits 12-23)
99 */
100 #define PVRSRV_HAP_CACHED                                       (1U<<12)
101 #define PVRSRV_HAP_UNCACHED                                     (1U<<13)
102 #define PVRSRV_HAP_WRITECOMBINE                         (1U<<14)
103 #define PVRSRV_HAP_CACHETYPE_MASK                       (PVRSRV_HAP_CACHED|PVRSRV_HAP_UNCACHED|PVRSRV_HAP_WRITECOMBINE)
104 #define PVRSRV_HAP_KERNEL_ONLY                          (1U<<15)
105 #define PVRSRV_HAP_SINGLE_PROCESS                       (1U<<16)
106 #define PVRSRV_HAP_MULTI_PROCESS                        (1U<<17)
107 #define PVRSRV_HAP_FROM_EXISTING_PROCESS        (1U<<18)
108 #define PVRSRV_HAP_NO_CPU_VIRTUAL           (1U<<19)
109 #define PVRSRV_MAP_GC_MMU                   (1UL<<20)
110 #define PVRSRV_HAP_GPU_PAGEABLE             (1U<<21)
111 #define PVRSRV_HAP_NO_GPU_VIRTUAL_ON_ALLOC  (1U<<22)
112 #define PVRSRV_HAP_MAPTYPE_MASK                         (PVRSRV_HAP_KERNEL_ONLY \
113                                             |PVRSRV_HAP_SINGLE_PROCESS \
114                                             |PVRSRV_HAP_MULTI_PROCESS \
115                                             |PVRSRV_HAP_FROM_EXISTING_PROCESS)
116 #define PVRSRV_HAP_MAPPING_CTRL_MASK            (PVRSRV_HAP_NO_CPU_VIRTUAL\
117                                             |PVRSRV_HAP_GPU_PAGEABLE \
118                                             |PVRSRV_HAP_NO_GPU_VIRTUAL_ON_ALLOC)
120 /*
121         Allows user allocations to override heap attributes
122         (Bits shared with heap flags)
123 */
124 #define PVRSRV_MEM_CACHED                                       PVRSRV_HAP_CACHED
125 #define PVRSRV_MEM_UNCACHED                                     PVRSRV_HAP_UNCACHED
126 #define PVRSRV_MEM_WRITECOMBINE                         PVRSRV_HAP_WRITECOMBINE
128 /*
129         Backing store flags (defined internally)
130         (bits 24-26)
131 */
132 #define PVRSRV_MEM_BACKINGSTORE_FIELD_SHIFT     (24)
134 /*
135         Per allocation/mapping flags
136         (bits 27-30)
137  */
138 #define PVRSRV_MAP_NOUSERVIRTUAL            (1UL<<27)
139 #define PVRSRV_MEM_XPROC                                        (1U<<28)
140 #define PVRSRV_MEM_ION                                          (1U<<29)
141 #define PVRSRV_MEM_ALLOCATENONCACHEDMEM         (1UL<<30)
143 /*
144         Internal allocation/mapping flags
145         (bit 31)
146 */
147 #define PVRSRV_MEM_SPARSE                                       (1U<<31)
150 /*
151  * How much context we lose on a (power) mode change
152  */
153 #define PVRSRV_NO_CONTEXT_LOSS                                  0               /*!< Do not lose state on power down */
154 #define PVRSRV_SEVERE_LOSS_OF_CONTEXT                   1               /*!< lose state on power down */
155 #define PVRSRV_PRE_STATE_CHANGE_MASK                    0x80    /*!< power state change mask */
158 /*
159  * Device cookie defines
160  */
161 #define PVRSRV_DEFAULT_DEV_COOKIE                       (1)      /*!< default device cookie */
164 /*
165  * Misc Info. present flags
166  */
167 #define PVRSRV_MISC_INFO_TIMER_PRESENT                                  (1U<<0)
168 #define PVRSRV_MISC_INFO_CLOCKGATE_PRESENT                              (1U<<1)
169 #define PVRSRV_MISC_INFO_MEMSTATS_PRESENT                               (1U<<2)
170 #define PVRSRV_MISC_INFO_GLOBALEVENTOBJECT_PRESENT              (1U<<3)
171 #define PVRSRV_MISC_INFO_DDKVERSION_PRESENT                             (1U<<4)
172 #define PVRSRV_MISC_INFO_CPUCACHEOP_PRESENT                             (1U<<5)
173 #define PVRSRV_MISC_INFO_FREEMEM_PRESENT                                (1U<<6)
174 #define PVRSRV_MISC_INFO_GET_REF_COUNT_PRESENT                  (1U<<7)
175 #define PVRSRV_MISC_INFO_GET_PAGE_SIZE_PRESENT                  (1U<<8)
176 #define PVRSRV_MISC_INFO_FORCE_SWAP_TO_SYSTEM_PRESENT   (1U<<9)
178 #define PVRSRV_MISC_INFO_RESET_PRESENT                                  (1U<<31)
180 /* PDUMP defines */
181 #define PVRSRV_PDUMP_MAX_FILENAME_SIZE                  20
182 #define PVRSRV_PDUMP_MAX_COMMENT_SIZE                   200
185 /*
186         Flags for PVRSRVChangeDeviceMemoryAttributes call.
187 */
188 #define PVRSRV_CHANGEDEVMEM_ATTRIBS_CACHECOHERENT               0x00000001
190 /*
191         Flags for PVRSRVMapExtMemory and PVRSRVUnmapExtMemory
192         ALTERNATEVA             -       Used when mapping multiple virtual addresses to the same physical address. Set this flag on extra maps.
193         PHYSCONTIG              -       Physical pages are contiguous (unused)
194 */
195 #define PVRSRV_MAPEXTMEMORY_FLAGS_ALTERNATEVA                   0x00000001
196 #define PVRSRV_MAPEXTMEMORY_FLAGS_PHYSCONTIG                    0x00000002
198 /*
199         Flags for PVRSRVModifySyncOps
200         WO_INC          -       Used to increment "WriteOpsPending/complete of sync info"
201         RO_INC          -       Used to increment "ReadOpsPending/complete of sync info"
202 */
203 #define PVRSRV_MODIFYSYNCOPS_FLAGS_WO_INC                       0x00000001
204 #define PVRSRV_MODIFYSYNCOPS_FLAGS_RO_INC                       0x00000002
206 /*
207         Flags for Services connection.
208         Allows to define per-client policy for Services
209 */
210 #define SRV_FLAGS_PERSIST               0x1
211 #define SRV_FLAGS_PDUMP_ACTIVE  0x2
213 /*
214         Pdump flags which are accessible to Services clients
215 */
216 #define PVRSRV_PDUMP_FLAGS_CONTINUOUS           0x1
218 /* Number of MM planes supported for the meminfo */
219 #define PVRSRV_MAX_NUMBER_OF_MM_BUFFER_PLANES  3
221 /* Invalid Device Virtual Address Value */
222 #define PVRSRV_BAD_DEVICE_ADDRESS           0
224 /* Maximum array size of the meminfo's when invoking
225  * PVRSRVMultiManageDevMem() in shared mode */
226 #define PVRSRV_MULTI_MANAGE_DEV_MEM_MAX_SIZE 128
228 /* Maximum array size of the meminfo's when invoking
229  * PVRSRVMultiManageDevMem() in direct (copy) mode */
230 #define PVRSRV_MULTI_MANAGE_DEV_MEM_MAX_DIRECT_SIZE 8
232 /******************************************************************************
233  * Enums
234  *****************************************************************************/
236 /*!
237  ******************************************************************************
238  * List of known device types.
239  *****************************************************************************/
240 typedef enum _PVRSRV_DEVICE_TYPE_
242         PVRSRV_DEVICE_TYPE_UNKNOWN                      = 0 ,
243         PVRSRV_DEVICE_TYPE_MBX1                         = 1 ,
244         PVRSRV_DEVICE_TYPE_MBX1_LITE            = 2 ,
246         PVRSRV_DEVICE_TYPE_M24VA                        = 3,
247         PVRSRV_DEVICE_TYPE_MVDA2                        = 4,
248         PVRSRV_DEVICE_TYPE_MVED1                        = 5,
249         PVRSRV_DEVICE_TYPE_MSVDX                        = 6,
251         PVRSRV_DEVICE_TYPE_SGX                          = 7,
253         PVRSRV_DEVICE_TYPE_VGX                          = 8,
255         /* 3rd party devices take ext type */
256         PVRSRV_DEVICE_TYPE_EXT                          = 9,
258     PVRSRV_DEVICE_TYPE_LAST             = 9,
260         PVRSRV_DEVICE_TYPE_FORCE_I32            = 0x7fffffff
262 } PVRSRV_DEVICE_TYPE;
264 #define HEAP_ID( _dev_ , _dev_heap_idx_ )       (  ((_dev_)<<24) | ((_dev_heap_idx_)&((1<<24)-1))  )
265 #define HEAP_IDX( _heap_id_ )                           ( (_heap_id_)&((1<<24) - 1 ) )
266 #define HEAP_DEV( _heap_id_ )                           ( (_heap_id_)>>24 )
268 /* common undefined heap ID define */
269 #define PVRSRV_UNDEFINED_HEAP_ID                        (~0LU)
271 /*!
272  ******************************************************************************
273  * User Module type
274  *****************************************************************************/
275 typedef enum
277         IMG_EGL                         = 0x00000001,
278         IMG_OPENGLES1           = 0x00000002,
279         IMG_OPENGLES2           = 0x00000003,
280         IMG_D3DM                        = 0x00000004,
281         IMG_SRV_UM                      = 0x00000005,
282         IMG_OPENVG                      = 0x00000006,
283         IMG_SRVCLIENT           = 0x00000007,
284         IMG_VISTAKMD            = 0x00000008,
285         IMG_VISTA3DNODE         = 0x00000009,
286         IMG_VISTAMVIDEONODE     = 0x0000000A,
287         IMG_VISTAVPBNODE        = 0x0000000B,
288         IMG_OPENGL                      = 0x0000000C,
289         IMG_D3D                         = 0x0000000D,
290 #if defined(SUPPORT_GRAPHICS_HAL) || defined(SUPPORT_COMPOSER_HAL)
291         IMG_ANDROID_HAL         = 0x0000000E,
292 #endif
293 #if defined(SUPPORT_OPENCL)
294         IMG_OPENCL                      = 0x0000000F,
295 #endif
297 } IMG_MODULE_ID;
300 #define APPHINT_MAX_STRING_SIZE 256
302 /*!
303  ******************************************************************************
304  * IMG data types
305  *****************************************************************************/
306 typedef enum
308         IMG_STRING_TYPE         = 1,
309         IMG_FLOAT_TYPE          ,
310         IMG_UINT_TYPE           ,
311         IMG_INT_TYPE            ,
312         IMG_FLAG_TYPE
313 }IMG_DATA_TYPE;
316 /******************************************************************************
317  * Structure definitions.
318  *****************************************************************************/
320 /*!
321  * Forward declaration
322  */
323 typedef struct _PVRSRV_DEV_DATA_ *PPVRSRV_DEV_DATA;
325 /*!
326  ******************************************************************************
327  * Device identifier structure
328  *****************************************************************************/
329 typedef struct _PVRSRV_DEVICE_IDENTIFIER_
331         PVRSRV_DEVICE_TYPE              eDeviceType;            /*!< Identifies the type of the device */
332         PVRSRV_DEVICE_CLASS             eDeviceClass;           /*!< Identifies more general class of device - display/3d/mpeg etc */
333         IMG_UINT32                              ui32DeviceIndex;        /*!< Index of the device within the system */
334         IMG_CHAR                                *pszPDumpDevName;       /*!< Pdump memory bank name */
335         IMG_CHAR                                *pszPDumpRegName;       /*!< Pdump register bank name */
337 } PVRSRV_DEVICE_IDENTIFIER;
340 /******************************************************************************
341  * Client dev info
342  ******************************************************************************
343  */
344 typedef struct _PVRSRV_CLIENT_DEV_DATA_
346         IMG_UINT32              ui32NumDevices;                         /*!< Number of services-managed devices connected */
347         PVRSRV_DEVICE_IDENTIFIER asDevID[PVRSRV_MAX_DEVICES];           /*!< Device identifiers */
348         PVRSRV_ERROR    (*apfnDevConnect[PVRSRV_MAX_DEVICES])(PPVRSRV_DEV_DATA);        /*< device-specific connection callback */
349         PVRSRV_ERROR    (*apfnDumpTrace[PVRSRV_MAX_DEVICES])(PPVRSRV_DEV_DATA);         /*!< device-specific debug trace callback */
351 } PVRSRV_CLIENT_DEV_DATA;
354 /*!
355  ******************************************************************************
356  * Kernel Services connection structure
357  *****************************************************************************/
358 typedef struct _PVRSRV_CONNECTION_
360         IMG_HANDLE hServices;                                   /*!< UM IOCTL handle */
361         IMG_UINT32 ui32ProcessID;                               /*!< Process ID for resource locking */
362         PVRSRV_CLIENT_DEV_DATA  sClientDevData; /*!< Client device data */
363         IMG_UINT32 ui32SrvFlags;                                /*!< Per-client Services flags */
364 }PVRSRV_CONNECTION;
367 /*!
368  ******************************************************************************
369  * This structure allows the user mode glue code to have an OS independent
370  * set of prototypes.
371  *****************************************************************************/
372 typedef struct _PVRSRV_DEV_DATA_
374         IMG_CONST PVRSRV_CONNECTION      *psConnection; /*!< Services connection info */
375 #if defined (SUPPORT_SID_INTERFACE)
376         IMG_SID                 hDevCookie;                             /*!< Dev cookie */
377 #else
378         IMG_HANDLE                      hDevCookie;                             /*!< Dev cookie */
379 #endif
381 } PVRSRV_DEV_DATA;
383 /*!
384  ******************************************************************************
385  * address:value update structure
386  *****************************************************************************/
387 typedef struct _PVRSRV_MEMUPDATE_
389         IMG_UINT32                      ui32UpdateAddr;         /*!< Address */
390         IMG_UINT32                      ui32UpdateVal;          /*!< value */
391 } PVRSRV_MEMUPDATE;
393 /*!
394  ******************************************************************************
395  * address:value register structure
396  *****************************************************************************/
397 typedef struct _PVRSRV_HWREG_
399         IMG_UINT32                      ui32RegAddr;    /*!< Address */
400         IMG_UINT32                      ui32RegVal;             /*!< value */
401 } PVRSRV_HWREG;
403 /*!
404  ******************************************************************************
405  * Implementation details for memory handling
406  *****************************************************************************/
407 typedef struct _PVRSRV_MEMBLK_
409         IMG_DEV_VIRTADDR        sDevVirtAddr;                   /*!< Address of the memory in the IMG MMUs address space */
410         IMG_HANDLE                      hOSMemHandle;                   /*!< Stores the underlying memory allocation handle */
411         IMG_HANDLE                      hOSWrapMem;                             /*!< FIXME: better way to solve this problem */
412         IMG_HANDLE                      hBuffer;                                /*!< Stores the BM_HANDLE for the underlying memory management */
413         IMG_HANDLE                      hResItem;                               /*!< handle to resource item for allocate */
414         IMG_SYS_PHYADDR         *psIntSysPAddr;
416 } PVRSRV_MEMBLK;
418 /*!
419  ******************************************************************************
420  * Memory Management (externel interface)
421  *****************************************************************************/
422 typedef struct _PVRSRV_KERNEL_MEM_INFO_ *PPVRSRV_KERNEL_MEM_INFO;
424 typedef struct _PVRSRV_CLIENT_MEM_INFO_
426         /* CPU Virtual Address */
427         IMG_PVOID                               pvLinAddr;
429         /* CPU Virtual Address (for kernel mode) */
430         IMG_PVOID                               pvLinAddrKM;
432         /* Device Virtual Address */
433         IMG_DEV_VIRTADDR                sDevVAddr;
435         /* allocation flags */
436         IMG_UINT32                              ui32Flags;
438         /* client allocation flags */
439         IMG_UINT32                              ui32ClientFlags;
441         /* allocation size in bytes */
442         IMG_SIZE_T                              uAllocSize;
445         /* ptr to associated client sync info - NULL if no sync */
446         struct _PVRSRV_CLIENT_SYNC_INFO_        *psClientSyncInfo;
448 #if defined (SUPPORT_SID_INTERFACE)
449         /* handle to client mapping data (OS specific) */
450         IMG_SID                                                         hMappingInfo;
452         /* handle to kernel mem info */
453         IMG_SID                                                         hKernelMemInfo;
455         /* resman handle for UM mapping clean-up */
456         IMG_SID                                                         hResItem;
457 #else
458         /* handle to client mapping data (OS specific) */
459         IMG_HANDLE                                                      hMappingInfo;
461         /* handle to kernel mem info */
462         IMG_HANDLE                                                      hKernelMemInfo;
464         /* resman handle for UM mapping clean-up */
465         IMG_HANDLE                                                      hResItem;
466 #endif
468 #if defined(SUPPORT_MEMINFO_IDS)
469         #if !defined(USE_CODE)
470         /* Globally unique "stamp" for allocation (not re-used until wrap) */
471         IMG_UINT64                                                      ui64Stamp;
472         #else /* !defined(USE_CODE) */
473         IMG_UINT32                                                      dummy1;
474         IMG_UINT32                                                      dummy2;
475         #endif /* !defined(USE_CODE) */
476 #endif /* defined(SUPPORT_MEMINFO_IDS) */
478     /* Sub-system ID that allocated the buffer */
479         IMG_UINT64              uiSubSystem;
481         /*
482                 ptr to next mem info
483                 D3D uses psNext for mid-scene texture reload.
484         */
485         struct _PVRSRV_CLIENT_MEM_INFO_         *psNext;
487     /* Device Virtual Addresses for the YUV MM planes */
488         IMG_UINT32 planeOffsets[PVRSRV_MAX_NUMBER_OF_MM_BUFFER_PLANES];
489 } PVRSRV_CLIENT_MEM_INFO, *PPVRSRV_CLIENT_MEM_INFO;
491 /*
492         Multiple buffer device virtual mapping management
493 */
494 typedef enum
496         PVRSRV_MULTI_MANAGE_DEV_MEM_RQST_INVALID = 0,
497         /* We may not have GPU virtual address */
498         PVRSRV_MULTI_MANAGE_DEV_MEM_RQST_MAP = 1,
499         PVRSRV_MULTI_MANAGE_DEV_MEM_RQST_LOCK_MAP,
500         PVRSRV_MULTI_MANAGE_DEV_MEM_RQST_SWAP_MAP_FROM_PREV,
501         /* We have GPU virtual address */
502         PVRSRV_MULTI_MANAGE_DEV_MEM_RQST_UNMAP,
503         PVRSRV_MULTI_MANAGE_DEV_MEM_RQST_UNLOCK_MAP,
504         PVRSRV_MULTI_MANAGE_DEV_MEM_RQST_SWAP_MAP_TO_NEXT,
505         PVRSRV_MULTI_MANAGE_DEV_MEM_RQST_LAST = (IMG_UINT32)-1
506 } PVRSRV_MULTI_MANAGE_DEV_MEM_RQST_TYPE;
508 typedef struct _PVRSRV_MANAGE_DEV_MEM_REQUEST
510         PVRSRV_MULTI_MANAGE_DEV_MEM_RQST_TYPE eReqType;
511         IMG_UINT32                              ui32FieldSize;  /* valid if equal to the size of the structure */
512         IMG_HANDLE                              hKernelMemInfo;
513         IMG_HANDLE                              hKernelSyncInfo;
514         PVRSRV_CLIENT_MEM_INFO  *psClientMemInfo;       /* Client side reference */
515         IMG_UINT32                              ui32Hints;
516         IMG_UINT32                              ui32Attribs;
517         IMG_SIZE_T                              uSize;
518         IMG_SIZE_T                              uAlignment;
519         IMG_PVOID                               pvLinAddr;                      /* CPU Virtual Address */
520         IMG_UINT32                              ui32CpuMapRefCount;
521         IMG_DEV_VIRTADDR                sDevVAddr;                      /* Device Virtual Address */
522         IMG_UINT32                              ui32GpuMapRefCount;
523         IMG_UINT32                      ui32TransferFromToReqSlotIndx;  /* Transfer GPU virtual mapping from index */
524         IMG_UINT64                              uiSubSystem;
525         PVRSRV_ERROR                    eError;
526 }PVRSRV_MANAGE_DEV_MEM_REQUEST;
528 typedef PVRSRV_MANAGE_DEV_MEM_REQUEST PVRSRV_MANAGE_DEV_MEM_RESPONSE;
530 typedef struct _PVRSRV_MULTI_MANAGE_DEV_MEM_REQUESTS
532         IMG_UINT32              ui32BridgeFlags; /* Must be first member of structure */
533         #if defined (SUPPORT_SID_INTERFACE)
534         IMG_SID                 hDevCookie;
535         /* handle to kernel shared memory */
536         IMG_SID                 hKernelMemInfo;
537         #else
538         IMG_HANDLE              hDevCookie;
539         /* handle to kernel shared memory*/
540         IMG_HANDLE              hKernelMemInfo;
541         #endif
542         PVRSRV_CLIENT_MEM_INFO *psSharedMemClientMemInfo;       /* NULL if direct (not through shared) */
543         IMG_UINT32              ui32MaxNumberOfRequests;                        /* Must be <= PVRSRV_MULTI_MANAGE_DEV_MEM_MAX_DIRECT_SIZE for direct */
544         IMG_UINT32              ui32NumberOfValidRequests;                      /* Must be <= ui32MaxNumberOfRequests */
545         IMG_UINT32              ui32CtrlFlags;
546         IMG_UINT32              ui32StatusFlags;
547         PVRSRV_MANAGE_DEV_MEM_REQUEST sMemRequests[PVRSRV_MULTI_MANAGE_DEV_MEM_MAX_DIRECT_SIZE]; /* Memory Requests Array */
548 }PVRSRV_MULTI_MANAGE_DEV_MEM_REQUESTS;
550 /*!
551  ******************************************************************************
552  * Memory Heap Information
553  *****************************************************************************/
554 #define PVRSRV_MAX_CLIENT_HEAPS (32)
555 typedef struct _PVRSRV_HEAP_INFO_
557         IMG_UINT32                      ui32HeapID;
558 #if defined (SUPPORT_SID_INTERFACE)
559         IMG_SID                         hDevMemHeap;
560 #else
561         IMG_HANDLE                      hDevMemHeap;
562 #endif
563         IMG_DEV_VIRTADDR        sDevVAddrBase;
564         IMG_UINT32                      ui32HeapByteSize;
565         IMG_UINT32                      ui32Attribs;
566         IMG_UINT32                      ui32XTileStride;
567 }PVRSRV_HEAP_INFO;
572 /*
573         Event Object information structure
574 */
575 typedef struct _PVRSRV_EVENTOBJECT_
577         /* globally unique name of the event object */
578         IMG_CHAR        szName[EVENTOBJNAME_MAXLENGTH];
579         /* kernel specific handle for the event object */
580 #if defined (SUPPORT_SID_INTERFACE)
581         IMG_SID     hOSEventKM;
582 #else
583         IMG_HANDLE      hOSEventKM;
584 #endif
586 } PVRSRV_EVENTOBJECT;
588 /*
589         Cache operation type
590 */
591 typedef enum
593         PVRSRV_MISC_INFO_CPUCACHEOP_NONE = 0,
594         PVRSRV_MISC_INFO_CPUCACHEOP_CLEAN,
595         PVRSRV_MISC_INFO_CPUCACHEOP_FLUSH
596 } PVRSRV_MISC_INFO_CPUCACHEOP_TYPE;
598 /*!
599  ******************************************************************************
600  * Structure to retrieve misc. information from services
601  *****************************************************************************/
602 typedef struct _PVRSRV_MISC_INFO_
604         IMG_UINT32      ui32StateRequest;               /*!< requested State Flags */
605         IMG_UINT32      ui32StatePresent;               /*!< Present/Valid State Flags */
607         /*!< SOC Timer register */
608         IMG_VOID        *pvSOCTimerRegisterKM;
609         IMG_VOID        *pvSOCTimerRegisterUM;
610 #if defined (SUPPORT_SID_INTERFACE)
611         IMG_SID         hSOCTimerRegisterOSMemHandle;
612         IMG_SID         hSOCTimerRegisterMappingInfo;
613 #else
614         IMG_HANDLE      hSOCTimerRegisterOSMemHandle;
615         IMG_HANDLE      hSOCTimerRegisterMappingInfo;
616 #endif
618         /*!< SOC Clock Gating registers */
619         IMG_VOID        *pvSOCClockGateRegs;
620         IMG_UINT32      ui32SOCClockGateRegsSize;
622         /* Memory Stats/DDK version string depending on ui32StateRequest flags */
623         IMG_CHAR        *pszMemoryStr;
624         IMG_UINT32      ui32MemoryStrLen;
626         /* global event object */
627         PVRSRV_EVENTOBJECT      sGlobalEventObject;//FIXME: should be private to services
628 #if defined (SUPPORT_SID_INTERFACE)
629         IMG_EVENTSID            hOSGlobalEvent;
630 #else
631         IMG_HANDLE                      hOSGlobalEvent;
632 #endif
634         /* Note: add misc. items as required */
635         IMG_UINT32      aui32DDKVersion[4];
637         /*!< CPU cache flush controls: */
638         struct
639         {
640                 /*!< Defer the CPU cache op to the next HW op to be submitted (else flush now) */
641                 IMG_BOOL bDeferOp;
643                 /*!< Type of cache operation to perform */
644                 PVRSRV_MISC_INFO_CPUCACHEOP_TYPE eCacheOpType;
646                 /* This union is a bit unsightly. We need it because we'll use the psMemInfo
647                  * directly in the srvclient PVRSRVGetMiscInfo code, and then convert it
648                  * to a kernel meminfo if required. Try to not waste space.
649                  */
650 #if !defined (SUPPORT_SID_INTERFACE)
651                 union
652                 {
653                         /*!< Input client meminfo (UM side) */
654                         PVRSRV_CLIENT_MEM_INFO *psClientMemInfo;
656                         /*!< Output kernel meminfo (Bridge+KM side) */
657                         struct _PVRSRV_KERNEL_MEM_INFO_ *psKernelMemInfo;
658                 } u;
659 #endif
661                 /*!< Offset in MemInfo to start cache op */
662                 IMG_VOID *pvBaseVAddr;
664                 /*!< Length of range to perform cache op  */
665                 IMG_UINT32      ui32Length;
666         } sCacheOpCtl;
668         /*!< Meminfo refcount controls: */
669         struct
670         {
671                 /* This union is a bit unsightly. We need it because we'll use the psMemInfo
672                  * directly in the srvclient PVRSRVGetMiscInfo code, and then convert it
673                  * to a kernel meminfo if required. Try to not waste space.
674                  */
675 #if !defined(SUPPORT_SID_INTERFACE)
676                 union
677                 {
678                         /*!< Input client meminfo (UM side) */
679                         PVRSRV_CLIENT_MEM_INFO *psClientMemInfo;
681                         /*!< Output kernel meminfo (Bridge+KM side) */
682                         struct _PVRSRV_KERNEL_MEM_INFO_ *psKernelMemInfo;
683                 } u;
684 #endif
686                 /*!< Resulting refcount */
687                 IMG_UINT32 ui32RefCount;
688         } sGetRefCountCtl;
690         IMG_UINT32 ui32PageSize;
691 } PVRSRV_MISC_INFO;
693 /*!
694  ******************************************************************************
695  * Synchronisation token
696  *****************************************************************************/
697 typedef struct _PVRSRV_SYNC_TOKEN_
699         /* This token is supposed to be passed around as an opaque object
700            - caller should not rely on the internal fields staying the same.
701            The fields are hidden in sPrivate in order to reinforce this. */
702         struct
703         {
704 #if defined (SUPPORT_SID_INTERFACE)
705                 IMG_SID    hKernelSyncInfo;
706 #else
707                 IMG_HANDLE hKernelSyncInfo;
708 #endif
709                 IMG_UINT32 ui32ReadOpsPendingSnapshot;
710                 IMG_UINT32 ui32WriteOpsPendingSnapshot;
711                 IMG_UINT32 ui32ReadOps2PendingSnapshot;
712         } sPrivate;
713 } PVRSRV_SYNC_TOKEN;
716 /******************************************************************************
717  * PVR Client Event handling in Services
718  *****************************************************************************/
719 typedef enum _PVRSRV_CLIENT_EVENT_
721         PVRSRV_CLIENT_EVENT_HWTIMEOUT = 0,
722 } PVRSRV_CLIENT_EVENT;
724 typedef IMG_VOID (*PFN_QUEUE_COMMAND_COMPLETE)(IMG_HANDLE hCallbackData);
726 IMG_IMPORT
727 PVRSRV_ERROR IMG_CALLCONV PVRSRVClientEvent(IMG_CONST PVRSRV_CLIENT_EVENT eEvent,
728                                                                                         PVRSRV_DEV_DATA *psDevData,
729                                                                                         IMG_PVOID pvData);
731 /******************************************************************************
732  * PVR Services API prototypes.
733  *****************************************************************************/
734 IMG_IMPORT
735 PVRSRV_ERROR IMG_CALLCONV PVRSRVConnect(PVRSRV_CONNECTION **ppsConnection, IMG_UINT32 ui32SrvFlags);
737 IMG_IMPORT
738 PVRSRV_ERROR IMG_CALLCONV PVRSRVDisconnect(IMG_CONST PVRSRV_CONNECTION *psConnection);
740 IMG_IMPORT
741 PVRSRV_ERROR IMG_CALLCONV PVRSRVEnumerateDevices(IMG_CONST PVRSRV_CONNECTION                    *psConnection,
742                                                                                                         IMG_UINT32                                      *puiNumDevices,
743                                                                                                         PVRSRV_DEVICE_IDENTIFIER        *puiDevIDs);
744 IMG_IMPORT
745 PVRSRV_ERROR IMG_CALLCONV PVRSRVAcquireDeviceData(IMG_CONST PVRSRV_CONNECTION   *psConnection,
746                                                                                                         IMG_UINT32                      uiDevIndex,
747                                                                                                         PVRSRV_DEV_DATA         *psDevData,
748                                                                                                         PVRSRV_DEVICE_TYPE      eDeviceType);
749 IMG_IMPORT
750 PVRSRV_ERROR IMG_CALLCONV PVRSRVGetMiscInfo (IMG_CONST PVRSRV_CONNECTION *psConnection, PVRSRV_MISC_INFO *psMiscInfo);
752 IMG_IMPORT
753 PVRSRV_ERROR IMG_CALLCONV PVRSRVReleaseMiscInfo (IMG_CONST PVRSRV_CONNECTION *psConnection, PVRSRV_MISC_INFO *psMiscInfo);
755 IMG_IMPORT
756 PVRSRV_ERROR PVRSRVPollForValue ( const PVRSRV_CONNECTION *psConnection,
757 #if defined (SUPPORT_SID_INTERFACE)
758                                                         IMG_SID    hOSEvent,
759 #else
760                                                         IMG_HANDLE hOSEvent,
761 #endif
762                                                         volatile IMG_UINT32 *pui32LinMemAddr,
763                                                         IMG_UINT32 ui32Value,
764                                                         IMG_UINT32 ui32Mask,
765                                                         IMG_UINT32 ui32Waitus,
766                                                         IMG_UINT32 ui32Tries);
768 /* memory APIs */
769 IMG_IMPORT
770 PVRSRV_ERROR IMG_CALLCONV PVRSRVCreateDeviceMemContext(IMG_CONST PVRSRV_DEV_DATA *psDevData,
771 #if defined (SUPPORT_SID_INTERFACE)
772                                                                                         IMG_SID    *phDevMemContext,
773 #else
774                                                                                         IMG_HANDLE *phDevMemContext,
775 #endif
776                                                                                         IMG_UINT32 *pui32SharedHeapCount,
777                                                                                         PVRSRV_HEAP_INFO *psHeapInfo);
779 IMG_IMPORT
780 PVRSRV_ERROR IMG_CALLCONV PVRSRVDestroyDeviceMemContext(IMG_CONST PVRSRV_DEV_DATA *psDevData,
781 #if defined (SUPPORT_SID_INTERFACE)
782                                                                                         IMG_SID                         hDevMemContext
783 #else
784                                                                                         IMG_HANDLE                      hDevMemContext
785 #endif
786         );
788 IMG_IMPORT
789 PVRSRV_ERROR IMG_CALLCONV PVRSRVGetDeviceMemHeapInfo(IMG_CONST PVRSRV_DEV_DATA *psDevData,
790 #if defined (SUPPORT_SID_INTERFACE)
791                                                                                         IMG_SID     hDevMemContext,
792 #else
793                                                                                         IMG_HANDLE hDevMemContext,
794 #endif
795                                                                                         IMG_UINT32 *pui32SharedHeapCount,
796                                                                                         PVRSRV_HEAP_INFO *psHeapInfo);
798 #if defined(PVRSRV_LOG_MEMORY_ALLOCS)
799         #define PVRSRVAllocDeviceMem_log(psDevData, hDevMemHeap, ui32Attribs, ui32Size, ui32Alignment, ppsMemInfo, logStr) \
800                 (PVR_TRACE(("PVRSRVAllocDeviceMem(" #psDevData "," #hDevMemHeap "," #ui32Attribs "," #ui32Size "," #ui32Alignment "," #ppsMemInfo ")" \
801                         ": " logStr " (size = 0x%lx)", ui32Size)), \
802                 PVRSRVAllocDeviceMem(psDevData, hDevMemHeap, ui32Attribs, ui32Size, ui32Alignment, ppsMemInfo))
803 #else
804         #define PVRSRVAllocDeviceMem_log(psDevData, hDevMemHeap, ui32Attribs, ui32Size, ui32Alignment, ppsMemInfo, logStr) \
805                 PVRSRVAllocDeviceMem(psDevData, hDevMemHeap, ui32Attribs, ui32Size, ui32Alignment, ppsMemInfo)
806 #endif
809 IMG_IMPORT
810 PVRSRV_ERROR IMG_CALLCONV PVRSRVAllocDeviceMem2(IMG_CONST PVRSRV_DEV_DATA       *psDevData,
811 #if defined (SUPPORT_SID_INTERFACE)
812                                                                         IMG_SID                 hDevMemHeap,
813 #else
814                                                                         IMG_HANDLE              hDevMemHeap,
815 #endif
816                                                                         IMG_UINT32              ui32Attribs,
817                                                                         IMG_SIZE_T              ui32Size,
818                                                                         IMG_SIZE_T              ui32Alignment,
819                                                                         IMG_PVOID               pvPrivData,
820                                                                         IMG_UINT32              ui32PrivDataLength,
821                                                                         PVRSRV_CLIENT_MEM_INFO  **ppsMemInfo);
823 IMG_IMPORT
824 PVRSRV_ERROR IMG_CALLCONV PVRSRVAllocDeviceMem(IMG_CONST PVRSRV_DEV_DATA        *psDevData,
825 #if defined (SUPPORT_SID_INTERFACE)
826                                                                         IMG_SID                 hDevMemHeap,
827 #else
828                                                                         IMG_HANDLE              hDevMemHeap,
829 #endif
830                                                                         IMG_UINT32              ui32Attribs,
831                                                                         IMG_SIZE_T              ui32Size,
832                                                                         IMG_SIZE_T              ui32Alignment,
833                                                                         PVRSRV_CLIENT_MEM_INFO  **ppsMemInfo);
835 IMG_IMPORT
836 PVRSRV_ERROR IMG_CALLCONV PVRSRVFreeDeviceMem(IMG_CONST PVRSRV_DEV_DATA *psDevData,
837                                                                 PVRSRV_CLIENT_MEM_INFO          *psMemInfo);
839 IMG_IMPORT
840 PVRSRV_ERROR IMG_CALLCONV PVRSRVMultiManageDevMem(IMG_CONST PVRSRV_DEV_DATA     *psDevData,
841                 IMG_UINT32 ui32ControlFlags, PVRSRV_MULTI_MANAGE_DEV_MEM_REQUESTS * psMultiMemDevRequest,
842                 IMG_UINT32 *ui32StatusFlags, IMG_UINT32 *ui32IndexError);
844 IMG_IMPORT
845 PVRSRV_ERROR IMG_CALLCONV PVRSRVManageDevMem(IMG_CONST PVRSRV_DEV_DATA  *psDevData,
846                 PVRSRV_MULTI_MANAGE_DEV_MEM_RQST_TYPE eReq, PVRSRV_CLIENT_MEM_INFO *psMemInfo,
847                 IMG_UINT32 *ui32StatusFlags);
849 IMG_IMPORT
850 PVRSRV_ERROR IMG_CALLCONV PVRSRVManageDevMemSwapGpuVirtAddr(IMG_CONST PVRSRV_DEV_DATA   *psDevData,
851                 PVRSRV_CLIENT_MEM_INFO *psMemInfoSourceArray, PVRSRV_CLIENT_MEM_INFO *psMemInfoTargetArray,
852                 IMG_UINT32 ui32NumBuff, IMG_UINT32 *ui32StatusFlags);
854 IMG_IMPORT
855 PVRSRV_ERROR IMG_CALLCONV PVRSRVExportDeviceMem(IMG_CONST PVRSRV_DEV_DATA       *psDevData,
856                                                                                                 PVRSRV_CLIENT_MEM_INFO          *psMemInfo,
857 #if defined (SUPPORT_SID_INTERFACE)
858                                                                                                 IMG_SID                                         *phMemInfo
859 #else
860                                                                                                 IMG_HANDLE                                      *phMemInfo
861 #endif
862         );
864 IMG_IMPORT
865 PVRSRV_ERROR IMG_CALLCONV PVRSRVReserveDeviceVirtualMem(IMG_CONST PVRSRV_DEV_DATA *psDevData,
866 #if defined (SUPPORT_SID_INTERFACE)
867                                                                                         IMG_SID                         hDevMemHeap,
868 #else
869                                                                                         IMG_HANDLE                      hDevMemHeap,
870 #endif
871                                                                                         IMG_DEV_VIRTADDR        *psDevVAddr,
872                                                                                         IMG_SIZE_T                      ui32Size,
873                                                                                         IMG_SIZE_T                      ui32Alignment,
874                                                                                         PVRSRV_CLIENT_MEM_INFO          **ppsMemInfo);
875 IMG_IMPORT
876 PVRSRV_ERROR IMG_CALLCONV PVRSRVFreeDeviceVirtualMem(IMG_CONST PVRSRV_DEV_DATA *psDevData,
877                                                                                                         PVRSRV_CLIENT_MEM_INFO *psMemInfo);
879 IMG_IMPORT
880 PVRSRV_ERROR IMG_CALLCONV PVRSRVMapDeviceMemory (IMG_CONST PVRSRV_DEV_DATA *psDevData,
881 #if defined (SUPPORT_SID_INTERFACE)
882                                                                         IMG_SID hKernelMemInfo,
883                                                                         IMG_SID hDstDevMemHeap,
884 #else
885                                                                         IMG_HANDLE hKernelMemInfo,
886                                                                         IMG_HANDLE hDstDevMemHeap,
887 #endif
888                                                                         PVRSRV_CLIENT_MEM_INFO **ppsDstMemInfo);
890 IMG_IMPORT
891 PVRSRV_ERROR IMG_CALLCONV PVRSRVUnmapDeviceMemory (IMG_CONST PVRSRV_DEV_DATA *psDevData,
892                                                                                 PVRSRV_CLIENT_MEM_INFO *psMemInfo);
894 IMG_IMPORT
895 PVRSRV_ERROR IMG_CALLCONV PVRSRVMapExtMemory (IMG_CONST PVRSRV_DEV_DATA *psDevData,
896                                                                         PVRSRV_CLIENT_MEM_INFO          *psMemInfo,
897                                                                         IMG_SYS_PHYADDR                         *psSysPAddr,
898                                                                         IMG_UINT32                                      ui32Flags);
899 IMG_IMPORT
900 PVRSRV_ERROR IMG_CALLCONV PVRSRVUnmapExtMemory (IMG_CONST PVRSRV_DEV_DATA *psDevData,
901                                                                         PVRSRV_CLIENT_MEM_INFO          *psMemInfo,
902                                                                         IMG_UINT32                                      ui32Flags);
904 IMG_IMPORT
905 PVRSRV_ERROR IMG_CALLCONV PVRSRVWrapExtMemory(IMG_CONST PVRSRV_DEV_DATA *psDevData,
906 #if defined (SUPPORT_SID_INTERFACE)
907                                                                                                 IMG_SID                                 hDevMemContext,
908 #else
909                                                                                                 IMG_HANDLE                              hDevMemContext,
910 #endif
911                                                                                                 IMG_SIZE_T                              ui32ByteSize,
912                                                                                                 IMG_SIZE_T                              ui32PageOffset,
913                                                                                                 IMG_BOOL                                bPhysContig,
914                                                                                                 IMG_SYS_PHYADDR                 *psSysPAddr,
915                                                                                                 IMG_VOID                                *pvLinAddr,
916                                                                                                 IMG_UINT32                              ui32Flags,
917                                                                                                 PVRSRV_CLIENT_MEM_INFO **ppsMemInfo);
918 IMG_IMPORT
919 PVRSRV_ERROR IMG_CALLCONV PVRSRVUnwrapExtMemory (IMG_CONST PVRSRV_DEV_DATA *psDevData,
920                                                                                                 PVRSRV_CLIENT_MEM_INFO *psMemInfo);
922 PVRSRV_ERROR PVRSRVChangeDeviceMemoryAttributes(IMG_CONST PVRSRV_DEV_DATA                       *psDevData,
923                                                                                                 PVRSRV_CLIENT_MEM_INFO  *psClientMemInfo,
924                                                                                                 IMG_UINT32                              ui32Attribs);
926 IMG_IMPORT
927 PVRSRV_ERROR IMG_CALLCONV PVRSRVMapDeviceClassMemory (IMG_CONST PVRSRV_DEV_DATA *psDevData,
928 #if defined (SUPPORT_SID_INTERFACE)
929                                                                                 IMG_SID hDevMemContext,
930                                                                                 IMG_SID hDeviceClassBuffer,
931 #else
932                                                                                 IMG_HANDLE hDevMemContext,
933                                                                                 IMG_HANDLE hDeviceClassBuffer,
934 #endif
935                                                                                 PVRSRV_CLIENT_MEM_INFO **ppsMemInfo);
936 IMG_IMPORT
937 PVRSRV_ERROR IMG_CALLCONV PVRSRVUnmapDeviceClassMemory (IMG_CONST PVRSRV_DEV_DATA *psDevData,
938                                                                                 PVRSRV_CLIENT_MEM_INFO *psMemInfo);
940 IMG_IMPORT
941 PVRSRV_ERROR IMG_CALLCONV PVRSRVMapPhysToUserSpace(IMG_CONST PVRSRV_DEV_DATA *psDevData,
942                                                                           IMG_SYS_PHYADDR sSysPhysAddr,
943                                                                           IMG_UINT32 uiSizeInBytes,
944                                                                           IMG_PVOID *ppvUserAddr,
945                                                                           IMG_UINT32 *puiActualSize,
946                                                                           IMG_PVOID *ppvProcess);
948 IMG_IMPORT
949 PVRSRV_ERROR IMG_CALLCONV PVRSRVUnmapPhysToUserSpace(IMG_CONST PVRSRV_DEV_DATA *psDevData,
950                                                                                 IMG_PVOID pvUserAddr,
951                                                                                 IMG_PVOID pvProcess);
953 #if defined(LINUX)
954 IMG_IMPORT
955 PVRSRV_ERROR IMG_CALLCONV PVRSRVCloseExportedDeviceMemHanle(const PVRSRV_DEV_DATA       *psDevData,
956                                                                                                  IMG_INT i32Fd);
957 IMG_IMPORT
958 PVRSRV_ERROR IMG_CALLCONV PVRSRVExportDeviceMem2(IMG_CONST PVRSRV_DEV_DATA      *psDevData,
959                                                                                                  PVRSRV_CLIENT_MEM_INFO         *psMemInfo,
960                                                                                                  IMG_INT                                        *iFd);
962 IMG_IMPORT
963 PVRSRV_ERROR IMG_CALLCONV PVRSRVMapDeviceMemory2(IMG_CONST PVRSRV_DEV_DATA      *psDevData,
964                                                                                                  IMG_INT                                        iFd,
965 #if defined (SUPPORT_SID_INTERFACE)
966                                                                                                  IMG_SID                                        hDstDevMemHeap,
967 #else
968                                                                                                  IMG_HANDLE                                     hDstDevMemHeap,
969 #endif
970                                                                                                  PVRSRV_CLIENT_MEM_INFO         **ppsDstMemInfo);
971 #endif /* defined(LINUX) */
973 #if defined(SUPPORT_ION)
974 PVRSRV_ERROR PVRSRVMapIonHandle(const PVRSRV_DEV_DATA *psDevData,
975 #if defined (SUPPORT_SID_INTERFACE)
976                                                                  IMG_SID    hDevMemContext,
977 #else
978                                                                  IMG_HANDLE hDevMemContext,
979 #endif
980                                                                 IMG_INT32 uiFD,
981                                                                 IMG_UINT32 uiSize,
982                                                                 IMG_UINT32 ui32Attribs,
983                                                                 PVRSRV_CLIENT_MEM_INFO **ppsMemInfo);
985 PVRSRV_ERROR PVRSRVUnmapIonHandle(const PVRSRV_DEV_DATA *psDevData,
986                                                                   PVRSRV_CLIENT_MEM_INFO *psMemInfo);
987 #endif /* defined (SUPPORT_ION) */
990 IMG_IMPORT
991 PVRSRV_ERROR IMG_CALLCONV PVRSRVAllocDeviceMemSparse(const PVRSRV_DEV_DATA *psDevData,
992 #if defined (SUPPORT_SID_INTERFACE)
993                                                                                                         IMG_SID  hDevMemHeap,
994 #else
995                                                                                                         IMG_HANDLE hDevMemHeap,
996 #endif
997                                                                                                         IMG_UINT32 ui32Attribs,
998                                                                                                         IMG_SIZE_T uAlignment,
999                                                                                                         IMG_UINT32 ui32ChunkSize,
1000                                                                                                         IMG_UINT32 ui32NumVirtChunks,
1001                                                                                                         IMG_UINT32 ui32NumPhysChunks,
1002                                                                                                         IMG_BOOL *pabMapChunk,
1003                                                                                                         PVRSRV_CLIENT_MEM_INFO **ppsMemInfo);
1005 /******************************************************************************
1006  * PVR Allocation Synchronisation Functionality...
1007  *****************************************************************************/
1009 typedef enum _PVRSRV_SYNCVAL_MODE_
1011         PVRSRV_SYNCVAL_READ                             = IMG_TRUE,
1012         PVRSRV_SYNCVAL_WRITE                    = IMG_FALSE,
1014 } PVRSRV_SYNCVAL_MODE, *PPVRSRV_SYNCVAL_MODE;
1016 typedef IMG_UINT32 PVRSRV_SYNCVAL;
1018 IMG_IMPORT PVRSRV_ERROR PVRSRVWaitForOpsComplete(PPVRSRV_CLIENT_MEM_INFO psMemInfo,
1019         PVRSRV_SYNCVAL_MODE eMode, PVRSRV_SYNCVAL OpRequired);
1021 IMG_IMPORT PVRSRV_ERROR PVRSRVWaitForAllOpsComplete(PPVRSRV_CLIENT_MEM_INFO psMemInfo,
1022         PVRSRV_SYNCVAL_MODE eMode);
1024 IMG_IMPORT IMG_BOOL PVRSRVTestOpsComplete(PPVRSRV_CLIENT_MEM_INFO psMemInfo,
1025         PVRSRV_SYNCVAL_MODE eMode, PVRSRV_SYNCVAL OpRequired);
1027 IMG_IMPORT IMG_BOOL PVRSRVTestAllOpsComplete(PPVRSRV_CLIENT_MEM_INFO psMemInfo,
1028         PVRSRV_SYNCVAL_MODE eMode);
1030 IMG_IMPORT IMG_BOOL PVRSRVTestOpsNotComplete(PPVRSRV_CLIENT_MEM_INFO psMemInfo,
1031         PVRSRV_SYNCVAL_MODE eMode, PVRSRV_SYNCVAL OpRequired);
1033 IMG_IMPORT IMG_BOOL PVRSRVTestAllOpsNotComplete(PPVRSRV_CLIENT_MEM_INFO psMemInfo,
1034         PVRSRV_SYNCVAL_MODE eMode);
1036 IMG_IMPORT PVRSRV_SYNCVAL PVRSRVGetPendingOpSyncVal(PPVRSRV_CLIENT_MEM_INFO psMemInfo,
1037         PVRSRV_SYNCVAL_MODE eMode);
1040 /******************************************************************************
1041  * Common Device Class Enumeration
1042  *****************************************************************************/
1043 IMG_IMPORT
1044 PVRSRV_ERROR IMG_CALLCONV PVRSRVEnumerateDeviceClass(IMG_CONST PVRSRV_CONNECTION *psConnection,
1045                                                                                                         PVRSRV_DEVICE_CLASS DeviceClass,
1046                                                                                                         IMG_UINT32 *pui32DevCount,
1047                                                                                                         IMG_UINT32 *pui32DevID);
1049 /******************************************************************************
1050  * Display Device Class API definition
1051  *****************************************************************************/
1052 IMG_IMPORT
1053 IMG_HANDLE IMG_CALLCONV PVRSRVOpenDCDevice(IMG_CONST PVRSRV_DEV_DATA *psDevData,
1054                                                                                         IMG_UINT32 ui32DeviceID);
1056 IMG_IMPORT
1057 PVRSRV_ERROR IMG_CALLCONV PVRSRVCloseDCDevice(IMG_CONST PVRSRV_CONNECTION       *psConnection, IMG_HANDLE hDevice);
1059 IMG_IMPORT
1060 PVRSRV_ERROR IMG_CALLCONV PVRSRVEnumDCFormats (IMG_HANDLE hDevice,
1061                                                                                         IMG_UINT32              *pui32Count,
1062                                                                                         DISPLAY_FORMAT  *psFormat);
1064 IMG_IMPORT
1065 PVRSRV_ERROR IMG_CALLCONV PVRSRVEnumDCDims (IMG_HANDLE hDevice,
1066                                                                                 IMG_UINT32              *pui32Count,
1067                                                                                 DISPLAY_FORMAT  *psFormat,
1068                                                                                 DISPLAY_DIMS    *psDims);
1070 IMG_IMPORT
1071 PVRSRV_ERROR IMG_CALLCONV PVRSRVGetDCSystemBuffer(IMG_HANDLE hDevice,
1072 #if defined (SUPPORT_SID_INTERFACE)
1073                                                                                 IMG_SID *phBuffer
1074 #else
1075                                                                                 IMG_HANDLE *phBuffer
1076 #endif
1077         );
1079 IMG_IMPORT
1080 PVRSRV_ERROR IMG_CALLCONV PVRSRVGetDCInfo(IMG_HANDLE hDevice,
1081                                                                                 DISPLAY_INFO* psDisplayInfo);
1083 IMG_IMPORT
1084 PVRSRV_ERROR IMG_CALLCONV PVRSRVCreateDCSwapChain (IMG_HANDLE                           hDevice,
1085                                                                                                         IMG_UINT32                              ui32Flags,
1086                                                                                                         DISPLAY_SURF_ATTRIBUTES *psDstSurfAttrib,
1087                                                                                                         DISPLAY_SURF_ATTRIBUTES *psSrcSurfAttrib,
1088                                                                                                         IMG_UINT32                              ui32BufferCount,
1089                                                                                                         IMG_UINT32                              ui32OEMFlags,
1090                                                                                                         IMG_UINT32                              *pui32SwapChainID,
1091 #if defined (SUPPORT_SID_INTERFACE)
1092                                                                                                         IMG_SID                                 *phSwapChain
1093 #else
1094                                                                                                         IMG_HANDLE                              *phSwapChain
1095 #endif
1096         );
1098 IMG_IMPORT
1099 PVRSRV_ERROR IMG_CALLCONV PVRSRVDestroyDCSwapChain (IMG_HANDLE hDevice,
1100 #if defined (SUPPORT_SID_INTERFACE)
1101                                                                                         IMG_SID hSwapChain
1102 #else
1103                                                                                         IMG_HANDLE              hSwapChain
1104 #endif
1105         );
1107 IMG_IMPORT
1108 PVRSRV_ERROR IMG_CALLCONV PVRSRVSetDCDstRect (IMG_HANDLE hDevice,
1109 #if defined (SUPPORT_SID_INTERFACE)
1110                                                                                 IMG_SID         hSwapChain,
1111 #else
1112                                                                                 IMG_HANDLE      hSwapChain,
1113 #endif
1114                                                                                 IMG_RECT        *psDstRect);
1116 IMG_IMPORT
1117 PVRSRV_ERROR IMG_CALLCONV PVRSRVSetDCSrcRect (IMG_HANDLE hDevice,
1118 #if defined (SUPPORT_SID_INTERFACE)
1119                                                                                 IMG_SID         hSwapChain,
1120 #else
1121                                                                                 IMG_HANDLE      hSwapChain,
1122 #endif
1123                                                                                 IMG_RECT        *psSrcRect);
1125 IMG_IMPORT
1126 PVRSRV_ERROR IMG_CALLCONV PVRSRVSetDCDstColourKey (IMG_HANDLE hDevice,
1127 #if defined (SUPPORT_SID_INTERFACE)
1128                                                                                         IMG_SID         hSwapChain,
1129 #else
1130                                                                                         IMG_HANDLE      hSwapChain,
1131 #endif
1132                                                                                         IMG_UINT32      ui32CKColour);
1134 IMG_IMPORT
1135 PVRSRV_ERROR IMG_CALLCONV PVRSRVSetDCSrcColourKey (IMG_HANDLE hDevice,
1136 #if defined (SUPPORT_SID_INTERFACE)
1137                                                                                         IMG_SID         hSwapChain,
1138 #else
1139                                                                                         IMG_HANDLE      hSwapChain,
1140 #endif
1141                                                                                         IMG_UINT32      ui32CKColour);
1143 IMG_IMPORT
1144 PVRSRV_ERROR IMG_CALLCONV PVRSRVGetDCBuffers(IMG_HANDLE hDevice,
1145 #if defined (SUPPORT_SID_INTERFACE)
1146                                                                         IMG_SID     hSwapChain,
1147                                                                         IMG_SID    *phBuffer
1148 #else
1149                                                                         IMG_HANDLE hSwapChain,
1150                                                                         IMG_HANDLE *phBuffer
1151 #endif
1152         );
1154 IMG_IMPORT
1155 PVRSRV_ERROR IMG_CALLCONV PVRSRVGetDCBuffers2(IMG_HANDLE hDevice,
1156 #if defined (SUPPORT_SID_INTERFACE)
1157                                                                                           IMG_SID    hSwapChain,
1158                                                                                           IMG_SID   *phBuffer,
1159 #else
1160                                                                                           IMG_HANDLE hSwapChain,
1161                                                                                           IMG_HANDLE *phBuffer,
1162 #endif
1163                                                                                           IMG_SYS_PHYADDR *psPhyAddr);
1165 IMG_IMPORT
1166 PVRSRV_ERROR IMG_CALLCONV PVRSRVSwapToDCBuffer (IMG_HANDLE hDevice,
1167 #if defined (SUPPORT_SID_INTERFACE)
1168                                                                                 IMG_SID    hBuffer,
1169 #else
1170                                                                                 IMG_HANDLE hBuffer,
1171 #endif
1172                                                                                 IMG_UINT32 ui32ClipRectCount,
1173                                                                                 IMG_RECT  *psClipRect,
1174                                                                                 IMG_UINT32 ui32SwapInterval,
1175 #if defined (SUPPORT_SID_INTERFACE)
1176                                                                                 IMG_SID hPrivateTag
1177 #else
1178                                                                                 IMG_HANDLE hPrivateTag
1179 #endif
1180         );
1182 IMG_IMPORT
1183 PVRSRV_ERROR IMG_CALLCONV PVRSRVSwapToDCBuffer2 (IMG_HANDLE hDevice,
1184 #if defined (SUPPORT_SID_INTERFACE)
1185                                                                                 IMG_SID    hBuffer,
1186 #else
1187                                                                                 IMG_HANDLE hBuffer,
1188 #endif
1189                                                                                 IMG_UINT32 ui32SwapInterval,
1190                                                                                 PVRSRV_CLIENT_MEM_INFO **ppsMemInfos,
1191                                                                                 IMG_UINT32 ui32NumMemInfos,
1192                                                                                 IMG_PVOID  pvPrivData,
1193                                                                                 IMG_UINT32 ui32PrivDataLength);
1195 IMG_IMPORT
1196 PVRSRV_ERROR IMG_CALLCONV PVRSRVSwapToDCSystem (IMG_HANDLE hDevice,
1197 #if defined (SUPPORT_SID_INTERFACE)
1198                                                                                 IMG_SID hSwapChain
1199 #else
1200                                                                                 IMG_HANDLE hSwapChain
1201 #endif
1202         );
1204 /******************************************************************************
1205  * Buffer Device Class API definition
1206  *****************************************************************************/
1207 IMG_IMPORT
1208 IMG_HANDLE IMG_CALLCONV PVRSRVOpenBCDevice(IMG_CONST PVRSRV_DEV_DATA *psDevData,
1209                                                                                         IMG_UINT32 ui32DeviceID);
1211 IMG_IMPORT
1212 PVRSRV_ERROR IMG_CALLCONV PVRSRVCloseBCDevice(IMG_CONST PVRSRV_CONNECTION *psConnection,
1213                                                                                                 IMG_HANDLE hDevice);
1215 IMG_IMPORT
1216 PVRSRV_ERROR IMG_CALLCONV PVRSRVGetBCBufferInfo(IMG_HANDLE hDevice,
1217                                                                                                 BUFFER_INFO     *psBuffer);
1219 IMG_IMPORT
1220 PVRSRV_ERROR IMG_CALLCONV PVRSRVGetBCBuffer(IMG_HANDLE hDevice,
1221                                                                                                 IMG_UINT32 ui32BufferIndex,
1222 #if defined (SUPPORT_SID_INTERFACE)
1223                                                                                                 IMG_SID   *phBuffer
1224 #else
1225                                                                                                 IMG_HANDLE *phBuffer
1226 #endif
1227         );
1230 /******************************************************************************
1231  * PDUMP Function prototypes...
1232  *****************************************************************************/
1233 IMG_IMPORT
1234 PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpInit(IMG_CONST PVRSRV_CONNECTION *psConnection);
1236 IMG_IMPORT
1237 PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpStartInitPhase(IMG_CONST PVRSRV_CONNECTION *psConnection);
1239 IMG_IMPORT
1240 PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpStopInitPhase(IMG_CONST PVRSRV_CONNECTION *psConnection);
1242 IMG_IMPORT
1243 PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpMemPol(IMG_CONST PVRSRV_CONNECTION *psConnection,
1244 #if defined (SUPPORT_SID_INTERFACE)
1245                                                                                   IMG_SID    hKernelMemInfo,
1246 #else
1247                                                                                   PVRSRV_CLIENT_MEM_INFO *psMemInfo,
1248 #endif                                                                            
1249                                                                                   IMG_UINT32 ui32Offset,
1250                                                                                   IMG_UINT32 ui32Value,
1251                                                                                   IMG_UINT32 ui32Mask,
1252                                                                                   PDUMP_POLL_OPERATOR eOperator,
1253                                                                                   IMG_UINT32 ui32Flags);
1255 IMG_IMPORT
1256 PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpSyncPol(IMG_CONST PVRSRV_CONNECTION *psConnection,
1257 #if defined (SUPPORT_SID_INTERFACE)
1258                                                                                          IMG_SID    hKernelSyncInfo,
1259 #else
1260                                                                                          PVRSRV_CLIENT_SYNC_INFO *psClientSyncInfo,
1261 #endif
1262                                                                                          IMG_BOOL   bIsRead,
1263                                                                                          IMG_UINT32 ui32Value,
1264                                                                                          IMG_UINT32 ui32Mask);
1266 IMG_IMPORT
1267 PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpSyncPol2(IMG_CONST PVRSRV_CONNECTION *psConnection,
1268 #if defined (SUPPORT_SID_INTERFACE)
1269                                                                                          IMG_SID  hKernelSyncInfo,
1270 #else
1271                                                                                          PVRSRV_CLIENT_SYNC_INFO *psClientSyncInfo,
1272 #endif
1273                                                                                          IMG_BOOL bIsRead);
1275 IMG_IMPORT
1276 PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpMem(IMG_CONST PVRSRV_CONNECTION *psConnection,
1277                                                                         IMG_PVOID pvAltLinAddr,
1278                                                                         PVRSRV_CLIENT_MEM_INFO *psMemInfo,
1279                                                                         IMG_UINT32 ui32Offset,
1280                                                                         IMG_UINT32 ui32Bytes,
1281                                                                         IMG_UINT32 ui32Flags);
1283 IMG_IMPORT
1284 PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpSync(IMG_CONST PVRSRV_CONNECTION *psConnection,
1285                                                                                 IMG_PVOID pvAltLinAddr,
1286                                                                                 PVRSRV_CLIENT_SYNC_INFO *psClientSyncInfo,
1287                                                                                 IMG_UINT32 ui32Offset,
1288                                                                                 IMG_UINT32 ui32Bytes);
1290 IMG_IMPORT
1291 PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpReg(IMG_CONST PVRSRV_DEV_DATA *psDevData,
1292                                                                                  IMG_CHAR *pszRegRegion,
1293                                                                                         IMG_UINT32 ui32RegAddr,
1294                                                                                         IMG_UINT32 ui32RegValue,
1295                                                                                         IMG_UINT32 ui32Flags);
1297 IMG_IMPORT
1298 PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpRegPolWithFlags(const PVRSRV_DEV_DATA *psDevData,
1299                                                                                                          IMG_CHAR *pszRegRegion,
1300                                                                                                          IMG_UINT32 ui32RegAddr,
1301                                                                                                          IMG_UINT32 ui32RegValue,
1302                                                                                                          IMG_UINT32 ui32Mask,
1303                                                                                                          IMG_UINT32 ui32Flags);
1304 IMG_IMPORT
1305 PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpRegPol(const PVRSRV_DEV_DATA *psDevData,
1306                                                                                         IMG_CHAR *pszRegRegion,
1307                                                                                         IMG_UINT32 ui32RegAddr,
1308                                                                                         IMG_UINT32 ui32RegValue,
1309                                                                                         IMG_UINT32 ui32Mask);
1311 IMG_IMPORT
1312 PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpPDReg(IMG_CONST PVRSRV_CONNECTION *psConnection,
1313                                                                                         IMG_UINT32 ui32RegAddr,
1314                                                                                         IMG_UINT32 ui32RegValue);
1315 IMG_IMPORT
1316 PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpPDDevPAddr(IMG_CONST PVRSRV_CONNECTION *psConnection,
1317                                                                                                 PVRSRV_CLIENT_MEM_INFO *psMemInfo,
1318                                                                                                 IMG_UINT32 ui32Offset,
1319                                                                                                 IMG_DEV_PHYADDR sPDDevPAddr);
1321 #if !defined(USE_CODE)
1322 IMG_IMPORT
1323 PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpMemPages(IMG_CONST PVRSRV_DEV_DATA *psDevData,
1324 #if defined (SUPPORT_SID_INTERFACE)
1325                                                                                                                    IMG_SID                              hKernelMemInfo,
1326 #else
1327                                                                                                                    IMG_HANDLE                   hKernelMemInfo,
1328 #endif
1329                                                                                                                    IMG_DEV_PHYADDR              *pPages,
1330                                                                                                                    IMG_UINT32                   ui32NumPages,
1331                                                                                                                    IMG_DEV_VIRTADDR             sDevVAddr,
1332                                                                                                                    IMG_UINT32                   ui32Start,
1333                                                                                                                    IMG_UINT32                   ui32Length,
1334                                                                                                                    IMG_UINT32                   ui32Flags);
1335 #endif
1337 IMG_IMPORT
1338 PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpSetFrame(IMG_CONST PVRSRV_CONNECTION *psConnection,
1339                                                                                           IMG_UINT32 ui32Frame);
1341 IMG_IMPORT
1342 PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpComment(IMG_CONST PVRSRV_CONNECTION *psConnection,
1343                                                                                          IMG_CONST IMG_CHAR *pszComment,
1344                                                                                          IMG_BOOL bContinuous);
1346 IMG_IMPORT
1347 PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpCommentf(IMG_CONST PVRSRV_CONNECTION *psConnection,
1348                                                                                           IMG_BOOL bContinuous,
1349                                                                                           IMG_CONST IMG_CHAR *pszFormat, ...)
1350 #if !defined(USE_CODE)
1351                                                                                           IMG_FORMAT_PRINTF(3, 4)
1352 #endif
1355 IMG_IMPORT
1356 PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpCommentWithFlagsf(IMG_CONST PVRSRV_CONNECTION *psConnection,
1357                                                                                                            IMG_UINT32 ui32Flags,
1358                                                                                                            IMG_CONST IMG_CHAR *pszFormat, ...)
1359 #if !defined(USE_CODE)
1360                                                                                                            IMG_FORMAT_PRINTF(3, 4)
1361 #endif
1364 IMG_IMPORT
1365 PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpDriverInfo(IMG_CONST PVRSRV_CONNECTION *psConnection,
1366                                                                                                 IMG_CHAR *pszString,
1367                                                                                                 IMG_BOOL bContinuous);
1369 IMG_IMPORT
1370 PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpIsCapturing(IMG_CONST PVRSRV_CONNECTION *psConnection,
1371                                                                                                 IMG_BOOL *pbIsCapturing);
1373 IMG_IMPORT
1374 PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpBitmap(IMG_CONST PVRSRV_DEV_DATA *psDevData,
1375                                                                                         IMG_CHAR *pszFileName,
1376                                                                                         IMG_UINT32 ui32FileOffset,
1377                                                                                         IMG_UINT32 ui32Width,
1378                                                                                         IMG_UINT32 ui32Height,
1379                                                                                         IMG_UINT32 ui32StrideInBytes,
1380                                                                                         IMG_DEV_VIRTADDR sDevBaseAddr,
1381 #if defined (SUPPORT_SID_INTERFACE)
1382                                                                                         IMG_SID    hDevMemContext,
1383 #else
1384                                                                                         IMG_HANDLE hDevMemContext,
1385 #endif
1386                                                                                         IMG_UINT32 ui32Size,
1387                                                                                         PDUMP_PIXEL_FORMAT ePixelFormat,
1388                                                                                         PDUMP_MEM_FORMAT eMemFormat,
1389                                                                                         IMG_UINT32 ui32PDumpFlags);
1391 IMG_IMPORT
1392 PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpRegRead(IMG_CONST PVRSRV_DEV_DATA *psDevData,
1393                                                                                         IMG_CONST IMG_CHAR *pszRegRegion,
1394                                                                                         IMG_CONST IMG_CHAR *pszFileName,
1395                                                                                         IMG_UINT32 ui32FileOffset,
1396                                                                                         IMG_UINT32 ui32Address,
1397                                                                                         IMG_UINT32 ui32Size,
1398                                                                                         IMG_UINT32 ui32PDumpFlags);
1401 IMG_IMPORT
1402 IMG_BOOL IMG_CALLCONV PVRSRVPDumpIsCapturingTest(IMG_CONST PVRSRV_CONNECTION *psConnection);
1404 IMG_IMPORT
1405 PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpCycleCountRegRead(IMG_CONST PVRSRV_DEV_DATA *psDevData,
1406                                                                                                                 IMG_UINT32 ui32RegOffset,
1407                                                                                                                 IMG_BOOL bLastFrame);
1409 IMG_IMPORT IMG_HANDLE   PVRSRVLoadLibrary(const IMG_CHAR *pszLibraryName);
1410 IMG_IMPORT PVRSRV_ERROR PVRSRVUnloadLibrary(IMG_HANDLE hExtDrv);
1411 IMG_IMPORT PVRSRV_ERROR PVRSRVGetLibFuncAddr(IMG_HANDLE hExtDrv, const IMG_CHAR *pszFunctionName, IMG_VOID **ppvFuncAddr);
1413 IMG_IMPORT IMG_UINT32 PVRSRVClockus (void);
1414 IMG_IMPORT IMG_VOID PVRSRVWaitus (IMG_UINT32 ui32Timeus);
1415 IMG_IMPORT IMG_VOID PVRSRVReleaseThreadQuanta (void);
1416 IMG_IMPORT IMG_UINT32 IMG_CALLCONV PVRSRVGetCurrentProcessID(void);
1417 IMG_IMPORT IMG_CHAR * IMG_CALLCONV PVRSRVSetLocale(const IMG_CHAR *pszLocale);
1423 IMG_IMPORT IMG_VOID IMG_CALLCONV PVRSRVCreateAppHintState(IMG_MODULE_ID eModuleID,
1424                                                                                                                 const IMG_CHAR *pszAppName,
1425                                                                                                                 IMG_VOID **ppvState);
1426 IMG_IMPORT IMG_VOID IMG_CALLCONV PVRSRVFreeAppHintState(IMG_MODULE_ID eModuleID,
1427                                                                                  IMG_VOID *pvHintState);
1429 IMG_IMPORT IMG_BOOL IMG_CALLCONV PVRSRVGetAppHint(IMG_VOID                      *pvHintState,
1430                                                                                                   const IMG_CHAR        *pszHintName,
1431                                                                                                   IMG_DATA_TYPE         eDataType,
1432                                                                                                   const IMG_VOID        *pvDefault,
1433                                                                                                   IMG_VOID                      *pvReturn);
1435 /******************************************************************************
1436  * Memory API(s)
1437  *****************************************************************************/
1439 /* Exported APIs */
1440 IMG_IMPORT IMG_PVOID IMG_CALLCONV PVRSRVAllocUserModeMem (IMG_SIZE_T ui32Size);
1441 IMG_IMPORT IMG_PVOID IMG_CALLCONV PVRSRVCallocUserModeMem (IMG_SIZE_T ui32Size);
1442 IMG_IMPORT IMG_PVOID IMG_CALLCONV PVRSRVReallocUserModeMem (IMG_PVOID pvBase, IMG_SIZE_T uNewSize);
1443 IMG_IMPORT IMG_VOID  IMG_CALLCONV PVRSRVFreeUserModeMem (IMG_PVOID pvMem);
1444 IMG_IMPORT IMG_VOID PVRSRVMemCopy(IMG_VOID *pvDst, const IMG_VOID *pvSrc, IMG_SIZE_T ui32Size);
1445 IMG_IMPORT IMG_VOID PVRSRVMemSet(IMG_VOID *pvDest, IMG_UINT8 ui8Value, IMG_SIZE_T ui32Size);
1447 struct _PVRSRV_MUTEX_OPAQUE_STRUCT_;
1448 typedef struct  _PVRSRV_MUTEX_OPAQUE_STRUCT_ *PVRSRV_MUTEX_HANDLE;
1451 #if defined(PVR_DEBUG_MUTEXES)
1453 IMG_IMPORT PVRSRV_ERROR IMG_CALLCONV PVRSRVCreateMutex(PVRSRV_MUTEX_HANDLE *phMutex,
1454                                                                                                            IMG_CHAR pszMutexName[],
1455                                                                                                            IMG_CHAR pszFilename[],
1456                                                                                                            IMG_INT iLine);
1457 IMG_IMPORT PVRSRV_ERROR IMG_CALLCONV PVRSRVDestroyMutex(PVRSRV_MUTEX_HANDLE hMutex,
1458                                                                                                                 IMG_CHAR pszMutexName[],
1459                                                                                                                 IMG_CHAR pszFilename[],
1460                                                                                                                 IMG_INT iLine);
1461 IMG_IMPORT IMG_VOID IMG_CALLCONV PVRSRVLockMutex(PVRSRV_MUTEX_HANDLE hMutex,
1462                                                                                                  IMG_CHAR pszMutexName[],
1463                                                                                                  IMG_CHAR pszFilename[],
1464                                                                                                  IMG_INT iLine);
1465 IMG_IMPORT IMG_VOID IMG_CALLCONV PVRSRVUnlockMutex(PVRSRV_MUTEX_HANDLE hMutex,
1466                                                                                                    IMG_CHAR pszMutexName[],
1467                                                                                                    IMG_CHAR pszFilename[],
1468                                                                                                    IMG_INT iLine);
1470 #define PVRSRVCreateMutex(phMutex) PVRSRVCreateMutex(phMutex, #phMutex, __FILE__, __LINE__)
1471 #define PVRSRVDestroyMutex(hMutex) PVRSRVDestroyMutex(hMutex, #hMutex, __FILE__, __LINE__)
1472 #define PVRSRVLockMutex(hMutex) PVRSRVLockMutex(hMutex, #hMutex, __FILE__, __LINE__)
1473 #define PVRSRVUnlockMutex(hMutex) PVRSRVUnlockMutex(hMutex, #hMutex, __FILE__, __LINE__)
1475 #else /* defined(PVR_DEBUG_MUTEXES) */
1477 IMG_IMPORT PVRSRV_ERROR IMG_CALLCONV PVRSRVCreateMutex(PVRSRV_MUTEX_HANDLE *phMutex);
1478 IMG_IMPORT PVRSRV_ERROR IMG_CALLCONV PVRSRVDestroyMutex(PVRSRV_MUTEX_HANDLE hMutex);
1479 IMG_IMPORT IMG_VOID IMG_CALLCONV PVRSRVLockMutex(PVRSRV_MUTEX_HANDLE hMutex);
1480 IMG_IMPORT IMG_VOID IMG_CALLCONV PVRSRVUnlockMutex(PVRSRV_MUTEX_HANDLE hMutex);
1482 #endif /* defined(PVR_DEBUG_MUTEXES) */
1485 struct _PVRSRV_RECMUTEX_OPAQUE_STRUCT_;
1486 typedef struct  _PVRSRV_RECMUTEX_OPAQUE_STRUCT_ *PVRSRV_RECMUTEX_HANDLE;
1489 #if defined(PVR_DEBUG_MUTEXES)
1491 IMG_IMPORT PVRSRV_ERROR IMG_CALLCONV PVRSRVCreateRecursiveMutex(PVRSRV_RECMUTEX_HANDLE *phMutex,
1492                                                                                                            IMG_CHAR pszMutexName[],
1493                                                                                                            IMG_CHAR pszFilename[],
1494                                                                                                            IMG_INT iLine);
1495 IMG_IMPORT PVRSRV_ERROR IMG_CALLCONV PVRSRVDestroyRecursiveMutex(PVRSRV_RECMUTEX_HANDLE hMutex,
1496                                                                                                                 IMG_CHAR pszMutexName[],
1497                                                                                                                 IMG_CHAR pszFilename[],
1498                                                                                                                 IMG_INT iLine);
1499 IMG_IMPORT IMG_VOID IMG_CALLCONV PVRSRVLockRecursiveMutex(PVRSRV_RECMUTEX_HANDLE hMutex,
1500                                                                                                  IMG_CHAR pszMutexName[],
1501                                                                                                  IMG_CHAR pszFilename[],
1502                                                                                                  IMG_INT iLine);
1503 IMG_IMPORT IMG_VOID IMG_CALLCONV PVRSRVUnlockRecursiveMutex(PVRSRV_RECMUTEX_HANDLE hMutex,
1504                                                                                                    IMG_CHAR pszMutexName[],
1505                                                                                                    IMG_CHAR pszFilename[],
1506                                                                                                    IMG_INT iLine);
1508 #define PVRSRVCreateRecursiveMutex(phMutex) PVRSRVCreateRecursiveMutex(phMutex, #phMutex, __FILE__, __LINE__)
1509 #define PVRSRVDestroyRecursiveMutex(hMutex) PVRSRVDestroyRecursiveMutex(hMutex, #hMutex, __FILE__, __LINE__)
1510 #define PVRSRVLockRecursiveMutex(hMutex) PVRSRVLockRecursiveMutex(hMutex, #hMutex, __FILE__, __LINE__)
1511 #define PVRSRVUnlockRecursiveMutex(hMutex) PVRSRVUnlockRecursiveMutex(hMutex, #hMutex, __FILE__, __LINE__)
1513 #else /* defined(PVR_DEBUG_MUTEXES) */
1515 IMG_IMPORT PVRSRV_ERROR IMG_CALLCONV PVRSRVCreateRecursiveMutex(PVRSRV_RECMUTEX_HANDLE *phMutex);
1516 IMG_IMPORT PVRSRV_ERROR IMG_CALLCONV PVRSRVDestroyRecursiveMutex(PVRSRV_RECMUTEX_HANDLE hMutex);
1517 IMG_IMPORT IMG_VOID IMG_CALLCONV PVRSRVLockRecursiveMutex(PVRSRV_RECMUTEX_HANDLE hMutex);
1518 IMG_IMPORT IMG_VOID IMG_CALLCONV PVRSRVUnlockRecursiveMutex(PVRSRV_RECMUTEX_HANDLE hMutex);
1520 #endif /* defined(PVR_DEBUG_MUTEXES) */
1522 /* Non-recursive coarse-grained mutex shared between all threads in a proccess */
1523 IMG_IMPORT IMG_VOID IMG_CALLCONV PVRSRVLockProcessGlobalMutex(void);
1524 IMG_IMPORT IMG_VOID IMG_CALLCONV PVRSRVUnlockProcessGlobalMutex(void);
1527 struct _PVRSRV_SEMAPHORE_OPAQUE_STRUCT_;
1528 typedef struct  _PVRSRV_SEMAPHORE_OPAQUE_STRUCT_ *PVRSRV_SEMAPHORE_HANDLE;
1531         #define IMG_SEMAPHORE_WAIT_INFINITE       ((IMG_UINT64)0xFFFFFFFFFFFFFFFFull)
1534 #if !defined(USE_CODE)
1536 #ifdef INLINE_IS_PRAGMA
1537 #pragma inline(PVRSRVCreateSemaphore)
1538 #endif
1539 static INLINE PVRSRV_ERROR PVRSRVCreateSemaphore(PVRSRV_SEMAPHORE_HANDLE *phSemaphore, IMG_INT iInitialCount)
1541         PVR_UNREFERENCED_PARAMETER(iInitialCount);
1542         *phSemaphore = 0;
1543         return PVRSRV_OK;
1546 #ifdef INLINE_IS_PRAGMA
1547 #pragma inline(PVRSRVDestroySemaphore)
1548 #endif
1549 static INLINE PVRSRV_ERROR PVRSRVDestroySemaphore(PVRSRV_SEMAPHORE_HANDLE hSemaphore)
1551         PVR_UNREFERENCED_PARAMETER(hSemaphore);
1552         return PVRSRV_OK;
1555 #ifdef INLINE_IS_PRAGMA
1556 #pragma inline(PVRSRVWaitSemaphore)
1557 #endif
1558 static INLINE PVRSRV_ERROR PVRSRVWaitSemaphore(PVRSRV_SEMAPHORE_HANDLE hSemaphore, IMG_UINT64 ui64TimeoutMicroSeconds)
1560         PVR_UNREFERENCED_PARAMETER(hSemaphore);
1561         PVR_UNREFERENCED_PARAMETER(ui64TimeoutMicroSeconds);
1562         return PVRSRV_ERROR_INVALID_PARAMS;
1565 #ifdef INLINE_IS_PRAGMA
1566 #pragma inline(PVRSRVPostSemaphore)
1567 #endif
1568 static INLINE IMG_VOID PVRSRVPostSemaphore(PVRSRV_SEMAPHORE_HANDLE hSemaphore, IMG_INT iPostCount)
1570         PVR_UNREFERENCED_PARAMETER(hSemaphore);
1571         PVR_UNREFERENCED_PARAMETER(iPostCount);
1574 #endif /* !defined(USE_CODE) */
1577 /* Non-exported APIs */
1578 #if defined(DEBUG) && (defined(__linux__) || defined(__QNXNTO__) )
1579 IMG_IMPORT IMG_PVOID IMG_CALLCONV PVRSRVAllocUserModeMemTracking(IMG_SIZE_T ui32Size, IMG_CHAR *pszFileName, IMG_UINT32 ui32LineNumber);
1581 IMG_IMPORT IMG_PVOID IMG_CALLCONV PVRSRVCallocUserModeMemTracking(IMG_SIZE_T ui32Size, IMG_CHAR *pszFileName, IMG_UINT32 ui32LineNumber);
1583 IMG_IMPORT IMG_VOID  IMG_CALLCONV PVRSRVFreeUserModeMemTracking(IMG_VOID *pvMem);
1585 IMG_IMPORT IMG_PVOID IMG_CALLCONV PVRSRVReallocUserModeMemTracking(IMG_VOID *pvMem, IMG_SIZE_T ui32NewSize, 
1586                                                                                                           IMG_CHAR *pszFileName, IMG_UINT32 ui32LineNumber);
1587 #endif
1589 /******************************************************************************
1590  * PVR Event Object API(s)
1591  *****************************************************************************/
1593 IMG_IMPORT PVRSRV_ERROR PVRSRVEventObjectWait(const PVRSRV_CONNECTION *psConnection,
1594 #if defined (SUPPORT_SID_INTERFACE)
1595                                                                         IMG_EVENTSID hOSEvent
1596 #else
1597                                                                         IMG_HANDLE hOSEvent
1598 #endif
1599         );
1601 /*!
1602  ******************************************************************************
1604  @Function              PVRSRVCreateSyncInfoModObj
1606  @Description   Creates an empty Modification object to be later used by PVRSRVModifyPendingSyncOps
1608  ******************************************************************************/
1609 IMG_IMPORT
1610 PVRSRV_ERROR IMG_CALLCONV PVRSRVCreateSyncInfoModObj(const PVRSRV_CONNECTION *psConnection,
1611 #if defined (SUPPORT_SID_INTERFACE)
1612                                                                                                          IMG_SID *phKernelSyncInfoModObj
1613 #else
1614                                                                                                          IMG_HANDLE *phKernelSyncInfoModObj
1615 #endif
1616         );
1618 /*!
1619  ******************************************************************************
1621  @Function              PVRSRVDestroySyncInfoModObj
1623  @Description   Destroys a Modification object.  Must be empty.
1625  ******************************************************************************/
1626 IMG_IMPORT
1627 PVRSRV_ERROR IMG_CALLCONV PVRSRVDestroySyncInfoModObj(const PVRSRV_CONNECTION *psConnection,
1628 #if defined (SUPPORT_SID_INTERFACE)
1629                                                                                                           IMG_SID hKernelSyncInfoModObj
1630 #else
1631                                                                                                           IMG_HANDLE hKernelSyncInfoModObj
1632 #endif
1633         );
1637 /*!
1638  ******************************************************************************
1640  @Function              PVRSRVModifyPendingSyncOps
1642  @Description   Returns PRE-INCREMENTED sync op values. Performs thread safe increment
1643                                 of sync ops values as specified by ui32ModifyFlags.
1645                                 PVRSRV_ERROR_RETRY is returned if the supplied modification object
1646                 is not empty.  This is on the assumption that a different thread
1647                                 will imminently call PVRSRVModifyCompleteSyncOps.  This thread should
1648                                 sleep before retrying.  It should be regarded as an error if no such
1649                                 other thread exists.
1651                                 Note that this API has implied locking semantics, as follows:
1653                                 PVRSRVModifyPendingSyncOps() 
1654                                         -  announces an operation on the buffer is "pending", and 
1655                                                    conceptually takes a ticket to represent your place in the queue.
1656                                                 -  NB: ** exclusive access to the resource is  _NOT_ granted at this time **
1657                                 PVRSRVSyncOpsFlushToModObj()
1658                                         -  ensures you have exclusive access to the resource (conceptually, a LOCK)
1659                                                 -  the previously "pending" operation can now be regarded as "in progress"
1660                                 PVRSRVModifyCompleteSyncOps()
1661                                         -  declares that the previously "in progress" operation is now complete. (UNLOCK)
1662                                 
1664  ******************************************************************************/
1665 IMG_IMPORT
1666 PVRSRV_ERROR IMG_CALLCONV PVRSRVModifyPendingSyncOps(const PVRSRV_CONNECTION *psConnection,
1667 #if defined (SUPPORT_SID_INTERFACE)
1668                                                                                                           IMG_SID    hKernelSyncInfoModObj,
1669 #else
1670                                                                                                           IMG_HANDLE hKernelSyncInfoModObj,
1671 #endif
1672                                                                                                           PVRSRV_CLIENT_SYNC_INFO *psSyncInfo,
1673                                                                                                           IMG_UINT32 ui32ModifyFlags,
1674                                                                                                           IMG_UINT32 *pui32ReadOpsPending,
1675                                                                                                           IMG_UINT32 *pui32WriteOpsPending);
1677 /*!
1678  ******************************************************************************
1680  @Function              PVRSRVModifyCompleteSyncOps
1682  @Description   Performs thread safe increment of sync ops values as specified
1683                 by the ui32ModifyFlags that were given to PVRSRVModifyPendingSyncOps.
1684                                 The supplied Modification Object will become empty.
1686                                 Note that this API has implied locking semantics, as
1687                                 described above in PVRSRVModifyPendingSyncOps
1689  ******************************************************************************/
1690 IMG_IMPORT
1691 PVRSRV_ERROR IMG_CALLCONV PVRSRVModifyCompleteSyncOps(const PVRSRV_CONNECTION *psConnection,
1692 #if defined (SUPPORT_SID_INTERFACE)
1693                                                                                                           IMG_SID hKernelSyncInfoModObj
1694 #else
1695                                                                                                           IMG_HANDLE hKernelSyncInfoModObj
1696 #endif
1697         );
1699 /*!
1700  ******************************************************************************
1702  @Function      PVRSRVSyncOpsTakeToken
1704  @Description Takes a "deli-counter" style token for future use with
1705               PVRSRVSyncOpsFlushToToken().  In practice this means
1706               recording a snapshot of the current "pending" values.  A
1707               future PVRSRVSyncOpsFlushToToken() will ensure that all
1708               operations that were pending at the time of this
1709               PVRSRVSyncOpsTakeToken() call will be flushed.
1710               Operations may be subsequently queued after this call
1711               and would not be flushed.  The caller is required to
1712               provide storage for the token.  The token is disposable
1713               - i.e. the caller can simply let the token go out of
1714               scope without telling us... in particular, there is no
1715               obligation to call PVRSRVSyncOpsFlushToToken().
1716               Multiple tokens may be taken.  There is no implied
1717               locking with this API.
1719  ******************************************************************************/
1720 IMG_IMPORT
1721 PVRSRV_ERROR IMG_CALLCONV PVRSRVSyncOpsTakeToken(const PVRSRV_CONNECTION *psConnection,
1722 #if defined (SUPPORT_SID_INTERFACE)
1723                                                                                                  const IMG_SID      hKernelSyncInfo,
1724 #else
1725                                                                                                  const PVRSRV_CLIENT_SYNC_INFO *psSyncInfo,
1726 #endif
1727                                                                                                  PVRSRV_SYNC_TOKEN *psSyncToken);
1728 /*!
1729  ******************************************************************************
1731  @Function      PVRSRVSyncOpsFlushToToken
1733  @Description Tests whether the dependencies for a pending sync op modification
1734               have been satisfied.  If this function returns PVRSRV_OK, then the
1735               "complete" counts have caught up with the snapshot of the "pending"
1736               values taken when PVRSRVSyncOpsTakeToken() was called.
1737               In the event that the dependencies are not (yet) met,
1738                           this call will auto-retry if bWait is specified, otherwise, it will
1739                           return PVRSRV_ERROR_RETRY.  (Not really an "error")
1741                           (auto-retry behaviour not implemented)
1743  ******************************************************************************/
1744 IMG_IMPORT
1745 PVRSRV_ERROR IMG_CALLCONV PVRSRVSyncOpsFlushToToken(const PVRSRV_CONNECTION *psConnection,
1746 #if defined (SUPPORT_SID_INTERFACE)
1747                                                                                                         const IMG_SID            hKernelSyncInfo,
1748 #else
1749                                                                                                         const PVRSRV_CLIENT_SYNC_INFO *psSyncInfo,
1750 #endif
1751                                                                                                         const PVRSRV_SYNC_TOKEN *psSyncToken,
1752                                                                                                         IMG_BOOL bWait);
1753 /*!
1754  ******************************************************************************
1756  @Function      PVRSRVSyncOpsFlushToModObj
1758  @Description Tests whether the dependencies for a pending sync op modification
1759               have been satisfied.  If this function returns PVRSRV_OK, then the
1760               "complete" counts have caught up with the snapshot of the "pending"
1761               values taken when PVRSRVModifyPendingSyncOps() was called.
1762               PVRSRVModifyCompleteSyncOps() can then be called without risk of
1763                           stalling.  In the event that the dependencies are not (yet) met,
1764                           this call will auto-retry if bWait is specified, otherwise, it will
1765                           return PVRSRV_ERROR_RETRY.  (Not really an "error")
1767                           Note that this API has implied locking semantics, as
1768                           described above in PVRSRVModifyPendingSyncOps
1770  ******************************************************************************/
1771 IMG_IMPORT
1772 PVRSRV_ERROR IMG_CALLCONV PVRSRVSyncOpsFlushToModObj(const PVRSRV_CONNECTION *psConnection,
1773 #if defined (SUPPORT_SID_INTERFACE)
1774                                                                                                          IMG_SID  hKernelSyncInfoModObj,
1775 #else
1776                                                                                                          IMG_HANDLE hKernelSyncInfoModObj,
1777 #endif
1778                                                                                                          IMG_BOOL bWait);
1780 /*!
1781  ******************************************************************************
1783  @Function      PVRSRVSyncOpsFlushToDelta
1785  @Description Compares the number of outstanding operations (pending count minus
1786               complete count) with the limit specified.  If no more than ui32Delta
1787               operations are outstanding, this function returns PVRSRV_OK.
1788               In the event that there are too many outstanding operations,
1789                           this call will auto-retry if bWait is specified, otherwise, it will
1790                           return PVRSRV_ERROR_RETRY.  (Not really an "error")
1792  ******************************************************************************/
1793 IMG_IMPORT
1794 PVRSRV_ERROR IMG_CALLCONV PVRSRVSyncOpsFlushToDelta(const PVRSRV_CONNECTION *psConnection,
1795                                                                                                         PVRSRV_CLIENT_SYNC_INFO *psClientSyncInfo,
1796                                                                                                         IMG_UINT32 ui32Delta,
1797                                                                                                         IMG_BOOL bWait);
1799 /*!
1800  ******************************************************************************
1802  @Function      PVRSRVAllocSyncInfo
1804  @Description Creates a Sync Object.  Unlike the sync objects created
1805                           automatically with "PVRSRVAllocDeviceMem", the sync objects
1806                           returned by this function do _not_ have a UM mapping to the
1807                           sync data and they do _not_ have the device virtual address
1808                           of the "opscomplete" fields.  These data are to be deprecated.
1810  ******************************************************************************/
1812 IMG_IMPORT
1813 PVRSRV_ERROR IMG_CALLCONV PVRSRVAllocSyncInfo(IMG_CONST PVRSRV_DEV_DATA *psDevData,
1814                                                                                           PVRSRV_CLIENT_SYNC_INFO **ppsSyncInfo);
1816 /*!
1817  ******************************************************************************
1819  @Function      PVRSRVFreeSyncInfo
1821  @Description Destroys a Sync Object created via
1822               PVRSRVAllocSyncInfo.
1824  ******************************************************************************/
1826 IMG_IMPORT
1827 PVRSRV_ERROR IMG_CALLCONV PVRSRVFreeSyncInfo(IMG_CONST PVRSRV_DEV_DATA *psDevData,
1828                                                                                          PVRSRV_CLIENT_SYNC_INFO *psSyncInfo);
1830 /*!
1831  ******************************************************************************
1833  @Function              PVRSRVGetErrorString
1835  @Description   Returns a text string relating to the PVRSRV_ERROR enum.
1837  ******************************************************************************/
1838 IMG_IMPORT
1839 const IMG_CHAR *PVRSRVGetErrorString(PVRSRV_ERROR eError);
1842 /*!
1843  ******************************************************************************
1845  @Function              PVRSRVCacheInvalidate
1847  @Description   Invalidate the CPU cache for a specified memory
1848                 area. Note that PVRSRVGetMiscInfo provides similar cpu
1849                 cache flush/invalidate functionality for some platforms.
1851  ******************************************************************************/
1853 IMG_IMPORT
1854 PVRSRV_ERROR IMG_CALLCONV PVRSRVCacheInvalidate(const PVRSRV_CONNECTION *psConnection,
1855                                                 IMG_PVOID pvLinearAddress,
1856                                                     IMG_UINT32 ui32Size);
1858 /******************************************************************************
1859  Time wrapping macro
1860 ******************************************************************************/
1861 #define TIME_NOT_PASSED_UINT32(a,b,c)           (((a) - (b)) < (c))
1863 #if defined (__cplusplus)
1865 #endif
1866 #endif /* __SERVICES_H__ */
1868 /******************************************************************************
1869  End of file (services.h)
1870 ******************************************************************************/