1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/kernel/eka/include/nkern/nk_priv.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,613 @@
1.4 +// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of the License "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// e32\include\nkern\nk_priv.h
1.18 +//
1.19 +// WARNING: This file contains some APIs which are internal and are subject
1.20 +// to change without notice. Such APIs should therefore not be used
1.21 +// outside the Kernel and Hardware Services package.
1.22 +//
1.23 +
1.24 +#ifndef __NK_PRIV_H__
1.25 +#define __NK_PRIV_H__
1.26 +#include <cpudefs.h>
1.27 +#include <nkern.h>
1.28 +
1.29 +/********************************************
1.30 + * DFCs
1.31 + ********************************************/
1.32 +
1.33 +/**
1.34 +@internalComponent
1.35 +*/
1.36 +inline TBool TDfc::TestAndSetQueued()
1.37 + { return __e32_atomic_swp_ord8(&iSpare3, 1); }
1.38 +
1.39 +/********************************************
1.40 + * Thread
1.41 + ********************************************/
1.42 +
1.43 +class TUserModeCallback;
1.44 +
1.45 +/**
1.46 +@publishedPartner
1.47 +@released
1.48 +
1.49 +Base class for a nanokernel thread.
1.50 +*/
1.51 +class NThreadBase : public TPriListLink
1.52 + {
1.53 +public:
1.54 + /**
1.55 + Defines the possible states of a nanokernel thread.
1.56 + */
1.57 + enum NThreadState
1.58 + {
1.59 + /**
1.60 + The thread is eligible for execution.
1.61 +
1.62 + Threads in this state are linked into the ready list.
1.63 + The highest priority READY thread is the one that will run, unless it
1.64 + is blocked on a fast mutex.
1.65 + */
1.66 + EReady,
1.67 +
1.68 + /**
1.69 + The thread is explicitly suspended (rather than blocking on
1.70 + a wait object).
1.71 + */
1.72 + ESuspended,
1.73 +
1.74 + /**
1.75 + The thread is blocked waiting for a fast semaphore to be signalled.
1.76 + */
1.77 + EWaitFastSemaphore,
1.78 +
1.79 + /**
1.80 + The thread is blocked waiting for a specific time period to elapse.
1.81 + */
1.82 + ESleep,
1.83 +
1.84 + /**
1.85 + The thread is blocked on a wait object implemented in a layer above
1.86 + the nanokernel.
1.87 +
1.88 + In practice, this means that it is blocked on a Symbian OS
1.89 + semaphore or mutex.
1.90 + */
1.91 + EBlocked,
1.92 +
1.93 + /**
1.94 + The thread has terminated and will not execute again.
1.95 + */
1.96 + EDead,
1.97 +
1.98 + /**
1.99 + The thread is a DFC-handling thread and it is blocked waiting for
1.100 + the DFC to be queued.
1.101 + */
1.102 + EWaitDfc,
1.103 +
1.104 + /**
1.105 + Not a thread state, but defines the maximum number of states.
1.106 + */
1.107 + ENumNStates
1.108 + };
1.109 +
1.110 +
1.111 +
1.112 +
1.113 + /**
1.114 + Defines a set of values that, when passed to a nanokernel state handler,
1.115 + indicates which operation is being performed on the thread.
1.116 +
1.117 + Every thread that can use a new type of wait object, must have a nanokernel
1.118 + state handler installed to handle operations on that thread while it is
1.119 + waiting on that wait object.
1.120 +
1.121 + A wait handler has the signature:
1.122 + @code
1.123 + void StateHandler(NThread* aThread, TInt aOp, TInt aParam);
1.124 + @endcode
1.125 +
1.126 + where aOp is one of these enum values.
1.127 +
1.128 + The state handler is always called with preemption disabled.
1.129 + */
1.130 + enum NThreadOperation
1.131 + {
1.132 + /**
1.133 + Indicates that the thread is suspended while not in a critical section,
1.134 + and not holding a fast mutex.
1.135 +
1.136 + StateHandler() is called in whichever context
1.137 + NThreadBase::Suspend() is called from.
1.138 +
1.139 + Note that the third parameter passed to StateHandler() contains
1.140 + the requested suspension count.
1.141 + */
1.142 + ESuspend=0,
1.143 +
1.144 + /**
1.145 + Indicates that the thread is being resumed while suspended, and
1.146 + the last suspension has been removed.
1.147 +
1.148 + StateHandler() is called in whichever context
1.149 + NThreadBase::Resume() is called from.
1.150 + */
1.151 + EResume=1,
1.152 +
1.153 + /**
1.154 + Indicates that the thread has all suspensions cancelled while
1.155 + actually suspended.
1.156 +
1.157 + Statehandler() is called in whichever context
1.158 + NThreadBase::ForceResume() is called from.
1.159 + */
1.160 + EForceResume=2,
1.161 +
1.162 + /**
1.163 + Indicates that the thread is being released from its wait.
1.164 +
1.165 + Statehandler() is called in whichever context
1.166 + NThreadBase::Release() is called from.
1.167 + */
1.168 + ERelease=3,
1.169 +
1.170 + /**
1.171 + Indicates that the thread's priority is being changed.
1.172 +
1.173 + StateHandler() is called in whichever context
1.174 + NThreadBase::SetPriority() is called from.
1.175 + */
1.176 + EChangePriority=4,
1.177 +
1.178 + /**
1.179 + Indicates that the thread has called NKern::ThreadLeaveCS() with
1.180 + an unknown NThreadBase::iCsFunction that is negative, but not equal
1.181 + to NThreadBase::ECsExitPending.
1.182 +
1.183 + Note that NThreadBase::iCsFunction is internal to Symbian OS.
1.184 + */
1.185 + ELeaveCS=5,
1.186 +
1.187 + /**
1.188 + Indicates that the thread's wait timeout has expired, and no timeout
1.189 + handler has been defined for that thread.
1.190 +
1.191 + StateHandler() is called in the context of the nanokernel
1.192 + timer thread, DfcThread1.
1.193 + */
1.194 + ETimeout=6,
1.195 + };
1.196 +
1.197 + enum NThreadCSFunction
1.198 + {
1.199 + ECSExitPending=-1,
1.200 + ECSExitInProgress=-2
1.201 + };
1.202 +
1.203 + enum NThreadTimeoutOp
1.204 + {
1.205 + ETimeoutPreamble=0,
1.206 + ETimeoutPostamble=1,
1.207 + ETimeoutSpurious=2,
1.208 + };
1.209 +public:
1.210 + NThreadBase();
1.211 + TInt Create(SNThreadCreateInfo& anInfo, TBool aInitial);
1.212 + IMPORT_C void CheckSuspendThenReady();
1.213 + IMPORT_C void Ready();
1.214 + void DoReady();
1.215 + void DoCsFunction();
1.216 + IMPORT_C TBool Suspend(TInt aCount);
1.217 + IMPORT_C TBool Resume();
1.218 + IMPORT_C TBool ForceResume();
1.219 + IMPORT_C void Release(TInt aReturnCode);
1.220 + IMPORT_C void RequestSignal();
1.221 + IMPORT_C void SetPriority(TInt aPriority);
1.222 + void SetEntry(NThreadFunction aFunction);
1.223 + IMPORT_C void Kill();
1.224 + void Exit();
1.225 + void ForceExit();
1.226 + // hooks for platform-specific code
1.227 + void OnKill();
1.228 + void OnExit();
1.229 +public:
1.230 + static void TimerExpired(TAny* aPtr);
1.231 + inline void UnknownState(TInt aOp, TInt aParam)
1.232 + { (*iHandlers->iStateHandler)((NThread*)this,aOp,aParam); }
1.233 +
1.234 + /** @internalComponent */
1.235 + inline TUint8 Attributes()
1.236 + { return iSpare2; }
1.237 +
1.238 + /** @internalComponent */
1.239 + inline TUint8 SetAttributes(TUint8 aNewAtt)
1.240 + { return __e32_atomic_swp_ord8(&iSpare2, aNewAtt); }
1.241 +
1.242 + /** @internalComponent */
1.243 + inline TUint8 ModifyAttributes(TUint8 aClearMask, TUint8 aSetMask)
1.244 + { return __e32_atomic_axo_ord8(&iSpare2, (TUint8)~(aClearMask|aSetMask), aSetMask); }
1.245 +
1.246 + /** @internalComponent */
1.247 + inline void SetAddressSpace(TAny* a)
1.248 + { iAddressSpace=a; }
1.249 +
1.250 + inline void SetReturnValue(TInt aValue)
1.251 + { iReturnValue=aValue; }
1.252 + inline void SetExtraContext(TAny* a, TInt aSize)
1.253 + { iExtraContext = a; iExtraContextSize = aSize; }
1.254 +
1.255 + /** @internalComponent */
1.256 + void CallUserModeCallbacks();
1.257 +public:
1.258 +// TUint8 iNState; // use iSpare1 for state
1.259 +// TUint8 i_ThrdAttr; /**< @internalComponent */ // use iSpare2 for attributes
1.260 +// TUint8 iUserContextType; // use iSpare3
1.261 + NFastMutex* iHeldFastMutex; /**< @internalComponent */ // fast mutex held by this thread
1.262 + NFastMutex* iWaitFastMutex; /**< @internalComponent */ // fast mutex on which this thread is blocked
1.263 + TAny* iAddressSpace; /**< @internalComponent */
1.264 + TInt iTime; // time remaining
1.265 + TInt iTimeslice; // timeslice for this thread
1.266 + NFastSemaphore iRequestSemaphore; /**< @internalComponent */
1.267 + TAny* iWaitObj; // object on which this thread is waiting
1.268 + TInt iSuspendCount; /**< @internalComponent */ // -how many times we have been suspended
1.269 + TInt iCsCount; /**< @internalComponent */ // critical section count
1.270 + TInt iCsFunction; /**< @internalComponent */ // what to do on leaving CS: +n=suspend n times, 0=nothing, -1=exit
1.271 + NTimer iTimer; /**< @internalComponent */
1.272 + TInt iReturnValue;
1.273 + TLinAddr iStackBase; /**< @internalComponent */
1.274 + TInt iStackSize; /**< @internalComponent */
1.275 + const SNThreadHandlers* iHandlers; /**< @internalComponent */ // additional thread event handlers
1.276 + const SFastExecTable* iFastExecTable; /**< @internalComponent */
1.277 + const SSlowExecEntry* iSlowExecTable; /**< @internalComponent */ // points to first entry iEntries[0]
1.278 + TLinAddr iSavedSP; /**< @internalComponent */
1.279 + TAny* iExtraContext; /**< @internalComponent */ // parent FPSCR value (iExtraContextSize == -1), coprocessor context (iExtraContextSize > 0) or NULL
1.280 + TInt iExtraContextSize; /**< @internalComponent */ // +ve=dynamically allocated, 0=none, -1=iExtraContext stores parent FPSCR value
1.281 + TUint iLastStartTime; /**< @internalComponent */ // last start of execution timestamp
1.282 + TUint64 iTotalCpuTime; /**< @internalComponent */ // total time spent running, in hi-res timer ticks
1.283 + TUint32 iTag; /**< @internalComponent */ // User defined set of bits which is ANDed with a mask when the thread is scheduled, and indicates if a DFC should be scheduled.
1.284 + TAny* iVemsData; /**< @internalComponent */ // This pointer can be used by any VEMS to store any data associated with the thread. This data must be clean up before the Thread Exit Monitor completes.
1.285 + TUserModeCallback* volatile iUserModeCallbacks; /**< @internalComponent */ // Head of singly-linked list of callbacks
1.286 + TUint32 iSpare7; /**< @internalComponent */ // spare to allow growth while preserving BC
1.287 + TUint32 iSpare8; /**< @internalComponent */ // spare to allow growth while preserving BC
1.288 + };
1.289 +
1.290 +__ASSERT_COMPILE(!(_FOFF(NThreadBase,iTotalCpuTime)&7));
1.291 +
1.292 +#ifdef __INCLUDE_NTHREADBASE_DEFINES__
1.293 +#define iNState iSpare1
1.294 +#define i_ThrdAttr iSpare2
1.295 +#define iUserContextType iSpare3
1.296 +#endif
1.297 +
1.298 +#define i_NThread_BasePri iPriority
1.299 +
1.300 +/********************************************
1.301 + * Scheduler
1.302 + ********************************************/
1.303 +
1.304 +/**
1.305 +@internalComponent
1.306 +*/
1.307 +class TScheduler : public TPriListBase
1.308 + {
1.309 +public:
1.310 + TScheduler();
1.311 + void Remove(NThreadBase* aThread);
1.312 + void RotateReadyList(TInt aPriority);
1.313 + void QueueDfcs();
1.314 + static void Reschedule();
1.315 + static void YieldTo(NThreadBase* aThread);
1.316 + void TimesliceTick();
1.317 + IMPORT_C static TScheduler* Ptr();
1.318 + inline void SetProcessHandler(TLinAddr aHandler) {iProcessHandler=aHandler;}
1.319 +private:
1.320 + SDblQueLink* iExtraQueues[KNumPriorities-1];
1.321 +public:
1.322 + TUint8 iRescheduleNeededFlag;
1.323 + TUint8 iDfcPendingFlag;
1.324 + TInt iKernCSLocked;
1.325 + SDblQue iDfcs;
1.326 + TLinAddr iMonitorExceptionHandler;
1.327 + TLinAddr iProcessHandler;
1.328 + TLinAddr iRescheduleHook;
1.329 + TUint8 iInIDFC;
1.330 + NFastMutex iLock;
1.331 + NThreadBase* iCurrentThread;
1.332 + TAny* iAddressSpace;
1.333 + TAny* iExtras[16];
1.334 + // For EMI support
1.335 + NThread* iSigma;
1.336 + TDfc* iEmiDfc;
1.337 + TUint32 iEmiMask;
1.338 + TUint32 iEmiState;
1.339 + TUint32 iEmiDfcTrigger;
1.340 + TBool iLogging;
1.341 + TAny* iBufferStart;
1.342 + TAny* iBufferEnd;
1.343 + TAny* iBufferTail;
1.344 + TAny* iBufferHead;
1.345 + // For BTrace suport
1.346 + TUint8 iCpuUsageFilter;
1.347 + TUint8 iFastMutexFilter;
1.348 + BTrace::THandler iBTraceHandler;
1.349 + // Idle notification
1.350 + SDblQue iIdleDfcs;
1.351 + TUint32 iIdleGenerationCount;
1.352 + // Delayed threads
1.353 + SDblQue iDelayedQ;
1.354 + TDfc iDelayDfc;
1.355 + };
1.356 +
1.357 +GLREF_D TScheduler TheScheduler;
1.358 +
1.359 +/**
1.360 +@internalComponent
1.361 +*/
1.362 +inline void RescheduleNeeded()
1.363 + {TheScheduler.iRescheduleNeededFlag=TRUE;}
1.364 +
1.365 +#include <nk_plat.h>
1.366 +
1.367 +/**
1.368 +@internalComponent
1.369 +*/
1.370 +inline NThread* NCurrentThread()
1.371 + { return (NThread*)TheScheduler.iCurrentThread; }
1.372 +
1.373 +
1.374 +/**
1.375 +@internalComponent
1.376 +*/
1.377 +#define __NK_ASSERT_UNLOCKED __NK_ASSERT_DEBUG(TheScheduler.iKernCSLocked==0)
1.378 +
1.379 +/**
1.380 +@internalComponent
1.381 +*/
1.382 +#define __NK_ASSERT_LOCKED __NK_ASSERT_DEBUG(TheScheduler.iKernCSLocked!=0)
1.383 +
1.384 +#ifdef _DEBUG
1.385 +/**
1.386 +@publishedPartner
1.387 +@released
1.388 +*/
1.389 +#define __ASSERT_NO_FAST_MUTEX { \
1.390 + NThread* nt=NKern::CurrentThread(); \
1.391 + __NK_ASSERT_DEBUG(!nt->iHeldFastMutex); \
1.392 + }
1.393 +
1.394 +/**
1.395 +@publishedPartner
1.396 +@released
1.397 +*/
1.398 +#define __ASSERT_FAST_MUTEX(m) { \
1.399 + NThread* nt=NKern::CurrentThread(); \
1.400 + __NK_ASSERT_DEBUG(nt->iHeldFastMutex==(m) && (m)->iHoldingThread==nt); \
1.401 + }
1.402 +
1.403 +/**
1.404 +@publishedPartner
1.405 +@released
1.406 +*/
1.407 +#define __ASSERT_SYSTEM_LOCK { \
1.408 + NThread* nt=NKern::CurrentThread(); \
1.409 + NFastMutex& m=TScheduler::Ptr()->iLock; \
1.410 + __NK_ASSERT_DEBUG(nt->iHeldFastMutex==&m && m.iHoldingThread==nt); \
1.411 + }
1.412 +
1.413 +#define __ASSERT_NOT_ISR __NK_ASSERT_DEBUG(NKern::CurrentContext()!=NKern::EInterrupt)
1.414 +
1.415 +#else
1.416 +#define __ASSERT_NO_FAST_MUTEX
1.417 +#define __ASSERT_FAST_MUTEX(m)
1.418 +#define __ASSERT_SYSTEM_LOCK
1.419 +#define __ASSERT_NOT_ISR
1.420 +#endif
1.421 +
1.422 +/********************************************
1.423 + * System timer queue
1.424 + ********************************************/
1.425 +
1.426 +/**
1.427 +@publishedPartner
1.428 +@released
1.429 +*/
1.430 +class NTimerQ
1.431 + {
1.432 + friend class NTimer;
1.433 +public:
1.434 + typedef void (*TDebugFn)(TAny* aPtr, TInt aPos); /**< @internalComponent */
1.435 + enum { ETimerQMask=31, ENumTimerQueues=32 }; /**< @internalComponent */ // these are not easily modifiable
1.436 +
1.437 + /** @internalComponent */
1.438 + struct STimerQ
1.439 + {
1.440 + SDblQue iIntQ;
1.441 + SDblQue iDfcQ;
1.442 + };
1.443 +public:
1.444 + NTimerQ();
1.445 + static void Init1(TInt aTickPeriod);
1.446 + static void Init3(TDfcQue* aDfcQ);
1.447 + IMPORT_C static TAny* TimerAddress();
1.448 + IMPORT_C void Tick();
1.449 + IMPORT_C static TInt IdleTime();
1.450 + IMPORT_C static void Advance(TInt aTicks);
1.451 +private:
1.452 + static void DfcFn(TAny* aPtr);
1.453 + void Dfc();
1.454 + void Add(NTimer* aTimer);
1.455 + void AddFinal(NTimer* aTimer);
1.456 +public:
1.457 + STimerQ iTickQ[ENumTimerQueues]; /**< @internalComponent */ // NOTE: the order of member data is important
1.458 + TUint32 iPresent; /**< @internalComponent */ // The assembler code relies on it
1.459 + TUint32 iMsCount; /**< @internalComponent */
1.460 + SDblQue iHoldingQ; /**< @internalComponent */
1.461 + SDblQue iOrderedQ; /**< @internalComponent */
1.462 + SDblQue iCompletedQ; /**< @internalComponent */
1.463 + TDfc iDfc; /**< @internalComponent */
1.464 + TUint8 iTransferringCancelled; /**< @internalComponent */
1.465 + TUint8 iCriticalCancelled; /**< @internalComponent */
1.466 + TUint8 iPad1; /**< @internalComponent */
1.467 + TUint8 iPad2; /**< @internalComponent */
1.468 + TDebugFn iDebugFn; /**< @internalComponent */
1.469 + TAny* iDebugPtr; /**< @internalComponent */
1.470 + TInt iTickPeriod; /**< @internalComponent */ // in microseconds
1.471 + /**
1.472 + This member is intended for use by ASSP/variant interrupt code as a convenient
1.473 + location to store rounding error information where hardware interrupts are not
1.474 + exactly one millisecond. The Symbian kernel does not make any use of this member.
1.475 + @publishedPartner
1.476 + @released
1.477 + */
1.478 + TInt iRounding;
1.479 + };
1.480 +
1.481 +GLREF_D NTimerQ TheTimerQ;
1.482 +
1.483 +/**
1.484 +@internalComponent
1.485 +*/
1.486 +inline TUint32 NTickCount()
1.487 + {return TheTimerQ.iMsCount;}
1.488 +
1.489 +/**
1.490 +@internalComponent
1.491 +*/
1.492 +inline TInt NTickPeriod()
1.493 + {return TheTimerQ.iTickPeriod;}
1.494 +
1.495 +
1.496 +extern "C" {
1.497 +/**
1.498 +@internalComponent
1.499 +*/
1.500 +extern void NKCrashHandler(TInt aPhase, const TAny* a0, TInt a1);
1.501 +
1.502 +/**
1.503 +@internalComponent
1.504 +*/
1.505 +extern TUint32 CrashState;
1.506 +}
1.507 +
1.508 +
1.509 +#define __ACQUIRE_BTRACE_LOCK()
1.510 +#define __RELEASE_BTRACE_LOCK()
1.511 +
1.512 +/**
1.513 +@internalComponent
1.514 +*/
1.515 +TBool InterruptsStatus(TBool aRequest);
1.516 +
1.517 +//declarations for the checking of kernel preconditions
1.518 +
1.519 +/**
1.520 +@internalComponent
1.521 +
1.522 +PRECOND_FUNCTION_CALLER is needed for __ASSERT_WITH_MESSAGE_ALWAYS(),
1.523 +so is outside the #ifdef _DEBUG.
1.524 +*/
1.525 +#ifndef PRECOND_FUNCTION_CALLER
1.526 +#define PRECOND_FUNCTION_CALLER 0
1.527 +#endif
1.528 +
1.529 +#ifdef _DEBUG
1.530 +
1.531 +/**
1.532 +@internalComponent
1.533 +*/
1.534 +#define MASK_NO_FAST_MUTEX 0x1
1.535 +#define MASK_CRITICAL 0x2
1.536 +#define MASK_NO_CRITICAL 0x4
1.537 +#define MASK_KERNEL_LOCKED 0x8
1.538 +#define MASK_KERNEL_UNLOCKED 0x10
1.539 +#define MASK_KERNEL_LOCKED_ONCE 0x20
1.540 +#define MASK_INTERRUPTS_ENABLED 0x40
1.541 +#define MASK_INTERRUPTS_DISABLED 0x80
1.542 +#define MASK_SYSTEM_LOCKED 0x100
1.543 +#define MASK_NOT_ISR 0x400
1.544 +#define MASK_NOT_IDFC 0x800
1.545 +#define MASK_NOT_THREAD 0x1000
1.546 +#define MASK_NO_CRITICAL_IF_USER 0x2000
1.547 +#define MASK_THREAD_STANDARD ( MASK_NO_FAST_MUTEX | MASK_KERNEL_UNLOCKED | MASK_INTERRUPTS_ENABLED | MASK_NOT_ISR | MASK_NOT_IDFC )
1.548 +#define MASK_THREAD_CRITICAL ( MASK_THREAD_STANDARD | MASK_CRITICAL )
1.549 +#define MASK_ALWAYS_FAIL 0x4000
1.550 +#define MASK_NO_RESCHED 0x8000
1.551 +
1.552 +#if defined(__STANDALONE_NANOKERNEL__) || (!defined (__KERNEL_APIS_CONTEXT_CHECKS_WARNING__)&&!defined (__KERNEL_APIS_CONTEXT_CHECKS_FAULT__))
1.553 +#define CHECK_PRECONDITIONS(mask,function)
1.554 +#define __ASSERT_WITH_MESSAGE_DEBUG(cond,message,function)
1.555 +
1.556 +#else
1.557 +/**
1.558 +@internalComponent
1.559 +*/
1.560 +extern "C" TInt CheckPreconditions(TUint32 aConditionMask, const char* aFunction, TLinAddr aAddr);
1.561 +/**
1.562 +@internalComponent
1.563 +*/
1.564 +#define CHECK_PRECONDITIONS(mask,function) CheckPreconditions(mask,function,PRECOND_FUNCTION_CALLER)
1.565 +
1.566 +#ifdef __KERNEL_APIS_CONTEXT_CHECKS_FAULT__
1.567 +
1.568 +/**
1.569 +@internalComponent
1.570 +*/
1.571 +#define __ASSERT_WITH_MESSAGE_DEBUG(cond,message,function) \
1.572 + __ASSERT_DEBUG( (cond), ( \
1.573 + DEBUGPRINT("Assertion failed: %s\nFunction: %s; called from: %08x\n",message,function,PRECOND_FUNCTION_CALLER),\
1.574 + NKFault(function, 0)))
1.575 +
1.576 +#else//!__KERNEL_APIS_CONTEXT_CHECKS_FAULT__
1.577 +/**
1.578 +@internalComponent
1.579 +*/
1.580 +#define __ASSERT_WITH_MESSAGE_DEBUG(cond,message,function) \
1.581 + __ASSERT_DEBUG( (cond), \
1.582 + DEBUGPRINT("Assertion failed: %s\nFunction: %s; called from: %08x\n",message,function,PRECOND_FUNCTION_CALLER))
1.583 +
1.584 +
1.585 +#endif//__KERNEL_APIS_CONTEXT_CHECKS_FAULT__
1.586 +#endif//(!defined (__KERNEL_APIS_CONTEXT_CHECKS_WARNING__)&&!defined (__KERNEL_APIS_CONTEXT_CHECKS_FAULT__))
1.587 +
1.588 +#else//if !DEBUG
1.589 +
1.590 +#define CHECK_PRECONDITIONS(mask,function)
1.591 +#define __ASSERT_WITH_MESSAGE_DEBUG(cond,message,function)
1.592 +
1.593 +#endif//_DEBUG
1.594 +
1.595 +#if (!defined (__KERNEL_APIS_CONTEXT_CHECKS_WARNING__)&&!defined (__KERNEL_APIS_CONTEXT_CHECKS_FAULT__))
1.596 +#define __ASSERT_WITH_MESSAGE_ALWAYS(cond,message,function)
1.597 +#else
1.598 +#ifdef __KERNEL_APIS_CONTEXT_CHECKS_FAULT__
1.599 +/**
1.600 +@internalComponent
1.601 +*/
1.602 +#define __ASSERT_WITH_MESSAGE_ALWAYS(cond,message,function) \
1.603 + __ASSERT_ALWAYS( (cond), ( \
1.604 + DEBUGPRINT("Assertion failed: %s\nFunction: %s; called from: %08x\n",message,function,PRECOND_FUNCTION_CALLER),\
1.605 + NKFault(function, 0)))
1.606 +#else
1.607 +/**
1.608 +@internalComponent
1.609 +*/
1.610 +#define __ASSERT_WITH_MESSAGE_ALWAYS(cond,message,function) \
1.611 + __ASSERT_ALWAYS( (cond), \
1.612 + DEBUGPRINT("Assertion failed: %s\nFunction: %s; called from: %08x\n",message,function,PRECOND_FUNCTION_CALLER))
1.613 +#endif//__KERNEL_APIS_CONTEXT_CHECKS_FAULT__
1.614 +#endif//(!defined (__KERNEL_APIS_CONTEXT_CHECKS_WARNING__)&&!defined (__KERNEL_APIS_CONTEXT_CHECKS_FAULT__))
1.615 +
1.616 +#endif