1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2007-2010 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 |
21 |
25 |
22 namespace NUnitTesting_USBDI |
26 namespace NUnitTesting_USBDI |
23 { |
27 { |
24 |
28 |
25 |
29 |
26 CInterruptTransfer::CInterruptTransfer(RUsbPipe& aPipe,RUsbInterface& aInterface,TInt aMaxTransferSize,MTransferObserver& aObserver,TInt aTransferId) |
30 CInterruptTransfer::CInterruptTransfer(RUsbPipe& aPipe,RUsbInterface& aInterface,TInt aMaxTransferSize,MTransferObserver& aObserver,TInt aTransferId) |
27 : CBaseTransfer(aPipe,aInterface,aObserver,aTransferId), |
31 : CBaseTransfer(aPipe,aInterface,aObserver,aTransferId), |
28 iTransferDescriptor(aMaxTransferSize) // Allocate the buffer for interrupt transfers |
32 iTransferDescriptor(aMaxTransferSize) // Allocate the buffer for interrupt transfers |
29 { |
33 { |
|
34 OstTraceFunctionEntryExt( CINTERRUPTTRANSFER_CINTERRUPTTRANSFER_ENTRY, this ); |
30 |
35 |
|
36 OstTraceFunctionExit1( CINTERRUPTTRANSFER_CINTERRUPTTRANSFER_EXIT, this ); |
31 } |
37 } |
32 |
38 |
33 CInterruptTransfer::~CInterruptTransfer() |
39 CInterruptTransfer::~CInterruptTransfer() |
34 { |
40 { |
35 LOG_FUNC |
41 OstTraceFunctionEntry1( CINTERRUPTTRANSFER_CINTERRUPTTRANSFER_ENTRY_DUP01, this ); |
36 |
42 |
37 // Cancel the transfer |
43 // Cancel the transfer |
38 |
44 |
39 Cancel(); |
45 Cancel(); |
|
46 OstTraceFunctionExit1( CINTERRUPTTRANSFER_CINTERRUPTTRANSFER_EXIT_DUP01, this ); |
40 } |
47 } |
41 |
48 |
42 |
49 |
43 TPtrC8 CInterruptTransfer::DataPolled() |
50 TPtrC8 CInterruptTransfer::DataPolled() |
44 { |
51 { |
|
52 OstTraceFunctionEntry1( CINTERRUPTTRANSFER_DATAPOLLED_ENTRY, this ); |
45 return iTransferDescriptor.Buffer(); |
53 return iTransferDescriptor.Buffer(); |
46 } |
54 } |
47 |
55 |
48 |
56 |
49 TInt CInterruptTransfer::TransferInL(TInt aSize) |
57 TInt CInterruptTransfer::TransferInL(TInt aSize) |
50 { |
58 { |
51 LOG_FUNC |
59 OstTraceFunctionEntryExt( CINTERRUPTTRANSFER_TRANSFERINL_ENTRY, this ); |
52 |
60 |
53 // Activate the asynchronous transfer |
61 // Activate the asynchronous transfer |
54 RDebug::Printf("Activating interrupt in transfer"); |
62 OstTrace0(TRACE_NORMAL, CINTERRUPTTRANSFER_TRANSFERINL, "Activating interrupt in transfer"); |
55 iTransferDescriptor.SaveData(aSize); |
63 iTransferDescriptor.SaveData(aSize); |
56 Pipe().Transfer(iTransferDescriptor,iStatus); |
64 Pipe().Transfer(iTransferDescriptor,iStatus); |
57 SetActive(); |
65 SetActive(); |
|
66 OstTraceFunctionExitExt( CINTERRUPTTRANSFER_TRANSFERINL_EXIT, this, KErrNone ); |
58 return KErrNone; |
67 return KErrNone; |
59 } |
68 } |
60 |
69 |
61 TInt CInterruptTransfer::RegisterTransferDescriptor() |
70 TInt CInterruptTransfer::RegisterTransferDescriptor() |
62 { |
71 { |
63 LOG_FUNC |
72 OstTraceFunctionEntry1( CINTERRUPTTRANSFER_REGISTERTRANSFERDESCRIPTOR_ENTRY, this ); |
64 |
73 |
65 // Register the transfer descriptor with the interface |
74 // Register the transfer descriptor with the interface |
66 TInt err(Interface().RegisterTransferDescriptor(iTransferDescriptor)); |
75 TInt err(Interface().RegisterTransferDescriptor(iTransferDescriptor)); |
67 if(err != KErrNone) |
76 if(err != KErrNone) |
68 { |
77 { |
69 RDebug::Printf("<Error %d> Unable to register transfer descriptor",err); |
78 OstTrace1(TRACE_NORMAL, CINTERRUPTTRANSFER_REGISTERTRANSFERDESCRIPTOR, "<Error %d> Unable to register transfer descriptor",err); |
70 } |
79 } |
|
80 OstTraceFunctionExitExt( CINTERRUPTTRANSFER_REGISTERTRANSFERDESCRIPTOR_EXIT, this, err ); |
71 return err; |
81 return err; |
72 } |
82 } |
73 |
83 |
74 |
84 |
75 |
85 |