|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef __MEMAPI_H__ |
|
21 #define __MEMAPI_H__ |
|
22 |
|
23 // Headers |
|
24 #include <e32def.h> // For TInt |
|
25 #include <e32cmn.h> // For TDes8 |
|
26 |
|
27 /* |
|
28 * Part of ISCEs internal MEM API. |
|
29 * Static interface for for usage of Memory management services. |
|
30 * Class spesific faults can be found from source file. |
|
31 */ |
|
32 class MemApi |
|
33 { |
|
34 |
|
35 public: |
|
36 |
|
37 /* |
|
38 * Allocates a block of minimum of size aSize. |
|
39 * Descriptor length shall be set to zero, but maximum length may be bigger than size given as parameter. |
|
40 * Memory content of the descriptor shall be filled with zeros until maximum length. |
|
41 * Memory allocated for the block shall be physically contigous, non-cached and word aligned. |
|
42 * If aSize is zero class spesific fault thrown. |
|
43 * If not possible to allocate a block class spesific fault thrown. |
|
44 * If not called in kernel thread context class spesific fault thrown. |
|
45 * If called with FM held or kernel unlocked asserts thrown according to OS macros. |
|
46 * @pre Called always in kernel thread context |
|
47 * @pre No fastmutex held |
|
48 * @pre Kernel unlocked |
|
49 * @post Calling thread not blocked |
|
50 */ |
|
51 IMPORT_C static TDes8& AllocBlock( const TUint16 aSize ); |
|
52 |
|
53 /* |
|
54 * Deallocates a block given as parameter. |
|
55 * If block was already deallocated class spesific fault thrown. |
|
56 * If block was not from the memory management pool class spesific fault thrown. |
|
57 * If not called in kernel thread context class spesific fault thrown. |
|
58 * If called with FM held or kernel unlocked asserts thrown according to OS macros. |
|
59 * @pre Called always in kernel thread context |
|
60 * @pre No fastmutex held |
|
61 * @pre Kernel unlocked |
|
62 * @post Calling thread not blocked |
|
63 */ |
|
64 IMPORT_C static void DeallocBlock( TDes8& aBlock ); |
|
65 |
|
66 }; |
|
67 |
|
68 #endif // __MEMAPI_H__ |