]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - android-sdk/device-ti-proprietary-open.git/blob - jacinto6/sgx_src/eurasia_km/services4/srvkm/include/metrics.h
proprietary-open: jacinto6: add graphics kernel module sources
[android-sdk/device-ti-proprietary-open.git] / jacinto6 / sgx_src / eurasia_km / services4 / srvkm / include / metrics.h
1 /*************************************************************************/ /*!
2 @Title          Time measurement interface.
3 @Copyright      Copyright (c) Imagination Technologies Ltd. All Rights Reserved
4 @License        Dual MIT/GPLv2
6 The contents of this file are subject to the MIT license as set out below.
8 Permission is hereby granted, free of charge, to any person obtaining a copy
9 of this software and associated documentation files (the "Software"), to deal
10 in the Software without restriction, including without limitation the rights
11 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 copies of the Software, and to permit persons to whom the Software is
13 furnished to do so, subject to the following conditions:
15 The above copyright notice and this permission notice shall be included in
16 all copies or substantial portions of the Software.
18 Alternatively, the contents of this file may be used under the terms of
19 the GNU General Public License Version 2 ("GPL") in which case the provisions
20 of GPL are applicable instead of those above.
22 If you wish to allow use of your version of this file only under the terms of
23 GPL, and not to allow others to use your version of this file under the terms
24 of the MIT license, indicate your decision by deleting the provisions above
25 and replace them with the notice and other provisions required by GPL as set
26 out in the file called "GPL-COPYING" included in this distribution. If you do
27 not delete the provisions above, a recipient may use your version of this file
28 under the terms of either the MIT license or GPL.
30 This License is also included in this distribution in the file called
31 "MIT-COPYING".
33 EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
34 PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
35 BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
36 PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
37 COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
38 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
39 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
40 */ /**************************************************************************/
42 #ifndef _METRICS_
43 #define _METRICS_
46 #if defined (__cplusplus)
47 extern "C" {
48 #endif
51 #if defined(DEBUG) || defined(TIMING)
54 typedef struct 
55 {
56         IMG_UINT32 ui32Start;
57         IMG_UINT32 ui32Stop;
58         IMG_UINT32 ui32Total;
59         IMG_UINT32 ui32Count;
60 } Temporal_Data;
62 extern Temporal_Data asTimers[]; 
64 extern IMG_UINT32 PVRSRVTimeNow(IMG_VOID);
65 extern IMG_VOID   PVRSRVSetupMetricTimers(IMG_VOID *pvDevInfo);
66 extern IMG_VOID   PVRSRVOutputMetricTotals(IMG_VOID);
69 #define PVRSRV_TIMER_DUMMY                              0
71 #define PVRSRV_TIMER_EXAMPLE_1                  1
72 #define PVRSRV_TIMER_EXAMPLE_2                  2
75 #define PVRSRV_NUM_TIMERS               (PVRSRV_TIMER_EXAMPLE_2 + 1)
77 #define PVRSRV_TIME_START(X)    { \
78                                                                         asTimers[X].ui32Count += 1; \
79                                                                         asTimers[X].ui32Count |= 0x80000000L; \
80                                                                         asTimers[X].ui32Start = PVRSRVTimeNow(); \
81                                                                         asTimers[X].ui32Stop  = 0; \
82                                                                 }
84 #define PVRSRV_TIME_SUSPEND(X)  { \
85                                                                         asTimers[X].ui32Stop += PVRSRVTimeNow() - asTimers[X].ui32Start; \
86                                                                 }
88 #define PVRSRV_TIME_RESUME(X)   { \
89                                                                         asTimers[X].ui32Start = PVRSRVTimeNow(); \
90                                                                 }
92 #define PVRSRV_TIME_STOP(X)             { \
93                                                                         asTimers[X].ui32Stop  += PVRSRVTimeNow() - asTimers[X].ui32Start; \
94                                                                         asTimers[X].ui32Total += asTimers[X].ui32Stop; \
95                                                                         asTimers[X].ui32Count &= 0x7FFFFFFFL; \
96                                                                 }
98 #define PVRSRV_TIME_RESET(X)    { \
99                                                                         asTimers[X].ui32Start = 0; \
100                                                                         asTimers[X].ui32Stop  = 0; \
101                                                                         asTimers[X].ui32Total = 0; \
102                                                                         asTimers[X].ui32Count = 0; \
103                                                                 }
106 #if defined(__sh__)
108 #define TST_REG   ((volatile IMG_UINT8 *) (psDevInfo->pvSOCRegsBaseKM))         // timer start register
110 #define TCOR_2    ((volatile IMG_UINT *)  (psDevInfo->pvSOCRegsBaseKM+28))      // timer constant register_2
111 #define TCNT_2    ((volatile IMG_UINT *)  (psDevInfo->pvSOCRegsBaseKM+32))      // timer counter register_2
112 #define TCR_2     ((volatile IMG_UINT16 *)(psDevInfo->pvSOCRegsBaseKM+36))      // timer control register_2
114 #define TIMER_DIVISOR  4
116 #endif /* defined(__sh__) */
120 #else /* defined(DEBUG) || defined(TIMING) */
124 #define PVRSRV_TIME_START(X)
125 #define PVRSRV_TIME_SUSPEND(X)
126 #define PVRSRV_TIME_RESUME(X)
127 #define PVRSRV_TIME_STOP(X)
128 #define PVRSRV_TIME_RESET(X)
130 #define PVRSRVSetupMetricTimers(X)
131 #define PVRSRVOutputMetricTotals()
135 #endif /* defined(DEBUG) || defined(TIMING) */
137 #if defined(__cplusplus)
139 #endif
142 #endif /* _METRICS_ */
144 /**************************************************************************
145  End of file (metrics.h)
146 **************************************************************************/