kerneltest/e32test/iic/iic_psl/iic_client.cpp
changeset 90 947f0dc9f7a8
parent 0 a41df078684a
child 199 189ece41fa29
equal deleted inserted replaced
52:2d65c2f76d7b 90:947f0dc9f7a8
    88 	}
    88 	}
    89 
    89 
    90 class DIicClientChan : public DBase
    90 class DIicClientChan : public DBase
    91 	{
    91 	{
    92 public:
    92 public:
    93 	DIicClientChan(DIicBusChannel* aChan, TInt8 aChanNum, TUint8 aChanType):iChan(aChan),iChanNumber(aChanNum),iChanType(aChanType){};
    93 	DIicClientChan(DIicBusChannel* aChan, TInt8 aChanNum, TUint8 aChanType):iChanNumber(aChanNum),iChanType(aChanType),iChan(aChan){};
    94 	~DIicClientChan();
    94 	~DIicClientChan();
    95 	TInt GetChanNum()const {return iChanNumber;};
    95 	TInt GetChanNum()const {return iChanNumber;};
    96 	TUint8 GetChanType()const {return iChanType;};
    96 	TUint8 GetChanType()const {return iChanType;};
    97 	DIicBusChannel* GetChannelPtr(){return iChan;};
    97 	DIicBusChannel* GetChannelPtr(){return iChan;};
    98 	inline DIicClientChan& operator=(DIicClientChan& aChan) {iChanNumber=aChan.iChanNumber; iChanType=aChan.iChanType; iChan=aChan.iChan; return *this;};
    98 	inline DIicClientChan& operator=(DIicClientChan& aChan) {iChanNumber=aChan.iChanNumber; iChanType=aChan.iChanType; iChan=aChan.iChan; return *this;};
   497 
   497 
   498 DDeviceIicClient::DDeviceIicClient()
   498 DDeviceIicClient::DDeviceIicClient()
   499 // Constructor
   499 // Constructor
   500     {
   500     {
   501 	CLIENT_PRINT(("> DDeviceIicClient::DDeviceIicClient()"));
   501 	CLIENT_PRINT(("> DDeviceIicClient::DDeviceIicClient()"));
   502     __KTRACE_OPT(KRESMANAGER, Kern::Printf("> DDeviceIicClient::DDeviceIicClient()"));
   502     __KTRACE_OPT(KIIC, Kern::Printf("> DDeviceIicClient::DDeviceIicClient()"));
   503     iParseMask=0;		// No info, no PDD, no Units
   503     iParseMask=0;		// No info, no PDD, no Units
   504     iUnitsMask=0;
   504     iUnitsMask=0;
   505     iVersion=TVersion(KIicClientMajorVersionNumber,
   505     iVersion=TVersion(KIicClientMajorVersionNumber,
   506 		      KIicClientMinorVersionNumber,
   506 		      KIicClientMinorVersionNumber,
   507 		      KIicClientBuildVersionNumber);
   507 		      KIicClientBuildVersionNumber);
   527 #endif /*STANDALONE_CHANNEL*/
   527 #endif /*STANDALONE_CHANNEL*/
   528 
   528 
   529 DDeviceIicClient::~DDeviceIicClient()
   529 DDeviceIicClient::~DDeviceIicClient()
   530     {
   530     {
   531 	CLIENT_PRINT(("> DDeviceIicClient::~DDeviceIicClient()"));
   531 	CLIENT_PRINT(("> DDeviceIicClient::~DDeviceIicClient()"));
   532     __KTRACE_OPT(KRESMANAGER, Kern::Printf("> DDeviceIicClient::~DDeviceIicClient()"));
   532     __KTRACE_OPT(KIIC, Kern::Printf("> DDeviceIicClient::~DDeviceIicClient()"));
   533 #ifdef STANDALONE_CHANNEL
   533 #ifdef STANDALONE_CHANNEL
   534     //For Standalone Channel, the client is responsible for channel destroy
   534     //For Standalone Channel, the client is responsible for channel destroy
   535     ChannelArray.ResetAndDestroy();
   535     ChannelArray.ResetAndDestroy();
   536 #endif
   536 #endif
   537 	}
   537 	}
   538 
   538 
   539 TInt DDeviceIicClient::Install()
   539 TInt DDeviceIicClient::Install()
   540 // Install the device driver.
   540 // Install the device driver.
   541     {
   541     {
   542 	CLIENT_PRINT(("> DDeviceIicClient::Install()"));
   542 	CLIENT_PRINT(("> DDeviceIicClient::Install()"));
   543     __KTRACE_OPT(KRESMANAGER, Kern::Printf("> DDeviceIicClient::Install()"));
   543     __KTRACE_OPT(KIIC, Kern::Printf("> DDeviceIicClient::Install()"));
   544     return(SetName(&KLddRootName));
   544     return(SetName(&KLddRootName));
   545     }
   545     }
   546 
   546 
   547 // Auxiliary functions for ordering entries in the array of TTransStatusPair pointers
   547 // Auxiliary functions for ordering entries in the array of TTransStatusPair pointers
   548 // The first is to enable searching by Transaction (used by the callback)
   548 // The first is to enable searching by Transaction (used by the callback)
   761 	//If in STANDALONE_CHANNEL mode, the client creates a list of channels
   761 	//If in STANDALONE_CHANNEL mode, the client creates a list of channels
   762 #ifdef STANDALONE_CHANNEL
   762 #ifdef STANDALONE_CHANNEL
   763 	DIicClientChan* aClientChan;
   763 	DIicClientChan* aClientChan;
   764 	TInt r = KErrNone;
   764 	TInt r = KErrNone;
   765 	DIicBusChannel *chan = NULL, *chanM = NULL, *chanS = NULL;
   765 	DIicBusChannel *chan = NULL, *chanM = NULL, *chanS = NULL;
   766 	TInt i;
   766 	TUint i;
   767 	for(i=0; i<NUM_CHANNELS_SPI; i++)
   767 	for(i=0; i<NUM_CHANNELS_SPI; i++)
   768 		{
   768 		{
   769 		CLIENT_PRINT(("\n"));
   769 		CLIENT_PRINT(("\n"));
   770 #if defined(MASTER_MODE)
   770 #if defined(MASTER_MODE)
   771 		if(CHANNEL_TYPE_SPI(i) == (DIicBusChannel::EMaster))
   771 		if(CHANNEL_TYPE_SPI(i) == (DIicBusChannel::EMaster))
  1017 
  1017 
  1018 DChannelIicClient::~DChannelIicClient()
  1018 DChannelIicClient::~DChannelIicClient()
  1019 // Destructor
  1019 // Destructor
  1020     {
  1020     {
  1021 	CLIENT_PRINT(("> DChannelIicClient::~DChannelIicClient()"));
  1021 	CLIENT_PRINT(("> DChannelIicClient::~DChannelIicClient()"));
  1022     __KTRACE_OPT(KRESMANAGER, Kern::Printf("> DChannelIicClient::~DChannelIicClient()"));
  1022     __KTRACE_OPT(KIIC, Kern::Printf("> DChannelIicClient::~DChannelIicClient()"));
  1023     delete iNotif;
  1023     delete iNotif;
  1024     iArrayMutex->Close(NULL);
  1024     iArrayMutex->Close(NULL);
  1025     iChanArrWrtSem->Close(NULL);
  1025     iChanArrWrtSem->Close(NULL);
  1026 	iDfcQue->Destroy();
  1026 	iDfcQue->Destroy();
  1027 	// decrement the DThread's reference count
  1027 	// decrement the DThread's reference count
  2073 	delete iSpiBuf;
  2073 	delete iSpiBuf;
  2074 	iSpiBuf=NULL;
  2074 	iSpiBuf=NULL;
  2075 	delete iI2cBuf;
  2075 	delete iI2cBuf;
  2076 	iI2cBuf=NULL;
  2076 	iI2cBuf=NULL;
  2077 	TIicBusTransfer* currTfer = iTfer;
  2077 	TIicBusTransfer* currTfer = iTfer;
  2078 	TIicBusTransfer* nextTfer = NULL;
       
  2079 	while(currTfer)
  2078 	while(currTfer)
  2080 		{
  2079 		{
  2081 		TIicBusTransfer* nextTfer = (TIicBusTransfer*)(currTfer->Next());
  2080 		TIicBusTransfer* nextTfer = (TIicBusTransfer*)(currTfer->Next());
  2082 		delete currTfer;
  2081 		delete currTfer;
  2083 		if(nextTfer)
  2082 		if(nextTfer)
  2085 		else
  2084 		else
  2086 			currTfer = NULL;
  2085 			currTfer = NULL;
  2087 		};
  2086 		};
  2088 	iTfer=NULL;
  2087 	iTfer=NULL;
  2089 	currTfer = iFdTfer;
  2088 	currTfer = iFdTfer;
  2090 	nextTfer = NULL;
       
  2091 	while(currTfer)
  2089 	while(currTfer)
  2092 		{
  2090 		{
  2093 		TIicBusTransfer* nextTfer = (TIicBusTransfer*)(currTfer->Next());
  2091 		TIicBusTransfer* nextTfer = (TIicBusTransfer*)(currTfer->Next());
  2094 		delete currTfer;
  2092 		delete currTfer;
  2095 		if(nextTfer)
  2093 		if(nextTfer)