baseport/syborg/soundsc/shared_sound.h
author johnathan.white@2718R8BGH51.accenture.com
Mon, 08 Mar 2010 18:45:03 +0000
changeset 46 b6935a90ca64
parent 45 01c1ffcc4fca
child 72 d00bf4f57250
permissions -rw-r--r--
Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer Add example minigui application with hooks to profiler (which writes results to S:\). Modified NGA framebuffer to run its own dfc queue at high priority

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

#ifndef __SYBORGSHARED_SOUND_H__
#define __SYBORGSHARED_SOUND_H__

#include <soundsc.h>

#ifdef _ENABLE_SYBORG_AUDIO_DRIVER_DEBUG
#define SYBORG_SOUND_DEBUG(x...) Kern::Printf(x)
#else
#define SYBORG_SOUND_DEBUG(x...)
#endif

#undef ASSERT
#define ASSERT(x) (x) || (Kern::Printf("Sound.pdd: ASSERTION FAILED: "#x),0);

#include "virtio_audio.h"
#include "virtio.h"
#include "virtio_audio_defs.h"

/// @brief defines the maximum size for a single audio data transfer
static const TInt KMaxTransferLength = 128 * 1024;

namespace VirtIo
{
class DIoHandler;
}

class DDriverSyborgSoundScPddFactory;


class DDriverSyborgSoundScPdd : public DSoundScPdd, VirtIo::MIoCallback
	{
public:

	DDriverSyborgSoundScPdd(DDriverSyborgSoundScPddFactory* aPhysicalDevice, 
		TInt aUnitType, VirtIo::DIoHandler *aIoHandler, TUint aDataQueueId);
	~DDriverSyborgSoundScPdd();
	TInt DoCreate();
	void GetChunkCreateInfo(TChunkCreateInfo& aChunkCreateInfo);
	void Caps(TDes8& aCapsBuf) const;
	TInt MaxTransferLen() const;
	TInt SetConfig(const TDesC8& aConfigBuf);
	TInt SetVolume(TInt aVolume);
	TInt StartTransfer();
	TInt TransferData(TUint aTransferID, TLinAddr aLinAddr, TPhysAddr aPhysAddr, TInt aNumBytes);
	void StopTransfer();
	TInt PauseTransfer();
	TInt ResumeTransfer();
	TInt PowerUp();
	void PowerDown();
	TInt CustomConfig(TInt aFunction, TAny* aParam);
	void SetCaps();
	TDfcQue* DfcQ();
	TDfcQue* DfcQ( TInt aUnit );
	
	TInt CalculateBufferTime(TInt aNumBytes);
private:

	// implementation of VirtIo::MIoCallback
	virtual TBool VirtIoCallback( VirtIo::MIoHandler& aVirtIoHandler, VirtIo::MQueue& aQueue, 
		VirtIo::Token aToken, TUint aBytesTransferred );

public:
	
	DDriverSyborgSoundScPddFactory*	iPhysicalDevice;
	
	TInt						iUnitType; //Play or Record

	VirtIo::MIoHandler* iIoHandler;
	
	TUint iDataQueueId;
	
private:

	TSoundFormatsSupportedV02	iCaps;
	
	TCurrentSoundFormatV02		iConfig;

	VirtIo::Audio::DControl* iAudioControl;
	
	};

#endif