os/ossrv/genericopenlibs/cstdlib/TSTLIB/COMMINIT.CPP
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // Initialise Comm Server in an simple text shell environment
    15 // 
    16 //
    17 
    18 #include <e32base.h>
    19 #include <e32std.h>
    20 #include <f32file.h>
    21 #include <e32hal.h>
    22 
    23 #if defined (__WINS__)
    24 #define PDD_NAME _L("ECDRV")
    25 #define LDD_NAME _L("ECOMM")
    26 #define LDD_FNAME _L("ECOMM")
    27 #else
    28 #define PDD_NAME _L("EUART1")
    29 #define LDD_NAME _L("ECOMM")
    30 #define LDD_FNAME _L("FCOMM")
    31 #endif
    32 
    33 extern "C" {
    34 
    35 EXPORT_C int CommInit(int aEnhanced)
    36 	{
    37 	RFs fs;
    38 	TInt err=fs.Connect();	// make sure the FileServer is alive (only needed for WINS test code)
    39 	fs.Close();
    40 
    41 	err=User::LoadPhysicalDevice(PDD_NAME);
    42 	if (err!=KErrNone && err!=KErrAlreadyExists)
    43 		return(err);
    44 	err=User::LoadLogicalDevice( aEnhanced?LDD_FNAME:LDD_NAME );
    45 	if (err!=KErrNone && err!=KErrAlreadyExists)
    46 		return(err);
    47 	return KErrNone;
    48 	}
    49 
    50 }