author | Gareth Stockwell <gareth.stockwell@accenture.com> |
Fri, 24 Sep 2010 13:30:20 +0100 | |
branch | graphics-phase-3 |
changeset 114 | 19c4533e1567 |
parent 71 | d00bf4f57250 |
permissions | -rw-r--r-- |
13
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
1 |
/* |
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
2 |
* This component and the accompanying materials are made available |
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
3 |
* under the terms of the License "Eclipse Public License v1.0" |
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
4 |
* which accompanies this distribution, and is available |
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
5 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
6 |
* |
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
7 |
* Initial Contributors: |
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
8 |
* Nokia Corporation - initial contribution. |
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
9 |
* |
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
10 |
* Contributors: |
45
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
21
diff
changeset
|
11 |
* Accenture Ltd |
13
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
12 |
* |
45
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
21
diff
changeset
|
13 |
* Description: This file is a part of sound driver for Syborg adaptation. |
13
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
14 |
* |
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
15 |
*/ |
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
16 |
|
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
17 |
#ifndef __SYBORGSHARED_SOUND_H__ |
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
18 |
#define __SYBORGSHARED_SOUND_H__ |
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
19 |
|
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
20 |
#include <soundsc.h> |
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
21 |
|
71
d00bf4f57250
Fix bug 873. Fixes to syborg virtio-audio code as well as to the audio driver
Maciej Jablonski <maciej.jablonski@sosco.com>
parents:
45
diff
changeset
|
22 |
#ifndef DISABLE_SYBORG_SOUND_DEBUG |
d00bf4f57250
Fix bug 873. Fixes to syborg virtio-audio code as well as to the audio driver
Maciej Jablonski <maciej.jablonski@sosco.com>
parents:
45
diff
changeset
|
23 |
#define SYBORG_SOUND_DEBUG(x...) __KTRACE_OPT(KSOUND1, Kern::Printf(x)) |
13
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
24 |
#else |
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
25 |
#define SYBORG_SOUND_DEBUG(x...) |
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
26 |
#endif |
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
27 |
|
45
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
21
diff
changeset
|
28 |
#undef ASSERT |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
21
diff
changeset
|
29 |
#define ASSERT(x) (x) || (Kern::Printf("Sound.pdd: ASSERTION FAILED: "#x),0); |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
21
diff
changeset
|
30 |
|
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
21
diff
changeset
|
31 |
#include "virtio_audio.h" |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
21
diff
changeset
|
32 |
#include "virtio.h" |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
21
diff
changeset
|
33 |
#include "virtio_audio_defs.h" |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
21
diff
changeset
|
34 |
|
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
21
diff
changeset
|
35 |
/// @brief defines the maximum size for a single audio data transfer |
71
d00bf4f57250
Fix bug 873. Fixes to syborg virtio-audio code as well as to the audio driver
Maciej Jablonski <maciej.jablonski@sosco.com>
parents:
45
diff
changeset
|
36 |
static const TInt KMaxTransferLength = 256 * 1024; |
45
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
21
diff
changeset
|
37 |
|
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
21
diff
changeset
|
38 |
namespace VirtIo |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
21
diff
changeset
|
39 |
{ |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
21
diff
changeset
|
40 |
class DIoHandler; |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
21
diff
changeset
|
41 |
} |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
21
diff
changeset
|
42 |
|
13
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
43 |
class DDriverSyborgSoundScPddFactory; |
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
44 |
|
45
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
21
diff
changeset
|
45 |
|
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
21
diff
changeset
|
46 |
class DDriverSyborgSoundScPdd : public DSoundScPdd, VirtIo::MIoCallback |
13
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
47 |
{ |
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
48 |
public: |
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
49 |
|
45
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
21
diff
changeset
|
50 |
DDriverSyborgSoundScPdd(DDriverSyborgSoundScPddFactory* aPhysicalDevice, |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
21
diff
changeset
|
51 |
TInt aUnitType, VirtIo::DIoHandler *aIoHandler, TUint aDataQueueId); |
13
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
52 |
~DDriverSyborgSoundScPdd(); |
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
53 |
TInt DoCreate(); |
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
54 |
void GetChunkCreateInfo(TChunkCreateInfo& aChunkCreateInfo); |
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
55 |
void Caps(TDes8& aCapsBuf) const; |
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
56 |
TInt MaxTransferLen() const; |
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
57 |
TInt SetConfig(const TDesC8& aConfigBuf); |
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
58 |
TInt SetVolume(TInt aVolume); |
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
59 |
TInt StartTransfer(); |
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
60 |
TInt TransferData(TUint aTransferID, TLinAddr aLinAddr, TPhysAddr aPhysAddr, TInt aNumBytes); |
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
61 |
void StopTransfer(); |
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
62 |
TInt PauseTransfer(); |
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
63 |
TInt ResumeTransfer(); |
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
64 |
TInt PowerUp(); |
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
65 |
void PowerDown(); |
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
66 |
TInt CustomConfig(TInt aFunction, TAny* aParam); |
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
67 |
void SetCaps(); |
45
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
21
diff
changeset
|
68 |
TDfcQue* DfcQ(); |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
21
diff
changeset
|
69 |
TDfcQue* DfcQ( TInt aUnit ); |
13
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
70 |
|
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
71 |
TInt CalculateBufferTime(TInt aNumBytes); |
45
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
21
diff
changeset
|
72 |
private: |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
21
diff
changeset
|
73 |
|
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
21
diff
changeset
|
74 |
// implementation of VirtIo::MIoCallback |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
21
diff
changeset
|
75 |
virtual TBool VirtIoCallback( VirtIo::MIoHandler& aVirtIoHandler, VirtIo::MQueue& aQueue, |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
21
diff
changeset
|
76 |
VirtIo::Token aToken, TUint aBytesTransferred ); |
13
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
77 |
|
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
78 |
public: |
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
79 |
|
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
80 |
DDriverSyborgSoundScPddFactory* iPhysicalDevice; |
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
81 |
|
45
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
21
diff
changeset
|
82 |
TInt iUnitType; //Play or Record |
13
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
83 |
|
45
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
21
diff
changeset
|
84 |
VirtIo::MIoHandler* iIoHandler; |
13
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
85 |
|
45
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
21
diff
changeset
|
86 |
TUint iDataQueueId; |
13
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
87 |
|
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
88 |
private: |
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
89 |
|
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
90 |
TSoundFormatsSupportedV02 iCaps; |
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
91 |
|
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
92 |
TCurrentSoundFormatV02 iConfig; |
45
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
21
diff
changeset
|
93 |
|
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
21
diff
changeset
|
94 |
VirtIo::Audio::DControl* iAudioControl; |
13
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
95 |
|
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
96 |
}; |
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
97 |
|
73107a0bc259
Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff
changeset
|
98 |
#endif |