diff -r 000000000000 -r a41df078684a kernel/eka/include/drivers/iic_channel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/kernel/eka/include/drivers/iic_channel.h Mon Oct 19 15:55:17 2009 +0100 @@ -0,0 +1,901 @@ +// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// e32/include/drivers/iic_channel.h +// Include file for channel implementation +// +// WARNING: This file contains some APIs which are internal and are subject +// to change without notice. Such APIs should therefore not be used +// outside the Kernel and Hardware Services package. + +/** +@file +@internalTechnology +*/ +#ifndef __IIC_CHANNEL_H__ +#define __IIC_CHANNEL_H__ + +#ifdef STANDALONE_CHANNEL +#include +#else +#include +#endif + +static const char KIicChannelPanic[]="Iic Channel PIL"; + +const static TInt KChannelTypeMask = 0x03; +const static TInt KBusTypeShift = 2; +const static TInt KBusTypeMask = 0x07< KMaxWaitTime + */ + TInt SetMasterWaitTime(TInt8 aWaitTime); + /** + @publishedPartner + @prototype 9.6 + Function invoked by the PSL to get the timeout period to wait for a response from the bus master + + @return The wait time, in milliseconds + */ + inline TInt8 GetMasterWaitTime(); + /** + @publishedPartner + @prototype 9.6 + Function invoked by the PSL to set the timeout period to wait for a response from the Client + + @param aWaitTime Argument specifying the wait time, in milliseconds (limit=KMaxWaitTime) + @return KErrNone + */ + TInt SetClientWaitTime(TInt8 aWaitTime); + /** + @publishedPartner + @prototype 9.6 + Function invoked by the PSL to get the timeout period to wait for a response from the Client + + @return The wait time, in milliseconds + */ + inline TInt8 GetClientWaitTime(); +private: + //Method to instruct PSL to indicate a bus error to the bus Master, then return + void SendBusErrorAndReturn(); + void SetChannelId(TInt& aChannelId); + + void CompleteAsynchCapture(TInt aResult); + void SlaveTimerCallBack(); + static void SlaveStaticCB(TAny* aDumPtr); + +protected: + TInt8 iRxGranularity; + TInt8 iTxGranularity; + TInt8 iNumRxWords; + TInt8 iNumTxWords; + TInt8 iRxOffset; + TInt8 iTxOffset; +private: + TInt8 iChannelInUse; + TInt8 iSpare1; +protected: + TInt16 iChannelId; // channel identifier to be returned to client (in aChannelId) +private: + TInt16 iInstanceCount; // instance count part of aChannelId +protected: + TDes8* iConfigHeader; + TInt8* iTxBuf; + TInt8* iRxBuf; +private: + TIicBusSlaveCallback* iNotif; + TDfc* iClientTimeoutDfc; // To be queued on the dfc queue used by iNotif + DThread* iClient; // stored when client captures channel +#ifndef STANDALONE_CHANNEL + DIicBusController* iController; +#endif + + TInt8 iTimerState; + TInt8 iMasterWaitTime; // 8 bits allows maximum wait time of 0.25 seconds + TInt8 iClientWaitTime; // 8 bits allows maximum wait time of 0.25 seconds + TInt8 iSpare2; + + TInt8 iReqTrig; // Represents the trigger required by the Client (bitmask from TIicBusSlaveTrigger). + TInt8 iAccumTrig; // Represents the events accumulated during the current trigger period + TInt16 iSpare3; + + TSpinLock iSpinLock; + TAny* iReserved1; + TAny* iReserved2; + + friend class DIicBusChannelMasterSlave; + friend class DIicBusController; // For static method DIicBusController::DeRegisterChannel + }; + +/** +@internalComponent +@prototype 9.6 +The Master-Slave Channel class (not for derivation) +*/ +class DIicBusChannelMasterSlave : public DIicBusChannel + { +public: + // constructor +#ifdef STANDALONE_CHANNEL + IMPORT_C DIicBusChannelMasterSlave(TBusType aBusType, TChannelDuplex aChanDuplex, DIicBusChannelMaster* aMasterChan, DIicBusChannelSlave* aSlaveChan); +#else + inline DIicBusChannelMasterSlave(TBusType aBusType, TChannelDuplex aChanDuplex, DIicBusChannelMaster* aMasterChan, DIicBusChannelSlave* aSlaveChan); +#endif + ~DIicBusChannelMasterSlave(){delete iMasterChannel; delete iSlaveChannel; } + inline TInt DoCreate(); + // Master side interface to Bus Controller + virtual TInt QueueTransaction(TIicBusTransaction* aTransaction); + virtual TInt QueueTransaction(TIicBusTransaction* aTransaction, TIicBusCallback* aCallback); + inline TInt CancelTransaction(TIicBusTransaction* aTransaction); + + // Slave side interface to Bus Controller + virtual TInt CaptureChannel(TDes8* aConfigHdr, TIicBusSlaveCallback* aCallback, TInt& aChannelId, TBool aAsynch); + virtual TInt ReleaseChannel(); + inline TInt RegisterRxBuffer(TPtr8 aRxBuffer, TInt8 aBufGranularity, TInt8 aNumWords, TInt8 aOffset); + inline TInt RegisterTxBuffer(TPtr8 aTxBuffer, TInt8 aBufGranularity, TInt8 aNumWords, TInt8 aOffset); + inline TInt SetNotificationTrigger(TInt aTrigger); + virtual TInt StaticExtension(TUint aFunction, TAny* aParam1, TAny* aParam2); + +private: + // Base class support + virtual TInt CheckHdr(TDes8* /*aHdr*/){ __ASSERT_DEBUG(0,Kern::Fault("DIicBusChannelMasterSlave::CheckHdr",__LINE__)); \ + return KErrGeneral;}; // Not accessed. PSL implementation for Master or Slave used. +protected: + DIicBusChannelMaster* iMasterChannel; + DIicBusChannelSlave* iSlaveChannel; +private: + + friend class DIicBusChannelMaster; + friend class DIicBusChannelSlave; + friend class DIicBusController; // For static method DIicBusController::DeRegisterChannel + }; + +#include + +#endif // #ifndef __IIC_CHANNEL_H__ +