os/kernelhwsrv/kernel/eka/common/common.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     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".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // e32\common\common.h
    15 // 
    16 //
    17 
    18 #ifndef __E32_COMMON_H__
    19 #define __E32_COMMON_H__
    20 
    21 #ifdef __KERNEL_MODE__
    22 #include <e32cmn.h>
    23 #include <e32panic.h>
    24 #include "u32std.h"
    25 #else
    26 #include <e32std.h>
    27 #include <e32base.h>
    28 #include <e32math.h>
    29 #include <e32svr.h>
    30 #include <e32ver.h>
    31 #include <e32hal.h>
    32 #include <e32panic.h>
    33 #include <u32exec.h>
    34 #endif
    35 
    36 GLREF_C void Panic(TCdtPanic aPanic);
    37 GLDEF_C void PanicBadArrayIndex();
    38 GLREF_C TInt __DoConvertNum(TUint, TRadix, TUint, TUint8*&);
    39 GLREF_C TInt __DoConvertNum(Uint64, TRadix, TUint, TUint8*&);
    40 
    41 #ifdef __KERNEL_MODE__
    42 GLREF_C void KernHeapFault(TCdtPanic aPanic);
    43 GLREF_C void KHeapCheckThreadState();
    44 TInt StringLength(const TUint16* aPtr);
    45 TInt StringLength(const TUint8* aPtr);
    46 
    47 #define	STD_CLASS					Kern
    48 #define	STRING_LENGTH(s)			StringLength(s)
    49 #define	STRING_LENGTH_16(s)			StringLength(s)
    50 #define	PANIC_CURRENT_THREAD(c,r)	Kern::PanicCurrentThread(c, r)
    51 #define __KERNEL_CHECK_RADIX(r)		__ASSERT_ALWAYS(((r)==EDecimal)||((r)==EHex),Panic(EInvalidRadix))
    52 #define	APPEND_BUF_SIZE				10
    53 #define	APPEND_BUF_SIZE_64			20
    54 #define	HEAP_PANIC(r)				RHeapK::Fault(r)
    55 #define	GET_PAGE_SIZE(x)			x = M::PageSizeInBytes()
    56 #define	DIVISION_BY_ZERO()			FAULT()
    57 
    58 #ifdef _DEBUG
    59 #define	__CHECK_THREAD_STATE		RHeapK::CheckThreadState()
    60 #else
    61 #define	__CHECK_THREAD_STATE
    62 #endif
    63 
    64 #else
    65 
    66 #define	STD_CLASS					User
    67 #define	STRING_LENGTH(s)			User::StringLength(s)
    68 #define	STRING_LENGTH_16(s)			User::StringLength(s)
    69 #define	PANIC_CURRENT_THREAD(c,r)	User::Panic(c, r)
    70 #define	MEM_COMPARE_16				Mem::Compare
    71 #define __KERNEL_CHECK_RADIX(r)
    72 #define	APPEND_BUF_SIZE				32
    73 #define	APPEND_BUF_SIZE_64			64
    74 #define	HEAP_PANIC(r)				Panic(r)
    75 #define	GET_PAGE_SIZE(x)			UserHal::PageSizeInBytes(x)
    76 #define	DIVISION_BY_ZERO()			User::RaiseException(EExcIntegerDivideByZero)
    77 #define	__CHECK_THREAD_STATE
    78 
    79 #endif	// __KERNEL_MODE__
    80 
    81 #endif