Symbian3/SDK/Source/GUID-57A909F3-EAEA-5FE2-B620-E21204794497.dita
author Dominic Pinkman <dominic.pinkman@nokia.com>
Tue, 20 Jul 2010 12:00:49 +0100
changeset 13 48780e181b38
parent 7 51a74ef9ed63
permissions -rw-r--r--
Week 28 contribution of SDK documentation content. See release notes for details. Fixes bugs Bug 1897 and Bug 1522.

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License 
"Eclipse Public License v1.0" which accompanies this distribution, 
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
    Nokia Corporation - initial contribution.
Contributors: 
-->
<!DOCTYPE task
  PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="GUID-57A909F3-EAEA-5FE2-B620-E21204794497" xml:lang="en"><title>How
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.
This tutorial describes how to load the drivers required for the Serial Communications
Server. </shortdesc><prolog><metadata><keywords/></metadata></prolog><taskbody>
<context id="GUID-3FD29C37-082A-4B68-A955-E4B0D625BA92"><p>Testing of communications software can be done using the Symbian platform
console shell interface rather than a GUI interface. The console shell interface
has advantages when testing since the console allows software to be tested
in isolation. When testing with a GUI interface the testing can be difficult
if other software in the GUI is attempting to access resources. If the device
or the emulator is started with just the console, then only the kernel and
file system are running. The tester can then load the software required for
the test and ensure that no other software is using any resources. This avoids
problems of other software interrupting the CPU or using and releasing memory
or other hardware while a test is running. </p><p>Any test applications that
have not been launched by the GUI should  explicitly load the correct physical
and logical device drivers. In most cases the bootloader will load the physical
device driver. It is safe to load a device driver which has already been loaded,
since the API will return <xref href="GUID-D1D25122-F2B8-3C78-8599-84905BFD47B8.dita"><apiname>KErrAlreadyExists</apiname></xref></p> </context>
<steps id="GUID-8D0D239F-51F9-512A-8405-ADD01AE1660B">
<step id="GUID-21876E62-D2A9-510A-BAD2-CB3E4271A02B"><cmd>Identify the names
of the physical and logical device drivers required.</cmd>
<info><p> The names of device drivers change since variations are created
for different platforms: the ecuart and infra-red logical device driver is
usually called <filepath>ECOMM</filepath> while the USB logical device driver
is usually called <filepath>EUSBC</filepath>. For fast infra-red the logical
device driver is usually called <filepath>EFIR</filepath>. For ecuart, infra-red
and USB the physical device driver is usually called <filepath>ECDRV</filepath> on
the emulator. For devices the physical device drivers have a variety of names.
The euart and USB the physical device driver is usually called <filepath>EUART</filepath> or <filepath>EUART</filepath> with
a number for each port from base 1, for example <filepath>EUART1</filepath> and <filepath>EUART2</filepath>.
For infra-red the physical device driver is usually called <filepath>EUART2</filepath>.
For fast infra-red the physical device driver is usually called <filepath>DIFIR</filepath> for
both emulator and devices. </p></info>
</step>
<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
load the physical device driver and check the return code.</cmd>
<info>A return code of <codeph>KErrAlreadyExists</codeph> can be ignored. </info>
</step>
<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
load the logical device driver and check the return code. </cmd>
<info>A return code of <codeph>KErrAlreadyExists</codeph> can be ignored. </info>
</step>
<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>
<info> The RootServer loads the Serial Communications Server. </info>
</step>
</steps>
<example><title>Example</title> <codeblock id="GUID-B45CC19A-856B-54C2-84BD-840E72391F20" xml:space="preserve">#if defined (__WINS__)
    #define PDD_NAME _L("ECDRV")
#else
    #define PDD_NAME _L("EUART1")
#endif
#define LDD_NAME _L("ECOMM")
TInt r = User::LoadPhysicalDevice (PDD_NAME);
if (r != KErrNone &amp;&amp; r != KErrAlreadyExists) 
    {
    User::Leave(r);
    }
r = User::LoadLogicalDevice (LDD_NAME);
if (r != KErrNone &amp;&amp; r != KErrAlreadyExists) 
    {
    User::Leave(r);
    }

r = StartC32(); 
User::LeaveIfError(r);</codeblock> </example>
</taskbody><related-links>
<link href="GUID-D90C86C6-B85D-5941-9919-3725A9FFD548.dita"><linktext>Text shell
(eshell)</linktext></link>
</related-links></task>