Update contrib.
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // template\template_variant\inc\soundsc_plat.h
15 // Definitions for the Template shared chunk sound physical device driver (PDD).
25 #ifndef __SOUNDSC_PLAT_H__
26 #define __SOUNDSC_PLAT_H__
28 #include <drivers/dma.h>
29 #include <drivers/soundsc.h>
31 //#define __KTRACE_SND(s) s;
32 #define __KTRACE_SND(s)
35 // Fill in the maximum number of requests that may be outstanding on the playback and record DMA channels for this device.
36 const TInt KTemplateMaxTxDmaRequests=2;
37 const TInt KTemplateMaxRxDmaRequests=2;
40 // Fill in the maximum transfer length supported on the playback and record DMA channels for this device.
41 const TInt KTemplateMaxTxDmaTransferLen=0;
42 const TInt KTemplateMaxRxDmaTransferLen=0;
44 // Forward declarations
45 class DTemplateSoundScTxDmaRequest;
46 class DTemplateSoundScRxDmaRequest;
49 Factory class instantiated from ordinal 0.
50 The Template physical device for the shared chunk sound driver used to create the DSoundScPdd-derived channel objects.
52 class DTemplateSoundScPddFactory : public DPhysicalDevice
55 DTemplateSoundScPddFactory();
56 ~DTemplateSoundScPddFactory();
57 virtual TInt Install();
58 virtual void GetCaps(TDes8& aDes) const;
59 virtual TInt Create(DBase*& aChannel, TInt aUnit, const TDesC8* aInfo, const TVersion& aVer);
60 virtual TInt Validate(TInt aUnit, const TDesC8* aInfo, const TVersion& aVer);
62 /** The DFC queue (used also by the LDD). */
63 TDynamicDfcQue* iDfcQ;
64 friend class DTemplateSoundScTxPdd;
65 friend class DTemplateSoundScRxPdd;
69 The Template physical device driver (PDD) for the playback shared chunk sound driver.
74 // Add any private functions and data you require
76 class DTemplateSoundScTxPdd : public DSoundScPdd
79 DTemplateSoundScTxPdd();
80 ~DTemplateSoundScTxPdd();
83 // Implementations of the pure virtual functions inherited from DSoundScPdd (called by LDD).
84 virtual TDfcQue* DfcQ(TInt aUnit);
85 virtual void GetChunkCreateInfo(TChunkCreateInfo& aChunkCreateInfo);
86 virtual void Caps(TDes8& aCapsBuf) const;
87 virtual TInt MaxTransferLen() const;
88 virtual TInt SetConfig(const TDesC8& aConfigBuf);
89 virtual TInt SetVolume(TInt aVolume);
90 virtual TInt StartTransfer();
91 virtual TInt TransferData(TUint aTransferID,TLinAddr aLinAddr,TPhysAddr aPhysAddr,TInt aNumBytes);
92 virtual void StopTransfer();
93 virtual TInt PauseTransfer();
94 virtual TInt ResumeTransfer();
95 virtual TInt PowerUp();
96 virtual void PowerDown();
97 virtual TInt CustomConfig(TInt aFunction,TAny* aParam);
98 virtual TInt TimeTransferred(TInt64& aTimeTransferred, TInt aStatus);
99 void PlayCallback(TUint aTransferID,TInt aTransferResult,TInt aBytesTransferred);
104 /** A pointer to the PDD factory. */
105 DTemplateSoundScPddFactory* iPhysicalDevice;
106 /** The capabilities of this device. */
107 TSoundFormatsSupportedV02 iCaps;
108 /** The playback DMA channel. */
109 TDmaChannel* iDmaChannel;
110 /** The DMA request structures used for transfers. */
111 DTemplateSoundScTxDmaRequest* iDmaRequest[KTemplateMaxTxDmaRequests];
112 /** The number of outstanding DMA play requests on the DMA channel. */
114 /** A flag selecting the next DMA request for transfer. */
116 friend class DTemplateSoundScPddFactory;
120 The Template physical device driver (PDD) for the record shared chunk sound driver.
125 // Add any private functions and data you require
127 class DTemplateSoundScRxPdd : public DSoundScPdd
130 DTemplateSoundScRxPdd();
131 ~DTemplateSoundScRxPdd();
134 // Implementations of the pure virtual functions inherited from DSoundScPdd (called by LDD).
135 virtual TDfcQue* DfcQ(TInt aUnit);
136 virtual void GetChunkCreateInfo(TChunkCreateInfo& aChunkCreateInfo);
137 virtual void Caps(TDes8& aCapsBuf) const;
138 virtual TInt MaxTransferLen() const;
139 virtual TInt SetConfig(const TDesC8& aConfigBuf);
140 virtual TInt SetVolume(TInt aVolume);
141 virtual TInt StartTransfer();
142 virtual TInt TransferData(TUint aTransferID,TLinAddr aLinAddr,TPhysAddr aPhysAddr,TInt aNumBytes);
143 virtual void StopTransfer();
144 virtual TInt PauseTransfer();
145 virtual TInt ResumeTransfer();
146 virtual TInt PowerUp();
147 virtual void PowerDown();
148 virtual TInt CustomConfig(TInt aFunction,TAny* aParam);
149 virtual TInt TimeTransferred(TInt64& aTimeTransferred, TInt aStatus);
150 void RecordCallback(TUint aTransferID,TInt aTransferResult,TInt aBytesTransferred);
155 /** A pointer to the PDD factory. */
156 DTemplateSoundScPddFactory* iPhysicalDevice;
157 /** The capabilities of this device. */
158 TSoundFormatsSupportedV02 iCaps;
159 /** The record DMA channel. */
160 TDmaChannel* iDmaChannel;
161 /** The DMA request structures used for transfers. */
162 DTemplateSoundScRxDmaRequest* iDmaRequest[KTemplateMaxRxDmaRequests];
163 /** The number of outstanding DMA record requests on the DMA channel. */
165 /** A flag selecting the next DMA request for transfer. */
167 friend class DTemplateSoundScPddFactory;
171 Wrapper function for a shared chunk sound driver playback DMA request.
173 class DTemplateSoundScTxDmaRequest : public DDmaRequest
176 DTemplateSoundScTxDmaRequest(TDmaChannel& aChannel,DTemplateSoundScTxPdd* aPdd,TInt aMaxTransferSize=0);
177 static void DmaService(TResult aResult, TAny* aArg);
179 /** Pointer back to the PDD. */
180 DTemplateSoundScTxPdd* iPdd;
181 /** The transfer ID for this DMA request - supplied by the LDD. */
183 /** The transfer sizes in progress. */
188 Wrapper function for a shared chunk sound driver record DMA request.
190 class DTemplateSoundScRxDmaRequest : public DDmaRequest
193 DTemplateSoundScRxDmaRequest(TDmaChannel& aChannel,DTemplateSoundScRxPdd* aPdd,TInt aMaxTransferSize=0);
194 static void DmaService(TResult aResult, TAny* aArg);
196 /** Pointer back to the PDD. */
197 DTemplateSoundScRxPdd* iPdd;
198 /** The transfer ID for this DMA request - supplied by the LDD. */
200 /** The transfer sizes in progress. */
204 #endif /* __SOUNDSC_PLAT_H__ */