sl@0: // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // e32\include\nkern\nk_trace.h sl@0: // sl@0: // WARNING: This file contains some APIs which are internal and are subject sl@0: // to change without notice. Such APIs should therefore not be used sl@0: // outside the Kernel and Hardware Services package. sl@0: // sl@0: sl@0: #ifndef NK_TRACE_H sl@0: #define NK_TRACE_H sl@0: sl@0: /** sl@0: @internalComponent sl@0: */ sl@0: #define DEBUGPRINT KPrintf sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: #define DEBUGMASK (KDebugMask()) sl@0: #define DEBUGNUM(x) (KDebugNum(x)) sl@0: sl@0: GLREF_C void KPrintf(const char*,...); sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: IMPORT_C TInt KDebugMask(); sl@0: IMPORT_C TBool KDebugNum(TInt aBitNum); sl@0: sl@0: #if defined(_DEBUG) sl@0: //#if (1) sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: // __KTRACE_MASK only supports the first 32 debug trace bits sl@0: #define __KTRACE_MASK(a,p) {if((DEBUGMASK&(a)))p;} sl@0: #define __KTRACE_OPT(a,p) {if((DEBUGNUM(a)))p;} sl@0: #define __KTRACE_OPT2(a,b,p) {if( (DEBUGNUM(a)) || (DEBUGNUM(b)) )p;} sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: // __KTRACE_ALL only supports the first 32 debug trace bits sl@0: #define __KTRACE_ALL(a,p) {if((DEBUGMASK&(a))==(a))p;} sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: #define KHARDWARE 0 //0x00000001 sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: #define KBOOT 1 //0x00000002 sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: #define KSERVER 2 //0x00000004 sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: #define KMMU 3 //0x00000008 sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: #define KSEMAPHORE 4 //0x00000010 sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: #define KSCHED 5 //0x00000020 sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: #define KPROC 6 //0x00000040 sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: #define KEXEC 7 //0x00000080 sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: #define KDEBUGGER 8 //0x00000100 // for kernel-side debug agents sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: #define KTHREAD 9 //0x00000200 sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: #define KDLL 10 //0x00000400 sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: #define KIPC 11 //0x00000800 sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: #define KPBUS1 12 //0x00001000 sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: #define KPBUS2 13 //0x00002000 sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: #define KPBUSDRV 14 //0x00004000 sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: #define KPOWER 15 //0x00008000 sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: #define KTIMING 16 //0x00010000 sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: #define KEVENT 17 //0x00020000 sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: #define KOBJECT 18 //0x00040000 sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: #define KDFC 19 //0x00080000 sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: #define KEXTENSION 20 //0x00100000 sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: #define KSCHED2 21 //0x00200000 sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: #define KLOCDRV 22 //0x00400000 sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: #define KFAIL 23 //0x00800000 sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: #define KTHREAD2 24 //0x01000000 sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: #define KDEVICE 25 //0x02000000 sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: #define KMEMTRACE 26 //0x04000000 sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: #define KDMA 27 //0x08000000 sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: #define KMMU2 28 //0x10000000 sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: #define KNKERN 29 //0x20000000 sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: #define KSCRATCH 30 //0x40000000 // reserved for temporary debugging sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: #define KPANIC 31 //0x80000000 sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: #define KUSB 32 //0x00000001, index 1 sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: #define KUSBPSL 33 //0x00000002, index 1 sl@0: sl@0: /** sl@0: @internalComponent sl@0: @released sl@0: */ sl@0: #define KNETWORK1 34 //0x00000004, index 1 sl@0: sl@0: /** sl@0: @internalComponent sl@0: @released sl@0: */ sl@0: #define KNETWORK2 35 //0x00000008, index 1 sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: #define KSOUND1 36 //0x00000010, index 1 sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: #define KUSBHOST 37 //0x00000020, index 1 sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: #define KUSBOTG 38 //0x00000040, index 1 sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: #define KUSBJOURNAL 39 //0x00000080, index 1 sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: #define KUSBHO 40 //0x00000100, index 1 sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: #define KRESMANAGER 41 //0x00000200, index 1 sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @prototype sl@0: */ sl@0: #define KIIC 42 //0x00000400, index 1 sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @prototype sl@0: */ sl@0: #define KHCR 43 //0x00000800, index 1 sl@0: sl@0: /** sl@0: @internalComponent sl@0: @released sl@0: */ sl@0: #define KREALTIME 63 //0x80000000, index 1 sl@0: sl@0: /** sl@0: @internalComponent sl@0: @released sl@0: */ sl@0: #define KPAGING 62 //0x40000000, index 1 sl@0: sl@0: /** sl@0: @internalComponent sl@0: @released sl@0: */ sl@0: #define KLOCDPAGING 61 //0x20000000, index 1 sl@0: sl@0: /** sl@0: @internalComponent sl@0: @released sl@0: */ sl@0: #define KDATAPAGEWARN 60 //0x10000000, index 1 sl@0: sl@0: /** sl@0: @internalComponent sl@0: @prototype sl@0: */ sl@0: #define KPCI 59 //0x08000000, index 1 sl@0: sl@0: /** sl@0: @internalComponent sl@0: @prototype sl@0: */ sl@0: #define KPIPE 58 //0x04000000, index 1 sl@0: sl@0: // RESERVED: Trace bits 192 - 255 are reserved for licensee partners sl@0: sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: #define KALWAYS -1 //0xffffffff sl@0: #define KMAXTRACE (KNumTraceMaskWords*32-1) // the maximum debug trace bit sl@0: #else sl@0: #define __KTRACE_OPT(a,p) sl@0: #define __KTRACE_ALL(a,p) sl@0: #define __KTRACE_OPT2(a,b,p) sl@0: #define KALWAYS -1 sl@0: #define KMAXTRACE (KNumTraceMaskWords*32-1) sl@0: #endif sl@0: sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: #define DEBUGMASKWORD2 2 sl@0: sl@0: /* sl@0: words 0 & 1 of debug mask should be used for kernel debugging sl@0: word 2 of debug mask should be used to configure the ways the kernel behaves sl@0: word 3 of debug mask should be used to configure the ways the user library behaves sl@0: words 4 & 5 of debug mask should be used for file system debugging sl@0: words 6 & 7 of debug mask are reserved for licensees sl@0: */ sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: #define KALLTHREADSSYSTEM 64 //0x00000001, index 2 sl@0: sl@0: /** sl@0: Suppresses console output (in EWSRV) for faster automated tests. sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: #define KTESTFAST 65 //0x00000002, index 2 sl@0: sl@0: /** sl@0: Suppresses anything which might disturb latency testing, sl@0: for example platsec diagnostics emitted with the system lock held. sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: #define KTESTLATENCY 66 //0x00000004, index 2 sl@0: sl@0: /** sl@0: When a crash occurs this flag determines whether the debugger executes. sl@0: If set the crash debugger will NOT operate (even if it's in rom). sl@0: If clear the crash debugger will run. sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: #define KDEBUGMONITORDISABLE 67 //0x00000008, index 2 sl@0: sl@0: /** sl@0: When a crash occurs this flag determines whether the logger executes. sl@0: If set the crash logger will NOT operate (even if it's in rom). sl@0: If clear the crash logger will run. sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: #define KCRASHLOGGERDISABLE 68 //0x00000010, index 2 sl@0: sl@0: /** sl@0: Delay scheduling of newly unblocked threads until the next timer tick sl@0: occurs, to check for thread priority dependencies. Part of the crazy sl@0: scheduler functionality. sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: #define KCRAZYSCHEDDELAY 69 //0x00000020, index 2 sl@0: sl@0: sl@0: sl@0: /* Word 3 of debug mask : configures user library behaviour */ sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: #define KUSERHEAPTRACE 96 //0x00000001, index 3 sl@0: sl@0: sl@0: sl@0: #ifdef KFAIL sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: #define __KTRACE_FAIL(r,p) {if ((r)!=KErrNone && (DEBUGNUM(KFAIL))) p;} sl@0: sl@0: #else sl@0: #define __KTRACE_FAIL(r,p) sl@0: #endif sl@0: sl@0: #include sl@0: sl@0: #ifdef __KERNEL_MODE__ sl@0: sl@0: sl@0: class DBTraceFilter2; sl@0: sl@0: /** sl@0: @internalComponent sl@0: */ sl@0: struct SBTraceData sl@0: { sl@0: TUint8 iFilter[256]; sl@0: BTrace::THandler iHandler; sl@0: BTrace::TControlFunction iControl; sl@0: DBTraceFilter2*volatile iFilter2; sl@0: sl@0: TBool CheckFilter2(TUint32 aUid); sl@0: }; sl@0: sl@0: /** sl@0: @internalComponent sl@0: */ sl@0: extern SBTraceData BTraceData; sl@0: sl@0: #if defined(_DEBUG) || defined(BTRACE_KERNEL_ALL) sl@0: sl@0: #undef BTRACE_THREAD_IDENTIFICATION sl@0: #undef BTRACE_CPU_USAGE sl@0: #undef BTRACE_CHUNKS sl@0: #undef BTRACE_CODESEGS sl@0: #undef BTRACE_PAGING sl@0: #undef BTRACE_PAGING_MEDIA sl@0: #undef BTRACE_KERNEL_MEMORY sl@0: #undef BTRACE_RAM_ALLOCATOR sl@0: #undef BTRACE_FAST_MUTEX sl@0: #undef BTRACE_RESOURCE_MANAGER sl@0: #undef BTRACE_RESMANUS sl@0: #undef BTRACE_TRAWEVENT sl@0: #undef BTRACE_SYMBIAN_KERNEL_SYNC sl@0: #undef BTRACE_FLEXIBLE_MEM_MODEL sl@0: #undef BTRACE_CLIENT_SERVER sl@0: #undef BTRACE_REQUESTS sl@0: sl@0: sl@0: /** sl@0: If defined, code for BTrace category BTrace::EThreadIdentification sl@0: is compiled into the kernel. sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: #define BTRACE_THREAD_IDENTIFICATION sl@0: sl@0: /** sl@0: If defined, code for BTrace category BTrace::ECpuUsage sl@0: is compiled into the kernel. sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: #define BTRACE_CPU_USAGE sl@0: sl@0: /** sl@0: If defined, code for BTrace category BTrace::EChunks is compiled into the sl@0: kernel. sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: #define BTRACE_CHUNKS sl@0: sl@0: /** sl@0: If defined, code for BTrace category BTrace::ECodeSegs is compiled into the sl@0: kernel. sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: #define BTRACE_CODESEGS sl@0: sl@0: /** sl@0: If defined, code for BTrace category BTrace::EPaging is compiled into the sl@0: kernel. sl@0: @publishedPartner sl@0: @released 9.3 sl@0: */ sl@0: #define BTRACE_PAGING sl@0: sl@0: /** sl@0: If defined, code for BTrace category BTrace::EPagingMedia is compiled into the sl@0: Local Media Subsystem and relevant paging media drivers. sl@0: @publishedPartner sl@0: @released 9.3 sl@0: */ sl@0: #define BTRACE_PAGING_MEDIA sl@0: sl@0: /** sl@0: If defined, code for BTrace category BTrace::EKernelMemory is compiled into the sl@0: kernel. sl@0: @publishedPartner sl@0: @released 9.4 sl@0: */ sl@0: #define BTRACE_KERNEL_MEMORY sl@0: sl@0: /** sl@0: If defined, code for BTrace category BTrace::ERamAllocator is compiled into the sl@0: kernel. sl@0: sl@0: This BTrace category is only supported on the multiple and moving memory models. sl@0: sl@0: @publishedPartner sl@0: @released 9.4 sl@0: */ sl@0: #if defined(__MEMMODEL_MOVING__) || defined (__MEMMODEL_MULTIPLE__) sl@0: #define BTRACE_RAM_ALLOCATOR sl@0: #endif sl@0: sl@0: /** sl@0: If defined, code for BTrace category BTrace::EFastMutex is compiled into the sl@0: kernel. sl@0: */ sl@0: #define BTRACE_FAST_MUTEX sl@0: sl@0: /** sl@0: If defined, code for BTrace category BTrace::EResourceManager is compiled into the sl@0: Resource Manager Subsystem. sl@0: @publishedPartner sl@0: @released 9.5 sl@0: */ sl@0: #define BTRACE_RESOURCE_MANAGER sl@0: sl@0: /** sl@0: If defined, code for BTrace category BTrace::EResourceManagerUs is compiled into the sl@0: Resource Manager Subsystem's User-Side API. sl@0: @publishedPartner sl@0: @released 9.5 sl@0: */ sl@0: #define BTRACE_RESMANUS sl@0: sl@0: /** sl@0: If defined, code for BTrace category BTrace::ERawEvent is compiled into the sl@0: kernel. sl@0: @publishedPartner sl@0: @released 9.5 sl@0: */ sl@0: #define BTRACE_TRAWEVENT sl@0: sl@0: /** sl@0: If defined, code for BTrace category BTrace::ESymbianKernelSync is compiled into sl@0: the kernel. sl@0: */ sl@0: #define BTRACE_SYMBIAN_KERNEL_SYNC sl@0: sl@0: /** sl@0: If defined, code for BTrace category BTrace::EFlexibleMemModel is compiled into sl@0: the kernel. sl@0: sl@0: This BTrace category is only supported on the flexible memory model. sl@0: */ sl@0: #define BTRACE_FLEXIBLE_MEM_MODEL sl@0: sl@0: /** sl@0: If defined, code for BTrace category BTrace::EIic is compiled into the sl@0: IIC Subsystem. sl@0: */ sl@0: #define BTRACE_IIC sl@0: sl@0: /** sl@0: If defined, code for BTrace category BTrace::EClientServer is compiled into the sl@0: kernel. sl@0: */ sl@0: #define BTRACE_CLIENT_SERVER sl@0: sl@0: /** sl@0: If defined, code for BTrace category BTrace::ERequest is compiled into the sl@0: kernel. sl@0: */ sl@0: #define BTRACE_REQUESTS sl@0: sl@0: #endif // _DEBUG sl@0: sl@0: #endif // __KERNEL_MODE__ sl@0: sl@0: sl@0: #if defined(BTRACE_KERNEL_PROTOTYPE) sl@0: // Prototype trace categories... sl@0: #undef BTRACE_THREAD_PRIORITY sl@0: #define BTRACE_THREAD_PRIORITY sl@0: #endif sl@0: sl@0: #if defined(BTRACE_KERNEL_VERBOSE) sl@0: // Verbose trace options sl@0: sl@0: #ifdef BTRACE_PAGING sl@0: /** sl@0: If defined, verbose code for BTrace category BTrace::EPaging is compiled into the sl@0: kernel. sl@0: @publishedPartner sl@0: @released 9.3 sl@0: */ sl@0: #define BTRACE_PAGING_VERBOSE sl@0: #endif sl@0: sl@0: #endif //BTRACE_KERNEL_VERBOSE sl@0: sl@0: #if defined(_DEBUG) && !defined(__SMP__) sl@0: /** sl@0: @internalComponent sl@0: */ sl@0: TInt KCrazySchedulerEnabled(); sl@0: #endif sl@0: sl@0: #endif // NK_TRACE_H