baseport/syborg/soundsc/virtio_io.h
author Gareth Stockwell <gareth.stockwell@accenture.com>
Mon, 06 Sep 2010 16:25:43 +0100
changeset 106 3bc1a978be44
parent 45 01c1ffcc4fca
permissions -rw-r--r--
Fix for Bug 3671 - QEMU GDB stub listens on IPv6-only port on Windows 7 The connection string used by the GDB stub does not specify which version of the Internet Protocol should be used by the port on which it listens. On host platforms with IPv6 support, such as Windows 7, this means that the stub listens on an IPv6-only port. Since the GDB client uses IPv4, this means that the client cannot connect to 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_IO_H
#define VIRTIO_IO_H

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

namespace VirtIo
{

class DIo : public DBase, public MIo
	{
public:
	DIo( TAny* aIoBase ): iIoBase( reinterpret_cast<TUint32*>( aIoBase ) )
		{ }
	
	virtual void GetDeviceIds( TUint32 &aPeripheralId, TUint32 &aDeviceId );
	
	virtual void SetQueueBase( TUint aQId, TAny* iDescRegion );
	
	virtual TAny* GetQueueBase( TUint aQId);
	
	virtual TUint GetQueueCount( TUint aQId )
		{
		write(EIoQueueSelect, aQId);
		return read(EIoQueueSize);
		}
	
	virtual void PostQueue( TUint aQId )
		{ write(EIoQueueNotify, aQId); SYBORG_VIRTIO_DEBUG("PostQueue Q%d", aQId ); }
		
	virtual TBool EnableInterrupt( TBool aEnable )
		{ return swap(EIoInterruptEnable, aEnable?1:0); }

	virtual void SetStatus( TUint status )
		{ write(EIoStatus, status ); }
		
	virtual void ClearInteruptStatus()
		{ write( EIoInterruptStatus, 1 ); }

	virtual TBool InteruptStatus()
		{ return read( EIoInterruptStatus ); }
		
	
	void Reset()
		{ SetStatus( EStatusReset ); };
	
	
private:	
	void write(TUint idx, TUint32 value )
		{ iIoBase[idx] = value; }
		
	TUint32 read(TUint idx)
		{ return iIoBase[idx]; }
		
	TUint32 swap(TUint idx, TUint32 value )
		{ 
		TUint32 t = iIoBase[idx]; 
		iIoBase[idx] = value; 
		return t;
		}
	
	volatile TUint32* iIoBase;

	};

} // namespace VirtIo

#endif