baseport/syborg/soundsc/shared_sound.h
changeset 45 01c1ffcc4fca
parent 21 8374da225e88
child 71 d00bf4f57250
equal deleted inserted replaced
44:72a7468afdd4 45:01c1ffcc4fca
     1 /*
     1 /*
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
     2 * This component and the accompanying materials are made available
     5 * under the terms of the License "Eclipse Public License v1.0"
     3 * under the terms of the License "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     4 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     5 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 *
     6 *
     9 * Initial Contributors:
     7 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
     8 * Nokia Corporation - initial contribution.
    11 *
     9 *
    12 * Contributors:
    10 * Contributors:
       
    11 * Accenture Ltd
    13 *
    12 *
    14 * Description:
    13 * Description: This file is a part of sound driver for Syborg adaptation.
    15 *
    14 *
    16 */
    15 */
    17 
    16 
    18 #ifndef __SYBORGSHARED_SOUND_H__
    17 #ifndef __SYBORGSHARED_SOUND_H__
    19 #define __SYBORGSHARED_SOUND_H__
    18 #define __SYBORGSHARED_SOUND_H__
    20 
    19 
    21 #include <soundsc.h>
    20 #include <soundsc.h>
    22 
    21 
    23 #ifdef _DEBUG
    22 #ifdef _ENABLE_SYBORG_AUDIO_DRIVER_DEBUG
    24 #define SYBORG_SOUND_DEBUG(x...) Kern::Printf(x)
    23 #define SYBORG_SOUND_DEBUG(x...) Kern::Printf(x)
    25 #else
    24 #else
    26 #define SYBORG_SOUND_DEBUG(x...)
    25 #define SYBORG_SOUND_DEBUG(x...)
    27 #endif
    26 #endif
    28 
    27 
       
    28 #undef ASSERT
       
    29 #define ASSERT(x) (x) || (Kern::Printf("Sound.pdd: ASSERTION FAILED: "#x),0);
       
    30 
       
    31 #include "virtio_audio.h"
       
    32 #include "virtio.h"
       
    33 #include "virtio_audio_defs.h"
       
    34 
       
    35 /// @brief defines the maximum size for a single audio data transfer
       
    36 static const TInt KMaxTransferLength = 128 * 1024;
       
    37 
       
    38 namespace VirtIo
       
    39 {
       
    40 class DIoHandler;
       
    41 }
       
    42 
    29 class DDriverSyborgSoundScPddFactory;
    43 class DDriverSyborgSoundScPddFactory;
    30 
    44 
    31 class DDriverSyborgSoundScPdd : public DSoundScPdd
    45 
       
    46 class DDriverSyborgSoundScPdd : public DSoundScPdd, VirtIo::MIoCallback
    32 	{
    47 	{
    33 public:
    48 public:
    34 
    49 
    35 	DDriverSyborgSoundScPdd();
    50 	DDriverSyborgSoundScPdd(DDriverSyborgSoundScPddFactory* aPhysicalDevice, 
       
    51 		TInt aUnitType, VirtIo::DIoHandler *aIoHandler, TUint aDataQueueId);
    36 	~DDriverSyborgSoundScPdd();
    52 	~DDriverSyborgSoundScPdd();
    37 	TInt DoCreate();
    53 	TInt DoCreate();
    38 	void GetChunkCreateInfo(TChunkCreateInfo& aChunkCreateInfo);
    54 	void GetChunkCreateInfo(TChunkCreateInfo& aChunkCreateInfo);
    39 	void Caps(TDes8& aCapsBuf) const;
    55 	void Caps(TDes8& aCapsBuf) const;
    40 	TInt MaxTransferLen() const;
    56 	TInt MaxTransferLen() const;
    46 	TInt PauseTransfer();
    62 	TInt PauseTransfer();
    47 	TInt ResumeTransfer();
    63 	TInt ResumeTransfer();
    48 	TInt PowerUp();
    64 	TInt PowerUp();
    49 	void PowerDown();
    65 	void PowerDown();
    50 	TInt CustomConfig(TInt aFunction, TAny* aParam);
    66 	TInt CustomConfig(TInt aFunction, TAny* aParam);
    51 	void Callback(TUint aTransferID, TInt aTransferResult, TInt aBytesTransferred);
       
    52 
       
    53 	void SetCaps();
    67 	void SetCaps();
    54         // There was a change in the signature for DfcQ() which
    68 	TDfcQue* DfcQ();
    55         // is a pure virtual method in the parent.
    69 	TDfcQue* DfcQ( TInt aUnit );
    56         //  for Symbian^2
       
    57         TDfcQue* DfcQ();
       
    58         //  for Symbian^3
       
    59 	TDfcQue* DfcQ(TInt aUnit);
       
    60 	
    70 	
    61 	TInt CalculateBufferTime(TInt aNumBytes);
    71 	TInt CalculateBufferTime(TInt aNumBytes);
       
    72 private:
       
    73 
       
    74 	// implementation of VirtIo::MIoCallback
       
    75 	virtual TBool VirtIoCallback( VirtIo::MIoHandler& aVirtIoHandler, VirtIo::MQueue& aQueue, 
       
    76 		VirtIo::Token aToken, TUint aBytesTransferred );
    62 
    77 
    63 public:
    78 public:
    64 	
    79 	
    65 	DDriverSyborgSoundScPddFactory*	iPhysicalDevice;
    80 	DDriverSyborgSoundScPddFactory*	iPhysicalDevice;
    66 	
    81 	
    67 	class TTransferArrayInfo{
    82 	TInt						iUnitType; //Play or Record
    68 
    83 
    69 public:
    84 	VirtIo::MIoHandler* iIoHandler;
    70 	TUint 						iTransferID;
       
    71 	TLinAddr 					iLinAddr;
       
    72 	TInt 						iNumBytes;
       
    73 	TInt						iPlayTime;
       
    74 	};
       
    75 	
    85 	
    76 	RArray<TTransferArrayInfo> iTransferArray;
    86 	TUint iDataQueueId;
    77 	
       
    78 	NTimer						iTimer;
       
    79 	
       
    80 	TInt						iUnitType; //Play or Record
       
    81 	
    87 	
    82 private:
    88 private:
    83 
    89 
    84 	TSoundFormatsSupportedV02	iCaps;
    90 	TSoundFormatsSupportedV02	iCaps;
    85 	
    91 	
    86 	TCurrentSoundFormatV02		iConfig;
    92 	TCurrentSoundFormatV02		iConfig;
       
    93 
       
    94 	VirtIo::Audio::DControl* iAudioControl;
    87 	
    95 	
    88 
       
    89 
       
    90 	};
    96 	};
    91 
    97 
    92 
       
    93 
       
    94 
       
    95 #endif 
    98 #endif