kernel/eka/include/kernel/kern_priv.h
branchRCL_3
changeset 256 c1f20ce4abcf
parent 117 5b5d147c7838
child 257 3e88ff8f41d5
equal deleted inserted replaced
249:a179b74831c9 256:c1f20ce4abcf
    33 #include <kernel/kernboot.h>
    33 #include <kernel/kernboot.h>
    34 #include <e32def_private.h>
    34 #include <e32def_private.h>
    35 #include <e32const_private.h>
    35 #include <e32const_private.h>
    36 #include <e32des8_private.h>
    36 #include <e32des8_private.h>
    37 #include <e32event_private.h>
    37 #include <e32event_private.h>
    38 
    38 #include <kernel/heap_hybrid.h>
    39 
    39 
    40 #ifndef __MINIMUM_MACHINE_CODE__
    40 #ifndef __MINIMUM_MACHINE_CODE__
    41 #ifdef __MARM__
    41 #ifdef __MARM__
    42 #ifndef __BIG_ENDIAN__
    42 #ifndef __BIG_ENDIAN__
    43 
    43 
   544 	inline TTimer();
   544 	inline TTimer();
   545 	~TTimer();
   545 	~TTimer();
   546 	TInt After(TInt aInterval, TTickCallBack aFunction, TRequestStatus& aStatus);
   546 	TInt After(TInt aInterval, TTickCallBack aFunction, TRequestStatus& aStatus);
   547 	TInt At(const TTimeK& aTime, TSecondCallBack aFunction, TRequestStatus& aStatus);
   547 	TInt At(const TTimeK& aTime, TSecondCallBack aFunction, TRequestStatus& aStatus);
   548 	TInt AfterHighRes(TInt aInterval, NTimerFn aFunction, TRequestStatus& aStatus);
   548 	TInt AfterHighRes(TInt aInterval, NTimerFn aFunction, TRequestStatus& aStatus);
       
   549 	TInt AgainHighRes(TInt aInterval, NTimerFn aFunction, TRequestStatus& aStatus);
   549 	TInt Inactivity(TInt aSeconds, TInactivityCallBack aFunction, TRequestStatus& aStatus);
   550 	TInt Inactivity(TInt aSeconds, TInactivityCallBack aFunction, TRequestStatus& aStatus);
   550 	void Cancel(DThread* aThread);
   551 	void Cancel(DThread* aThread);
   551 	void Abort(DThread* aThread, TInt aTypeMask);
   552 	void Abort(DThread* aThread, TInt aTypeMask);
   552 	void SetType(TTimerType aType);
   553 	void SetType(TTimerType aType);
   553 public:
   554 public:
   586 	void Cancel();
   587 	void Cancel();
   587 	TInt After(TRequestStatus& aStatus, TInt aInterval);
   588 	TInt After(TRequestStatus& aStatus, TInt aInterval);
   588 	TInt At(TRequestStatus& aStatus, const TTimeK& aTime);
   589 	TInt At(TRequestStatus& aStatus, const TTimeK& aTime);
   589 	TInt Lock(TRequestStatus& aStatus, TTimerLockSpec aLock);
   590 	TInt Lock(TRequestStatus& aStatus, TTimerLockSpec aLock);
   590 	void HighRes(TRequestStatus& aStatus, TInt aInterval);
   591 	void HighRes(TRequestStatus& aStatus, TInt aInterval);
       
   592 	void AgainHighRes(TRequestStatus& aStatus, TInt aInterval);
   591 	TInt Inactivity(TRequestStatus& aStatus, TInt aSeconds);
   593 	TInt Inactivity(TRequestStatus& aStatus, TInt aSeconds);
   592 	void Abort(TBool aAbortAbsolute);
   594 	void Abort(TBool aAbortAbsolute);
   593 	virtual TInt RequestUserHandle(DThread* aThread, TOwnerType aType);
   595 	virtual TInt RequestUserHandle(DThread* aThread, TOwnerType aType);
   594 private:
   596 private:
   595 	inline DThread* Owner();
   597 	inline DThread* Owner();
   741 	void SuspendPendingThread(DThread* aThread);
   743 	void SuspendPendingThread(DThread* aThread);
   742 	void RemovePendingThread(DThread* aThread);
   744 	void RemovePendingThread(DThread* aThread);
   743 	void ChangePendingThreadPriority(DThread* aThread, TInt aNewPriority);
   745 	void ChangePendingThreadPriority(DThread* aThread, TInt aNewPriority);
   744 	void WakeUpNextThread();
   746 	void WakeUpNextThread();
   745 public:
   747 public:
   746 	TInt Wait();
   748 	TInt Wait(TInt aTimeout=0);	// 0 means wait forever, -1 means poll, n>0 means n nanokernel ticks
   747 	void Signal();
   749 	void Signal();
   748 	void Reset();
   750 	void Reset();
   749 public:
   751 public:
   750 	TInt iHoldCount;			// number of times held by current thread
   752 	TInt iHoldCount;			// number of times held by current thread
   751 	TInt iWaitCount;			// number of waiting threads
   753 	TInt iWaitCount;			// number of waiting threads
  1518 		ETypeSecureId= 2,
  1520 		ETypeSecureId= 2,
  1519 		ETypeVendorId= 3,
  1521 		ETypeVendorId= 3,
  1520 		};
  1522 		};
  1521 	enum TMask
  1523 	enum TMask
  1522 		{
  1524 		{
  1523 		EMaskFail = ETypeFail << KCSPBitsFree, 
  1525 		EMaskFail = TUint32 (ETypeFail) << KCSPBitsFree, 
  1524 		EMaskCapsOnly = ETypeCapsOnly << KCSPBitsFree,
  1526 		EMaskCapsOnly = TUint32 (ETypeCapsOnly) << KCSPBitsFree,
  1525 		EMaskSecureId = ETypeSecureId << KCSPBitsFree,
  1527 		EMaskSecureId = TUint32 (ETypeSecureId) << KCSPBitsFree,
  1526 		EMaskVendorId = ETypeVendorId << KCSPBitsFree,
  1528 		EMaskVendorId = TUint32 (ETypeVendorId) << KCSPBitsFree,
  1527 		};
  1529 		};
  1528 	TInt Set(const TSecurityPolicy& aPolicy);
  1530 	TInt Set(const TSecurityPolicy& aPolicy);
  1529 #ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
  1531 #ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
  1530 	inline TBool CheckPolicy(DProcess* aProcess, const char* aDiagnostic=0) const
  1532 	inline TBool CheckPolicy(DProcess* aProcess, const char* aDiagnostic=0) const
  1531 		{
  1533 		{
  2258 
  2260 
  2259 
  2261 
  2260 /********************************************
  2262 /********************************************
  2261  * Kernel heap
  2263  * Kernel heap
  2262  ********************************************/
  2264  ********************************************/
  2263 class RHeapK : public RHeap
  2265 class RHeapK : public RHybridHeap
  2264 	{
  2266 	{
  2265 public:
  2267 public:
  2266 	static RHeapK* FixedHeap(TAny* aBase, TInt aMaxLength);
  2268 	static RHeapK* FixedHeap(TAny* aBase, TInt aMaxLength);
  2267 	TInt CreateMutex();
  2269 	TInt CreateMutex();
  2268 	void Mutate(TInt aOffset, TInt aMaxLength);
  2270 	void Mutate(TInt aOffset, TInt aMaxLength);
  2276 	inline TInt TotalAllocSize() const
  2278 	inline TInt TotalAllocSize() const
  2277 		{ return iTotalAllocSize; }
  2279 		{ return iTotalAllocSize; }
  2278 	static void CheckThreadState();
  2280 	static void CheckThreadState();
  2279 	static void Fault(TInt aFault);
  2281 	static void Fault(TInt aFault);
  2280 	inline TBool CheckForSimulatedAllocFail()
  2282 	inline TBool CheckForSimulatedAllocFail()
  2281 		{ return RHeap::CheckForSimulatedAllocFail(); }
  2283 	    { return RHybridHeap::CheckForSimulatedAllocFail(); }	
  2282 	inline DMutex* Mutex() const; /**< @internalComponent */
  2284 	inline DMutex* Mutex() const; /**< @internalComponent */
  2283 public:
  2285 public:
  2284 	friend class Monitor;
  2286 	friend class Monitor;
  2285 	};
  2287 	};
  2286 
       
  2287 inline void RHeap::Lock() const
       
  2288 	{
       
  2289 	DMutex* m = *(DMutex**)&iLock;
       
  2290 	if (m)
       
  2291 		Kern::MutexWait(*m);
       
  2292 	}
       
  2293 
       
  2294 inline void RHeap::Unlock() const
       
  2295 	{
       
  2296 	DMutex* m = *(DMutex**)&iLock;
       
  2297 	if (m)
       
  2298 		Kern::MutexSignal(*m);
       
  2299 	}
       
  2300 
  2288 
  2301 /**
  2289 /**
  2302 @internalComponent
  2290 @internalComponent
  2303 */
  2291 */
  2304 inline DMutex* RHeapK::Mutex() const
  2292 inline DMutex* RHeapK::Mutex() const
  2305 	{ return *(DMutex**)&iLock;	}
  2293 	{ return *(DMutex**)&iLock;	}
  2306 
       
  2307 inline TInt RHeap::SetBrk(TInt aBrk)
       
  2308 	{
       
  2309 	return ((DChunk*)iChunkHandle)->Adjust(aBrk);
       
  2310 	}
       
  2311 
  2294 
  2312 enum TSecureClockStatusFlags 
  2295 enum TSecureClockStatusFlags 
  2313 	{
  2296 	{
  2314 	ESecureClockPresent = 1,		// signals a trusted time source has been found 
  2297 	ESecureClockPresent = 1,		// signals a trusted time source has been found 
  2315 	ESecureClockOffsetPresent = 2,	// signals nonsecure offset was read from HAL
  2298 	ESecureClockOffsetPresent = 2,	// signals nonsecure offset was read from HAL