bsptemplate/asspandvariant/template_assp/iic/iic_slave.h
author Tom Cosgrove <tom.cosgrove@nokia.com>
Fri, 28 May 2010 16:29:07 +0100
changeset 30 8aab599e3476
parent 0 a41df078684a
permissions -rw-r--r--
Fix for bug 2283 (RVCT 4.0 support is missing from PDK 3.0.h) Have multiple extension sections in the bld.inf, one for each version of the compiler. The RVCT version building the tools will build the runtime libraries for its version, but make sure we extract all the other versions from zip archives. Also add the archive for RVCT4.

/*
* Copyright (c) 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:
*
*/


#ifndef __IIC_SLAVE_H__
#define __IIC_SLAVE_H__

#include <drivers/iic_channel.h>

class DIicBusChannelSlavePsl: public DIicBusChannelSlave
	{

public:
	static DIicBusChannelSlavePsl* New(TInt aChannelNumber, const TBusType aBusType,
	                              const TChannelDuplex aChanDuplex);

	// Gateway function for PSL implementation
	virtual TInt DoRequest(TInt aOperation);

	DIicBusChannelSlavePsl(TInt aChannelNumber, const TBusType aBusType,
	                 const TChannelDuplex aChanDuplex);

private:
	// Overriders for base class pure-virtual methods
	virtual TInt DoCreate(); // second-stage construction,
	virtual TInt CheckHdr(TDes8* aHdrBuff);
	virtual void ProcessData(TInt aTrigger, TIicBusSlaveCallback* aCb);

	// Internal methods..
	TBool TransConfigDiffersFromPrev();
	TInt ConfigureInterface();
	TInt AsynchConfigureInterface();
	TInt InitTransfer();

	// ISR handler and other static methods..
	static void IicPslIsr(TAny* aPtr);
	static void TimeoutCallback(TAny* aPtr);
	static inline void NotifyClientEnd(DIicBusChannelSlavePsl* aPtr);

	// Register base for the Master channel
	TUint iSlaveChanBase;

	// Interrupt ID for the Master channel
	TInt iSlaveIntId;

	// Bit mask of the transfer triggers managed by the channel
	TUint8 iTrigger;

	// Granularity, expressed as the number of bytes in a word
	TInt8 iWordSize;

	// Flag indicating transmission activity - optional, may not be required for all bus types
	// In the template example it is used to indicate transitions on a chip-select line, such as for SPI.
	TInt8 iInProgress;

	// Dummy variable used merely to demonstrate the asynchronous channel capture mechanism
	// See method AsynchConfigureInterface
	TInt8 iAsyncConfig;

	// Pointers to buffers used for Rx and Tx transfers
	TInt8 *iTxData;
	TInt8 *iRxData;
	TInt8 *iTxDataEnd;
	TInt8 *iRxDataEnd;

	// Timer to guard 'while' loops..
	NTimer iHwGuardTimer;

	// status of the transaction
	volatile TInt iTransactionStatus;
	};

#endif /*__IIC_SLAVE_H__*/