1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/genericopenlibs/cstdlib/TSTLIB/COMMINIT.CPP Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,50 @@
1.4 +// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// Initialise Comm Server in an simple text shell environment
1.18 +//
1.19 +//
1.20 +
1.21 +#include <e32base.h>
1.22 +#include <e32std.h>
1.23 +#include <f32file.h>
1.24 +#include <e32hal.h>
1.25 +
1.26 +#if defined (__WINS__)
1.27 +#define PDD_NAME _L("ECDRV")
1.28 +#define LDD_NAME _L("ECOMM")
1.29 +#define LDD_FNAME _L("ECOMM")
1.30 +#else
1.31 +#define PDD_NAME _L("EUART1")
1.32 +#define LDD_NAME _L("ECOMM")
1.33 +#define LDD_FNAME _L("FCOMM")
1.34 +#endif
1.35 +
1.36 +extern "C" {
1.37 +
1.38 +EXPORT_C int CommInit(int aEnhanced)
1.39 + {
1.40 + RFs fs;
1.41 + TInt err=fs.Connect(); // make sure the FileServer is alive (only needed for WINS test code)
1.42 + fs.Close();
1.43 +
1.44 + err=User::LoadPhysicalDevice(PDD_NAME);
1.45 + if (err!=KErrNone && err!=KErrAlreadyExists)
1.46 + return(err);
1.47 + err=User::LoadLogicalDevice( aEnhanced?LDD_FNAME:LDD_NAME );
1.48 + if (err!=KErrNone && err!=KErrAlreadyExists)
1.49 + return(err);
1.50 + return KErrNone;
1.51 + }
1.52 +
1.53 +}