baseport/syborg/soundsc/virtio_iohandler.h
author Gareth Stockwell <gareth.stockwell@accenture.com>
Wed, 22 Sep 2010 15:40:40 +0100
branchgraphics-phase-3
changeset 111 345f1c88c950
parent 45 01c1ffcc4fca
permissions -rw-r--r--
Fixes to syborg-graphicswrapper.vcproj These changes allow syborg-graphicswrapper to link against the hostthreadadapter and khronosapiwrapper libraries built by the graphics.simulator component. The .vcproj file uses relative paths, which requires that the following three packages are laid out as follows: os/ graphics adapt/ graphics.simulator qemu

/*
* 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:
* Accenture Ltd
*
* Contributors:
*
* Description: This file is a part of sound driver for Syborg adaptation.
*
*/

#ifndef VIRTIO_IOHANDLER_H
#define VIRTIO_IOHANDLER_H

#include "virtio.h"
#include <e32def.h>

namespace VirtIo
{

class DQueue;

class DIo;


class DIoHandler : public DBase, public MIoHandler
	{
	static const TUint KMaxClients = 4;
public:
	DIoHandler( TAny* aVirtIoBase, TUint aIntNum, TDfcQue* aDfcQue );
	
	virtual void RegisterClient( MIoCallback* aClient )
		{
		ASSERT( iClientCount < KMaxClients );
		iClients[iClientCount++] = aClient;
		}
	
	virtual void UnregisterClient( MIoCallback* aClient );

	TInt Construct();
	
	
	virtual ~DIoHandler();
	
	virtual MQueue& Queue( TUint id );

private:	
	void ScheduleCallback();
	
	void WaitForCompletion();
	
	void Wipe();
	
	static TBool CheckProcessing( TAny* aSelf );
	
	void InstallIsr();
	
	void UninstallIsr();
	
	static void ServeIsr( TAny* aSelf );

	static void ServeDfc( TAny* aSelf );
	
	TBool NotifyClients( MQueue& aQueue, Token aToken, TUint aBytesTransferred );
	
	void InterruptHandler();
	
	TAny* iVirtIoBase;
	TUint iIntNum;
	
	TDfcQue* iDfcQue;
	TDfc iDfc;
	
	//managed
	DIo* iVirtIo;
	
	TUint iQueueCount;
	//double managed
	DQueue** iQueue;
		
	TUint iClientCount;	
	MIoCallback* iClients[KMaxClients];
	
	};


} // namespace VirtIo

#endif