Exemplo n.º 1
0
// config
TPLauncherConfig::TPLauncherConfig(TPicoConfig &cfg)
: iEmuConfig(cfg)
{
	iLastROMFile.Copy(_L("C:\\"));

	// ini
	TBuf<KMaxFileName*3> tmpbuff; // hopefully large enough
	RProcess me;
	me.CommandLine(tmpbuff);
	TInt pos = tmpbuff.Find(_L(" "));
	if(pos == KErrNotFound) pos = tmpbuff.Length();
	if(pos > 3) {
		iIniFileName.Copy(tmpbuff.Ptr(), pos-3);
		iIniFileName.Append(_L("ini"));
	}
	//DEBUGPRINT(_L("[app] made ini: %S"), &iIniFileName);
}
Exemplo n.º 2
0
GLDEF_C TInt E32Main()
{
//	test.SetLogged(EFalse); 	// Turn off serial port debugging!

    TInt r;
    test.Title();

    test.Start(_L("PC Card Modem Test Program"));

    RProcess proc;
    TBuf <0x100> cmd;
    proc.CommandLine(cmd);

    // First parameter (if present) sets the serial port number
    TInt port=0;
    if ((cmd.Length()>0) && (cmd[0]>='1' && cmd[0]<='4'))
        port=(TInt)(cmd[0]-'0');

    // 2nd parameter (if present) sets the start speed
    // (4=115K,3=57600,2=38400,1=19200,0=9600)
    TInt startSpeed=4;
    if ((cmd.Length()>3) && (cmd[2]>='0' && cmd[2]<='4'))
        startSpeed=(TInt)(cmd[2]-'0');

    test.Next(_L("Load Device Drivers"));
    TBuf<10> pddName=PDD_NAME;
#if !defined (__WINS__)
    pddName[5]=(TText)('1'+port);
    TInt muid=0;
    if (HAL::Get(HAL::EMachineUid, muid)==KErrNone)
    {
        // Brutus uses EUART4 for both COM3 and COM4
        if (muid==HAL::EMachineUid_Brutus && port==4)
            pddName[5]=(TText)'4';
    }
#endif
    r=User::LoadPhysicalDevice(pddName);
    test(r==KErrNone||r==KErrAlreadyExists);
    r=User::LoadLogicalDevice(LDD_NAME);
    test(r==KErrNone||r==KErrAlreadyExists);

    test.Next(_L("Open serial port"));
    theSerialPort=new RComm;
    test(theSerialPort!=NULL);
    r=theSerialPort->Open(port);
    test(r==KErrNone);
//  TCommCaps capsBuf;
//  TCommCapsV01& caps=capsBuf();
//	theSerialPort->Caps(capsBuf);

    // Check that the driver powering sequence has completed successfully by
    // issueing a few simple driver control functions.
    test.Next(_L("Modem power tests"));
    test(theSerialPort->SetReceiveBufferLength(KStandardRxBufferSize)==KErrNone);
    r=theSerialPort->ReceiveBufferLength();
//	test.Printf(_L("(%d)"),r); // ???
    test(r==KStandardRxBufferSize);
    r=(TInt)theSerialPort->Signals();
//	test.Printf(_L("(%d)"),r); // ???
    test(r>=0);

    RTimer timer;
    TRequestStatus rs;
    test(timer.CreateLocal()==KErrNone);
    TTime tim;
    tim.HomeTime();
    tim+=TTimeIntervalSeconds(8);
    timer.At(rs,tim);
    UserHal::SwitchOff();
    User::WaitForRequest(rs);
    test(rs.Int()==KErrNone);

    r=theSerialPort->ReceiveBufferLength();
//	test.Printf(_L("(%d)"),r); // ???
    test(r==KStandardRxBufferSize);
    r=(TInt)theSerialPort->Signals();
//	test.Printf(_L("(%d)"),r); // ???
    test(r>=0);
    User::After(2000000);		  // 2Secs !!!

    if (startSpeed>=4)
    {
        test.Next(_L("Testing at 115K"));
        testAllLineRates(EBps115200);
    }

    if (startSpeed>=3)
    {
        test.Next(_L("Testing at 57600"));
        testAllLineRates(EBps57600);
    }

    if (startSpeed>=2)
    {
        test.Next(_L("Testing at 38400"));
        testAllLineRates(EBps38400);
    }

    if (startSpeed>=1)
    {
        test.Next(_L("Testing at 19200"));
        testAllLineRates(EBps19200);
    }

    test.Next(_L("Testing at 9600"));
    testAllLineRates(EBps9600);

    test.Next(_L("Close serial port"));
    theSerialPort->Close();
    delete theSerialPort;
    test.End();
    return(KErrNone);
}