sl@0: // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // e32test\device\t_firco2.cpp sl@0: // sl@0: // sl@0: sl@0: #include "t_fir2.h" sl@0: sl@0: #if defined(__VC32__) && _MSC_VER==1100 sl@0: // Disable MSVC++ 5.0 aggressive warnings about non-expansion of inline functions. sl@0: #pragma warning(disable : 4710) // function '...' not expanded sl@0: #endif sl@0: sl@0: #ifdef __WINS__ sl@0: #include sl@0: RSocketServ ss; sl@0: #endif sl@0: sl@0: TBuf8<2060> WriteBuf; sl@0: TBuf8<2060> ReadBuf; sl@0: TInt iTimeDelay=1000000; sl@0: TInt iBufSz=2000; sl@0: TBool iRWToWrite=EFalse; sl@0: TInt iDataStart=-1; sl@0: TInt iReadFramesCount=0; sl@0: TInt iFrameError=0; sl@0: void ResetReadBuffer() sl@0: { sl@0: TInt i=0; sl@0: ReadBuf.SetLength(2060); sl@0: for(i=0;i<2050;i++) sl@0: ReadBuf[i] ='R'; sl@0: } sl@0: sl@0: TBool CompareBuffers(TInt aLen) sl@0: { sl@0: TInt i=0; sl@0: while(iConstructL(); sl@0: return self; sl@0: } sl@0: sl@0: void CActiveConsole::ConstructL () sl@0: { sl@0: TFirCaps aCapsBuf; sl@0: TFirCapsV01& aCaps=aCapsBuf(); sl@0: TFirConfig aConfigBuf; sl@0: TFirConfigV01& aConfig=aConfigBuf(); sl@0: sl@0: iConsole->Printf(_L("\r\n")); sl@0: CActiveScheduler::Add(this); // Add to active scheduler sl@0: sl@0: // Load Driver sl@0: TInt ret=User::LoadPhysicalDevice(_L("Difir")); sl@0: if (ret!=KErrNone) sl@0: iConsole->Printf(_L("Error %d on loading Fir PDD\r\n"),ret); sl@0: else sl@0: iConsole->Printf(_L("Successfully loaded Fir PDD\r\n")); sl@0: sl@0: ret=User::LoadLogicalDevice(_L("Efir")); sl@0: if (ret!=KErrNone) sl@0: iConsole->Printf(_L("Error %d on loading Fir LDD\r\n"),ret); sl@0: else sl@0: iConsole->Printf(_L("Successfully loaded Fir LDD\r\n")); sl@0: sl@0: SetUpBuffers(); sl@0: sl@0: ret=iPort.Open(0); sl@0: if (ret!=KErrNone) sl@0: iConsole->Printf(_L("Error %d on opening Fastir port\r\n"),ret); sl@0: else sl@0: iConsole->Printf(_L("Successfully opened Fastir port\r\n")); sl@0: sl@0: sl@0: ret=iPort.Caps(aCapsBuf); sl@0: if (ret!=KErrNone) sl@0: iConsole->Printf(_L("Error %d on getting caps\r\n"),ret); sl@0: else sl@0: { sl@0: if(aCaps.iRate & KCapsFirBps576000) sl@0: iConsole->Printf(_L("576000 Bps supported\r\n")); sl@0: if(aCaps.iRate & KCapsFirBps1152000) sl@0: iConsole->Printf(_L("1152000 Bps supported\r\n")); sl@0: if(aCaps.iRate & KCapsFirBps4000000) sl@0: iConsole->Printf(_L("4000000 Bps supported\r\n")); sl@0: } sl@0: sl@0: /*ret=iPort.Config(aConfigBuf); sl@0: if (ret!=KErrNone) sl@0: iConsole->Printf(_L("Error %d getting config\r\n"),ret); sl@0: else sl@0: { sl@0: if(aConfig.iRate==EBps4000000) sl@0: iConsole->Printf(_L("Fir config is 4Mbps\r\n")); sl@0: }*/ sl@0: sl@0: iRW=CActiveRW::NewL(iConsole,&iPort); sl@0: if(iRW) sl@0: iConsole->Printf(_L("Have created writer\r\n")); sl@0: else sl@0: iConsole->Printf(_L("Failed to create writer\r\n")); sl@0: } sl@0: sl@0: CActiveConsole::~CActiveConsole() sl@0: { sl@0: // Make sure we're cancelled sl@0: Cancel(); sl@0: sl@0: if(iRW) sl@0: delete iRW; sl@0: sl@0: iPort.Close(); sl@0: } sl@0: sl@0: void CActiveConsole::DoCancel() sl@0: { sl@0: iConsole->ReadCancel(); sl@0: } sl@0: sl@0: void CActiveConsole::RunL() sl@0: { sl@0: ProcessKeyPressL(TChar(iConsole->KeyCode())); sl@0: // iConsole->Printf(_L("CActiveConsole - Completed with code %d\r\n\r\n"), iStatus.Int ()); sl@0: } sl@0: sl@0: void CActiveConsole::RequestCharacter() sl@0: { sl@0: if(!iInit1) sl@0: { sl@0: Options1(); sl@0: return; sl@0: } sl@0: if(!iInit2) sl@0: { sl@0: Options2(); sl@0: return; sl@0: } sl@0: if(!iInit3) sl@0: { sl@0: Options3(); sl@0: return; sl@0: } sl@0: // A request is issued to the CConsoleBase to accept a sl@0: // character from the keyboard. sl@0: iConsole->Printf(_L("*********************************\r\n")); sl@0: iConsole->Printf(_L("press Escape to quit\r\n")); sl@0: iConsole->Printf(_L("press '1'/'2' to start as reader/writer\r\n")); sl@0: iConsole->Printf(_L("press '3' stop \r\n")); sl@0: iConsole->Printf(_L("press '8' to show FIR regs\r\n")); sl@0: iConsole->Printf(_L("press '9' to show Dma reader regs\r\n")); sl@0: iConsole->Printf(_L("press '0' to show Dma writer regs\r\n")); sl@0: iConsole->Printf(_L("press 'a' to show TxBuf info\r\n")); sl@0: iConsole->Printf(_L("press 'b' to show RxBuf info\r\n")); sl@0: iConsole->Printf(_L("press 'c' to show Chunk info\r\n")); sl@0: iConsole->Printf(_L("press 'd' to show misc info\r\n")); sl@0: iConsole->Read(iStatus); sl@0: SetActive(); sl@0: } sl@0: sl@0: void CActiveConsole::Options1() sl@0: { sl@0: iConsole->Printf(_L("*****Choose Delay*****\r\n")); sl@0: iConsole->Printf(_L("press '1' 576000 baud\r\n")); sl@0: iConsole->Printf(_L("press '2' 1152000 baud\r\n")); sl@0: iConsole->Printf(_L("press '3' 4000000 baud\r\n")); sl@0: iConsole->Read(iStatus); sl@0: SetActive(); sl@0: } sl@0: sl@0: void CActiveConsole::Options2() sl@0: { sl@0: iConsole->Printf(_L("*****Choose Delay*****\r\n")); sl@0: iConsole->Printf(_L("press '1' 1.00 sec delay\r\n")); sl@0: iConsole->Printf(_L("press '2' 100 ms delay\r\n")); sl@0: iConsole->Printf(_L("press '3' 10 ms delay\r\n")); sl@0: iConsole->Printf(_L("press '4' 1 ms delay\r\n")); sl@0: iConsole->Printf(_L("press '5' 0.00 sec delay\r\n")); sl@0: iConsole->Read(iStatus); sl@0: SetActive(); sl@0: } sl@0: sl@0: void CActiveConsole::Options3() sl@0: { sl@0: iConsole->Printf(_L("****Choose Buf Sz*****\r\n")); sl@0: iConsole->Printf(_L("press '1' 1 byte \r\n")); sl@0: iConsole->Printf(_L("press '2' 4 bytes\r\n")); sl@0: iConsole->Printf(_L("press '3' 2000 bytes\r\n")); sl@0: iConsole->Printf(_L("press '4' 2042 bytes\r\n")); sl@0: iConsole->Read(iStatus); sl@0: SetActive(); sl@0: } sl@0: sl@0: void CActiveConsole::ProcessKeyPressL(TChar aChar) sl@0: { sl@0: if (aChar == EKeyEscape) sl@0: { sl@0: CActiveScheduler::Stop(); sl@0: return; sl@0: } sl@0: sl@0: if(!iInit1) sl@0: { sl@0: switch(aChar) sl@0: { sl@0: case '1': sl@0: iBaudRate=EBps576000; sl@0: break; sl@0: case '2': sl@0: iBaudRate=EBps1152000; sl@0: break; sl@0: case '3': sl@0: iBaudRate=EBps4000000; sl@0: break; sl@0: default: sl@0: iBaudRate=EBps4000000; sl@0: break; sl@0: } sl@0: iConsole->Printf(_L("Baud rate: %d\r\n"),iBaudRate); sl@0: iInit1=ETrue; sl@0: TFirConfig aConfigBuf; sl@0: TFirConfigV01& aConfig=aConfigBuf(); sl@0: aConfig.iRate=iBaudRate; sl@0: TInt ret=iPort.SetConfig(aConfigBuf); sl@0: iConsole->Printf(_L("Error %d on SetConfig\r\n"),ret); sl@0: RequestCharacter(); sl@0: return; sl@0: } sl@0: sl@0: if(!iInit2) sl@0: { sl@0: switch(aChar) sl@0: { sl@0: case '1'://1 sec sl@0: iTimeDelay=1000000; sl@0: break; sl@0: case '2'://100ms sl@0: iTimeDelay=100000; sl@0: break; sl@0: case '3'://10ms sl@0: iTimeDelay=10000; sl@0: break; sl@0: case '4'://1ms sl@0: iTimeDelay=1000; sl@0: break; sl@0: case '5'://0 sec sl@0: iTimeDelay=0; sl@0: break; sl@0: default: sl@0: iTimeDelay=1000000; sl@0: break; sl@0: } sl@0: iConsole->Printf(_L("Time Delay: %d\r\n"),iTimeDelay); sl@0: iInit2=ETrue; sl@0: RequestCharacter(); sl@0: return; sl@0: } sl@0: if(!iInit3) sl@0: { sl@0: switch(aChar) sl@0: { sl@0: case '1': sl@0: iBufSz=1; sl@0: break; sl@0: case '2': sl@0: iBufSz=4; sl@0: break; sl@0: case '3': sl@0: iBufSz=2000; sl@0: break; sl@0: case '4': sl@0: iBufSz=2042; sl@0: break; sl@0: default: sl@0: iBufSz=2000; sl@0: break; sl@0: } sl@0: iConsole->Printf(_L("Buffer size: %d\r\n"),iBufSz); sl@0: iInit3=ETrue; sl@0: RequestCharacter(); sl@0: return; sl@0: } sl@0: sl@0: switch (aChar) sl@0: { sl@0: case '1'://start reader sl@0: iRW->Start(EFalse); sl@0: break; sl@0: case '2'://stop reader sl@0: iRW->Start(ETrue); sl@0: break; sl@0: case '3'://start writer sl@0: iRW->Stop(); sl@0: break; sl@0: case '8'://get fir regs sl@0: GetFirRegs(); sl@0: break; sl@0: case '9'://get dma reader regs sl@0: GetDmaReaderRegs(); sl@0: break; sl@0: case '0'://get dma writer regs sl@0: GetDmaWriterRegs(); sl@0: break; sl@0: case 'a'://get TxBuf info sl@0: GetWriteBufInfo(); sl@0: break; sl@0: case 'b'://get RxBuf info sl@0: GetReadBufInfo(); sl@0: break; sl@0: case 'c'://get RxBuf info sl@0: GetChunkInfo(); sl@0: break; sl@0: case 'd': sl@0: GetMiscInfo(); sl@0: break; sl@0: default: sl@0: iConsole->Printf(_L("\r\nUnknown Command\r\n\r\n")); sl@0: break; sl@0: } sl@0: RequestCharacter (); sl@0: return; sl@0: } sl@0: sl@0: void CActiveConsole::GetFirRegs() sl@0: { sl@0: /* TInt r=0; sl@0: TDebugFirRegs FirRegs; sl@0: r=iPort.GetFirRegs(FirRegs); sl@0: iConsole->Printf(_L("RxFrameStatus : 0x%x\r\n"),FirRegs.RxFrameStatus); sl@0: iConsole->Printf(_L("RxBufferEmpty : 0x%x\r\n"),FirRegs.RxBufferEmpty); sl@0: iConsole->Printf(_L("RxError : 0x%x\r\n"),FirRegs.RxError); sl@0: iConsole->Printf(_L("RxOverrun : 0x%x\r\n"),FirRegs.RxOverrun); sl@0: iConsole->Printf(_L("CrcError : 0x%x\r\n"),FirRegs.CrcError); sl@0: iConsole->Printf(_L("TxFrameStatus : 0x%x\r\n"),FirRegs.TxFrameStatus); sl@0: iConsole->Printf(_L("TxBufferEmpty : 0x%x\r\n"),FirRegs.TxBufferEmpty); sl@0: iConsole->Printf(_L("TxBufferSz : 0x%x\r\n"),FirRegs.TxBufferSz); sl@0: iConsole->Printf(_L("TxOverrun : 0x%x\r\n"),FirRegs.TxOverrun);*/ sl@0: } sl@0: sl@0: void CActiveConsole::GetDmaReaderRegs() sl@0: { sl@0: /* TInt r=0; sl@0: TDebugDmaChannelRegs DmaRxRegs; sl@0: r=iPort.GetDmaRxRegs(DmaRxRegs); sl@0: iConsole->Printf(_L("Rx Chan : %d\n"),DmaRxRegs.DmaRxChannel); sl@0: iConsole->Printf(_L("Tx Chan : %d\n"),DmaRxRegs.DmaTxChannel); sl@0: iConsole->Printf(_L("Rx DmaMode : %d\n"),DmaRxRegs.DmaMode); sl@0: iConsole->Printf(_L("Rx DmaState : %d\n"),DmaRxRegs.DmaState); sl@0: iConsole->Printf(_L("Rx DmaBuffer : %x\n"),DmaRxRegs.DmaBuffer); sl@0: User::After(1000000); sl@0: iConsole->Printf(_L("Rx DmGauge : %d\n"),DmaRxRegs.DmaGauge); sl@0: iConsole->Printf(_L("Rx DmaSrcAddr : %x\n"),DmaRxRegs.DmaSrcAddr); sl@0: iConsole->Printf(_L("Rx DmaSrcInc : %d\n"),DmaRxRegs.DmaSrcInc); sl@0: iConsole->Printf(_L("Rx DmaDestAddr: %x\n"),DmaRxRegs.DmaDestAddr); sl@0: iConsole->Printf(_L("Rx DmaDestInc : %d\n"),DmaRxRegs.DmaDestInc); sl@0: iConsole->Printf(_L("Rx DmaCount : %d\n"),DmaRxRegs.DmaCount); sl@0: iConsole->Printf(_L("Rx MatchClear : %x\n"),DmaRxRegs.MatchClear); sl@0: iConsole->Printf(_L("Rx MatchSet : %x\n"),DmaRxRegs.MatchSet);*/ sl@0: } sl@0: sl@0: void CActiveConsole::GetDmaWriterRegs() sl@0: { sl@0: /* TInt r=0; sl@0: TDebugDmaChannelRegs DmaTxRegs; sl@0: r=iPort.GetDmaTxRegs(DmaTxRegs); sl@0: iConsole->Printf(_L("Rx Chan : %d\n"),DmaTxRegs.DmaRxChannel); sl@0: iConsole->Printf(_L("Tx Chan : %d\n"),DmaTxRegs.DmaTxChannel); sl@0: iConsole->Printf(_L("Tx DmaMode : %d\n"),DmaTxRegs.DmaMode); sl@0: iConsole->Printf(_L("Tx DmaState : %d\n"),DmaTxRegs.DmaState); sl@0: iConsole->Printf(_L("Tx DmaBuffer : %x\n"),DmaTxRegs.DmaBuffer); sl@0: User::After(1000000); sl@0: iConsole->Printf(_L("Tx DmGauge : %d\n"),DmaTxRegs.DmaGauge); sl@0: iConsole->Printf(_L("Tx DmaSrcAddr : %x\n"),DmaTxRegs.DmaSrcAddr); sl@0: iConsole->Printf(_L("Tx DmaSrcInc : %d\n"),DmaTxRegs.DmaSrcInc); sl@0: iConsole->Printf(_L("Tx DmaDestAddr: %x\n"),DmaTxRegs.DmaDestAddr); sl@0: iConsole->Printf(_L("Tx DmaDestInc : %d\n"),DmaTxRegs.DmaDestInc); sl@0: iConsole->Printf(_L("Tx DmaCount : %d\n"),DmaTxRegs.DmaCount); sl@0: iConsole->Printf(_L("Tx MatchClear : %x\n"),DmaTxRegs.MatchClear); sl@0: iConsole->Printf(_L("Tx MatchSet : %x\n"),DmaTxRegs.MatchSet);*/ sl@0: } sl@0: sl@0: void CActiveConsole::GetReadBufInfo() sl@0: { sl@0: /* TInt r=0; sl@0: TDebugBufInfo RxBufInfo; sl@0: r=iPort.GetRxBufInfo(RxBufInfo); sl@0: iConsole->Printf(_L("Rx no frames: %d\r\n"),RxBufInfo.iNoFrames); sl@0: iConsole->Printf(_L("Rx insert pt: %d\r\n"),RxBufInfo.iInsertPt); sl@0: iConsole->Printf(_L("Rx remove pt: %d\r\n"),RxBufInfo.iRemovePt); sl@0: iConsole->Printf(_L("Rx head : %d\r\n"),RxBufInfo.iHead); sl@0: iConsole->Printf(_L("Rx tail : %d\r\n"),RxBufInfo.iTail); sl@0: iConsole->Printf(_L("Rx active : %x\r\n"),RxBufInfo.iActive); sl@0: iConsole->Printf(_L("Rx cancelled: %x\r\n"),RxBufInfo.iCancelled); sl@0: iConsole->Printf(_L("Client read pending: %d\r\n"),RxBufInfo.iClientPending);*/ sl@0: } sl@0: sl@0: void CActiveConsole::GetWriteBufInfo() sl@0: { sl@0: /* TInt r=0; sl@0: TDebugBufInfo TxBufInfo; sl@0: r=iPort.GetTxBufInfo(TxBufInfo); sl@0: iConsole->Printf(_L("Tx no frames: %d\r\n"),TxBufInfo.iNoFrames); sl@0: iConsole->Printf(_L("Tx insert pt: %d\r\n"),TxBufInfo.iInsertPt); sl@0: iConsole->Printf(_L("Tx remove pt: %d\r\n"),TxBufInfo.iRemovePt); sl@0: iConsole->Printf(_L("Tx head : %d\r\n"),TxBufInfo.iHead); sl@0: iConsole->Printf(_L("Tx tail : %d\r\n"),TxBufInfo.iTail); sl@0: iConsole->Printf(_L("Tx active : %x\r\n"),TxBufInfo.iActive); sl@0: iConsole->Printf(_L("Tx cancelled: %x\r\n"),TxBufInfo.iCancelled); sl@0: iConsole->Printf(_L("Client write pending: %d\r\n"),TxBufInfo.iClientPending);*/ sl@0: } sl@0: sl@0: void CActiveConsole::GetChunkInfo() sl@0: { sl@0: /* TInt r=0; sl@0: TDebugDmaChunkInfo DmaChunkInfo; sl@0: r=iPort.GetDmaChunkInfo(DmaChunkInfo); sl@0: iConsole->Printf(_L("Write Chunk Phys Addr: 0x%x\r\n"),DmaChunkInfo.iWriteChunkPhysAddr); sl@0: iConsole->Printf(_L("Write Chunk Lin Addr: 0x%x\r\n"),DmaChunkInfo.iWriteChunkLinAddr); sl@0: iConsole->Printf(_L("Read Chunk Phys Addr: 0x%x\r\n"),DmaChunkInfo.iReadChunkPhysAddr); sl@0: iConsole->Printf(_L("Read Chunk Lin Addr: 0x%x\r\n"),DmaChunkInfo.iReadChunkLinAddr); sl@0: //iConsole->Printf(_L("Write Chunk Phys Addr: 0x%x\r\n"),DmaChunkInfo.);*/ sl@0: } sl@0: sl@0: void CActiveConsole::GetMiscInfo() sl@0: { sl@0: /* TInt r=0; sl@0: TDebugInterruptInfo IntInfo; sl@0: r=iPort.GetInterruptsInfo(IntInfo); sl@0: iConsole->Printf(_L("No writer dma interrupts: %d\r\n"),IntInfo.iNoTxDmaInts); sl@0: iConsole->Printf(_L("No reader dma interrupts: %d\r\n"),IntInfo.iNoRxDmaInts); sl@0: //iConsole->Printf(_L("Total Hspp interrupts: %d\r\n"),IntInfo.iNoHsspInts); sl@0: iConsole->Printf(_L("Total Framing errors : %d\r\n"),IntInfo.iNoFREs); sl@0: iConsole->Printf(_L("No xtra chars : %d\r\n"),IntInfo.iNoXtraChars); sl@0: iConsole->Printf(_L("No unwanted chars : %d\r\n"),IntInfo.iNoUnwantedChars); sl@0: iConsole->Printf(_L("No Rx dma leftovers : %d\r\n"),IntInfo.iNoRxDmaInts);*/ sl@0: } sl@0: sl@0: sl@0: sl@0: // sl@0: // class CActiveRW sl@0: // sl@0: sl@0: CActiveRW::CActiveRW(CConsoleBase* aConsole,RDevFir* aPort) sl@0: : CActive (EPriorityNormal) sl@0: { sl@0: iConsole=aConsole; sl@0: iPort=aPort; sl@0: iLength=0; sl@0: } sl@0: sl@0: CActiveRW* CActiveRW::NewL(CConsoleBase* aConsole,RDevFir* aPort) sl@0: { sl@0: CActiveRW* self = new (ELeave) CActiveRW(aConsole,aPort); sl@0: sl@0: CleanupStack::PushL (self); sl@0: self->ConstructL(); sl@0: CActiveScheduler::Add (self); sl@0: CleanupStack::Pop (); sl@0: return (self); sl@0: } sl@0: sl@0: void CActiveRW::ConstructL() sl@0: { sl@0: } sl@0: sl@0: CActiveRW::~CActiveRW() sl@0: { sl@0: Cancel(); sl@0: } sl@0: sl@0: void CActiveRW::RunL () sl@0: { sl@0: TInt i=0; sl@0: TInt wlength=0; sl@0: TInt rlength=0; sl@0: TInt iErrorRate=0; sl@0: if (iStatus != KErrNone) sl@0: iConsole->Printf(_L("Error %d\r\n"),iStatus.Int()); sl@0: sl@0: //return; sl@0: if(iTimeDelay) sl@0: User::After(iTimeDelay); sl@0: sl@0: sl@0: if(iNextXfer==EWriteXfer) sl@0: { sl@0: // ; sl@0: iReadFramesCount++; sl@0: rlength=ReadBuf[0]+(ReadBuf[1]<<8); sl@0: sl@0: if(rlength != ReadBuf.Length() || iStatus != KErrNone) sl@0: { sl@0: iFrameError++; sl@0: RDebug::Print(_L("********* SHORT READ %d %d*********\n\r"),rlength, ReadBuf.Length()); sl@0: } sl@0: sl@0: if(iReadFramesCount>0) sl@0: iErrorRate=(iFrameError*2000+iReadFramesCount)/(2*iReadFramesCount); sl@0: else sl@0: iErrorRate=0; sl@0: sl@0: iConsole->Printf(_L("R:%-4d FR %d EC %d Err %3d.%1d%%\r\n"), sl@0: ReadBuf.Length(),iReadFramesCount,iFrameError, iErrorRate/10,iErrorRate%10); sl@0: sl@0: iLength=(iLength+1)%10; sl@0: wlength=iBufSz+iLength; sl@0: WriteBuf.SetLength(wlength); sl@0: WriteBuf[0]=wlength; sl@0: WriteBuf[1]=wlength>>8; sl@0: iPort->Write(iStatus, WriteBuf, WriteBuf.Length()); sl@0: iNextXfer=EReadXfer; sl@0: sl@0: } sl@0: else sl@0: { // EReadXfer sl@0: iConsole->Printf(_L("W:%-4d "),WriteBuf.Length()); sl@0: ResetReadBuffer(); sl@0: iPort->Read(iStatus, ReadBuf, ReadBuf.Length()); sl@0: iNextXfer=EWriteXfer; sl@0: } sl@0: SetActive(); sl@0: } sl@0: sl@0: void CActiveRW::Start(TBool StartWriting) sl@0: { sl@0: if(IsActive()) sl@0: return; sl@0: sl@0: if(StartWriting) sl@0: { sl@0: if(iDataStart==-1) sl@0: { sl@0: iDataStart=0x80; sl@0: SetUpBuffers(); sl@0: } sl@0: iConsole->Printf(_L("Starting with write.....\r\n")); sl@0: WriteBuf.SetLength(iBufSz); sl@0: WriteBuf[0]=iBufSz; sl@0: WriteBuf[1]=iBufSz>>8; sl@0: iPort->Write(iStatus, WriteBuf, WriteBuf.Length()); sl@0: iNextXfer=EReadXfer; sl@0: } sl@0: else sl@0: { sl@0: if(iDataStart==-1) sl@0: { sl@0: iDataStart=0x0; sl@0: SetUpBuffers(); sl@0: } sl@0: iConsole->Printf(_L("Starting with read.....\r\n")); sl@0: iPort->Read(iStatus, ReadBuf, ReadBuf.Length()); sl@0: iNextXfer=EWriteXfer; sl@0: } sl@0: SetActive(); sl@0: } sl@0: sl@0: void CActiveRW::Stop() sl@0: { sl@0: iConsole->Printf(_L("Stopping.....\r\n")); sl@0: Cancel(); sl@0: } sl@0: sl@0: void CActiveRW::DoCancel() sl@0: { sl@0: iPort->WriteCancel(); sl@0: iPort->ReadCancel(); sl@0: } sl@0: sl@0: #pragma warning (default:4710)