author | mikaruus <mika.a.ruuskanen@nokia.com> |
Thu, 14 Jan 2010 10:44:58 +0200 | |
changeset 5 | 8ccc39f9d787 |
parent 0 | 63b37f68c1ce |
permissions | -rw-r--r-- |
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 |
||
19 |
||
20 |
#include "queue.h" |
|
21 |
#include "iadtrace.h" // For C_TRACE.. |
|
22 |
#include "OstTraceDefinitions.h" |
|
23 |
#ifdef OST_TRACE_COMPILER_IN_USE |
|
24 |
#include "queueTraces.h" |
|
25 |
#endif |
|
26 |
||
27 |
// NOTE!!! Ensure thattrace prints are out of critical section's at least with fast mutex / semaphore. |
|
28 |
||
29 |
// CONSTS |
|
30 |
const TInt KOneLeft( 1 ); |
|
31 |
||
32 |
EXPORT_C DQueue::DQueue( |
|
33 |
const TInt aSize |
|
34 |
// None |
|
35 |
) |
|
36 |
{ |
|
37 |
OstTrace1( TRACE_NORMAL, DQUEUE_DQUEUE_ENTRY, ">DQueue::DQueue;aSize=%d", aSize ); |
|
38 |
||
39 |
C_TRACE( ( _T( "DQueue::DQueue 0x%x %d ->" ), this, aSize ) ); |
|
40 |
iQueueMutex = new NFastMutex(); |
|
41 |
ASSERT_RESET_ALWAYS( iQueueMutex, EIADMemoryAllocationFailure | EIADFaultIdentifier14 << KFaultIdentifierShift ); |
|
42 |
iSize = aSize; |
|
43 |
ASSERT_RESET_ALWAYS( ( iSize >= KOneLeft ), EIADQueueOutOfSync | EIADFaultIdentifier15 << KFaultIdentifierShift ); |
|
44 |
iInputIndex = 0; |
|
45 |
iOutputIndex = 0; |
|
46 |
iCount = 0; |
|
47 |
// Reserve memory for the buffer. |
|
48 |
iRingBuffer = new TDes8*[ aSize ]; |
|
49 |
C_TRACE( ( _T( "DQueue::DQueue 0x%x" ), iRingBuffer ) ); |
|
50 |
ASSERT_RESET_ALWAYS( iRingBuffer, EIADMemoryAllocationFailure | EIADFaultIdentifier15 << KFaultIdentifierShift ); |
|
51 |
for( TInt i( 0 ); i < iSize; ++i ) |
|
52 |
{ |
|
53 |
iRingBuffer[ i ] = NULL; |
|
54 |
} |
|
55 |
C_TRACE( ( _T( "DQueue::DQueue 0x%x <-" ), this ) ); |
|
56 |
||
57 |
OstTrace0( TRACE_NORMAL, DQUEUE_DQUEUE, "<DQueue::DQueue" ); |
|
58 |
} |
|
59 |
||
60 |
EXPORT_C DQueue::~DQueue( |
|
61 |
// None |
|
62 |
) |
|
63 |
{ |
|
64 |
OstTrace0( TRACE_NORMAL, DUP1_DQUEUE_DQUEUE_ENTRY, ">DQueue::~DQueue" ); |
|
65 |
||
66 |
C_TRACE( ( _T( "DQueue::~DQueue 0x%x %d ->" ), this, iCount ) ); |
|
67 |
// NOTE! This don't deallocate the blocks from the allocated memory just the pointers! |
|
68 |
ASSERT_RESET_ALWAYS( iCount == 0, EIADQueueOutOfSync | EIADFaultIdentifier1 << KFaultIdentifierShift ); |
|
69 |
C_TRACE( ( _T( "DQueue::~DQueue TBRx" ) ) ); |
|
70 |
for( TInt i( 0 ); i < iSize; ++i ) |
|
71 |
{ |
|
72 |
TDes8* temp = iRingBuffer[ i ]; |
|
73 |
if( temp ) |
|
74 |
{ |
|
75 |
C_TRACE( ( _T( "DQueue::~DQueue ptr 0x%x" ), temp ) ); |
|
76 |
OstTrace1( TRACE_NORMAL, DUP1_DQUEUE_DQUEUE, "DQueue::~DQueue;temp=%x", temp ); |
|
77 |
||
78 |
delete temp; |
|
79 |
temp = NULL; |
|
80 |
} |
|
81 |
} |
|
82 |
C_TRACE( ( _T( "DQueue::~DQueue TBRz" ) ) ); |
|
83 |
///* TODO!!! CHECK THIS OUT |
|
84 |
if( iRingBuffer ) |
|
85 |
{ |
|
86 |
C_TRACE( ( _T( "DQueue::~DQueue iRingBuffer 0x%x, iRingBuffer[0] 0x%x" ), iRingBuffer, iRingBuffer[0] ) ); |
|
87 |
OstTraceExt2( TRACE_NORMAL, DUP2_DQUEUE_DQUEUE, "DQueue::~DQueue;iRingBuffer=%x;iRingBuffer[0]=%x", (TUint)(iRingBuffer), (TUint)(iRingBuffer[0]) ); |
|
88 |
delete [] iRingBuffer; |
|
89 |
iRingBuffer = NULL; |
|
90 |
} |
|
91 |
||
92 |
iSize = 0; |
|
93 |
iInputIndex = 0; |
|
94 |
iOutputIndex = 0; |
|
95 |
iCount = 0; |
|
96 |
if( iQueueMutex ) |
|
97 |
{ |
|
98 |
C_TRACE( ( _T( "DQueue::~DQueue iQueueMutex" ) ) ); |
|
99 |
OstTrace0( TRACE_NORMAL, DUP3_DQUEUE_DQUEUE, "DQueue::~DQueue iQueueMutex" ); |
|
100 |
delete iQueueMutex; |
|
101 |
iQueueMutex = NULL; |
|
102 |
} |
|
103 |
C_TRACE( ( _T( "DQueue::~DQueue 0x%x <-" ), this ) ); |
|
104 |
||
105 |
OstTrace0( TRACE_NORMAL, DUP1_DQUEUE_DQUEUE_EXIT, "<DQueue::~DQueue" ); |
|
106 |
} |
|
107 |
||
108 |
EXPORT_C void DQueue::Add( |
|
109 |
const TDesC8& aMessage |
|
110 |
) |
|
111 |
{ |
|
112 |
OstTrace1( TRACE_NORMAL, DQUEUE_ADD_ENTRY, ">DQueue::Add;aMessage=%x", ( TUint )&( aMessage ) ); |
|
113 |
||
114 |
C_TRACE( ( _T( "DQueue::Add 0x%x %d %d %d %d 0x%x ->" ), this, iSize, iCount, iInputIndex, iOutputIndex, &aMessage ) ); |
|
115 |
NKern::FMWait( iQueueMutex ); |
|
116 |
// If queue get's overfilled throw kernel fault. |
|
117 |
// TODO: to change with cmt so that returns error code before when queue gets full |
|
118 |
ASSERT_RESET_ALWAYS( ( iCount < iSize ), EIADQueueOutOfSync | EIADFaultIdentifier2 << KFaultIdentifierShift ); |
|
119 |
// Place the buffer into the queue. |
|
120 |
iRingBuffer[ iInputIndex ] = static_cast<TDes8*>( &const_cast<TDesC8&>( aMessage ) ); |
|
121 |
// Adjust input pointer. |
|
122 |
iInputIndex = ( ( iInputIndex + 1 ) % iSize ); |
|
123 |
// Remember the amount of the requests in the queue. |
|
124 |
iCount++; |
|
125 |
NKern::FMSignal( iQueueMutex ); |
|
126 |
C_TRACE( ( _T( "DQueue::Add 0x%x %d %d %d %d 0x%x <-" ), this, iSize, iCount, iInputIndex, iOutputIndex, &aMessage ) ); |
|
127 |
||
128 |
OstTrace0( TRACE_NORMAL, DQUEUE_ADD, "<DQueue::Add" ); |
|
129 |
} |
|
130 |
||
131 |
EXPORT_C TUint16 DQueue::Count( |
|
132 |
// None |
|
133 |
) |
|
134 |
{ |
|
135 |
OstTrace0( TRACE_NORMAL, DQUEUE_COUNT_ENTRY, ">DQueue::Count" ); |
|
136 |
||
137 |
C_TRACE( ( _T( "DQueue::Count 0x%x %d <->" ), this, iCount ) ); |
|
138 |
TUint16 count( KErrNone ); |
|
139 |
NKern::FMWait( iQueueMutex ); |
|
140 |
// If count is too big. |
|
141 |
ASSERT_RESET_ALWAYS( ( iCount <= iSize ), EIADQueueOutOfSync | EIADFaultIdentifier3 << KFaultIdentifierShift ); |
|
142 |
count = iCount; |
|
143 |
NKern::FMSignal( iQueueMutex ); |
|
144 |
||
145 |
OstTraceExt1( TRACE_NORMAL, DQUEUE_COUNT, "<DQueue::Count;count=%hu", count ); |
|
146 |
return count; |
|
147 |
} |
|
148 |
||
149 |
EXPORT_C TDes8& DQueue::Get( |
|
150 |
// None |
|
151 |
) |
|
152 |
{ |
|
153 |
OstTraceExt5( TRACE_NORMAL, DQUEUE_GET_ENTRY, ">DQueue::Get;iSize=%hu;iCount=%hu;iInputIndex=%hu;iOutputIndex=%hu;this=%x", iSize, iCount, iInputIndex, iOutputIndex, (TUint)(this)); |
|
154 |
||
155 |
C_TRACE( ( _T( "DQueue::Get 0x%x %d %d %d %d ->" ), this, iSize, iCount, iInputIndex, iOutputIndex ) ); |
|
156 |
NKern::FMWait( iQueueMutex ); |
|
157 |
// If queue is empty. |
|
158 |
ASSERT_RESET_ALWAYS( ( iCount > 0 ), EIADQueueOutOfSync | EIADFaultIdentifier4 << KFaultIdentifierShift ); |
|
159 |
// Get the buffer from the queue. |
|
160 |
TDes8* temp = iRingBuffer[ iOutputIndex ]; |
|
161 |
// Set buffer location to NULL. |
|
162 |
iRingBuffer[ iOutputIndex ] = NULL; |
|
163 |
// Adjust output pointer. |
|
164 |
iOutputIndex = ( ( iOutputIndex + 1 ) % iSize ); |
|
165 |
// Remember the amount of the requests in the queue. |
|
166 |
iCount--; |
|
167 |
NKern::FMSignal( iQueueMutex ); |
|
168 |
ASSERT_RESET_ALWAYS( temp, EIADQueueOutOfSync | EIADFaultIdentifier5 << KFaultIdentifierShift ); |
|
169 |
C_TRACE( ( _T( "DQueue::Get 0x%x %d %d %d %d 0x%x <-" ), this, iSize, iCount, iInputIndex, iOutputIndex, temp ) ); |
|
170 |
||
171 |
OstTraceExt5( TRACE_NORMAL, DQUEUE_GET_EXIT, "<DQueue::Get;iCount=%hu;iInputIndex=%hu;iOutputIndex=%hu;this=%x;temp=%x", iCount, iInputIndex, iOutputIndex, (TUint)(this), (TUint)(temp) ); |
|
172 |
return *temp; |
|
173 |
} |
|
174 |
||
175 |
EXPORT_C void DQueue::RollBack( |
|
176 |
const TDesC8& aMsgToRoll |
|
177 |
) |
|
178 |
{ |
|
179 |
OstTraceExt5( TRACE_NORMAL, DQUEUE_ROLLBACK_ENTRY, "DQueue::RollBack;aMsgToRoll=%x;iSize=%hu;iCount=%hu;iInputIndex=%hu;iOutputIndex=%hu", ( TUint )&( aMsgToRoll ), iSize, iCount, iInputIndex, iOutputIndex ); |
|
180 |
OstTrace1( TRACE_NORMAL, DQUEUE_ROLLBACK, "DQueue::RollBack;this=%x", (TUint)(this) ); |
|
181 |
||
182 |
||
183 |
C_TRACE( ( _T( "DQueue::RollBack 0x%x %d %d %d %d 0x%x ->" ), this, iSize, iCount, iInputIndex, iOutputIndex, &aMsgToRoll ) ); |
|
184 |
NKern::FMWait( iQueueMutex ); |
|
185 |
ASSERT_RESET_ALWAYS( ( iCount < iSize ), EIADQueueOutOfSync | EIADFaultIdentifier6 << KFaultIdentifierShift ); |
|
186 |
// If needs to rollback from 0 to iSize -1 index. |
|
187 |
iOutputIndex = ( iOutputIndex == 0 ) ? iSize : iOutputIndex; |
|
188 |
// Adjust output pointer. |
|
189 |
iOutputIndex = ( ( iOutputIndex - 1 ) % iSize ); |
|
190 |
// Get the descriptor from queue where the rollback is made. |
|
191 |
iRingBuffer[ iOutputIndex ] = static_cast<TDes8*>( &const_cast<TDesC8&>( aMsgToRoll ) ); |
|
192 |
// Remember the amount of the requests in the queue. |
|
193 |
iCount++; |
|
194 |
NKern::FMSignal( iQueueMutex ); |
|
195 |
C_TRACE( ( _T( "DQueue::RollBack 0x%x %d %d %d %d 0x%x <-" ), this, iSize, iCount, iInputIndex, iOutputIndex, &aMsgToRoll ) ); |
|
196 |
||
197 |
OstTraceExt5( TRACE_NORMAL, DQUEUE_ROLLBACK_EXIT, "<DQueue::RollBack;iCount=%hu;iInputIndex=%hu;iOutputIndex=%hu;aMsgToRoll=%x;this=%x", iCount, iInputIndex, iOutputIndex, (TUint)&(aMsgToRoll), (TUint)(this) ); |
|
198 |
} |
|
199 |
||
200 |
TIADReq::TIADReq() |
|
201 |
:iRequest( EIADAsyncLast ), iCompleteStatus( KRequestPending ) |
|
202 |
{ |
|
203 |
OstTrace0( TRACE_NORMAL, TIADREQ_TIADREQ_ENTRY, "<>TIADReq::TIADReq" ); |
|
204 |
// None |
|
205 |
} |
|
206 |
||
207 |
EXPORT_C TIADReq::TIADReq( TIADAsyncRequest aReq, TInt aStat ) |
|
208 |
:iRequest( aReq), iCompleteStatus( aStat ) |
|
209 |
{ |
|
210 |
OstTraceExt2( TRACE_NORMAL, DUP1_TIADREQ_TIADREQ_ENTRY, "<>TIADReq::TIADReq;aReq=%x;aStat=%d", ( TUint )&( aReq ), aStat ); |
|
211 |
ASSERT_RESET_ALWAYS( iRequest != EIADAsyncLast, EIADQueueOutOfSync | EIADFaultIdentifier7 << KFaultIdentifierShift ); |
|
212 |
ASSERT_RESET_ALWAYS( iCompleteStatus != KRequestPending, EIADQueueOutOfSync | EIADFaultIdentifier8 << KFaultIdentifierShift ); |
|
213 |
} |
|
214 |
||
215 |
||
216 |
EXPORT_C DReqQueue::DReqQueue() |
|
217 |
{ |
|
218 |
OstTrace1( TRACE_NORMAL, DREQQUEUE_DREQQUEUE_ENTRY, ">DReqQueue::DReqQueue;this=%x", (TUint)(this) ); |
|
219 |
||
220 |
C_TRACE( ( _T( "DReqQueue::DReqQueue 0x%x %d ->" ), this ) ); |
|
221 |
iQueueMutex = new NFastMutex(); |
|
222 |
ASSERT_RESET_ALWAYS( iQueueMutex, EIADMemoryAllocationFailure | EIADFaultIdentifier16 << KFaultIdentifierShift ); |
|
223 |
iSize = EIADAsyncLast; |
|
224 |
ASSERT_RESET_ALWAYS( ( iSize >= KOneLeft ), EIADQueueOutOfSync | EIADFaultIdentifier9 << KFaultIdentifierShift ); |
|
225 |
iInputIndex = 0; |
|
226 |
iOutputIndex = 0; |
|
227 |
iCount = 0; |
|
228 |
for( TInt i( 0 ); i < iSize; ++i ) |
|
229 |
{ |
|
230 |
iReqRingBuffer[ i ].iRequest = EIADAsyncLast; |
|
231 |
iReqRingBuffer[ i ].iCompleteStatus = KRequestPending; |
|
232 |
iReqList[ i ] = NULL; |
|
233 |
} |
|
234 |
C_TRACE( ( _T( "DReqQueue::DReqQueue 0x%x <-" ), this ) ); |
|
235 |
||
236 |
OstTrace1( TRACE_NORMAL, DREQQUEUE_DREQQUEUE_EXIT, "<DReqQueue::DReqQueue;this=%x", (TUint)(this) ); |
|
237 |
} |
|
238 |
||
239 |
EXPORT_C DReqQueue::~DReqQueue() |
|
240 |
{ |
|
241 |
OstTraceExt2( TRACE_NORMAL, DUP1_DREQQUEUE_DREQQUEUE_ENTRY, "DReqQueue::~DReqQueue;this=%x;iCount=%hu", (TUint)(this), iCount ); |
|
242 |
||
243 |
C_TRACE( ( _T( "DReqQueue::~DReqQueue 0x%x %d ->" ), this, iCount ) ); |
|
244 |
// NOTE! This don't deallocate the blocks from the allocated memory just the pointers! |
|
245 |
ASSERT_RESET_ALWAYS( iCount == 0, EIADQueueOutOfSync | EIADFaultIdentifier10 << KFaultIdentifierShift ); |
|
246 |
for( TInt i( 0 ); i < iSize; ++i ) |
|
247 |
{ |
|
248 |
iReqRingBuffer[ i ].iRequest = EIADAsyncLast; |
|
249 |
iReqRingBuffer[ i ].iCompleteStatus = KRequestPending; |
|
250 |
iReqList[ i ] = NULL; |
|
251 |
} |
|
252 |
iSize = 0; |
|
253 |
iInputIndex = 0; |
|
254 |
iOutputIndex = 0; |
|
255 |
iCount = 0; |
|
256 |
if( iQueueMutex ) |
|
257 |
{ |
|
258 |
C_TRACE( ( _T( "DReqQueue::~DReqQueue iQueueMutex" ) ) ); |
|
259 |
delete iQueueMutex; |
|
260 |
iQueueMutex = NULL; |
|
261 |
} |
|
262 |
C_TRACE( ( _T( "DReqQueue::~DReqQueue 0x%x <-" ), this ) ); |
|
263 |
||
264 |
OstTrace1( TRACE_NORMAL, DUP1_DREQQUEUE_DREQQUEUE_EXIT, "<DReqQueue::~DReqQueue;this=%x", this ); |
|
265 |
} |
|
266 |
||
267 |
/* |
|
268 |
* In case of queue overflow throw kern::fault, REQ: isaaccessdriver should not lose ISI nor data messages. |
|
269 |
* Adds the message in the end of the ringbuffer queue. |
|
270 |
* @param const TDesC8& aMessage, message to be added. |
|
271 |
*/ |
|
272 |
EXPORT_C TBool DReqQueue::Add( TIADReq aReq ) |
|
273 |
{ |
|
274 |
OstTraceExt5( TRACE_NORMAL, DREQQUEUE_ADD_ENTRY, "DReqQueue::Add;aReq=%x;iSize=%hu;iCount=%hu;iInputIndex=%hu;iOutputIndex=%hu", ( TUint )&( aReq ), iSize, iCount, iInputIndex, iOutputIndex ); |
|
275 |
OstTrace1( TRACE_NORMAL, DREQQUEUE_ADD, ">DReqQueue::Add;this=%x", this ); |
|
276 |
||
277 |
C_TRACE( ( _T( "DReqQueue::Add 0x%x %d %d %d %d ->" ), this, iSize, iCount, iInputIndex, iOutputIndex ) ); |
|
278 |
TBool ok( EFalse ); |
|
279 |
NKern::FMWait( iQueueMutex ); |
|
280 |
// If queue get's overfilled throw kernel fault. |
|
281 |
ASSERT_RESET_ALWAYS( ( iCount < iSize ), EIADQueueOutOfSync | EIADFaultIdentifier11 << KFaultIdentifierShift ); |
|
5
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
282 |
ASSERT_RESET_ALWAYS( EIADAsyncLast > aReq.iRequest, EIADOverTheLimits | EIADFaultIdentifier11 << KFaultIdentifierShift | (TUint8)aReq.iRequest << KExtraInfoShift); |
0 | 283 |
if( iReqList[ aReq.iRequest ] ) |
284 |
{ |
|
285 |
// Place the buffer into the queue. |
|
286 |
iReqRingBuffer[ iInputIndex ] = aReq; |
|
287 |
// Adjust input pointer. |
|
288 |
iInputIndex = ( ( iInputIndex + 1 ) % iSize ); |
|
289 |
// Remember the amount of the requests in the queue. |
|
290 |
iCount++; |
|
291 |
ok = ETrue; |
|
292 |
} |
|
293 |
NKern::FMSignal( iQueueMutex ); |
|
294 |
C_TRACE( ( _T( "DReqQueue::Add 0x%x %d %d %d %d %d <-" ), this, iSize, iCount, iInputIndex, iOutputIndex, ok ) ); |
|
295 |
||
296 |
OstTraceExt5( TRACE_NORMAL, DUP1_DREQQUEUE_ADD_EXIT, "DReqQueue::Add;iCount=%hu;iInputIndex=%hu;iOutputIndex=%hu;ok=%x;this=%x", iCount, iInputIndex, iOutputIndex, (TUint)(ok), (TUint)(this) ); |
|
297 |
return ok; |
|
298 |
} |
|
299 |
||
300 |
/* |
|
301 |
*Returns the first pointer ( iOutputIndex ) from the ring buffer. |
|
302 |
*/ |
|
303 |
EXPORT_C TBool DReqQueue::Empty() |
|
304 |
{ |
|
305 |
OstTraceExt2( TRACE_NORMAL, DREQQUEUE_EMPTY_ENTRY, "DReqQueue::Empty;this=%x;iCount=%hu", (TUint)this, iCount ); |
|
306 |
||
307 |
C_TRACE( ( _T( "DReqQueue::Empty 0x%x %d <->" ), this, iCount ) ); |
|
308 |
return iCount == 0 ? ETrue : EFalse; |
|
309 |
||
310 |
} |
|
311 |
||
312 |
/* |
|
313 |
*Returns the first pointer ( iOutputIndex ) from the ring buffer. |
|
314 |
*/ |
|
315 |
EXPORT_C TIADReq DReqQueue::Get() |
|
316 |
{ |
|
317 |
OstTraceExt5( TRACE_NORMAL, DREQQUEUE_GET_ENTRY, "DReqQueue::Get;iSize=%hu;iCount=%hu;iInputIndex=%hu;iOutputIndex=%hu;this=%x", iSize, iCount, iInputIndex, iOutputIndex, (TUint)this ); |
|
318 |
||
319 |
C_TRACE( ( _T( "DReqQueue::Get 0x%x %d %d %d %d ->" ), this, iSize, iCount, iInputIndex, iOutputIndex ) ); |
|
320 |
NKern::FMWait( iQueueMutex ); |
|
321 |
// If queue is empty. |
|
322 |
ASSERT_RESET_ALWAYS( ( iCount > 0 ), EIADQueueOutOfSync | EIADFaultIdentifier12 << KFaultIdentifierShift ); |
|
323 |
// Get the buffer from the queue. |
|
324 |
ASSERT_RESET_ALWAYS( EIADAsyncLast > iOutputIndex, EIADOverTheLimits | EIADFaultIdentifier12 << KFaultIdentifierShift ); |
|
325 |
TIADReq temp = iReqRingBuffer[ iOutputIndex ]; |
|
326 |
// Set buffer location to NULL. |
|
327 |
iReqRingBuffer[ iOutputIndex ].iRequest = EIADAsyncLast; |
|
328 |
iReqRingBuffer[ iOutputIndex ].iCompleteStatus = KRequestPending; |
|
329 |
// Adjust output pointer. |
|
330 |
iOutputIndex = ( ( iOutputIndex + 1 ) % iSize ); |
|
331 |
// Remember the amount of the requests in the queue. |
|
332 |
iCount--; |
|
333 |
NKern::FMSignal( iQueueMutex ); |
|
334 |
ASSERT_RESET_ALWAYS( temp.iRequest != EIADAsyncLast, EIADQueueOutOfSync | EIADFaultIdentifier13 << KFaultIdentifierShift ); |
|
335 |
ASSERT_RESET_ALWAYS( temp.iCompleteStatus != KRequestPending, EIADQueueOutOfSync | EIADFaultIdentifier14 << KFaultIdentifierShift ); |
|
336 |
C_TRACE( ( _T( "DQueue::Get 0x%x %d %d %d %d <-" ), this, iSize, iCount, iInputIndex, iOutputIndex ) ); |
|
337 |
||
338 |
OstTraceExt5( TRACE_NORMAL, DREQQUEUE_GET, "<DReqQueue::Get;iCount=%hu;iInputIndex=%hu;iOutputIndex=%hu;this=%x;temp=%x", iCount, iInputIndex, iOutputIndex, (TUint)(this), (TUint)&temp ); |
|
339 |
return temp; |
|
340 |
} |
|
341 |
||
342 |
/* |
|
343 |
* Set req active / deactive. Default deactive. |
|
344 |
*/ |
|
345 |
EXPORT_C void DReqQueue::SetReq( TIADAsyncRequest aReqToSet, TRequestStatus* aStatus ) |
|
346 |
{ |
|
347 |
OstTraceExt3( TRACE_NORMAL, DREQQUEUE_SETREQ_ENTRY, ">DReqQueue::SetReq;aReqToSet=%x;aStatus=%x;this=%x", ( TUint )&( aReqToSet ), ( TUint )( aStatus ), (TUint)(this) ); |
|
348 |
||
349 |
C_TRACE( ( _T( "DReqQueue::SetReq 0x%x %d 0x%x ->" ), this, aReqToSet, aStatus ) ); |
|
350 |
ASSERT_RESET_ALWAYS( aReqToSet < EIADAsyncLast, EIADWrongRequest | EIADFaultIdentifier13 << KFaultIdentifierShift ); |
|
351 |
// If setting same request twice. |
|
352 |
C_TRACE( ( _T( "DReqQueue::SetReq 0x%x %d 0x%x 0x%x TBR" ), this, aReqToSet, aStatus, iReqList[ aReqToSet ] ) ); |
|
353 |
//jos !NULL ja !NULL fault |
|
5
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
354 |
ASSERT_RESET_ALWAYS( !( !iReqList[ aReqToSet ] && aStatus == NULL ), EIADCommon | (TUint8)aReqToSet << KExtraInfoShift ); |
0 | 355 |
iReqList[ aReqToSet ] = aStatus; |
356 |
C_TRACE( ( _T( "DReqQueue::SetReq 0x%x %d 0x%x <-" ), this, aReqToSet, aStatus ) ); |
|
357 |
||
358 |
OstTraceExt3( TRACE_NORMAL, DREQQUEUE_SETREQ_EXIT, "<DReqQueue::SetReq;aReqToSet=%x;aStatus=%x;this=%x", ( TUint )&( aReqToSet ), ( TUint )( aStatus ), (TUint)(this) ); |
|
359 |
} |
|
360 |
||
361 |
/* |
|
362 |
* Set req active / deactive. Default deactive. |
|
363 |
*/ |
|
364 |
EXPORT_C TRequestStatus* DReqQueue::GetReq( TIADAsyncRequest aReqToGet ) |
|
365 |
{ |
|
366 |
OstTraceExt2( TRACE_NORMAL, DREQQUEUE_GETREQ_ENTRY, ">DReqQueue::GetReq;aReqToGet=%x;this=%x", (TUint)this, ( TUint )&( aReqToGet ) ); |
|
367 |
||
5
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
368 |
ASSERT_RESET_ALWAYS( aReqToGet < EIADAsyncLast, EIADWrongRequest | EIADFaultIdentifier14 << KFaultIdentifierShift | (TUint8)aReqToGet << KExtraInfoShift ); |
0 | 369 |
|
370 |
C_TRACE( ( _T( "DReqQueue::GetReq 0x%x 0x%x %d <->" ), this, iReqList[ aReqToGet ], aReqToGet ) ); |
|
371 |
||
372 |
TRequestStatus* tmpStatus = iReqList[ aReqToGet ]; |
|
373 |
||
374 |
OstTraceExt3( TRACE_NORMAL, DREQQUEUE_GETREQ_EXIT, "<DReqQueue::GetReq;this=%x;aReqToGet=%x;retStatusPtr=%x", (TUint)this, ( TUint )&( aReqToGet ), (TUint)tmpStatus ); |
|
375 |
return tmpStatus; |
|
376 |
} |
|
377 |
||
378 |
// End of file. |