os/kernelhwsrv/kerneltest/e32test/usbho/t_usbdi/src/hostinterrupttransfers.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 // Copyright (c) 2007-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 the License "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 // @file hostinterrupttransfers.cpp
    15 // @internalComponent
    16 // 
    17 //
    18 
    19 #include "hosttransfers.h"
    20 #include "testdebug.h"
    21 
    22 namespace NUnitTesting_USBDI
    23 	{
    24 	
    25 	
    26 CInterruptTransfer::CInterruptTransfer(RUsbPipe& aPipe,RUsbInterface& aInterface,TInt aMaxTransferSize,MTransferObserver& aObserver,TInt aTransferId)
    27 :	CBaseTransfer(aPipe,aInterface,aObserver,aTransferId),
    28 	iTransferDescriptor(aMaxTransferSize) // Allocate the buffer for interrupt transfers
    29 	{
    30 
    31 	}
    32 	
    33 CInterruptTransfer::~CInterruptTransfer()
    34 	{
    35 	LOG_FUNC 
    36 	
    37 	// Cancel the transfer
    38 
    39 	Cancel();
    40 	}
    41 	
    42 	
    43 TPtrC8 CInterruptTransfer::DataPolled()
    44 	{
    45 	return iTransferDescriptor.Buffer();
    46 	}
    47 	
    48 	
    49 TInt CInterruptTransfer::TransferInL(TInt aSize)
    50 	{
    51 	LOG_FUNC
    52 	
    53 	// Activate the asynchronous transfer 	
    54 	RDebug::Printf("Activating interrupt in transfer");
    55 	iTransferDescriptor.SaveData(aSize);
    56 	Pipe().Transfer(iTransferDescriptor,iStatus);
    57 	SetActive();
    58 	return KErrNone;
    59 	}
    60 
    61 TInt CInterruptTransfer::RegisterTransferDescriptor()
    62 	{
    63 	LOG_FUNC
    64 	
    65 	// Register the transfer descriptor with the interface	
    66 	TInt err(Interface().RegisterTransferDescriptor(iTransferDescriptor));
    67 	if(err != KErrNone)
    68 		{
    69 		RDebug::Printf("<Error %d> Unable to register transfer descriptor",err);
    70 		}
    71 	return err;
    72 	}
    73 	
    74 
    75 		
    76 	}