1 /**********************************************************************
2 Copyright (c) Imagination Technologies Ltd.
4 Permission is hereby granted, free of charge, to any person obtaining a copy
5 of this software and associated documentation files (the "Software"), to deal
6 in the Software without restriction, including without limitation the rights
7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 copies of the Software, and to permit persons to whom the Software is
9 furnished to do so, subject to the following conditions:
11 The above copyright notice and this permission notice shall be included in
12 all copies or substantial portions of the Software.
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 ******************************************************************************/
27 #if defined (__cplusplus)
32 #if defined(DEBUG) || defined(TIMING)
43 extern Temporal_Data asTimers[];
45 extern IMG_UINT32 PVRSRVTimeNow(IMG_VOID);
46 extern IMG_VOID PVRSRVSetupMetricTimers(IMG_VOID *pvDevInfo);
47 extern IMG_VOID PVRSRVOutputMetricTotals(IMG_VOID);
50 #define PVRSRV_TIMER_DUMMY 0
52 #define PVRSRV_TIMER_EXAMPLE_1 1
53 #define PVRSRV_TIMER_EXAMPLE_2 2
56 #define PVRSRV_NUM_TIMERS (PVRSRV_TIMER_EXAMPLE_2 + 1)
58 #define PVRSRV_TIME_START(X) { \
59 asTimers[X].ui32Count += 1; \
60 asTimers[X].ui32Count |= 0x80000000L; \
61 asTimers[X].ui32Start = PVRSRVTimeNow(); \
62 asTimers[X].ui32Stop = 0; \
65 #define PVRSRV_TIME_SUSPEND(X) { \
66 asTimers[X].ui32Stop += PVRSRVTimeNow() - asTimers[X].ui32Start; \
69 #define PVRSRV_TIME_RESUME(X) { \
70 asTimers[X].ui32Start = PVRSRVTimeNow(); \
73 #define PVRSRV_TIME_STOP(X) { \
74 asTimers[X].ui32Stop += PVRSRVTimeNow() - asTimers[X].ui32Start; \
75 asTimers[X].ui32Total += asTimers[X].ui32Stop; \
76 asTimers[X].ui32Count &= 0x7FFFFFFFL; \
79 #define PVRSRV_TIME_RESET(X) { \
80 asTimers[X].ui32Start = 0; \
81 asTimers[X].ui32Stop = 0; \
82 asTimers[X].ui32Total = 0; \
83 asTimers[X].ui32Count = 0; \
89 #define TST_REG ((volatile IMG_UINT8 *) (psDevInfo->pvSOCRegsBaseKM))
91 #define TCOR_2 ((volatile IMG_UINT *) (psDevInfo->pvSOCRegsBaseKM+28))
92 #define TCNT_2 ((volatile IMG_UINT *) (psDevInfo->pvSOCRegsBaseKM+32))
93 #define TCR_2 ((volatile IMG_UINT16 *)(psDevInfo->pvSOCRegsBaseKM+36))
95 #define TIMER_DIVISOR 4
107 #define PVRSRV_TIME_START(X)
108 #define PVRSRV_TIME_SUSPEND(X)
109 #define PVRSRV_TIME_RESUME(X)
110 #define PVRSRV_TIME_STOP(X)
111 #define PVRSRV_TIME_RESET(X)
113 #define PVRSRVSetupMetricTimers(X)
114 #define PVRSRVOutputMetricTotals()
120 #if defined(__cplusplus)