First public contribution.
1 // Copyright (c) 1994-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // e32\include\e32def_private.h
16 // WARNING: This file contains some APIs which are internal and are subject
17 // to change without notice. Such APIs should therefore not be used
18 // outside the Kernel and Hardware Services package.
21 #ifndef __E32DEF_PRIVATE_H__
22 #define __E32DEF_PRIVATE_H__
30 #define __PROFILE_START(aBin) RDebug::ProfileStart(aBin)
36 #define __PROFILE_END(aBin) RDebug::ProfileEnd(aBin)
42 #define __PROFILE_RESET(aNumberOfBins) RDebug::ProfileReset(0,aNumberOfBins)
48 #define __PROFILE_DISPLAY(aNumberOfBins) \
49 { TFixedArray<TProfile, aNumberOfBins> result; \
50 RDebug::ProfileResult(result.Begin(), 0, aNumberOfBins); \
51 for (TInt i=0; i<aNumberOfBins; i++) \
52 RDebug::Print(_L("Profile bin %d: Calls: %d, Clock ticks: %d\n" ),i,res[i].iCount,result[i].iTime); \
54 #else /* __PROFILING__ */
55 #define __PROFILE_START(aBin)
56 #define __PROFILE_END(aBin)
57 #define __PROFILE_RESET(aNumberOfBins)
58 #define __PROFILE_DISPLAY(aNumberOfBins)
67 Marks the start of Kernel heap checking.
69 Checking the Kernel heap is only useful when developing Kernel side code such
70 as device drivers and media drivers.
72 This macro is defined only for debug builds.
74 This macro must be matched by a corresponding call to __KHEAP_MARKEND or __KHEAP_MARKENDC.
75 Calls to this macro can be nested but each call must be matched by corresponding
76 call to __KHEAP_MARKEND or __KHEAP_MARKENDC.
78 @see User::__DbgMarkStart()
82 #define __KHEAP_MARK User::__DbgMarkStart(TRUE)
91 Checks that the number of allocated cells at the current nested level of the
92 Kernel heap is the same as the specified value. This macro is defined only
93 for debug builds. Checking the Kernel heap is only useful when developing
94 Kernel side code such as device drivers and media drivers.
96 The macro also takes the name of the file containing this source code statement
97 and the line number of this source code statement; they are displayed as part
98 of the panic category, if the checks fail.
100 @param aCount The number of heap cells expected to be allocated at
101 the current nest level.
103 @see User::__DbgMarkCheck()
106 #define __KHEAP_CHECK(aCount) User::__DbgMarkCheck(TRUE,FALSE,aCount,(TText8*)__FILE__,__LINE__)
115 Checks that the total number of allocated cells on the Kernel heap is the same
116 as the specified value.
118 It is only useful when developing Kernel side code such as device drivers
121 The macro also takes the name of the file containing this source code statement
122 and the line number of this source code statement; they are displayed as part
123 of the panic category, if the checks fail.
125 This macro is defined only for debug builds.
127 @param aCount The total number of heap cells expected to be allocated
129 @see User::__DbgMarkCheck()
130 @see __UHEAP_CHECKALL
132 #define __KHEAP_CHECKALL(aCount) User::__DbgMarkCheck(TRUE,TRUE,aCount,(TText8*)__FILE__,__LINE__)
141 Marks the end of Kernel heap checking. The macro expects zero heap cells to
142 remain allocated at the current nest level.
144 This macro is defined only for debug builds. Checking the Kernel heap is only
145 useful when developing Kernel side code such as device drivers and media drivers.
147 This macro must match an earlier call to __KHEAP_MARK.
149 @see User::__DbgMarkEnd()
152 #define __KHEAP_MARKEND User::__DbgMarkEnd(TRUE,0)
161 Marks the end of Kernel heap checking. The macro expects aCount heap cells
162 to remain allocated at the current nest level.
164 This macro is defined only for debug builds.
166 This macro must match an earlier call to __KHEAP_MARK.
168 @param aCount The number of heap cells expected to remain allocated at
169 the current nest level.
171 @see User::__DbgMarkEnd()
174 #define __KHEAP_MARKENDC(aCount) User::__DbgMarkEnd(TRUE,aCount)
183 Simulates Kernel heap allocation failure. The failure occurs on the next call
184 to new or any of the functions which allocate memory from the heap. This macro
185 is defined only for debug builds.
187 Checking the Kernel heap is only useful when developing Kernel side code such
188 as device drivers and media drivers.
190 @param aCount The rate of failure - heap allocation fails every aCount attempt.
192 @see User::__DbgSetAllocFail()
194 #define __KHEAP_FAILNEXT(aCount) User::__DbgSetAllocFail(TRUE,RAllocator::EFailNext,aCount)
200 Simulates Kernel heap allocation failures. aBurst failures will occur on the next call
201 to new or any of the functions which allocate memory from the heap. This macro
202 is defined only for debug builds.
204 Checking the Kernel heap is only useful when developing Kernel side code such
205 as device drivers and media drivers.
207 @param aCount The heap allocation will fail after aCount-1 allocation attempts.
208 Note when used with RHeap the maximum value aCount can be set
210 @param aBurst The number of allocations that will fail after aCount-1 allocation
211 attempts. Note when used with RHeap the maximum value aBurst can be
212 set to is KMaxTUint16.
215 @see User::__DbgSetBurstAllocFail()
217 #define __KHEAP_BURSTFAILNEXT(aCount,aBurst) User::__DbgSetBurstAllocFail(TRUE,RAllocator::EBurstFailNext,aCount,aBurst)
224 Simulates Kernel heap allocation failure.
226 The failure occurs on subsequent calls to new or any of the functions which
227 allocate memory from this heap.
229 This macro is defined only for debug builds.
231 @param aType The type of failure to be simulated.
232 @param aRate The failure rate.
234 @see RAllocator::TAllocFail
235 @see User::__DbgSetAllocFail()
237 #define __KHEAP_SETFAIL(aType,aRate) User::__DbgSetAllocFail(TRUE,aType,aRate)
243 Simulates Kernel heap allocation failure.
245 The failure occurs on subsequent calls to new or any of the functions which
246 allocate memory from this heap.
248 This macro is defined only for debug builds.
250 @param aType The type of failure to be simulated.
251 @param aRate The failure rate. Note when used with RHeap the maximum value
252 aRate can be set to is KMaxTUint16.
253 @param aBurst The number of consecutive allocations that will fail. Note
254 when used with RHeap the maximum value aBurst can be set to
257 @see RAllocator::TAllocFail
258 @see User::__DbgSetBurstAllocFail()
260 #define __KHEAP_SETBURSTFAIL(aType,aRate,aBurst) User::__DbgSetBurstAllocFail(TRUE,aType,aRate,aBurst)
268 Cancels simulated Kernel heap allocation failure.
270 Checking the Kernel heap is only useful when developing Kernel side code such
271 as device drivers and media drivers.
273 This macro is defined only for debug builds.
275 @see User::__DbgSetAllocFail()
277 #define __KHEAP_RESET User::__DbgSetAllocFail(TRUE,RAllocator::ENone,1)
286 Cancels simulated kernel heap allocation failure.
287 It walks the the heap and sets the nesting level for all allocated
290 Checking the kernel heap is only useful when developing kernel side code such
291 as device drivers and media drivers.
293 This macro is defined only for debug builds.
295 #define __KHEAP_TOTAL_RESET User::__DbgSetAllocFail(TRUE,RAllocator::EReset,1)
303 Marks the start of Kernel heap checking.
305 Checking the Kernel heap is only useful when developing Kernel side code such
306 as device drivers and media drivers.
308 This macro is defined only for debug builds.
310 This macro must be matched by a corresponding call to __KHEAP_MARKEND or __KHEAP_MARKENDC.
311 Calls to this macro can be nested but each call must be matched by corresponding
312 call to __KHEAP_MARKEND or __KHEAP_MARKENDC.
314 @see User::__DbgMarkStart()
316 @see __KHEAP_MARKENDC
327 Checks that the number of allocated cells at the current nested level of the
328 Kernel heap is the same as the specified value. This macro is defined only
329 for debug builds. Checking the Kernel heap is only useful when developing
330 Kernel side code such as device drivers and media drivers.
332 The macro also takes the name of the file containing this source code statement
333 and the line number of this source code statement; they are displayed as part
334 of the panic category, if the checks fail.
336 @param aCount The number of heap cells expected to be allocated at
337 the current nest level.
339 @see User::__DbgMarkCheck()
342 #define __KHEAP_CHECK(aCount)
351 Checks that the total number of allocated cells on the Kernel heap is the same
352 as the specified value.
354 It is only useful when developing Kernel side code such as device drivers
357 The macro also takes the name of the file containing this source code statement
358 and the line number of this source code statement; they are displayed as part
359 of the panic category, if the checks fail.
361 This macro is defined only for debug builds.
363 @param aCount The total number of heap cells expected to be allocated
365 @see User::__DbgMarkCheck()
366 @see __UHEAP_CHECKALL
368 #define __KHEAP_CHECKALL(aCount)
377 Marks the end of Kernel heap checking. The macro expects zero heap cells to
378 remain allocated at the current nest level.
380 This macro is defined only for debug builds. Checking the Kernel heap is only
381 useful when developing Kernel side code such as device drivers and media drivers.
383 This macro must match an earlier call to __KHEAP_MARK.
385 @see User::__DbgMarkEnd()
388 #define __KHEAP_MARKEND
397 Marks the end of Kernel heap checking. The macro expects aCount heap cells
398 to remain allocated at the current nest level.
400 This macro is defined only for debug builds.
402 This macro must match an earlier call to __KHEAP_MARK.
404 @param aCount The number of heap cells expected to remain allocated at
405 the current nest level.
407 @see User::__DbgMarkEnd()
410 #define __KHEAP_MARKENDC(aCount)
419 Simulates Kernel heap allocation failure. The failure occurs on the next call
420 to new or any of the functions which allocate memory from the heap. This macro
421 is defined only for debug builds.
423 Checking the Kernel heap is only useful when developing Kernel side code such
424 as device drivers and media drivers.
426 @param aCount The rate of failure - heap allocation fails every aCount attempt.
428 @see User::__DbgSetAllocFail()
430 #define __KHEAP_FAILNEXT(aCount)
436 Simulates Kernel heap allocation failures. aBurst failures will occur on the next call
437 to new or any of the functions which allocate memory from the heap. This macro
438 is defined only for debug builds.
440 Checking the Kernel heap is only useful when developing Kernel side code such
441 as device drivers and media drivers.
443 @param aCount The heap allocation will fail after aCount-1 allocation attempts.
444 Note when used with RHeap the maximum value aCount can be set
446 @param aBurst The number of allocations that will fail after aCount-1 allocation
447 attempts. Note when used with RHeap the maximum value aBurst can
448 be set to is KMaxTUint16.
450 @see User::__DbgSetBurstAllocFail()
452 #define __KHEAP_BURSTFAILNEXT(aCount,aBurst)
460 Simulates Kernel heap allocation failure.
462 The failure occurs on subsequent calls to new or any of the functions which
463 allocate memory from this heap.
465 This macro is defined only for debug builds.
467 @param aType The type of failure to be simulated.
468 @param aRate The failure rate.
470 @see User::__DbgSetAllocFail()
472 #define __KHEAP_SETFAIL(aType,aRate)
478 Simulates Kernel heap allocation failure.
480 The failure occurs on subsequent calls to new or any of the functions which
481 allocate memory from this heap.
483 This macro is defined only for debug builds.
485 @param aType The type of failure to be simulated.
486 @param aRate The failure rate. Note when used with RHeap the maximum value
487 aRate can be set to is KMaxTUint16.
488 @param aBurst The number of consecutive allocations that will fail. Note
489 when used with RHeap the maximum value aBurst can be set
492 @see User::__DbgSetBurstAllocFail()
494 #define __KHEAP_SETBURSTFAIL(aType,aRate,aBurst)
502 Cancels simulated Kernel heap allocation failure.
504 Checking the Kernel heap is only useful when developing Kernel side code such
505 as device drivers and media drivers.
507 This macro is defined only for debug builds.
509 @see User::__DbgSetAllocFail()
511 #define __KHEAP_RESET
519 Cancels simulated kernel heap allocation failure.
520 It walks the the heap and sets the nesting level for all allocated
523 Checking the kernel heap is only useful when developing kernel side code such
524 as device drivers and media drivers.
526 This macro is defined only for debug builds.
528 #define __KHEAP_TOTAL_RESET
531 #ifndef __VALUE_IN_REGS__
536 #define __VALUE_IN_REGS__
540 /** @internalTechnology */
541 #define __NO_MUTABLE_KEYWORD
547 A sorted list of all the code segments in ROM that contain an Exception Descriptor.
550 typedef struct TRomExceptionSearchTable
553 The number of entries in the following table.
558 Address of the code segment of each TRomImageHeader that has an Exception Descriptor.
560 TLinAddr iEntries[1];
561 } TRomExceptionSearchTable;
566 typedef struct TExceptionDescriptor
569 TLinAddr iExIdxLimit;
570 TLinAddr iROSegmentBase;
571 TLinAddr iROSegmentLimit;
572 } TExceptionDescriptor;
574 #ifdef __KERNEL_MODE__
576 /** @internalComponent */
577 #define KIMPORT_C IMPORT_C
579 /** @internalComponent */
580 #define KEXPORT_C EXPORT_C
587 #endif //__E32DEF_PRIVATE_H__