kerneltest/e32test/usbho/t_usbdi/src/hostinterrupttransfers.cpp
branchRCL_3
changeset 257 3e88ff8f41d5
parent 256 c1f20ce4abcf
equal deleted inserted replaced
256:c1f20ce4abcf 257:3e88ff8f41d5
     1 // Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Eclipse Public License v1.0"
     4 // under the terms of the License "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    16 // 
    16 // 
    17 //
    17 //
    18 
    18 
    19 #include "hosttransfers.h"
    19 #include "hosttransfers.h"
    20 #include "testdebug.h"
    20 #include "testdebug.h"
    21 #include "OstTraceDefinitions.h"
       
    22 #ifdef OST_TRACE_COMPILER_IN_USE
       
    23 #include "hostinterrupttransfersTraces.h"
       
    24 #endif
       
    25 
    21 
    26 namespace NUnitTesting_USBDI
    22 namespace NUnitTesting_USBDI
    27 	{
    23 	{
    28 	
    24 	
    29 	
    25 	
    30 CInterruptTransfer::CInterruptTransfer(RUsbPipe& aPipe,RUsbInterface& aInterface,TInt aMaxTransferSize,MTransferObserver& aObserver,TInt aTransferId)
    26 CInterruptTransfer::CInterruptTransfer(RUsbPipe& aPipe,RUsbInterface& aInterface,TInt aMaxTransferSize,MTransferObserver& aObserver,TInt aTransferId)
    31 :	CBaseTransfer(aPipe,aInterface,aObserver,aTransferId),
    27 :	CBaseTransfer(aPipe,aInterface,aObserver,aTransferId),
    32 	iTransferDescriptor(aMaxTransferSize) // Allocate the buffer for interrupt transfers
    28 	iTransferDescriptor(aMaxTransferSize) // Allocate the buffer for interrupt transfers
    33 	{
    29 	{
    34     OstTraceFunctionEntryExt( CINTERRUPTTRANSFER_CINTERRUPTTRANSFER_ENTRY, this );
       
    35 
    30 
    36 	OstTraceFunctionExit1( CINTERRUPTTRANSFER_CINTERRUPTTRANSFER_EXIT, this );
       
    37 	}
    31 	}
    38 	
    32 	
    39 CInterruptTransfer::~CInterruptTransfer()
    33 CInterruptTransfer::~CInterruptTransfer()
    40 	{
    34 	{
    41 	OstTraceFunctionEntry1( CINTERRUPTTRANSFER_CINTERRUPTTRANSFER_ENTRY_DUP01, this );
    35 	LOG_FUNC 
    42 	
    36 	
    43 	// Cancel the transfer
    37 	// Cancel the transfer
    44 
    38 
    45 	Cancel();
    39 	Cancel();
    46 	OstTraceFunctionExit1( CINTERRUPTTRANSFER_CINTERRUPTTRANSFER_EXIT_DUP01, this );
       
    47 	}
    40 	}
    48 	
    41 	
    49 	
    42 	
    50 TPtrC8 CInterruptTransfer::DataPolled()
    43 TPtrC8 CInterruptTransfer::DataPolled()
    51 	{
    44 	{
    52 	OstTraceFunctionEntry1( CINTERRUPTTRANSFER_DATAPOLLED_ENTRY, this );
       
    53 	return iTransferDescriptor.Buffer();
    45 	return iTransferDescriptor.Buffer();
    54 	}
    46 	}
    55 	
    47 	
    56 	
    48 	
    57 TInt CInterruptTransfer::TransferInL(TInt aSize)
    49 TInt CInterruptTransfer::TransferInL(TInt aSize)
    58 	{
    50 	{
    59 	OstTraceFunctionEntryExt( CINTERRUPTTRANSFER_TRANSFERINL_ENTRY, this );
    51 	LOG_FUNC
    60 	
    52 	
    61 	// Activate the asynchronous transfer 	
    53 	// Activate the asynchronous transfer 	
    62 	OstTrace0(TRACE_NORMAL, CINTERRUPTTRANSFER_TRANSFERINL, "Activating interrupt in transfer");
    54 	RDebug::Printf("Activating interrupt in transfer");
    63 	iTransferDescriptor.SaveData(aSize);
    55 	iTransferDescriptor.SaveData(aSize);
    64 	Pipe().Transfer(iTransferDescriptor,iStatus);
    56 	Pipe().Transfer(iTransferDescriptor,iStatus);
    65 	SetActive();
    57 	SetActive();
    66 	OstTraceFunctionExitExt( CINTERRUPTTRANSFER_TRANSFERINL_EXIT, this, KErrNone );
       
    67 	return KErrNone;
    58 	return KErrNone;
    68 	}
    59 	}
    69 
    60 
    70 TInt CInterruptTransfer::RegisterTransferDescriptor()
    61 TInt CInterruptTransfer::RegisterTransferDescriptor()
    71 	{
    62 	{
    72 	OstTraceFunctionEntry1( CINTERRUPTTRANSFER_REGISTERTRANSFERDESCRIPTOR_ENTRY, this );
    63 	LOG_FUNC
    73 	
    64 	
    74 	// Register the transfer descriptor with the interface	
    65 	// Register the transfer descriptor with the interface	
    75 	TInt err(Interface().RegisterTransferDescriptor(iTransferDescriptor));
    66 	TInt err(Interface().RegisterTransferDescriptor(iTransferDescriptor));
    76 	if(err != KErrNone)
    67 	if(err != KErrNone)
    77 		{
    68 		{
    78 		OstTrace1(TRACE_NORMAL, CINTERRUPTTRANSFER_REGISTERTRANSFERDESCRIPTOR, "<Error %d> Unable to register transfer descriptor",err);
    69 		RDebug::Printf("<Error %d> Unable to register transfer descriptor",err);
    79 		}
    70 		}
    80 	OstTraceFunctionExitExt( CINTERRUPTTRANSFER_REGISTERTRANSFERDESCRIPTOR_EXIT, this, err );
       
    81 	return err;
    71 	return err;
    82 	}
    72 	}
    83 	
    73 	
    84 
    74 
    85 		
    75