|
1 <?xml version="1.0" encoding="utf-8"?> |
|
2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. --> |
|
3 <!-- This component and the accompanying materials are made available under the terms of the License |
|
4 "Eclipse Public License v1.0" which accompanies this distribution, |
|
5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". --> |
|
6 <!-- Initial Contributors: |
|
7 Nokia Corporation - initial contribution. |
|
8 Contributors: |
|
9 --> |
|
10 <!DOCTYPE task |
|
11 PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"> |
|
12 <task id="GUID-57A909F3-EAEA-5FE2-B620-E21204794497" xml:lang="en"><title>How |
|
13 to Load the Physical Device Driver and Logical Device Driver: Tutorial</title><shortdesc>When testing using the console, all drivers need to be loaded directly. |
|
14 This tutorial describes how to load the drivers required for the Serial Communications |
|
15 Server. </shortdesc><prolog><metadata><keywords/></metadata></prolog><taskbody> |
|
16 <context><p>Testing of communications software can be done using the Symbian |
|
17 OS console shell interface rather than a GUI interface. The console shell |
|
18 interface has advantages when testing since the console allows software to |
|
19 be tested in isolation. When testing with a GUI interface the testing can |
|
20 be difficult if other software in the GUI is attempting to access resources. |
|
21 If the device or the emulator is started with just the console, then only |
|
22 the kernel and file system are running. The tester can then load the software |
|
23 required for the test and ensure that no other software is using any resources. |
|
24 This avoids problems of other software interrupting the CPU or using and releasing |
|
25 memory or other hardware while a test is running. </p><p>Any test applications |
|
26 that have not been launched by the GUI should |
|
27 explicitly load the correct physical and logical device drivers. In most |
|
28 cases the bootloader will load the physical device driver. It is safe to load |
|
29 a |
|
30 device driver which has already been loaded, since the API will return |
|
31 <xref href="GUID-D1D25122-F2B8-3C78-8599-84905BFD47B8.dita"><apiname>KErrAlreadyExists</apiname></xref></p> </context> |
|
32 <steps id="GUID-8D0D239F-51F9-512A-8405-ADD01AE1660B"> |
|
33 <step id="GUID-21876E62-D2A9-510A-BAD2-CB3E4271A02B"><cmd>Identify the names |
|
34 of the physical and logical device drivers required.</cmd> |
|
35 <info><p> The names of device drivers change since variations are created |
|
36 for different platforms: the ecuart and infra-red logical device driver is |
|
37 usually called <filepath>ECOMM</filepath> while the USB logical device driver |
|
38 is usually called <filepath>EUSBC</filepath>. For fast infra-red the logical |
|
39 device driver is usually called <filepath>EFIR</filepath>. For ecuart, infra-red |
|
40 and USB the physical device driver is usually called <filepath>ECDRV</filepath> on |
|
41 the emulator. For devices the physical device drivers have a variety of names. |
|
42 The euart and USB the physical device driver is usually called <filepath>EUART</filepath> or <filepath>EUART</filepath> with |
|
43 a number for each port from base 1, for example <filepath>EUART1</filepath> and <filepath>EUART2</filepath>. |
|
44 For infra-red the physical device driver is usually called <filepath>EUART2</filepath>. |
|
45 For fast infra-red the physical device driver is usually called <filepath>DIFIR</filepath> for |
|
46 both emulator and devices. </p></info> |
|
47 </step> |
|
48 <step id="GUID-AE7AFB08-535A-5195-AF0D-4401390D8518"><cmd>Call <xref href="GUID-C197C9A7-EA05-3F24-9854-542E984C612D.dita#GUID-C197C9A7-EA05-3F24-9854-542E984C612D/GUID-1D773C95-A0DE-38EC-85BA-82162B2DC62E"><apiname>User::LoadPhysicalDevice</apiname></xref> to |
|
49 load the physical device driver and check the return code.</cmd> |
|
50 <info>A return code of <codeph>KErrAlreadyExists</codeph> can be ignored. </info> |
|
51 </step> |
|
52 <step id="GUID-CE68C060-4A44-5547-9DE6-A81DEAC367B1"><cmd>Call <xref href="GUID-C197C9A7-EA05-3F24-9854-542E984C612D.dita#GUID-C197C9A7-EA05-3F24-9854-542E984C612D/GUID-68D7C877-B611-3FCC-B85D-708501C1B66C"><apiname>User::LoadLogicalDevice</apiname></xref> to |
|
53 load the logical device driver and check the return code. </cmd> |
|
54 <info>A return code of <codeph>KErrAlreadyExists</codeph> can be ignored. </info> |
|
55 </step> |
|
56 <step id="GUID-E3332825-E22D-5D90-AA89-A6FD20500A9D"><cmd>Start the <xref href="GUID-2FED5145-58E4-5560-8E52-6BD499EECE13.dita">RootServer</xref> by calling <xref href="GUID-CFCBC5A6-FB1F-3DD7-B275-9B9C7389A8A7.dita"><apiname>StartC32()</apiname></xref>.</cmd> |
|
57 <info> The RootServer loads the Serial Communications Server. </info> |
|
58 </step> |
|
59 </steps> |
|
60 <example><title>Example</title> <codeblock id="GUID-B45CC19A-856B-54C2-84BD-840E72391F20" xml:space="preserve">#if defined (__WINS__) |
|
61 #define PDD_NAME _L("ECDRV") |
|
62 #else |
|
63 #define PDD_NAME _L("EUART1") |
|
64 #endif |
|
65 #define LDD_NAME _L("ECOMM") |
|
66 TInt r = User::LoadPhysicalDevice (PDD_NAME); |
|
67 if (r != KErrNone && r != KErrAlreadyExists) |
|
68 { |
|
69 User::Leave(r); |
|
70 } |
|
71 r = User::LoadLogicalDevice (LDD_NAME); |
|
72 if (r != KErrNone && r != KErrAlreadyExists) |
|
73 { |
|
74 User::Leave(r); |
|
75 } |
|
76 |
|
77 r = StartC32(); |
|
78 User::LeaveIfError(r);</codeblock> </example> |
|
79 </taskbody><related-links> |
|
80 <link href="GUID-D90C86C6-B85D-5941-9919-3725A9FFD548.dita"><linktext>Text shell |
|
81 (eshell)</linktext></link> |
|
82 </related-links></task> |