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 |
* Implementation of DMC logical device.
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
|
|
20 |
// INCLUDE FILES
|
|
21 |
#include <kern_priv.h> // class DThread
|
|
22 |
#include "dmc_extension.h" // iDmcDfcQueuePtrv
|
|
23 |
#include "dmc_user_if.h" // RDmc
|
|
24 |
#include "dmc_logical_channel.h"
|
|
25 |
#include "dmc_logical_device.h"
|
|
26 |
#include "dmc_event_handler_ape_cent.h" // HandleUserEvent
|
|
27 |
|
|
28 |
#include "dmc_trace.h"
|
|
29 |
|
|
30 |
#include "osttracedefinitions.h"
|
|
31 |
#ifdef OST_TRACE_COMPILER_IN_USE
|
|
32 |
#include "dmc_logical_deviceTraces.h"
|
|
33 |
#endif
|
|
34 |
|
|
35 |
// EXTERNAL DATA STRUCTURES
|
|
36 |
// EXTERNAL FUNCTION PROTOTYPES
|
|
37 |
// FORWARD DECLARATIONS
|
|
38 |
// CONSTANTS
|
|
39 |
// MACROS
|
|
40 |
|
|
41 |
// LOCAL CONSTANTS AND MACROS
|
|
42 |
#define LOG_CHNL_TBL_GRANULARITY 2 // Define smaller granularity than default
|
|
43 |
// value(4) because we haven't identified more
|
|
44 |
// than 2 clients so far.
|
|
45 |
#define DFC_OBJECT_PRIORITY 1 // priority for DFC object, 1 is default
|
|
46 |
_LIT(KDMCLogDevDfc, "DMCLogDevDFC"); // Name given to DFC dynamic queue
|
|
47 |
|
|
48 |
// MODULE DATA STRUCTURES
|
|
49 |
// LOCAL FUNCTION PROTOTYPES
|
|
50 |
|
|
51 |
|
|
52 |
// ==================== LOCAL FUNCTIONS ====================
|
|
53 |
|
|
54 |
// -----------------------------------------------------------------------------
|
|
55 |
// DLL entry point
|
|
56 |
// DLL export number 1: Create a new LDD factory on the Kernel heap
|
|
57 |
// Return Values: A new Kernel side "factory" object
|
|
58 |
// -----------------------------------------------------------------------------
|
|
59 |
DECLARE_EXTENSION_LDD()
|
|
60 |
{
|
|
61 |
OstTrace0(TRACE_ENTRY_EXIT, DECLARE_STANDARD_LDD_ENTRY,
|
|
62 |
"DMC:LOG_DEVICE: DECLARE_EXTENSION_LDD() # IN");
|
|
63 |
DMC_TRACE(("DMC:LOG_DEVICE: DECLARE_EXTENSION_LDD() # IN"));
|
|
64 |
|
|
65 |
DDmcLogicalDevice* dmcLogDevPtr = new DDmcLogicalDevice;
|
|
66 |
|
|
67 |
DMC_TRACE_ASSERT_RESET(dmcLogDevPtr,
|
|
68 |
"DMC:LOG_DEVICE: DMC create DECLARE_STANDARD_LDD() failed",
|
|
69 |
KErrNoMemory);
|
|
70 |
|
|
71 |
OstTrace1(TRACE_ENTRY_EXIT, DECLARE_STANDARD_LDD_RETURN,
|
|
72 |
"DECLARE_EXTENSION_LDD() # OUT - dmcLogDevPtr: 0x%x", (TUint)dmcLogDevPtr);
|
|
73 |
DMC_TRACE((("DMC:LOG_DEVICE: DECLARE_EXTENSION_LDD() # OUT, dmcLogDevPtr: 0x%x"),
|
|
74 |
dmcLogDevPtr));
|
|
75 |
|
|
76 |
return dmcLogDevPtr;
|
|
77 |
}
|
|
78 |
|
|
79 |
|
|
80 |
// ================= OTHER EXPORTED FUNCTIONS ==============
|
|
81 |
|
|
82 |
// ================= MEMBER FUNCTIONS =======================
|
|
83 |
|
|
84 |
//-----------------------------------------------------------
|
|
85 |
// DDmcLogicalDevice::DDmcLogicalDevice
|
|
86 |
//-----------------------------------------------------------
|
|
87 |
DDmcLogicalDevice::DDmcLogicalDevice()
|
|
88 |
: iLogChannelsPtr(LOG_CHNL_TBL_GRANULARITY)
|
|
89 |
, iDmcLogDeviceDfcQueuePtr(NULL)
|
|
90 |
, iUserEventDfcPtr(NULL)
|
|
91 |
{
|
|
92 |
OstTrace0(TRACE_ENTRY_EXIT, DDMC_LOGICAL_DEVICE__ENTRY,
|
|
93 |
"DMC:LOG_DEVICE: DDmcLogicalDevice() # IN");
|
|
94 |
DMC_TRACE(("DMC:LOG_DEVICE: DDmcLogicalDevice() # IN"));
|
|
95 |
|
|
96 |
// No PDD, so set to zero
|
|
97 |
iParseMask = 0;
|
|
98 |
iUnitsMask = 0;
|
|
99 |
|
|
100 |
TInt dfcQueueDmcPriority = (Kern::DfcQue0()->iThread->iPriority) + 1;
|
|
101 |
|
|
102 |
OstTrace1(TRACE_FLOW, DDMC_LOGICAL_DEVICE_1,
|
|
103 |
"DMC:LOG_DEVICE: DDmcLogicalDevice() - dfcQueueDmcPriority: %d",
|
|
104 |
dfcQueueDmcPriority);
|
|
105 |
DMC_TRACE((("DMC:LOG_DEVICE: DDmcLogicalDevice() - dfcQueueDmcPriority: %d"),
|
|
106 |
dfcQueueDmcPriority));
|
|
107 |
|
|
108 |
// DFC queue must be created in the critical section
|
|
109 |
NKern::ThreadEnterCS();
|
|
110 |
|
|
111 |
TInt retVal = Kern::DynamicDfcQCreate(iDmcLogDeviceDfcQueuePtr,
|
|
112 |
dfcQueueDmcPriority,
|
|
113 |
KDMCLogDevDfc);
|
|
114 |
NKern::ThreadLeaveCS();
|
|
115 |
|
|
116 |
OstTrace0(TRACE_FLOW, DDMC_LOGICAL_DEVICE_2,
|
|
117 |
"DMC:LOG_DEVICE: DDmcLogicalDevice() - Create iUserEventDfcPtr");
|
|
118 |
DMC_TRACE(("DMC:LOG_DEVICE: DDmcLogicalDevice() - Create iUserEventDfcPtr"));
|
|
119 |
|
|
120 |
iUserEventDfcPtr = new TDfc(ReceiveEventsDfc,
|
|
121 |
this,
|
|
122 |
iDmcLogDeviceDfcQueuePtr,
|
|
123 |
DFC_OBJECT_PRIORITY);
|
|
124 |
|
|
125 |
DMC_TRACE_ASSERT_RESET(iUserEventDfcPtr,
|
|
126 |
"DMC:LOG_DEVICE: DDmcLogicalDevice() - iUserEventDfcPtr",
|
|
127 |
KErrNoMemory);
|
|
128 |
|
|
129 |
// Assign the TDfc-queue to the event handler used for event sending.
|
|
130 |
DmcEvHandApeCent::SubscribeEvents(iUserEventDfcPtr);
|
|
131 |
|
|
132 |
|
|
133 |
OstTrace1(TRACE_FLOW, DDMC_LOGICAL_DEVICE_3,
|
|
134 |
"DMC:LOG_DEVICE: DDmcLogicalDevice() - return, retVal: %d", retVal);
|
|
135 |
DMC_TRACE((("DMC:LOG_DEVICE: DDmcLogicalDevice() - DynamicDfcQCreate, retVal: %d "), retVal));
|
|
136 |
DMC_TRACE_ASSERT_RESET(retVal == KErrNone , "Kern::DynamicDfcQCreate() failed", retVal);
|
|
137 |
|
|
138 |
OstTrace0(TRACE_ENTRY_EXIT, DDMC_LOGICAL_DEVICE_ENTRY__RETURN,
|
|
139 |
"DMC:LOG_DEVICE: DDmcLogicalDevice() # OUT");
|
|
140 |
DMC_TRACE(("DMC:LOG_DEVICE: DDmcLogicalDevice() # OUT"));
|
|
141 |
}
|
|
142 |
|
|
143 |
|
|
144 |
//-----------------------------------------------------------
|
|
145 |
// DDmcLogicalDevice::~DDmcLogicalDevice
|
|
146 |
//-----------------------------------------------------------
|
|
147 |
DDmcLogicalDevice::~DDmcLogicalDevice()
|
|
148 |
{
|
|
149 |
OstTrace0(TRACE_ENTRY_EXIT, DDMC_LOGICAL_DEVICE_ENTRY,
|
|
150 |
"DMC:LOG_DEVICE: ~DDmcLogicalDevice # IN");
|
|
151 |
DMC_TRACE(("DMC:LOG_DEVICE: ~DDmcLogicalDevice # IN"));
|
|
152 |
|
|
153 |
OstTrace0(TRACE_FLOW, DDMC_LOGICAL_DEVICE_DDMC_LOGICAL_DEVICE_1,
|
|
154 |
"DMC:LOG_DEVICE: ~DDmcLogicalChannel() - Close RPointerArray");
|
|
155 |
DMC_TRACE(("DMC:LOG_DEVICE: ~DDmcLogicalChannel() - Close RPointerArray"));
|
|
156 |
|
|
157 |
iLogChannelsPtr.Close();
|
|
158 |
|
|
159 |
// Delete the TDfc-object owned by this class.
|
|
160 |
delete iUserEventDfcPtr;
|
|
161 |
iUserEventDfcPtr = NULL;
|
|
162 |
|
|
163 |
OstTrace1(TRACE_FLOW, DDMC_LOGICAL_DEVICE_DDMC_LOGICAL_DEVICE_2,
|
|
164 |
"DMC:LOG_DEVICE: ~DDmcLogicalChannel() - iUserEventDfcPtr: 0x%x:", iUserEventDfcPtr);
|
|
165 |
DMC_TRACE((("DMC:LOG_DEVICE: ~DDmcLogicalChannel() - iUserEventDfcPtr: 0x%x"), iUserEventDfcPtr));
|
|
166 |
|
|
167 |
// Set the NULL pointer to make sure that no more events are sent.
|
|
168 |
DmcEvHandApeCent::UnsubscribeEvents(iUserEventDfcPtr);
|
|
169 |
|
|
170 |
if (iDmcLogDeviceDfcQueuePtr)
|
|
171 |
{
|
|
172 |
OstTrace0(TRACE_FLOW, DDMC_LOGICAL_DEVICE_DDMC_LOGICAL_DEVICE_3,
|
|
173 |
"DMC:LOGIC_CHNL: ~DDmcLogicalChannel() - call iDmcLogChannelDfcQueuePtr->Destroy");
|
|
174 |
DMC_TRACE(("DMC:LOGIC_CHNL: ~DDmcLogicalChannel() - call iDmcLogChannelDfcQueuePtr->Destroy"));
|
|
175 |
|
|
176 |
// Calling of dfc queue destroy must be in a critical section.
|
|
177 |
NKern::ThreadEnterCS();
|
|
178 |
iDmcLogDeviceDfcQueuePtr->Destroy();
|
|
179 |
NKern::ThreadLeaveCS();
|
|
180 |
|
|
181 |
iDmcLogDeviceDfcQueuePtr = NULL;
|
|
182 |
}
|
|
183 |
|
|
184 |
OstTrace0(TRACE_ENTRY_EXIT, DDMC_LOGICAL_DEVICE_ENTRY_RETURN,
|
|
185 |
"DMC:LOG_DEVICE: ~DDmcLogicalDevice # OUT");
|
|
186 |
DMC_TRACE(("DMC:LOG_DEVICE: ~DDmcLogicalDevice # OUT"));
|
|
187 |
}
|
|
188 |
|
|
189 |
|
|
190 |
//-----------------------------------------------------------
|
|
191 |
// DDmcLogicalDevice::Install
|
|
192 |
//-----------------------------------------------------------
|
|
193 |
TInt DDmcLogicalDevice::Install()
|
|
194 |
{
|
|
195 |
OstTrace0(TRACE_ENTRY_EXIT, DDMC_LOGICAL_DEVICE_INSTALL_ENTRY,
|
|
196 |
"DMC:LOG_DEVICE: Install() # IN" );
|
|
197 |
DMC_TRACE(("DMC:LOG_DEVICE: Install() # IN"));
|
|
198 |
|
|
199 |
// Name of the logical driver
|
|
200 |
TInt retStatus = SetName(&KDmcDrvName);
|
|
201 |
|
|
202 |
OstTrace1(TRACE_ENTRY_EXIT, DDMC_LOGICAL_DEVICE_INSTALL_RETURN,
|
|
203 |
"DMC:LOG_DEVICE: Install() # OUT retStatus: %d:", retStatus);
|
|
204 |
DMC_TRACE((("DMC:LOG_DEVICE: Install() # OUT - retStatus: %d"), retStatus));
|
|
205 |
|
|
206 |
return retStatus;
|
|
207 |
}
|
|
208 |
|
|
209 |
|
|
210 |
// -----------------------------------------------------------------------------
|
|
211 |
// DDmcLogicalDevice::GetCaps
|
|
212 |
// -----------------------------------------------------------------------------
|
|
213 |
void DDmcLogicalDevice::GetCaps(TDes8& /* aDes */) const
|
|
214 |
{
|
|
215 |
OstTrace0(TRACE_ENTRY_EXIT, DDMC_LOGICAL_DEVICE_GET_CAPS_ENTRY,
|
|
216 |
"DMC:LOG_DEVICE: GetCaps() # IN");
|
|
217 |
DMC_TRACE(("DMC:LOG_DEVICE: GetCaps() # IN"));
|
|
218 |
|
|
219 |
|
|
220 |
OstTrace0(TRACE_ENTRY_EXIT, DDMC_LOGICAL_DEVICE_GET_CAPS_RETURN,
|
|
221 |
"DMC:LOG_DEVICE: GetCaps() # OUT");
|
|
222 |
DMC_TRACE(("DMC:LOG_DEVICE: GetCaps() # OUT"));
|
|
223 |
}
|
|
224 |
|
|
225 |
|
|
226 |
// -----------------------------------------------------------------------------
|
|
227 |
// DDmcLogicalDevice::Create
|
|
228 |
// -----------------------------------------------------------------------------
|
|
229 |
TInt DDmcLogicalDevice::Create(DLogicalChannelBase*& aChannel)
|
|
230 |
{
|
|
231 |
OstTrace1(TRACE_ENTRY_EXIT, DDMC_LOGICAL_DEVICE_CREATE_ENTRY,
|
|
232 |
"DMC:LOG_DEVICE: Create() # IN - aChannel: 0x%x",
|
|
233 |
(TUint)(aChannel));
|
|
234 |
DMC_TRACE((("DMC:LOG_DEVICE: Create() # IN - aChannel: 0x%x"), aChannel));
|
|
235 |
|
|
236 |
TInt retVal(KErrNone);
|
|
237 |
|
|
238 |
aChannel = new DDmcLogicalChannel(this);
|
|
239 |
|
|
240 |
if (!aChannel)
|
|
241 |
{
|
|
242 |
retVal = KErrNoMemory;
|
|
243 |
}
|
|
244 |
|
|
245 |
OstTrace1(TRACE_ENTRY_EXIT, DDMC_LOGICAL_DEVICE_CREATE_RETURN,
|
|
246 |
"DMC:LOG_DEVICE: Create() # OUT, retVal: %d", retVal);
|
|
247 |
DMC_TRACE((("DMC:LOG_DEVICE: Create() # OUT, retVal: %d"), retVal));
|
|
248 |
|
|
249 |
return retVal;
|
|
250 |
}
|
|
251 |
|
|
252 |
|
|
253 |
// -----------------------------------------------------------------------------
|
|
254 |
// DDmcLogicalDevice::GetTargetStartUpMode
|
|
255 |
// -----------------------------------------------------------------------------
|
|
256 |
TInt DDmcLogicalDevice::GetTargetStartUpMode(RDmc::TTargetStartupMode& aTargetStartUpmode) const
|
|
257 |
{
|
|
258 |
OstTrace0(TRACE_ENTRY_EXIT, DDMC_LOGICAL_DEVICE_GET_TARGET_STARTUP_MODE_ENTRY,
|
|
259 |
"DMC:LOG_DEVICE: GetTargetStartUpMode() # IN");
|
|
260 |
DMC_TRACE(("DMC:LOG_DEVICE: GetTargetStartUpMode() # IN"));
|
|
261 |
|
|
262 |
TUint bootReasonApiStartUpMode;
|
|
263 |
|
|
264 |
// Get the boot reason API target startup mode
|
|
265 |
(void)DmcEvHandApeCent::HandleEvent(USER_GET_TARGET_STARTUP_MODE,
|
|
266 |
NULL/*Kernel*/,
|
|
267 |
&bootReasonApiStartUpMode);
|
|
268 |
|
|
269 |
OstTrace1(TRACE_FLOW, DDMC_LOGICAL_DEVICE_GET_TARGET_STARTUP_MODE_1,
|
|
270 |
"DMC:LOGIC_CHNL: GetTargetStartUpMode() - *bootReasonApiStartUpMode: 0x%x",
|
|
271 |
bootReasonApiStartUpMode);
|
|
272 |
DMC_TRACE((("DMC:LOG_DEVICE: GetTargetStartUpMode() - *bootReasonApiStartUpMode: 0x%x"),
|
|
273 |
bootReasonApiStartUpMode));
|
|
274 |
|
|
275 |
// Convert the Boot Reason API mode to the user side target startup mode.
|
|
276 |
switch (bootReasonApiStartUpMode)
|
|
277 |
{
|
|
278 |
case TBootReason::EStartupModeNone:
|
|
279 |
{
|
|
280 |
aTargetStartUpmode = RDmc::EStartupModeNone;
|
|
281 |
}
|
|
282 |
break;
|
|
283 |
|
|
284 |
case TBootReason::EStartupModeNormal:
|
|
285 |
{
|
|
286 |
aTargetStartUpmode = RDmc::EStartupModeNormal;
|
|
287 |
}
|
|
288 |
break;
|
|
289 |
|
|
290 |
case TBootReason::EStartupModeCharging:
|
|
291 |
{
|
|
292 |
aTargetStartUpmode = RDmc::EStartupModeCharging;
|
|
293 |
}
|
|
294 |
break;
|
|
295 |
|
|
296 |
case TBootReason::EStartupModeAlarm:
|
|
297 |
{
|
|
298 |
aTargetStartUpmode = RDmc::EStartupModeAlarm;
|
|
299 |
}
|
|
300 |
break;
|
|
301 |
|
|
302 |
case TBootReason::EStartupModeTest:
|
|
303 |
{
|
|
304 |
aTargetStartUpmode = RDmc::EStartupModeTest;
|
|
305 |
}
|
|
306 |
break;
|
|
307 |
|
|
308 |
case TBootReason::EStartupModeFota:
|
|
309 |
{
|
|
310 |
aTargetStartUpmode = RDmc::EStartupModeFota;
|
|
311 |
}
|
|
312 |
break;
|
|
313 |
|
|
314 |
default:
|
|
315 |
{
|
|
316 |
// A fatal error, make a reset
|
|
317 |
OstTrace0(TRACE_FLOW, DDMC_LOGICAL_DEVICE_GET_TARGET_STARTUP_MODE_5,
|
|
318 |
"DMC:EH_APE_CEN: GetTargetStartUpMode() - bootReasonApiStartUpMode");
|
|
319 |
DMC_TRACE_ASSERT_RESET_BRUTAL("DMC:EH_APE_CEN: GetTargetStartUpMode() - bootReasonApiStartUpMode",
|
|
320 |
KErrArgument);
|
|
321 |
}
|
|
322 |
break;
|
|
323 |
}
|
|
324 |
|
|
325 |
OstTrace1(TRACE_ENTRY_EXIT, DDMC_LOGICAL_DEVICE_GET_TARGET_STARTUP_MODE_RETURN,
|
|
326 |
"DMC:LOG_DEVICE: GetTargetStartUpMode() # OUT - RDmc::aTargetStartUpmode: 0x%x",
|
|
327 |
aTargetStartUpmode);
|
|
328 |
DMC_TRACE((("DMC:LOG_DEVICE: GetTargetStartUpMode() # OUT - RDmc::aTargetStartUpmode: 0x%x"),
|
|
329 |
aTargetStartUpmode));
|
|
330 |
|
|
331 |
return KErrNone;
|
|
332 |
}
|
|
333 |
|
|
334 |
|
|
335 |
// -----------------------------------------------------------------------------
|
|
336 |
// DDmcLogicalDevice::GenerateReset
|
|
337 |
// -----------------------------------------------------------------------------
|
|
338 |
TInt DDmcLogicalDevice::GenerateReset(const RDmc::TTargetStartupMode aTargetStartUpmode) const
|
|
339 |
{
|
|
340 |
OstTrace1(TRACE_ENTRY_EXIT, DDMC_LOGICAL_DEVICE_GENERATE_RESET_ENTRY,
|
|
341 |
"DMC:LOG_DEVICE: GenerateReset() # IN - aTargetStartUpmode: 0x%x",
|
|
342 |
(aTargetStartUpmode));
|
|
343 |
DMC_TRACE((("DMC:LOG_DEVICE: GenerateReset() # IN - aTargetStartUpmode: 0x%x"),
|
|
344 |
aTargetStartUpmode));
|
|
345 |
|
|
346 |
TInt ret(KErrNone);
|
|
347 |
TUint bootReasonApiStartUpMode;
|
|
348 |
|
|
349 |
// Convert the user side target mode, in which a device is reset, to Boot Reason API mode.
|
|
350 |
switch (aTargetStartUpmode)
|
|
351 |
{
|
|
352 |
case RDmc::EStartupModeNone:
|
|
353 |
{
|
|
354 |
bootReasonApiStartUpMode = TBootReason::EStartupModeNone;
|
|
355 |
}
|
|
356 |
break;
|
|
357 |
|
|
358 |
case RDmc::EStartupModeNormal:
|
|
359 |
{
|
|
360 |
bootReasonApiStartUpMode = TBootReason::EStartupModeNormal;
|
|
361 |
}
|
|
362 |
break;
|
|
363 |
|
|
364 |
case RDmc::EStartupModeCharging:
|
|
365 |
{
|
|
366 |
bootReasonApiStartUpMode = TBootReason::EStartupModeCharging;
|
|
367 |
}
|
|
368 |
break;
|
|
369 |
|
|
370 |
case RDmc::EStartupModeAlarm:
|
|
371 |
{
|
|
372 |
bootReasonApiStartUpMode = TBootReason::EStartupModeAlarm;
|
|
373 |
}
|
|
374 |
break;
|
|
375 |
|
|
376 |
case RDmc::EStartupModeTest:
|
|
377 |
{
|
|
378 |
bootReasonApiStartUpMode = TBootReason::EStartupModeTest;
|
|
379 |
}
|
|
380 |
break;
|
|
381 |
|
|
382 |
case RDmc::EStartupModeFota:
|
|
383 |
{
|
|
384 |
bootReasonApiStartUpMode = TBootReason::EStartupModeFota;
|
|
385 |
}
|
|
386 |
break;
|
|
387 |
|
|
388 |
default:
|
|
389 |
{
|
|
390 |
// A fatal error, make a reset
|
|
391 |
OstTrace0(TRACE_FLOW, DDMC_LOGICAL_DEVICE_GENERATE_RESET_5,
|
|
392 |
"DMC:EH_APE_CEN: GenerateReset() - aTargetStartUpmode");
|
|
393 |
DMC_TRACE_ASSERT_RESET_BRUTAL("DMC:EH_APE_CEN: GenerateReset() - aTargetStartUpmode",
|
|
394 |
KErrArgument);
|
|
395 |
}
|
|
396 |
break;
|
|
397 |
}
|
|
398 |
|
|
399 |
OstTrace1(TRACE_FLOW, DDMC_LOGICAL_DEVICE_GENERATE_RESET_1,
|
|
400 |
"DMC:LOG_DEVICE: GenerateReset() - bootReasonApiStartUpMode: 0x%x",
|
|
401 |
bootReasonApiStartUpMode);
|
|
402 |
DMC_TRACE((("DMC:LOG_DEVICE: GenerateReset() - bootReasonApiStartUpMode: 0x%x"),
|
|
403 |
bootReasonApiStartUpMode));
|
|
404 |
|
|
405 |
// Generate reset
|
|
406 |
ret = DmcEvHandApeCent::HandleEvent(USER_GENERATE_RESET,
|
|
407 |
NULL/*Kernel*/,
|
|
408 |
&bootReasonApiStartUpMode);
|
|
409 |
|
|
410 |
OstTrace1(TRACE_ENTRY_EXIT, DDMC_LOGICAL_DEVICE__GENERATE_RESET_RETURN,
|
|
411 |
"DMC:LOG_DEVICE: GenerateReset() # OUT - ret: %d",
|
|
412 |
ret);
|
|
413 |
DMC_TRACE((("DMC:LOG_DEVICE: GenerateReset() # OUT - ret: %d"),
|
|
414 |
ret));
|
|
415 |
|
|
416 |
return ret;
|
|
417 |
}
|
|
418 |
|
|
419 |
|
|
420 |
// -----------------------------------------------------------------------------
|
|
421 |
// DDmcLogicalDevice::PowerOff
|
|
422 |
// -----------------------------------------------------------------------------
|
|
423 |
TInt DDmcLogicalDevice::PowerOff() const
|
|
424 |
{
|
|
425 |
OstTrace0(TRACE_ENTRY_EXIT, DDMC_LOGICAL_DEVICE_POWER_OFF_ENTRY,
|
|
426 |
"DMC:LOG_DEVICE: PowerOff() # IN");
|
|
427 |
DMC_TRACE(("DMC:LOG_DEVICE: PowerOff() # IN"));
|
|
428 |
|
|
429 |
TInt ret(KErrNone);
|
|
430 |
TUint bootReasonApiStartUpMode;
|
|
431 |
|
|
432 |
// None means that a device does not reset
|
|
433 |
bootReasonApiStartUpMode = TBootReason::EStartupModeNone;
|
|
434 |
|
|
435 |
// Power off the device
|
|
436 |
ret = DmcEvHandApeCent::HandleEvent(USER_POWER_OFF,
|
|
437 |
NULL/*Kernel*/,
|
|
438 |
&bootReasonApiStartUpMode);
|
|
439 |
|
|
440 |
OstTrace1(TRACE_ENTRY_EXIT, DDMC_LOGICAL_DEVICE_POWER_OFF_RETURN,
|
|
441 |
"DMC:LOG_DEVICE: PowerOff() # OUT - ret: %d",
|
|
442 |
ret);
|
|
443 |
DMC_TRACE((("DMC:LOG_DEVICE: PowerOff() # OUT - ret: %d"), ret));
|
|
444 |
|
|
445 |
return ret;
|
|
446 |
}
|
|
447 |
|
|
448 |
|
|
449 |
// -----------------------------------------------------------------------------
|
|
450 |
// DDmcLogicalDevice::IsHiddenReset
|
|
451 |
// -----------------------------------------------------------------------------
|
|
452 |
TInt DDmcLogicalDevice::IsHiddenReset(TBool& aHiddenStatus) const
|
|
453 |
{
|
|
454 |
OstTrace0(TRACE_ENTRY_EXIT, DDMC_LOGICAL_DEVICE_HIDDEN_RESET_ENTRY,
|
|
455 |
"DMC:LOG_DEVICE: IsHiddenReset() # IN");
|
|
456 |
DMC_TRACE(("DMC:LOG_DEVICE: IsHiddenReset() # IN"));
|
|
457 |
|
|
458 |
TInt ret(KErrNone);
|
|
459 |
TUint isHidden;
|
|
460 |
|
|
461 |
// Power off the device
|
|
462 |
ret = DmcEvHandApeCent::HandleEvent(USER_GET_HIDDEN_RESET_STATUS, NULL/*Kernel*/, &isHidden);
|
|
463 |
|
|
464 |
aHiddenStatus = static_cast<TBool>(isHidden);
|
|
465 |
|
|
466 |
OstTrace1(TRACE_FLOW, DDMC_LOGICAL_DEVICE_HIDDEN_RESET_1,
|
|
467 |
"DMC:LOG_DEVICE: IsHiddenReset() - aHiddenStatus: %d", aHiddenStatus);
|
|
468 |
OstTrace1(TRACE_ENTRY_EXIT, DDMC_LOGICAL_DEVICE_HIDDEN_RESET_RETURN,
|
|
469 |
"DMC:LOG_DEVICE: IsHiddenReset() # OUT - ret: %d", ret);
|
|
470 |
DMC_TRACE((("DMC:LOG_DEVICE: IsHiddenReset() # OUT - ret: %d, aHiddenStatus: %d"),
|
|
471 |
ret, aHiddenStatus));
|
|
472 |
|
|
473 |
return ret;
|
|
474 |
}
|
|
475 |
|
|
476 |
|
|
477 |
// -----------------------------------------------------------------------------
|
|
478 |
// DDmcLogicalDevice::SubscribeEvents
|
|
479 |
// -----------------------------------------------------------------------------
|
|
480 |
void DDmcLogicalDevice::SubscribeEvents(const DDmcLogicalChannel* const aLogChnlPtr)
|
|
481 |
{
|
|
482 |
OstTrace0(TRACE_ENTRY_EXIT, DDMC_LOGICAL_DEVICE_SUBSCRIBE_EVENTS_ENTRY,
|
|
483 |
"DMC:LOG_DEVICE: SubscribeEvents() # IN");
|
|
484 |
DMC_TRACE(("DMC:LOG_DEVICE: SubscribeEvents() # IN"));
|
|
485 |
|
|
486 |
OstTrace1(TRACE_FLOW, DDMC_LOGICAL_DEVICE_SUBSCRIBE_EVENTS_1,
|
|
487 |
"DMC:LOG_DEVICE: SubscribeEvents() - iUserEventDfcPtr: 0x%x", iUserEventDfcPtr);
|
|
488 |
DMC_TRACE((("DMC:LOG_DEVICE: SubscribeEvents() - iUserEventDfcPtr: 0x%x"), iUserEventDfcPtr));
|
|
489 |
|
|
490 |
// Needed to deliver asynchronous events.
|
|
491 |
iLogChannelsPtr.Append(aLogChnlPtr);
|
|
492 |
|
|
493 |
OstTrace1(TRACE_FLOW, DDMC_LOGICAL_DEVICE_CREATE_1,
|
|
494 |
"DMC:LOG_DEVICE: SubscribeEvents() - iLogChannelsPtr.Count: %d",
|
|
495 |
(TUint)(iLogChannelsPtr.Count()));
|
|
496 |
DMC_TRACE((("DMC:LOG_DEVICE: SubscribeEvents() iLogChannelsPtr.Count: %d"),
|
|
497 |
iLogChannelsPtr.Count()));
|
|
498 |
|
|
499 |
OstTrace0(TRACE_ENTRY_EXIT, DDMC_LOGICAL_DEVICE_SUBSCRIBE_EVENTS_RETURN,
|
|
500 |
"DMC:LOG_DEVICE: SubscribeEvents() # OUT");
|
|
501 |
DMC_TRACE(("DMC:LOG_DEVICE: SubscribeEvents() # OUT"));
|
|
502 |
}
|
|
503 |
|
|
504 |
|
|
505 |
// -----------------------------------------------------------------------------
|
|
506 |
// DDmcLogicalDevice::UnsubscribeEvents
|
|
507 |
// -----------------------------------------------------------------------------
|
|
508 |
void DDmcLogicalDevice::UnsubscribeEvents(const DDmcLogicalChannel* const aLogChnlPtr)
|
|
509 |
{
|
|
510 |
OstTrace0(TRACE_ENTRY_EXIT, DDMC_LOGICAL_DEVICE_UNSUBSCRIBE_EVENTS_ENTRY,
|
|
511 |
"DMC:LOG_DEVICE: UnsubscribeEvents() # IN");
|
|
512 |
DMC_TRACE(("DMC:LOG_DEVICE: UnsubscribeEvents() # IN"));
|
|
513 |
|
|
514 |
OstTrace1(TRACE_FLOW, DDMC_LOGICAL_DEVICE_UNSUBSCRIBE_EVENTS_1,
|
|
515 |
"DMC:LOG_DEVICE: UnsubscribeEvents() - Nbr of Logical Channels, Count: %d",
|
|
516 |
iLogChannelsPtr.Count());
|
|
517 |
DMC_TRACE((("DMC:LOG_DEVICE: UnsubscribeEvents() - Nbr of Logical Channels, Count: %d"),
|
|
518 |
iLogChannelsPtr.Count()));
|
|
519 |
TInt i(0);
|
|
520 |
|
|
521 |
if (iLogChannelsPtr.Count() > 0)
|
|
522 |
{
|
|
523 |
i = iLogChannelsPtr.Find(aLogChnlPtr);
|
|
524 |
|
|
525 |
OstTrace1(TRACE_FLOW, DDMC_LOGICAL_DEVICE_UNSUBSCRIBE_EVENTS_2,
|
|
526 |
"DMC:LOG_DEVICE: UnsubscribeEvents() - Array index: %d", i);
|
|
527 |
DMC_TRACE((("DMC:LOG_DEVICE: UnsubscribeEvents() - Array index: %d"), i));
|
|
528 |
|
|
529 |
|
|
530 |
/* No need to check the position of the array because "Remove()" panics with the
|
|
531 |
"PANIC: 130" if the position value is negative or greator than elements
|
|
532 |
in the array.
|
|
533 |
|
|
534 |
Removes only a logical channel object from the array, it does not delete it.
|
|
535 |
We do not have to delete the object itself because framework does it. */
|
|
536 |
iLogChannelsPtr.Remove(i);
|
|
537 |
}
|
|
538 |
|
|
539 |
OstTrace0(TRACE_ENTRY_EXIT, DDMC_LOGICAL_DEVICE_UNSUBSCRIBE_EVENTS_RETURN,
|
|
540 |
"DMC:LOG_DEVICE: UnsubscribeEvents() # OUT");
|
|
541 |
DMC_TRACE(("DMC:LOG_DEVICE: UnsubscribeEvents() # OUT"));
|
|
542 |
}
|
|
543 |
|
|
544 |
|
|
545 |
// -----------------------------------------------------------------------------
|
|
546 |
// DDmcLogicalDevice::ReceiveEventsDfc
|
|
547 |
// -----------------------------------------------------------------------------
|
|
548 |
void DDmcLogicalDevice::ReceiveEventsDfc(TAny* aPtr)
|
|
549 |
{
|
|
550 |
OstTrace0(TRACE_ENTRY_EXIT, DDMC_LOGICAL_DEVICE_REC_EVENTS_DFC_ENTRY,
|
|
551 |
"DMC:LOG_DEVICE: ReceiveEventsDfc() # IN");
|
|
552 |
DMC_TRACE(("DMC:LOG_DEVICE: ReceiveEventsDfc() # IN"));
|
|
553 |
DMC_TRACE_ASSERT_RESET(aPtr, "DMC:LOG_DEVICE: ReceiveEventsDfc() - Kernel NULL pointer",
|
|
554 |
KErrNoMemory);
|
|
555 |
|
|
556 |
DDmcLogicalDevice* dmcLogDevPtr = static_cast<DDmcLogicalDevice *>(aPtr);
|
|
557 |
|
|
558 |
OstTrace1(TRACE_FLOW, DDMC_REC_EVENTS_DFC_1,
|
|
559 |
"DMC:LOG_DEVICE: ReceiveEventsDfc() - dmcLogDevPtr: 0x%x",
|
|
560 |
(TUint)(dmcLogDevPtr));
|
|
561 |
DMC_TRACE((("DMC:LOG_DEVICE: ReceiveEventsDfc() - dmcLogDevPtr: 0x%x"),
|
|
562 |
dmcLogDevPtr));
|
|
563 |
|
|
564 |
// Get the type of the event. Power Off or reset are allowed.
|
|
565 |
TUint event;
|
|
566 |
RDmc::TEvent eventType;
|
|
567 |
|
|
568 |
/* No need to detect the ret value because the ret value indicates whether a request
|
|
569 |
is taken into process or not and this request is part of the any state, thus always
|
|
570 |
handled. */
|
|
571 |
(void)DmcEvHandApeCent::HandleEvent(USER_GET_EVENT_TYPE, NULL/*Kernel*/, &event);
|
|
572 |
|
|
573 |
OstTrace1(TRACE_FLOW, DDMC_REC_EVENTS_DFC_2,
|
|
574 |
"DMC:LOG_DEVICE: ReceiveEventsDfc() - Ext event type: 0x%x",
|
|
575 |
(TUint)(event));
|
|
576 |
DMC_TRACE((("DMC:LOG_DEVICE: ReceiveEventsDfc() - Ext event type: 0x%x"),
|
|
577 |
event));
|
|
578 |
|
|
579 |
switch (event)
|
|
580 |
{
|
|
581 |
case USER_CLIENT_POWER_OFF_EVENT:
|
|
582 |
{
|
|
583 |
eventType = RDmc::EPowerOffEvent;
|
|
584 |
}
|
|
585 |
break;
|
|
586 |
|
|
587 |
case USER_CLIENT_RESET_EVENT:
|
|
588 |
{
|
|
589 |
eventType = RDmc::EResetEvent;
|
|
590 |
}
|
|
591 |
break;
|
|
592 |
|
|
593 |
default:
|
|
594 |
{
|
|
595 |
DMC_TRACE_ALWAYS_ASSERT;
|
|
596 |
DMC_TRACE(("DMC:LOG_DEVICE: ReceiveEventsDfc() - default:"));
|
|
597 |
}
|
|
598 |
break;
|
|
599 |
}
|
|
600 |
|
|
601 |
OstTrace1(TRACE_FLOW, DDMC_REC_EVENTS_DFC_3,
|
|
602 |
"DMC:LOG_DEVICE: ReceiveEventsDfc() - RDmc eventType: %d",
|
|
603 |
(TUint)(eventType));
|
|
604 |
DMC_TRACE((("DMC:LOG_DEVICE: ReceiveEventsDfc() - RDmc eventType: %d"),
|
|
605 |
eventType));
|
|
606 |
|
|
607 |
OstTrace1(TRACE_FLOW, DDMC_REC_EVENTS_DFC_4,
|
|
608 |
"DMC:LOG_DEVICE: ReceiveEventsDfc() - Nbr of Logical Channels, Count: %d",
|
|
609 |
dmcLogDevPtr->iLogChannelsPtr.Count());
|
|
610 |
DMC_TRACE((("DMC:LOG_DEVICE: ReceiveEventsDfc() - Nbr of Logical Channels, Count: %d"),
|
|
611 |
dmcLogDevPtr->iLogChannelsPtr.Count()));
|
|
612 |
|
|
613 |
// Send an event to all clients.
|
|
614 |
for (TUint i = 0; i < dmcLogDevPtr->iLogChannelsPtr.Count(); i++)
|
|
615 |
{
|
|
616 |
dmcLogDevPtr->iLogChannelsPtr[i]->SendEvent(eventType);
|
|
617 |
}
|
|
618 |
|
|
619 |
OstTrace0(TRACE_ENTRY_EXIT, DDMC_LOGICAL_DEVICE_REC_EVENTS_DFC_RETURN,
|
|
620 |
"DMC:LOG_DEVICE: ReceiveEventsDfc() # OUT");
|
|
621 |
DMC_TRACE(("DMC:LOG_DEVICE: ReceiveEventsDfc() # OUT"));
|
|
622 |
}
|
|
623 |
|
|
624 |
|
|
625 |
// -----------------------------------------------------------------------------
|
|
626 |
// DDmcLogicalDevice::GetDynamicDfcQueue
|
|
627 |
// -----------------------------------------------------------------------------
|
|
628 |
TDynamicDfcQue* DDmcLogicalDevice::GetDynamicDfcQueue() const
|
|
629 |
{
|
|
630 |
OstTrace0(TRACE_ENTRY_EXIT, DDMC_LOGICAL_DEVICE_GET_DFCQ_ENTRY,
|
|
631 |
"DMC:LOG_DEVICE: GetDynamicDfcQueue() # IN");
|
|
632 |
DMC_TRACE(("DMC:LOG_DEVICE: GetDynamicDfcQueue() # IN"));
|
|
633 |
|
|
634 |
OstTrace1(TRACE_ENTRY_EXIT, DDMC_LOGICAL_DEVICE_GET_DFCQ_RETURN,
|
|
635 |
"DMC:LOG_DEVICE: GetDynamicDfcQueue() # OUT - iDmcLogDeviceDfcQueuePtr: 0x%x",
|
|
636 |
iDmcLogDeviceDfcQueuePtr);
|
|
637 |
DMC_TRACE((("DMC:LOG_DEVICE: GetDynamicDfcQueue() # OUT - iDmcLogDeviceDfcQueuePtr: 0x%x"),
|
|
638 |
iDmcLogDeviceDfcQueuePtr));
|
|
639 |
|
|
640 |
return iDmcLogDeviceDfcQueuePtr;
|
|
641 |
}
|
|
642 |
|
|
643 |
// End of File
|