0
|
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 |
#ifndef __ISIIF_H__
|
|
19 |
#define __ISIIF_H__
|
|
20 |
|
|
21 |
// Forward declarations
|
|
22 |
#ifdef __KERNEL_MODE__
|
|
23 |
class TDfc;
|
|
24 |
#endif
|
|
25 |
|
|
26 |
|
|
27 |
/**
|
|
28 |
* Class MISIIf defines an abstract interface for ISA entities.
|
|
29 |
* Interface is used to transceive ISI messages between ISA entities.
|
|
30 |
*/
|
|
31 |
class MISIIf
|
|
32 |
{
|
|
33 |
|
|
34 |
public:
|
|
35 |
|
|
36 |
#ifdef __KERNEL_MODE__
|
|
37 |
/**
|
|
38 |
* Returns a free block for sending ISI messages. Blocks descriptor length is set
|
|
39 |
* to zero, but maximum length can be more than size given as parameter.
|
|
40 |
* Interface shall be created before with MISIIf::NewISIIf or Kern::Fault raised.
|
|
41 |
* Fault is raised if no free blocks left.
|
|
42 |
* Responsibility to deallocate the block is transferred to caller.
|
|
43 |
* Execution: Synchronous
|
|
44 |
* Re-entrant: No
|
|
45 |
* Blocking: Yes
|
|
46 |
* Panic mode: Kern::Fault
|
|
47 |
* SMP safe: Yes
|
|
48 |
* @param aSize, minimum size of the buffer in bytes.
|
|
49 |
* @return TDes8&, reference to allocated block.
|
|
50 |
* @pre Called always in kernel thread context.
|
|
51 |
* @pre No fastmutex held.
|
|
52 |
* @pre Called with interrupts enabled and kernel unlocked.
|
|
53 |
* @post Calling thread not blocked.
|
|
54 |
*/
|
|
55 |
virtual TDes8& AllocateMsgBlock( const TUint16 aSize ) = 0;
|
|
56 |
|
|
57 |
|
|
58 |
/**
|
|
59 |
* Deallocates the ISI message block retrieved with MISIIf::Receive.
|
|
60 |
* After deallocation set pointer to NULL. Interface shall be created
|
|
61 |
* before with MISIIf::NewISIIf or Kern::Fault raised. ISI message shall
|
|
62 |
* be received before with MISIIf::Receive.
|
|
63 |
* Execution: Synchronous
|
|
64 |
* Re-entrant: No
|
|
65 |
* Blocking: Yes
|
|
66 |
* Panic mode: Kern::Fault
|
|
67 |
* SMP safe: Yes
|
|
68 |
* @param aMsgBlock, reference to block to deallocate.
|
|
69 |
* @pre Called always in kernel thread context.
|
|
70 |
* @pre No fastmutex held.
|
|
71 |
* @pre Called with interrupts enabled and kernel unlocked.
|
|
72 |
* @post Calling thread not blocked.
|
|
73 |
*/
|
|
74 |
virtual void DeallocateMsgBlock( TDes8& aMsgBlock ) = 0;
|
|
75 |
#endif
|
|
76 |
|
|
77 |
|
|
78 |
/**
|
|
79 |
* Creates a new ISI interface.
|
|
80 |
* Interface must be released with MISIIf::Release.
|
|
81 |
* If no memory available panics. When same UID already used Kern::Fault raised.
|
|
82 |
* Execution: Synchronous
|
|
83 |
* Re-entrant: Yes
|
|
84 |
* Blocking: No
|
|
85 |
* Panic mode: Kernel: Kern::Fault, User: User::Panic
|
|
86 |
* SMP safe: Yes
|
9
|
87 |
* @param aUID, clients unique UID identifier. TODO: Symbian UID
|
0
|
88 |
* @param aObjId, reference to write clients object id.
|
|
89 |
* @return pointer to new interface.
|
|
90 |
* @pre Called always in thread context (Kernel: in kernel thread context).
|
|
91 |
* @pre No fastmutex held. (Kernel only)
|
|
92 |
* @post Calling thread not blocked.
|
|
93 |
*/
|
|
94 |
IMPORT_C static MISIIf* NewISIIf( const TInt32 aUID, TUint8& aObjId );
|
|
95 |
|
|
96 |
|
|
97 |
/**
|
|
98 |
* Receive an ISI message from other ISA entity. Interface shall be created
|
|
99 |
* before with MISIIf::NewISIIf or panic raised. Receive shall always be
|
|
100 |
* pending after interface is created.
|
|
101 |
* Execution: Asynchronous
|
|
102 |
* Re-entrant: No
|
|
103 |
* Blocking: Yes
|
|
104 |
* Panic mode: Kernel: Kern::Fault, User: User::Panic
|
|
105 |
* SMP safe: Yes
|
|
106 |
* @param aRxStatus, updated when receive either succesful or failed.
|
|
107 |
KErrNone, receive succesful.
|
|
108 |
KErrCancel, outstanding request is cancelled.
|
|
109 |
KErrOverflow, not enough memory to store the message.
|
|
110 |
* @param aRxMsg, reference to store received message (Kernel only pointer reference).
|
|
111 |
* @param aNeededBufLen, if receive buffer too short correct lenght is written to this (User only).
|
|
112 |
* @param aRxCompletedDfc, DFC executed when receive is completed (Kernel only).
|
|
113 |
* @pre Called always in thread context (Kernel: in kernel thread context).
|
|
114 |
* @pre No fastmutex held (Kernel only).
|
|
115 |
* @post Calling thread not blocked.
|
|
116 |
*/
|
|
117 |
virtual void Receive( TRequestStatus& aRxStatus,
|
|
118 |
#ifndef __KERNEL_MODE__
|
|
119 |
TDes8& aRxMsg,
|
|
120 |
TUint16& aNeededBufLen
|
|
121 |
#else
|
|
122 |
TDes8*& aRxMsg,
|
|
123 |
const TDfc& aRxCompletedDfc
|
|
124 |
#endif
|
|
125 |
) = 0;
|
|
126 |
|
|
127 |
|
|
128 |
/**
|
|
129 |
* Cancels the pending receive request with KErrCancel.
|
|
130 |
* If the request is not pending anymore does nothing.
|
|
131 |
* Automatically called in MISIIf::Release. Interface shall be created
|
|
132 |
* before with MISIIf::NewISIIf or panic raised.
|
|
133 |
* Execution: Synchronous
|
|
134 |
* Re-entrant: No
|
|
135 |
* Blocking: Yes
|
|
136 |
* Panic mode: Kernel: Kern::Fault, User: User::Panic
|
|
137 |
* SMP safe: Yes
|
|
138 |
* @pre Called always in kernel thread context.
|
|
139 |
* @pre No fastmutex held (Kernel only).
|
|
140 |
* @pre Called with interrupts enabled and kernel unlocked (Kernel only).
|
|
141 |
* @post Calling thread not blocked.
|
|
142 |
*/
|
|
143 |
virtual void ReceiveCancel() = 0;
|
|
144 |
|
|
145 |
|
|
146 |
/**
|
|
147 |
* Deletes the concret object of the interface and releases reserved resources.
|
|
148 |
* Cancels pending receive request. Caller is responsible to set the interface pointer to NULL.
|
|
149 |
* In case of User::Panic called automatically.
|
|
150 |
* Execution: Synchronous
|
|
151 |
* Re-entrant: No
|
|
152 |
* Blocking: Yes
|
|
153 |
* Panic mode: Kernel: Kern::Fault, User: User::Panic
|
|
154 |
* SMP safe: Yes
|
|
155 |
* @pre Called always in kernel thread context.
|
|
156 |
* @pre No fastmutex held (Kernel only).
|
|
157 |
* @pre Called with interrupts enabled and kernel unlocked (Kernel only).
|
|
158 |
* @post Calling thread not blocked.
|
|
159 |
*/
|
|
160 |
virtual void Release() = 0;
|
|
161 |
|
|
162 |
|
|
163 |
/**
|
|
164 |
* Send ISI message to other ISA entity. Interface shall be created before
|
|
165 |
* with MISIIf::NewISIIf or panic raised.
|
|
166 |
* Execution: Synchronous
|
|
167 |
* Re-entrant: No
|
|
168 |
* Blocking: Yes
|
|
169 |
* Panic mode: Kernel: Kern::Fault, User: User::Panic
|
|
170 |
* SMP safe: Yes
|
|
171 |
* @param aTxMsg, ISI message to be send.
|
|
172 |
* @return success code of the operation.
|
|
173 |
KErrNone, send succesful.
|
|
174 |
KErrOverflow, too long message tried to send.
|
|
175 |
* @pre Called always in thread context (Kernel: in kernel thread context).
|
|
176 |
* @pre No fastmutex held (Kernel only).
|
|
177 |
* @post Calling thread not blocked.
|
|
178 |
*/
|
|
179 |
virtual TInt Send( const TDesC8& aTxMsg ) = 0;
|
|
180 |
|
|
181 |
};
|
|
182 |
|
|
183 |
#endif // _ISIIF_H_
|
|
184 |
|
|
185 |
// End of File
|