os/kernelhwsrv/bsptemplate/asspandvariant/template_variant/inc/soundsc_plat.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of the License "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
// template\template_variant\inc\soundsc_plat.h
sl@0
    15
// Definitions for the Template shared chunk sound physical device driver (PDD).
sl@0
    16
// 
sl@0
    17
//
sl@0
    18
sl@0
    19
/**
sl@0
    20
 @file
sl@0
    21
 @internalTechnology
sl@0
    22
 @prototype
sl@0
    23
*/
sl@0
    24
sl@0
    25
#ifndef __SOUNDSC_PLAT_H__
sl@0
    26
#define __SOUNDSC_PLAT_H__
sl@0
    27
sl@0
    28
#include <drivers/dma.h>
sl@0
    29
#include <drivers/soundsc.h>
sl@0
    30
sl@0
    31
//#define __KTRACE_SND(s) s;
sl@0
    32
#define __KTRACE_SND(s)
sl@0
    33
sl@0
    34
// TO DO: (mandatory)
sl@0
    35
// Fill in the maximum number of requests that may be outstanding on the playback and record DMA channels for this device.
sl@0
    36
const TInt KTemplateMaxTxDmaRequests=2;
sl@0
    37
const TInt KTemplateMaxRxDmaRequests=2;
sl@0
    38
sl@0
    39
// TO DO: (mandatory)
sl@0
    40
// Fill in the maximum transfer length supported  on the playback and record DMA channels for this device.
sl@0
    41
const TInt KTemplateMaxTxDmaTransferLen=0;
sl@0
    42
const TInt KTemplateMaxRxDmaTransferLen=0;
sl@0
    43
sl@0
    44
// Forward declarations
sl@0
    45
class DTemplateSoundScTxDmaRequest;
sl@0
    46
class DTemplateSoundScRxDmaRequest;
sl@0
    47
sl@0
    48
/**
sl@0
    49
Factory class instantiated from ordinal 0.
sl@0
    50
The Template physical device for the shared chunk sound driver used to create the DSoundScPdd-derived channel objects.
sl@0
    51
*/
sl@0
    52
class DTemplateSoundScPddFactory : public DPhysicalDevice
sl@0
    53
	{
sl@0
    54
public:
sl@0
    55
	DTemplateSoundScPddFactory();
sl@0
    56
	~DTemplateSoundScPddFactory();
sl@0
    57
	virtual TInt Install();
sl@0
    58
	virtual void GetCaps(TDes8& aDes) const;
sl@0
    59
	virtual TInt Create(DBase*& aChannel, TInt aUnit, const TDesC8* aInfo, const TVersion& aVer);
sl@0
    60
	virtual TInt Validate(TInt aUnit, const TDesC8* aInfo, const TVersion& aVer);
sl@0
    61
private:
sl@0
    62
	/** The DFC queue (used also by the LDD). */ 
sl@0
    63
	TDynamicDfcQue* iDfcQ;
sl@0
    64
	friend class DTemplateSoundScTxPdd;
sl@0
    65
	friend class DTemplateSoundScRxPdd;	
sl@0
    66
	};
sl@0
    67
sl@0
    68
/**
sl@0
    69
The Template physical device driver (PDD) for the playback shared chunk sound driver.
sl@0
    70
*/
sl@0
    71
//
sl@0
    72
// TO DO: (optional)
sl@0
    73
//
sl@0
    74
// Add any private functions and data you require
sl@0
    75
//
sl@0
    76
class DTemplateSoundScTxPdd : public DSoundScPdd
sl@0
    77
	{
sl@0
    78
public:
sl@0
    79
	DTemplateSoundScTxPdd();
sl@0
    80
	~DTemplateSoundScTxPdd();
sl@0
    81
	TInt DoCreate();
sl@0
    82
sl@0
    83
	// Implementations of the pure virtual functions inherited from DSoundScPdd (called by LDD).
sl@0
    84
	virtual TDfcQue* DfcQ(TInt aUnit);
sl@0
    85
	virtual void GetChunkCreateInfo(TChunkCreateInfo& aChunkCreateInfo);
sl@0
    86
	virtual void Caps(TDes8& aCapsBuf) const;
sl@0
    87
	virtual TInt MaxTransferLen() const;
sl@0
    88
	virtual TInt SetConfig(const TDesC8& aConfigBuf);
sl@0
    89
	virtual TInt SetVolume(TInt aVolume);
sl@0
    90
	virtual TInt StartTransfer();
sl@0
    91
	virtual TInt TransferData(TUint aTransferID,TLinAddr aLinAddr,TPhysAddr aPhysAddr,TInt aNumBytes);
sl@0
    92
	virtual void StopTransfer();
sl@0
    93
	virtual TInt PauseTransfer();
sl@0
    94
	virtual TInt ResumeTransfer();
sl@0
    95
	virtual TInt PowerUp();
sl@0
    96
	virtual void PowerDown();
sl@0
    97
	virtual TInt CustomConfig(TInt aFunction,TAny* aParam);
sl@0
    98
	virtual TInt TimeTransferred(TInt64& aTimeTransferred, TInt aStatus);
sl@0
    99
	void PlayCallback(TUint aTransferID,TInt aTransferResult,TInt aBytesTransferred);
sl@0
   100
private:
sl@0
   101
	void SetCaps();
sl@0
   102
	
sl@0
   103
private:
sl@0
   104
	/** A pointer to the PDD factory. */
sl@0
   105
	DTemplateSoundScPddFactory* iPhysicalDevice;
sl@0
   106
	/** The capabilities of this device. */
sl@0
   107
	TSoundFormatsSupportedV02 iCaps;
sl@0
   108
	/** The playback DMA channel. */
sl@0
   109
	TDmaChannel* iDmaChannel;
sl@0
   110
	/** The DMA request structures used for transfers. */ 				
sl@0
   111
	DTemplateSoundScTxDmaRequest* iDmaRequest[KTemplateMaxTxDmaRequests];
sl@0
   112
	/** The number of outstanding DMA play requests on the DMA channel. */	
sl@0
   113
	TInt iPendingPlay;
sl@0
   114
	/** A flag selecting the next DMA request for transfer. */
sl@0
   115
	TInt iFlag;
sl@0
   116
	friend class DTemplateSoundScPddFactory;
sl@0
   117
	};
sl@0
   118
	
sl@0
   119
/**
sl@0
   120
The Template physical device driver (PDD) for the record shared chunk sound driver.
sl@0
   121
*/
sl@0
   122
//
sl@0
   123
// TO DO: (optional)
sl@0
   124
//
sl@0
   125
// Add any private functions and data you require
sl@0
   126
//
sl@0
   127
class DTemplateSoundScRxPdd : public DSoundScPdd
sl@0
   128
	{
sl@0
   129
public:
sl@0
   130
	DTemplateSoundScRxPdd();
sl@0
   131
	~DTemplateSoundScRxPdd();
sl@0
   132
	TInt DoCreate();
sl@0
   133
sl@0
   134
	// Implementations of the pure virtual functions inherited from DSoundScPdd (called by LDD).
sl@0
   135
	virtual TDfcQue* DfcQ(TInt aUnit);
sl@0
   136
	virtual void GetChunkCreateInfo(TChunkCreateInfo& aChunkCreateInfo);
sl@0
   137
	virtual void Caps(TDes8& aCapsBuf) const;
sl@0
   138
	virtual TInt MaxTransferLen() const;
sl@0
   139
	virtual TInt SetConfig(const TDesC8& aConfigBuf);
sl@0
   140
	virtual TInt SetVolume(TInt aVolume);
sl@0
   141
	virtual TInt StartTransfer();
sl@0
   142
	virtual TInt TransferData(TUint aTransferID,TLinAddr aLinAddr,TPhysAddr aPhysAddr,TInt aNumBytes);
sl@0
   143
	virtual void StopTransfer();
sl@0
   144
	virtual TInt PauseTransfer();
sl@0
   145
	virtual TInt ResumeTransfer();
sl@0
   146
	virtual TInt PowerUp();
sl@0
   147
	virtual void PowerDown();
sl@0
   148
	virtual TInt CustomConfig(TInt aFunction,TAny* aParam);
sl@0
   149
	virtual TInt TimeTransferred(TInt64& aTimeTransferred, TInt aStatus);
sl@0
   150
	void RecordCallback(TUint aTransferID,TInt aTransferResult,TInt aBytesTransferred);	
sl@0
   151
private:
sl@0
   152
	void SetCaps();	
sl@0
   153
sl@0
   154
private:
sl@0
   155
	/** A pointer to the PDD factory. */
sl@0
   156
	DTemplateSoundScPddFactory* iPhysicalDevice;
sl@0
   157
	/** The capabilities of this device. */
sl@0
   158
	TSoundFormatsSupportedV02 iCaps;
sl@0
   159
	/** The record DMA channel. */
sl@0
   160
	TDmaChannel* iDmaChannel;
sl@0
   161
	/** The DMA request structures used for transfers. */ 				
sl@0
   162
	DTemplateSoundScRxDmaRequest* iDmaRequest[KTemplateMaxRxDmaRequests];
sl@0
   163
	/** The number of outstanding DMA record requests on the DMA channel. */	
sl@0
   164
	TInt iPendingRecord;
sl@0
   165
	/** A flag selecting the next DMA request for transfer. */
sl@0
   166
	TInt iFlag;
sl@0
   167
	friend class DTemplateSoundScPddFactory;
sl@0
   168
	};	
sl@0
   169
sl@0
   170
/**
sl@0
   171
Wrapper function for a shared chunk sound driver playback DMA request.
sl@0
   172
*/
sl@0
   173
class DTemplateSoundScTxDmaRequest : public DDmaRequest
sl@0
   174
	{
sl@0
   175
public:	
sl@0
   176
	DTemplateSoundScTxDmaRequest(TDmaChannel& aChannel,DTemplateSoundScTxPdd* aPdd,TInt aMaxTransferSize=0);
sl@0
   177
	static void DmaService(TResult aResult, TAny* aArg);
sl@0
   178
public:
sl@0
   179
	/** Pointer back to the PDD. */
sl@0
   180
	DTemplateSoundScTxPdd* iPdd;
sl@0
   181
	/** The transfer ID for this DMA request - supplied by the LDD. */
sl@0
   182
	TUint iTransferID;
sl@0
   183
	/** The transfer sizes in progress. */
sl@0
   184
	TUint iTransferSize;
sl@0
   185
	};
sl@0
   186
sl@0
   187
/**
sl@0
   188
Wrapper function for a shared chunk sound driver record DMA request.
sl@0
   189
*/
sl@0
   190
class DTemplateSoundScRxDmaRequest : public DDmaRequest
sl@0
   191
	{
sl@0
   192
public:	
sl@0
   193
	DTemplateSoundScRxDmaRequest(TDmaChannel& aChannel,DTemplateSoundScRxPdd* aPdd,TInt aMaxTransferSize=0);
sl@0
   194
	static void DmaService(TResult aResult, TAny* aArg);
sl@0
   195
public:
sl@0
   196
	/** Pointer back to the PDD. */
sl@0
   197
	DTemplateSoundScRxPdd* iPdd;
sl@0
   198
	/** The transfer ID for this DMA request - supplied by the LDD. */
sl@0
   199
	TUint iTransferID;
sl@0
   200
	/** The transfer sizes in progress. */
sl@0
   201
	TUint iTransferSize;
sl@0
   202
	};
sl@0
   203
sl@0
   204
#endif /* __SOUNDSC_PLAT_H__ */