--- a/kerneltest/e32test/iic/iic_psl/iic_client.cpp Tue Aug 31 16:34:26 2010 +0300
+++ b/kerneltest/e32test/iic/iic_psl/iic_client.cpp Wed Sep 01 12:34:56 2010 +0100
@@ -90,7 +90,7 @@
class DIicClientChan : public DBase
{
public:
- DIicClientChan(DIicBusChannel* aChan, TInt8 aChanNum, TUint8 aChanType):iChanNumber(aChanNum),iChanType(aChanType),iChan(aChan){};
+ DIicClientChan(DIicBusChannel* aChan, TInt8 aChanNum, TUint8 aChanType):iChan(aChan),iChanNumber(aChanNum),iChanType(aChanType){};
~DIicClientChan();
TInt GetChanNum()const {return iChanNumber;};
TUint8 GetChanType()const {return iChanType;};
@@ -112,13 +112,8 @@
#ifdef STANDALONE_CHANNEL
-#ifdef IIC_STUBS
-_LIT(KLddRootName,"iic_client_stubs");
+_LIT(KLddRootName,"iic_client_ctrless");
#else
-_LIT(KLddRootName,"iic_client_ctrless");
-#endif/*IIC_STUBS*/
-
-#else/*STANDALONE_CHANNEL*/
_LIT(KLddRootName,"iic_client");
#endif
_LIT(KIicClientThreadName,"IicClientLddThread");
@@ -408,7 +403,6 @@
TInt StaticExtension(TUint aId, TUint aFunction, TAny* aParam1, TAny* aParam2);
TInt CaptureChannel(TInt aBusId, TDes8* aConfigHdr, TIicBusSlaveCallback* aCallback, TInt& aChannelId, TBool aAsynch=NULL);
TInt ReleaseChannel(TInt aChannelId);
- TInt Spare1(TInt aBusId);
public:
inline void Lock() {Kern::MutexWait(*iArrayMutex);}
inline void Unlock() {Kern::MutexSignal(*iArrayMutex);}
@@ -505,7 +499,7 @@
// Constructor
{
CLIENT_PRINT(("> DDeviceIicClient::DDeviceIicClient()"));
- __KTRACE_OPT(KIIC, Kern::Printf("> DDeviceIicClient::DDeviceIicClient()"));
+ __KTRACE_OPT(KRESMANAGER, Kern::Printf("> DDeviceIicClient::DDeviceIicClient()"));
iParseMask=0; // No info, no PDD, no Units
iUnitsMask=0;
iVersion=TVersion(KIicClientMajorVersionNumber,
@@ -535,7 +529,7 @@
DDeviceIicClient::~DDeviceIicClient()
{
CLIENT_PRINT(("> DDeviceIicClient::~DDeviceIicClient()"));
- __KTRACE_OPT(KIIC, Kern::Printf("> DDeviceIicClient::~DDeviceIicClient()"));
+ __KTRACE_OPT(KRESMANAGER, Kern::Printf("> DDeviceIicClient::~DDeviceIicClient()"));
#ifdef STANDALONE_CHANNEL
//For Standalone Channel, the client is responsible for channel destroy
ChannelArray.ResetAndDestroy();
@@ -546,7 +540,7 @@
// Install the device driver.
{
CLIENT_PRINT(("> DDeviceIicClient::Install()"));
- __KTRACE_OPT(KIIC, Kern::Printf("> DDeviceIicClient::Install()"));
+ __KTRACE_OPT(KRESMANAGER, Kern::Printf("> DDeviceIicClient::Install()"));
return(SetName(&KLddRootName));
}
@@ -769,7 +763,7 @@
DIicClientChan* aClientChan;
TInt r = KErrNone;
DIicBusChannel *chan = NULL, *chanM = NULL, *chanS = NULL;
- TUint i;
+ TInt i;
for(i=0; i<NUM_CHANNELS_SPI; i++)
{
CLIENT_PRINT(("\n"));
@@ -1025,7 +1019,7 @@
// Destructor
{
CLIENT_PRINT(("> DChannelIicClient::~DChannelIicClient()"));
- __KTRACE_OPT(KIIC, Kern::Printf("> DChannelIicClient::~DChannelIicClient()"));
+ __KTRACE_OPT(KRESMANAGER, Kern::Printf("> DChannelIicClient::~DChannelIicClient()"));
delete iNotif;
iArrayMutex->Close(NULL);
iChanArrWrtSem->Close(NULL);
@@ -1330,56 +1324,6 @@
return r;
}
-//this function is added for improving the code coverage of IIC.
-//Spare1 is a placeholder for future expansion, and so returns KErrNotSupported.
-#ifdef STANDALONE_CHANNEL
-TInt DChannelIicClient::Spare1(TInt aBusId)
- {
- TInt r = KErrNone;
-
- TInt chanIndex = 0;
- DIicClientChan* chanPtr = NULL;
- if(r == KErrNone)
- {
- r = GetChanPtr(aBusId, chanIndex, chanPtr);
- if(r == KErrNone)
- {
- if(!chanPtr)
- {
- r = KErrArgument;
- }
- else
- {
- switch(chanPtr->GetChanType())
- {
- case DIicBusChannel::EMaster:
- {
- r = ((DIicBusChannelMaster*)(chanPtr->GetChannelPtr()))->Spare1(0,NULL,NULL);
- break;
- }
- case DIicBusChannel::EMasterSlave:
- {
- r = KErrNotSupported;
- break;
- }
- case DIicBusChannel::ESlave:
- {
- r = ((DIicBusChannelSlave*)(chanPtr->GetChannelPtr()))->Spare1(0,NULL,NULL);
- break;
- }
- default:
- {
- r = KErrArgument;
- }
- }
- }
- }
- }
- return r;
- }
-#endif
-
-#ifndef IIC_STUBS
void DChannelIicClient::DoCancel(TInt aMask)
{
// Cancel an outstanding request.
@@ -1462,68 +1406,7 @@
return;
}
-#else/*IIC_STUBS*/
-//should only be called in IIC_STUBS mode
-//DoCancel is used to cancel an asynchronous request which is still waiting in the queue and
-//has not yet been handled by IIC.
-//In the stub test, QueueTransaction should always return a KErrNotSupported error code
-//So we pretend there is an request waiting in the queue that can be cancelled by calling DoCancel.
-void DChannelIicClient::DoCancel(TInt aMask)
- {
- // Cancel an outstanding request.
- CLIENT_PRINT(("DChannelIicClient::DoCancel invoked with aMask=0x%x\n", aMask));
- // inline void CancelAsyncOperation(TRequestStatus* aStatus, TInt aBusId) {TInt* parms[2]; parms[0]=(TInt*)aStatus; parms[1]=(TInt*)aBusId;DoCancel((TInt)&parms[0]);}
- // aMask has the address on TInt* parms[2]
- // parms[0] = TRequestStatus pointer
- // parms[1] = Bus Identifier
- TInt* parms[2];
- TInt r=Kern::ThreadRawRead(iClient,(TAny*)aMask,&(parms[0]),2*sizeof(TInt*));
- if(r!=KErrNone)
- {
- CLIENT_PRINT(("DChannelIicClient::DoCancel ERROR - Can't read parms[]\n"));
- return; // Can't proceed if can't access request parameters
- }
- CLIENT_PRINT(("DChannelIicClient::DoCancel - TRequestStatus 0x%x, BusID = 0x%x\n",parms[0],parms[1]));
- TRequestStatus* status= (TRequestStatus*)(parms[0]);
-
- //A valid transaction object is required here in order to exercise the API
- TInt busIdI2c = (TInt)(parms[1]);
- TConfigI2cBufV01* i2cBuf=NULL;
- SET_BUS_TYPE(busIdI2c,EI2c);
- SET_CHAN_NUM(busIdI2c,10);
- // aDeviceId=1 ... 100kHz ... aTimeoutPeriod=100 ... aTransactionWaitCycles=10 - arbitrary paarmeters.
- r=CreateI2cBuf(i2cBuf, EI2cAddr7Bit, 36, ELittleEndian, 100);
- if(r!=KErrNone)
- {
- CLIENT_PRINT(("DChannelIicClient::DoCancel ERROR - Can't allocate memory for I2c buffer\n"));
- return; // Can't proceed if can't access request parameters
- }
-
- TIicBusTransfer* tfer = new TIicBusTransfer(TIicBusTransfer::EMasterWrite,8,i2cBuf);
- if(tfer == NULL)
- {
- CLIENT_PRINT(("DChannelIicClient::DoCancel ERROR - Can't allocate memory for the transfer\n"));
- delete i2cBuf;
- return;
- }
-
- TIicBusTransaction* transac = new TIicBusTransaction((TDes8*)i2cBuf, tfer);
- if(transac == NULL)
- {
- CLIENT_PRINT(("DChannelIicClient::DoCancel ERROR - Can't allocate memory for the transaction\n"));
- delete i2cBuf;
- delete tfer;
- return;
- }
-
- r = CancelTransaction(busIdI2c, transac);
- Kern::RequestComplete(iClient, status, r);
- delete i2cBuf;
- delete tfer;
- delete transac;
- }
-#endif/*IIC_STUBS*/
// Function to support preamble testing
void PreambleCallbackFunc(TIicBusTransaction* /*aTrans*/, TAny* aParam)
@@ -2192,6 +2075,7 @@
delete iI2cBuf;
iI2cBuf=NULL;
TIicBusTransfer* currTfer = iTfer;
+ TIicBusTransfer* nextTfer = NULL;
while(currTfer)
{
TIicBusTransfer* nextTfer = (TIicBusTransfer*)(currTfer->Next());
@@ -2203,6 +2087,7 @@
};
iTfer=NULL;
currTfer = iFdTfer;
+ nextTfer = NULL;
while(currTfer)
{
TIicBusTransfer* nextTfer = (TIicBusTransfer*)(currTfer->Next());
@@ -2512,17 +2397,8 @@
r = channelInterface.TestInterface();
break;
}
- case(RBusDevIicClient::ETestSpare1):
- {
- r = Spare1((TInt)a1);
- break;
- }
- case(RBusDevIicClient::ETestStaticEx):
- {
- r = StaticExtension((TUint32)a1, (TUint)RBusDevIicClient::ECtlIoNone, NULL, NULL);
- break;
- }
#endif
+
default:
{
CLIENT_PRINT(("DChannelIicClient::DoControl - unrecognised value for aId=0x%x\n",aId));