sl@0: // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // template\template_variant\inc\soundsc_plat.h sl@0: // Definitions for the Template shared chunk sound physical device driver (PDD). sl@0: // sl@0: // sl@0: sl@0: /** sl@0: @file sl@0: @internalTechnology sl@0: @prototype sl@0: */ sl@0: sl@0: #ifndef __SOUNDSC_PLAT_H__ sl@0: #define __SOUNDSC_PLAT_H__ sl@0: sl@0: #include sl@0: #include sl@0: sl@0: //#define __KTRACE_SND(s) s; sl@0: #define __KTRACE_SND(s) sl@0: sl@0: // TO DO: (mandatory) sl@0: // Fill in the maximum number of requests that may be outstanding on the playback and record DMA channels for this device. sl@0: const TInt KTemplateMaxTxDmaRequests=2; sl@0: const TInt KTemplateMaxRxDmaRequests=2; sl@0: sl@0: // TO DO: (mandatory) sl@0: // Fill in the maximum transfer length supported on the playback and record DMA channels for this device. sl@0: const TInt KTemplateMaxTxDmaTransferLen=0; sl@0: const TInt KTemplateMaxRxDmaTransferLen=0; sl@0: sl@0: // Forward declarations sl@0: class DTemplateSoundScTxDmaRequest; sl@0: class DTemplateSoundScRxDmaRequest; sl@0: sl@0: /** sl@0: Factory class instantiated from ordinal 0. sl@0: The Template physical device for the shared chunk sound driver used to create the DSoundScPdd-derived channel objects. sl@0: */ sl@0: class DTemplateSoundScPddFactory : public DPhysicalDevice sl@0: { sl@0: public: sl@0: DTemplateSoundScPddFactory(); sl@0: ~DTemplateSoundScPddFactory(); sl@0: virtual TInt Install(); sl@0: virtual void GetCaps(TDes8& aDes) const; sl@0: virtual TInt Create(DBase*& aChannel, TInt aUnit, const TDesC8* aInfo, const TVersion& aVer); sl@0: virtual TInt Validate(TInt aUnit, const TDesC8* aInfo, const TVersion& aVer); sl@0: private: sl@0: /** The DFC queue (used also by the LDD). */ sl@0: TDynamicDfcQue* iDfcQ; sl@0: friend class DTemplateSoundScTxPdd; sl@0: friend class DTemplateSoundScRxPdd; sl@0: }; sl@0: sl@0: /** sl@0: The Template physical device driver (PDD) for the playback shared chunk sound driver. sl@0: */ sl@0: // sl@0: // TO DO: (optional) sl@0: // sl@0: // Add any private functions and data you require sl@0: // sl@0: class DTemplateSoundScTxPdd : public DSoundScPdd sl@0: { sl@0: public: sl@0: DTemplateSoundScTxPdd(); sl@0: ~DTemplateSoundScTxPdd(); sl@0: TInt DoCreate(); sl@0: sl@0: // Implementations of the pure virtual functions inherited from DSoundScPdd (called by LDD). sl@0: virtual TDfcQue* DfcQ(TInt aUnit); sl@0: virtual void GetChunkCreateInfo(TChunkCreateInfo& aChunkCreateInfo); sl@0: virtual void Caps(TDes8& aCapsBuf) const; sl@0: virtual TInt MaxTransferLen() const; sl@0: virtual TInt SetConfig(const TDesC8& aConfigBuf); sl@0: virtual TInt SetVolume(TInt aVolume); sl@0: virtual TInt StartTransfer(); sl@0: virtual TInt TransferData(TUint aTransferID,TLinAddr aLinAddr,TPhysAddr aPhysAddr,TInt aNumBytes); sl@0: virtual void StopTransfer(); sl@0: virtual TInt PauseTransfer(); sl@0: virtual TInt ResumeTransfer(); sl@0: virtual TInt PowerUp(); sl@0: virtual void PowerDown(); sl@0: virtual TInt CustomConfig(TInt aFunction,TAny* aParam); sl@0: virtual TInt TimeTransferred(TInt64& aTimeTransferred, TInt aStatus); sl@0: void PlayCallback(TUint aTransferID,TInt aTransferResult,TInt aBytesTransferred); sl@0: private: sl@0: void SetCaps(); sl@0: sl@0: private: sl@0: /** A pointer to the PDD factory. */ sl@0: DTemplateSoundScPddFactory* iPhysicalDevice; sl@0: /** The capabilities of this device. */ sl@0: TSoundFormatsSupportedV02 iCaps; sl@0: /** The playback DMA channel. */ sl@0: TDmaChannel* iDmaChannel; sl@0: /** The DMA request structures used for transfers. */ sl@0: DTemplateSoundScTxDmaRequest* iDmaRequest[KTemplateMaxTxDmaRequests]; sl@0: /** The number of outstanding DMA play requests on the DMA channel. */ sl@0: TInt iPendingPlay; sl@0: /** A flag selecting the next DMA request for transfer. */ sl@0: TInt iFlag; sl@0: friend class DTemplateSoundScPddFactory; sl@0: }; sl@0: sl@0: /** sl@0: The Template physical device driver (PDD) for the record shared chunk sound driver. sl@0: */ sl@0: // sl@0: // TO DO: (optional) sl@0: // sl@0: // Add any private functions and data you require sl@0: // sl@0: class DTemplateSoundScRxPdd : public DSoundScPdd sl@0: { sl@0: public: sl@0: DTemplateSoundScRxPdd(); sl@0: ~DTemplateSoundScRxPdd(); sl@0: TInt DoCreate(); sl@0: sl@0: // Implementations of the pure virtual functions inherited from DSoundScPdd (called by LDD). sl@0: virtual TDfcQue* DfcQ(TInt aUnit); sl@0: virtual void GetChunkCreateInfo(TChunkCreateInfo& aChunkCreateInfo); sl@0: virtual void Caps(TDes8& aCapsBuf) const; sl@0: virtual TInt MaxTransferLen() const; sl@0: virtual TInt SetConfig(const TDesC8& aConfigBuf); sl@0: virtual TInt SetVolume(TInt aVolume); sl@0: virtual TInt StartTransfer(); sl@0: virtual TInt TransferData(TUint aTransferID,TLinAddr aLinAddr,TPhysAddr aPhysAddr,TInt aNumBytes); sl@0: virtual void StopTransfer(); sl@0: virtual TInt PauseTransfer(); sl@0: virtual TInt ResumeTransfer(); sl@0: virtual TInt PowerUp(); sl@0: virtual void PowerDown(); sl@0: virtual TInt CustomConfig(TInt aFunction,TAny* aParam); sl@0: virtual TInt TimeTransferred(TInt64& aTimeTransferred, TInt aStatus); sl@0: void RecordCallback(TUint aTransferID,TInt aTransferResult,TInt aBytesTransferred); sl@0: private: sl@0: void SetCaps(); sl@0: sl@0: private: sl@0: /** A pointer to the PDD factory. */ sl@0: DTemplateSoundScPddFactory* iPhysicalDevice; sl@0: /** The capabilities of this device. */ sl@0: TSoundFormatsSupportedV02 iCaps; sl@0: /** The record DMA channel. */ sl@0: TDmaChannel* iDmaChannel; sl@0: /** The DMA request structures used for transfers. */ sl@0: DTemplateSoundScRxDmaRequest* iDmaRequest[KTemplateMaxRxDmaRequests]; sl@0: /** The number of outstanding DMA record requests on the DMA channel. */ sl@0: TInt iPendingRecord; sl@0: /** A flag selecting the next DMA request for transfer. */ sl@0: TInt iFlag; sl@0: friend class DTemplateSoundScPddFactory; sl@0: }; sl@0: sl@0: /** sl@0: Wrapper function for a shared chunk sound driver playback DMA request. sl@0: */ sl@0: class DTemplateSoundScTxDmaRequest : public DDmaRequest sl@0: { sl@0: public: sl@0: DTemplateSoundScTxDmaRequest(TDmaChannel& aChannel,DTemplateSoundScTxPdd* aPdd,TInt aMaxTransferSize=0); sl@0: static void DmaService(TResult aResult, TAny* aArg); sl@0: public: sl@0: /** Pointer back to the PDD. */ sl@0: DTemplateSoundScTxPdd* iPdd; sl@0: /** The transfer ID for this DMA request - supplied by the LDD. */ sl@0: TUint iTransferID; sl@0: /** The transfer sizes in progress. */ sl@0: TUint iTransferSize; sl@0: }; sl@0: sl@0: /** sl@0: Wrapper function for a shared chunk sound driver record DMA request. sl@0: */ sl@0: class DTemplateSoundScRxDmaRequest : public DDmaRequest sl@0: { sl@0: public: sl@0: DTemplateSoundScRxDmaRequest(TDmaChannel& aChannel,DTemplateSoundScRxPdd* aPdd,TInt aMaxTransferSize=0); sl@0: static void DmaService(TResult aResult, TAny* aArg); sl@0: public: sl@0: /** Pointer back to the PDD. */ sl@0: DTemplateSoundScRxPdd* iPdd; sl@0: /** The transfer ID for this DMA request - supplied by the LDD. */ sl@0: TUint iTransferID; sl@0: /** The transfer sizes in progress. */ sl@0: TUint iTransferSize; sl@0: }; sl@0: sl@0: #endif /* __SOUNDSC_PLAT_H__ */